@ductape/sdk 0.0.4-v51 → 0.0.4-v52

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 (868) hide show
  1. package/README.md +1 -1
  2. package/dist/agents/agent-context.d.ts +98 -0
  3. package/dist/agents/agent-context.js +588 -0
  4. package/dist/agents/agent-context.js.map +1 -0
  5. package/dist/agents/agent-executor.d.ts +180 -0
  6. package/dist/agents/agent-executor.js +715 -0
  7. package/dist/agents/agent-executor.js.map +1 -0
  8. package/dist/agents/agents.service.d.ts +304 -0
  9. package/dist/agents/agents.service.js +1244 -0
  10. package/dist/agents/agents.service.js.map +1 -0
  11. package/dist/agents/index.d.ts +55 -0
  12. package/dist/agents/index.js +110 -0
  13. package/dist/agents/index.js.map +1 -0
  14. package/dist/agents/memory-manager.d.ts +182 -0
  15. package/dist/agents/memory-manager.js +383 -0
  16. package/dist/agents/memory-manager.js.map +1 -0
  17. package/dist/agents/tool-registry.d.ts +141 -0
  18. package/dist/agents/tool-registry.js +355 -0
  19. package/dist/agents/tool-registry.js.map +1 -0
  20. package/dist/agents/types/agents.types.d.ts +1225 -0
  21. package/dist/agents/types/agents.types.js +12 -0
  22. package/dist/agents/types/agents.types.js.map +1 -0
  23. package/dist/agents/types/index.d.ts +6 -0
  24. package/dist/agents/types/index.js +23 -0
  25. package/dist/agents/types/index.js.map +1 -0
  26. package/dist/agents/vector-store-adapter.d.ts +108 -0
  27. package/dist/agents/vector-store-adapter.js +213 -0
  28. package/dist/agents/vector-store-adapter.js.map +1 -0
  29. package/dist/api/services/appApi.service.js +4 -5
  30. package/dist/api/services/appApi.service.js.map +1 -1
  31. package/dist/api/services/processorApi.service.d.ts +322 -0
  32. package/dist/api/services/processorApi.service.js +252 -0
  33. package/dist/api/services/processorApi.service.js.map +1 -1
  34. package/dist/api/services/productsApi.service.d.ts +69 -1
  35. package/dist/api/services/productsApi.service.js +67 -31
  36. package/dist/api/services/productsApi.service.js.map +1 -1
  37. package/dist/api/services/resilienceApi.service.d.ts +106 -0
  38. package/dist/api/services/resilienceApi.service.js +224 -0
  39. package/dist/api/services/resilienceApi.service.js.map +1 -0
  40. package/dist/api/services/secretsApi.service.d.ts +38 -0
  41. package/dist/api/services/secretsApi.service.js +96 -0
  42. package/dist/api/services/secretsApi.service.js.map +1 -0
  43. package/dist/api/services/userApi.service.js +0 -1
  44. package/dist/api/services/userApi.service.js.map +1 -1
  45. package/dist/api/services/workflowApi.service.d.ts +199 -0
  46. package/dist/api/services/workflowApi.service.js +183 -0
  47. package/dist/api/services/workflowApi.service.js.map +1 -0
  48. package/dist/api/services/workspaceApi.service.js +0 -1
  49. package/dist/api/services/workspaceApi.service.js.map +1 -1
  50. package/dist/api/urls.d.ts +57 -0
  51. package/dist/api/urls.js +68 -1
  52. package/dist/api/urls.js.map +1 -1
  53. package/dist/api/utils/cache.utils.js +4 -10
  54. package/dist/api/utils/cache.utils.js.map +1 -1
  55. package/dist/apps/services/app.service.d.ts +0 -10
  56. package/dist/apps/services/app.service.js +74 -30
  57. package/dist/apps/services/app.service.js.map +1 -1
  58. package/dist/apps/utils/auth-context-manager.d.ts +137 -0
  59. package/dist/apps/utils/auth-context-manager.js +248 -0
  60. package/dist/apps/utils/auth-context-manager.js.map +1 -0
  61. package/dist/apps/utils/credential-manager.d.ts +128 -0
  62. package/dist/apps/utils/credential-manager.js +199 -0
  63. package/dist/apps/utils/credential-manager.js.map +1 -0
  64. package/dist/apps/utils/index.d.ts +10 -0
  65. package/dist/apps/utils/index.js +54 -0
  66. package/dist/apps/utils/index.js.map +1 -0
  67. package/dist/apps/utils/input-helpers.d.ts +67 -0
  68. package/dist/apps/utils/input-helpers.js +185 -0
  69. package/dist/apps/utils/input-helpers.js.map +1 -0
  70. package/dist/apps/utils/input-resolver.d.ts +165 -0
  71. package/dist/apps/utils/input-resolver.js +477 -0
  72. package/dist/apps/utils/input-resolver.js.map +1 -0
  73. package/dist/apps/utils/oauth-manager.d.ts +196 -0
  74. package/dist/apps/utils/oauth-manager.js +405 -0
  75. package/dist/apps/utils/oauth-manager.js.map +1 -0
  76. package/dist/apps/validators/joi-validators/create.appWebhook.validator.d.ts +2 -1
  77. package/dist/apps/validators/joi-validators/create.appWebhook.validator.js +15 -2
  78. package/dist/apps/validators/joi-validators/create.appWebhook.validator.js.map +1 -1
  79. package/dist/apps/validators/joi-validators/update.appWebhook.validator.d.ts +2 -1
  80. package/dist/apps/validators/joi-validators/update.appWebhook.validator.js +14 -2
  81. package/dist/apps/validators/joi-validators/update.appWebhook.validator.js.map +1 -1
  82. package/dist/bin.d.ts +26 -0
  83. package/dist/bin.js +28 -0
  84. package/dist/bin.js.map +1 -0
  85. package/dist/brokers/brokers.service.d.ts +257 -0
  86. package/dist/brokers/brokers.service.js +604 -0
  87. package/dist/brokers/brokers.service.js.map +1 -0
  88. package/dist/brokers/index.d.ts +46 -0
  89. package/dist/brokers/index.js +83 -0
  90. package/dist/brokers/index.js.map +1 -0
  91. package/dist/brokers/types/index.d.ts +288 -0
  92. package/dist/brokers/types/index.js +8 -0
  93. package/dist/brokers/types/index.js.map +1 -0
  94. package/dist/brokers/utils/broker.util.d.ts +33 -0
  95. package/dist/brokers/utils/broker.util.js +125 -0
  96. package/dist/brokers/utils/broker.util.js.map +1 -0
  97. package/dist/brokers/utils/providers/aws-sqs.service.d.ts +16 -0
  98. package/dist/brokers/utils/providers/aws-sqs.service.js +71 -0
  99. package/dist/brokers/utils/providers/aws-sqs.service.js.map +1 -0
  100. package/dist/brokers/utils/providers/google-pubsub.service.d.ts +16 -0
  101. package/dist/brokers/utils/providers/google-pubsub.service.js +43 -0
  102. package/dist/brokers/utils/providers/google-pubsub.service.js.map +1 -0
  103. package/dist/brokers/utils/providers/index.d.ts +6 -0
  104. package/dist/brokers/utils/providers/index.js +16 -0
  105. package/dist/brokers/utils/providers/index.js.map +1 -0
  106. package/dist/brokers/utils/providers/kafka.service.d.ts +16 -0
  107. package/dist/brokers/utils/providers/kafka.service.js +52 -0
  108. package/dist/brokers/utils/providers/kafka.service.js.map +1 -0
  109. package/dist/brokers/utils/providers/nats.service.d.ts +18 -0
  110. package/dist/brokers/utils/providers/nats.service.js +63 -0
  111. package/dist/brokers/utils/providers/nats.service.js.map +1 -0
  112. package/dist/brokers/utils/providers/rabbitmq.service.d.ts +14 -0
  113. package/dist/brokers/utils/providers/rabbitmq.service.js +67 -0
  114. package/dist/brokers/utils/providers/rabbitmq.service.js.map +1 -0
  115. package/dist/brokers/utils/providers/redis.service.d.ts +18 -0
  116. package/dist/brokers/utils/providers/redis.service.js +93 -0
  117. package/dist/brokers/utils/providers/redis.service.js.map +1 -0
  118. package/dist/cache/cache.manager.d.ts +159 -0
  119. package/dist/cache/cache.manager.js +265 -0
  120. package/dist/cache/cache.manager.js.map +1 -0
  121. package/dist/cache/cache.service.d.ts +186 -0
  122. package/dist/cache/cache.service.js +437 -0
  123. package/dist/cache/cache.service.js.map +1 -0
  124. package/dist/cache/index.d.ts +52 -0
  125. package/dist/cache/index.js +79 -0
  126. package/dist/cache/index.js.map +1 -0
  127. package/dist/cache/types/index.d.ts +106 -0
  128. package/dist/cache/types/index.js +6 -0
  129. package/dist/cache/types/index.js.map +1 -0
  130. package/dist/database/actions/action-manager.d.ts +170 -0
  131. package/dist/database/actions/action-manager.js +465 -0
  132. package/dist/database/actions/action-manager.js.map +1 -0
  133. package/dist/database/actions/index.d.ts +6 -0
  134. package/dist/database/actions/index.js +13 -0
  135. package/dist/database/actions/index.js.map +1 -0
  136. package/dist/database/adapters/adapter.factory.d.ts +62 -0
  137. package/dist/database/adapters/adapter.factory.js +97 -0
  138. package/dist/database/adapters/adapter.factory.js.map +1 -0
  139. package/dist/database/adapters/base.adapter.d.ts +307 -90
  140. package/dist/database/adapters/base.adapter.js +139 -20
  141. package/dist/database/adapters/base.adapter.js.map +1 -1
  142. package/dist/database/adapters/cassandra.adapter.d.ts +90 -0
  143. package/dist/database/adapters/cassandra.adapter.js +1019 -0
  144. package/dist/database/adapters/cassandra.adapter.js.map +1 -0
  145. package/dist/database/adapters/dynamodb.adapter.d.ts +94 -77
  146. package/dist/database/adapters/dynamodb.adapter.js +1162 -1305
  147. package/dist/database/adapters/dynamodb.adapter.js.map +1 -1
  148. package/dist/database/adapters/index.d.ts +11 -0
  149. package/dist/database/adapters/index.js +27 -0
  150. package/dist/database/adapters/index.js.map +1 -0
  151. package/dist/database/adapters/mariadb.adapter.d.ts +100 -0
  152. package/dist/database/adapters/mariadb.adapter.js +247 -0
  153. package/dist/database/adapters/mariadb.adapter.js.map +1 -0
  154. package/dist/database/adapters/mongodb.adapter.d.ts +105 -57
  155. package/dist/database/adapters/mongodb.adapter.js +941 -838
  156. package/dist/database/adapters/mongodb.adapter.js.map +1 -1
  157. package/dist/database/adapters/mysql.adapter.d.ts +76 -138
  158. package/dist/database/adapters/mysql.adapter.js +990 -1246
  159. package/dist/database/adapters/mysql.adapter.js.map +1 -1
  160. package/dist/database/adapters/postgresql.adapter.d.ts +75 -139
  161. package/dist/database/adapters/postgresql.adapter.js +1076 -1346
  162. package/dist/database/adapters/postgresql.adapter.js.map +1 -1
  163. package/dist/database/databases.service.d.ts +1374 -0
  164. package/dist/database/databases.service.js +2680 -0
  165. package/dist/database/databases.service.js.map +1 -0
  166. package/dist/database/index.d.ts +41 -13
  167. package/dist/database/index.js +97 -86
  168. package/dist/database/index.js.map +1 -1
  169. package/dist/database/migrations/index.d.ts +6 -0
  170. package/dist/database/migrations/index.js +12 -0
  171. package/dist/database/migrations/index.js.map +1 -0
  172. package/dist/database/migrations/migration-engine.d.ts +132 -0
  173. package/dist/database/migrations/migration-engine.js +1356 -0
  174. package/dist/database/migrations/migration-engine.js.map +1 -0
  175. package/dist/database/operators/aggregation-builder.d.ts +64 -0
  176. package/dist/database/operators/aggregation-builder.js +746 -0
  177. package/dist/database/operators/aggregation-builder.js.map +1 -0
  178. package/dist/database/operators/index.d.ts +7 -0
  179. package/dist/database/operators/index.js +15 -0
  180. package/dist/database/operators/index.js.map +1 -0
  181. package/dist/database/operators/query-builder.d.ts +55 -0
  182. package/dist/database/operators/query-builder.js +365 -0
  183. package/dist/database/operators/query-builder.js.map +1 -0
  184. package/dist/database/presave/decrypt.d.ts +25 -0
  185. package/dist/database/presave/decrypt.js +146 -0
  186. package/dist/database/presave/decrypt.js.map +1 -0
  187. package/dist/database/presave/index.d.ts +9 -0
  188. package/dist/database/presave/index.js +18 -0
  189. package/dist/database/presave/index.js.map +1 -0
  190. package/dist/database/presave/presave-processor.d.ts +148 -0
  191. package/dist/database/presave/presave-processor.js +702 -0
  192. package/dist/database/presave/presave-processor.js.map +1 -0
  193. package/dist/database/schema/index.d.ts +7 -0
  194. package/dist/database/schema/index.js +13 -0
  195. package/dist/database/schema/index.js.map +1 -0
  196. package/dist/database/schema/schema-manager.d.ts +258 -0
  197. package/dist/database/schema/schema-manager.js +637 -0
  198. package/dist/database/schema/schema-manager.js.map +1 -0
  199. package/dist/database/transactions/index.d.ts +6 -0
  200. package/dist/database/transactions/index.js +13 -0
  201. package/dist/database/transactions/index.js.map +1 -0
  202. package/dist/database/transactions/transaction-manager.d.ts +113 -0
  203. package/dist/database/transactions/transaction-manager.js +344 -0
  204. package/dist/database/transactions/transaction-manager.js.map +1 -0
  205. package/dist/database/triggers/index.d.ts +7 -0
  206. package/dist/database/triggers/index.js +14 -0
  207. package/dist/database/triggers/index.js.map +1 -0
  208. package/dist/database/triggers/trigger-processor.d.ts +239 -0
  209. package/dist/database/triggers/trigger-processor.js +1034 -0
  210. package/dist/database/triggers/trigger-processor.js.map +1 -0
  211. package/dist/database/types/action.interface.d.ts +148 -0
  212. package/dist/database/types/action.interface.js +6 -0
  213. package/dist/database/types/action.interface.js.map +1 -0
  214. package/dist/database/types/aggregation.interface.d.ts +179 -0
  215. package/dist/database/types/aggregation.interface.js +6 -0
  216. package/dist/database/types/aggregation.interface.js.map +1 -0
  217. package/dist/database/types/connection.interface.d.ts +137 -0
  218. package/dist/database/types/connection.interface.js +6 -0
  219. package/dist/database/types/connection.interface.js.map +1 -0
  220. package/dist/database/types/enums.d.ts +195 -0
  221. package/dist/database/types/enums.js +244 -0
  222. package/dist/database/types/enums.js.map +1 -0
  223. package/dist/database/types/index.d.ts +12 -10
  224. package/dist/database/types/index.js +26 -32
  225. package/dist/database/types/index.js.map +1 -1
  226. package/dist/database/types/migration.interface.d.ts +686 -0
  227. package/dist/database/types/migration.interface.js +9 -0
  228. package/dist/database/types/migration.interface.js.map +1 -0
  229. package/dist/database/types/presave.interface.d.ts +292 -0
  230. package/dist/database/types/presave.interface.js +60 -0
  231. package/dist/database/types/presave.interface.js.map +1 -0
  232. package/dist/database/types/query.interface.d.ts +199 -0
  233. package/dist/database/types/query.interface.js +6 -0
  234. package/dist/database/types/query.interface.js.map +1 -0
  235. package/dist/database/types/schema.interface.d.ts +398 -0
  236. package/dist/database/types/schema.interface.js +6 -0
  237. package/dist/database/types/schema.interface.js.map +1 -0
  238. package/dist/database/types/transaction.interface.d.ts +84 -0
  239. package/dist/database/types/transaction.interface.js +6 -0
  240. package/dist/database/types/transaction.interface.js.map +1 -0
  241. package/dist/database/types/trigger.interface.d.ts +612 -0
  242. package/dist/database/types/trigger.interface.js +121 -0
  243. package/dist/database/types/trigger.interface.js.map +1 -0
  244. package/dist/database/types/write.interface.d.ts +208 -0
  245. package/dist/database/types/write.interface.js +6 -0
  246. package/dist/database/types/write.interface.js.map +1 -0
  247. package/dist/database/utils/database-error.d.ts +96 -0
  248. package/dist/database/utils/database-error.js +221 -0
  249. package/dist/database/utils/database-error.js.map +1 -0
  250. package/dist/database/utils/index.d.ts +6 -0
  251. package/dist/database/utils/index.js +11 -0
  252. package/dist/database/utils/index.js.map +1 -0
  253. package/dist/graph/adapters/adapter.factory.d.ts +47 -0
  254. package/dist/graph/adapters/adapter.factory.js +77 -0
  255. package/dist/graph/adapters/adapter.factory.js.map +1 -0
  256. package/dist/graph/adapters/arangodb.adapter.d.ts +78 -72
  257. package/dist/graph/adapters/arangodb.adapter.js +1310 -1220
  258. package/dist/graph/adapters/arangodb.adapter.js.map +1 -1
  259. package/dist/graph/adapters/base.adapter.d.ts +135 -118
  260. package/dist/graph/adapters/base.adapter.js +46 -20
  261. package/dist/graph/adapters/base.adapter.js.map +1 -1
  262. package/dist/graph/adapters/index.d.ts +5 -4
  263. package/dist/graph/adapters/index.js +6 -8
  264. package/dist/graph/adapters/index.js.map +1 -1
  265. package/dist/graph/adapters/memgraph.adapter.d.ts +98 -73
  266. package/dist/graph/adapters/memgraph.adapter.js +1050 -1202
  267. package/dist/graph/adapters/memgraph.adapter.js.map +1 -1
  268. package/dist/graph/adapters/neo4j.adapter.d.ts +71 -78
  269. package/dist/graph/adapters/neo4j.adapter.js +912 -1605
  270. package/dist/graph/adapters/neo4j.adapter.js.map +1 -1
  271. package/dist/graph/adapters/neptune.adapter.d.ts +76 -81
  272. package/dist/graph/adapters/neptune.adapter.js +1095 -1228
  273. package/dist/graph/adapters/neptune.adapter.js.map +1 -1
  274. package/dist/graph/graphs.service.d.ts +524 -0
  275. package/dist/graph/graphs.service.js +1683 -0
  276. package/dist/graph/graphs.service.js.map +1 -0
  277. package/dist/graph/index.d.ts +54 -8
  278. package/dist/graph/index.js +67 -32
  279. package/dist/graph/index.js.map +1 -1
  280. package/dist/graph/transactions/index.d.ts +4 -0
  281. package/dist/graph/transactions/index.js +9 -0
  282. package/dist/graph/transactions/index.js.map +1 -0
  283. package/dist/graph/transactions/transaction-manager.d.ts +61 -0
  284. package/dist/graph/transactions/transaction-manager.js +126 -0
  285. package/dist/graph/transactions/transaction-manager.js.map +1 -0
  286. package/dist/graph/types/connection.interface.d.ts +141 -0
  287. package/dist/graph/types/connection.interface.js +9 -0
  288. package/dist/graph/types/connection.interface.js.map +1 -0
  289. package/dist/graph/types/enums.d.ts +101 -0
  290. package/dist/graph/types/enums.js +114 -0
  291. package/dist/graph/types/enums.js.map +1 -0
  292. package/dist/graph/types/index.d.ts +11 -9
  293. package/dist/graph/types/index.js +15 -30
  294. package/dist/graph/types/index.js.map +1 -1
  295. package/dist/graph/types/node.interface.d.ts +248 -0
  296. package/dist/graph/types/node.interface.js +9 -0
  297. package/dist/graph/types/node.interface.js.map +1 -0
  298. package/dist/graph/types/query.interface.d.ts +168 -0
  299. package/dist/graph/types/query.interface.js +9 -0
  300. package/dist/graph/types/query.interface.js.map +1 -0
  301. package/dist/graph/types/relationship.interface.d.ts +207 -0
  302. package/dist/graph/types/relationship.interface.js +9 -0
  303. package/dist/graph/types/relationship.interface.js.map +1 -0
  304. package/dist/graph/types/schema.interface.d.ts +295 -0
  305. package/dist/graph/types/schema.interface.js +9 -0
  306. package/dist/graph/types/schema.interface.js.map +1 -0
  307. package/dist/graph/types/transaction.interface.d.ts +55 -0
  308. package/dist/graph/types/transaction.interface.js +9 -0
  309. package/dist/graph/types/transaction.interface.js.map +1 -0
  310. package/dist/graph/types/traversal.interface.d.ts +181 -0
  311. package/dist/graph/types/traversal.interface.js +9 -0
  312. package/dist/graph/types/traversal.interface.js.map +1 -0
  313. package/dist/graph/utils/graph-error.d.ts +71 -0
  314. package/dist/graph/utils/graph-error.js +142 -0
  315. package/dist/graph/utils/graph-error.js.map +1 -0
  316. package/dist/graph/utils/index.d.ts +4 -0
  317. package/dist/graph/utils/index.js +9 -0
  318. package/dist/graph/utils/index.js.map +1 -0
  319. package/dist/index.d.ts +1905 -875
  320. package/dist/index.js +3063 -1282
  321. package/dist/index.js.map +1 -1
  322. package/dist/init.interface.d.ts +407 -0
  323. package/dist/init.interface.js +3 -0
  324. package/dist/init.interface.js.map +1 -0
  325. package/dist/jobs/index.d.ts +38 -0
  326. package/dist/jobs/index.js +50 -0
  327. package/dist/jobs/index.js.map +1 -0
  328. package/dist/jobs/jobs.service.d.ts +154 -0
  329. package/dist/jobs/jobs.service.js +491 -0
  330. package/dist/jobs/jobs.service.js.map +1 -0
  331. package/dist/jobs/jobs.state.d.ts +113 -0
  332. package/dist/jobs/jobs.state.js +447 -0
  333. package/dist/jobs/jobs.state.js.map +1 -0
  334. package/dist/jobs/types.d.ts +449 -0
  335. package/dist/jobs/types.js +74 -0
  336. package/dist/jobs/types.js.map +1 -0
  337. package/dist/logs/logs.types.d.ts +12 -2
  338. package/dist/logs/logs.types.js +5 -1
  339. package/dist/logs/logs.types.js.map +1 -1
  340. package/dist/models/index.d.ts +6 -0
  341. package/dist/models/index.js +11 -0
  342. package/dist/models/index.js.map +1 -0
  343. package/dist/models/models.service.d.ts +137 -0
  344. package/dist/models/models.service.js +195 -0
  345. package/dist/models/models.service.js.map +1 -0
  346. package/dist/notifications/index.d.ts +13 -0
  347. package/dist/notifications/index.js +26 -0
  348. package/dist/notifications/index.js.map +1 -0
  349. package/dist/notifications/notifications.service.d.ts +252 -0
  350. package/dist/notifications/notifications.service.js +654 -0
  351. package/dist/notifications/notifications.service.js.map +1 -0
  352. package/dist/notifications/types/index.d.ts +4 -0
  353. package/dist/notifications/types/index.js +21 -0
  354. package/dist/notifications/types/index.js.map +1 -0
  355. package/dist/notifications/types/notifications.types.d.ts +400 -0
  356. package/dist/notifications/types/notifications.types.js +49 -0
  357. package/dist/notifications/types/notifications.types.js.map +1 -0
  358. package/dist/processor/services/messagebrokers/kafka.service.js +2 -0
  359. package/dist/processor/services/messagebrokers/kafka.service.js.map +1 -1
  360. package/dist/processor/services/messagebrokers/rabbitmq.service.d.ts +1 -9
  361. package/dist/processor/services/messagebrokers/rabbitmq.service.js +11 -40
  362. package/dist/processor/services/messagebrokers/rabbitmq.service.js.map +1 -1
  363. package/dist/processor/services/processor.service.d.ts +86 -70
  364. package/dist/processor/services/processor.service.js +1353 -1259
  365. package/dist/processor/services/processor.service.js.map +1 -1
  366. package/dist/processor/utils/processor.utils.js +5 -1
  367. package/dist/processor/utils/processor.utils.js.map +1 -1
  368. package/dist/products/services/products.service.d.ts +167 -25
  369. package/dist/products/services/products.service.js +1248 -412
  370. package/dist/products/services/products.service.js.map +1 -1
  371. package/dist/products/validators/index.d.ts +6 -3
  372. package/dist/products/validators/index.js +14 -5
  373. package/dist/products/validators/index.js.map +1 -1
  374. package/dist/products/validators/joi-validators/create.productAgent.validator.d.ts +3 -0
  375. package/dist/products/validators/joi-validators/create.productAgent.validator.js +218 -0
  376. package/dist/products/validators/joi-validators/create.productAgent.validator.js.map +1 -0
  377. package/dist/products/validators/joi-validators/create.productDatabase.validator.js +5 -0
  378. package/dist/products/validators/joi-validators/create.productDatabase.validator.js.map +1 -1
  379. package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.d.ts +4 -15
  380. package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.js +109 -501
  381. package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.js.map +1 -1
  382. package/dist/products/validators/joi-validators/create.productGraph.validator.js +14 -9
  383. package/dist/products/validators/joi-validators/create.productGraph.validator.js.map +1 -1
  384. package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js +0 -1
  385. package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js.map +1 -1
  386. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +87 -30
  387. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +1 -1
  388. package/dist/products/validators/joi-validators/create.productModel.validator.d.ts +3 -0
  389. package/dist/products/validators/joi-validators/create.productModel.validator.js +132 -0
  390. package/dist/products/validators/joi-validators/create.productModel.validator.js.map +1 -0
  391. package/dist/products/validators/joi-validators/create.productNotification.validator.js +135 -50
  392. package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +1 -1
  393. package/dist/products/validators/joi-validators/create.productStorage.validator.js +77 -18
  394. package/dist/products/validators/joi-validators/create.productStorage.validator.js.map +1 -1
  395. package/dist/products/validators/joi-validators/create.productVector.validator.d.ts +3 -0
  396. package/dist/products/validators/joi-validators/create.productVector.validator.js +135 -0
  397. package/dist/products/validators/joi-validators/create.productVector.validator.js.map +1 -0
  398. package/dist/products/validators/joi-validators/update.productDatabase.validator.js +5 -0
  399. package/dist/products/validators/joi-validators/update.productDatabase.validator.js.map +1 -1
  400. package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.d.ts +0 -6
  401. package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.js +26 -28
  402. package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.js.map +1 -1
  403. package/dist/products/validators/joi-validators/update.productGraph.validator.js +11 -12
  404. package/dist/products/validators/joi-validators/update.productGraph.validator.js.map +1 -1
  405. package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.js +0 -1
  406. package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.js.map +1 -1
  407. package/dist/resilience/fallback.service.d.ts +88 -0
  408. package/dist/resilience/fallback.service.js +511 -0
  409. package/dist/resilience/fallback.service.js.map +1 -0
  410. package/dist/resilience/healthcheck.service.d.ts +106 -0
  411. package/dist/resilience/healthcheck.service.js +379 -0
  412. package/dist/resilience/healthcheck.service.js.map +1 -0
  413. package/dist/resilience/index.d.ts +104 -0
  414. package/dist/resilience/index.js +140 -0
  415. package/dist/resilience/index.js.map +1 -0
  416. package/dist/resilience/quota.service.d.ts +90 -0
  417. package/dist/resilience/quota.service.js +519 -0
  418. package/dist/resilience/quota.service.js.map +1 -0
  419. package/dist/resilience/resilience.service.d.ts +95 -0
  420. package/dist/resilience/resilience.service.js +525 -0
  421. package/dist/resilience/resilience.service.js.map +1 -0
  422. package/dist/resilience/types/index.d.ts +479 -0
  423. package/dist/resilience/types/index.js +26 -0
  424. package/dist/resilience/types/index.js.map +1 -0
  425. package/dist/secrets/index.d.ts +10 -0
  426. package/dist/secrets/index.js +33 -0
  427. package/dist/secrets/index.js.map +1 -0
  428. package/dist/secrets/secrets.resolver.d.ts +52 -0
  429. package/dist/secrets/secrets.resolver.js +233 -0
  430. package/dist/secrets/secrets.resolver.js.map +1 -0
  431. package/dist/secrets/secrets.service.d.ts +83 -0
  432. package/dist/secrets/secrets.service.js +159 -0
  433. package/dist/secrets/secrets.service.js.map +1 -0
  434. package/dist/secrets/secrets.types.d.ts +188 -0
  435. package/dist/secrets/secrets.types.js +87 -0
  436. package/dist/secrets/secrets.types.js.map +1 -0
  437. package/dist/sessions/index.d.ts +50 -0
  438. package/dist/sessions/index.js +93 -0
  439. package/dist/sessions/index.js.map +1 -0
  440. package/dist/sessions/sessions.helper.d.ts +68 -0
  441. package/dist/sessions/sessions.helper.js +116 -0
  442. package/dist/sessions/sessions.helper.js.map +1 -0
  443. package/dist/sessions/sessions.resolver.d.ts +150 -0
  444. package/dist/sessions/sessions.resolver.js +356 -0
  445. package/dist/sessions/sessions.resolver.js.map +1 -0
  446. package/dist/sessions/sessions.service.d.ts +170 -0
  447. package/dist/sessions/sessions.service.js +736 -0
  448. package/dist/sessions/sessions.service.js.map +1 -0
  449. package/dist/sessions/types/index.d.ts +290 -0
  450. package/dist/sessions/types/index.js +6 -0
  451. package/dist/sessions/types/index.js.map +1 -0
  452. package/dist/storage/index.d.ts +66 -0
  453. package/dist/storage/index.js +98 -0
  454. package/dist/storage/index.js.map +1 -0
  455. package/dist/storage/storage.service.d.ts +123 -0
  456. package/dist/storage/storage.service.js +478 -0
  457. package/dist/storage/storage.service.js.map +1 -0
  458. package/dist/storage/types/index.d.ts +207 -0
  459. package/dist/storage/types/index.js +6 -0
  460. package/dist/storage/types/index.js.map +1 -0
  461. package/dist/storage/utils/storage.util.d.ts +51 -0
  462. package/dist/storage/utils/storage.util.js +402 -0
  463. package/dist/storage/utils/storage.util.js.map +1 -0
  464. package/dist/test/index.d.ts +3 -0
  465. package/dist/test/index.js +13 -0
  466. package/dist/test/index.js.map +1 -0
  467. package/dist/test/test.appBuilder.d.ts +0 -1
  468. package/dist/test/test.appBuilder.js +0 -15
  469. package/dist/test/test.appBuilder.js.map +1 -1
  470. package/dist/test/test.database.js +140 -0
  471. package/dist/test/test.database.js.map +1 -0
  472. package/dist/test/test.health.d.ts +0 -1
  473. package/dist/test/test.health.js +0 -48
  474. package/dist/test/test.health.js.map +1 -1
  475. package/dist/test/test.import.d.ts +0 -1
  476. package/dist/test/test.import.js +0 -1506
  477. package/dist/test/test.import.js.map +1 -1
  478. package/dist/test/test.import.openapi.d.ts +0 -1
  479. package/dist/test/test.import.openapi.js +0 -75
  480. package/dist/test/test.import.openapi.js.map +1 -1
  481. package/dist/test/test.imports.d.ts +0 -1
  482. package/dist/test/test.imports.js +0 -76
  483. package/dist/test/test.imports.js.map +1 -1
  484. package/dist/test/test.logs.d.ts +0 -1
  485. package/dist/test/test.logs.js +0 -17
  486. package/dist/test/test.logs.js.map +1 -1
  487. package/dist/test/test.notifiers.d.ts +0 -1
  488. package/dist/test/test.notifiers.js +0 -84
  489. package/dist/test/test.notifiers.js.map +1 -1
  490. package/dist/test/test.processor.d.ts +0 -1
  491. package/dist/test/test.processor.js +0 -37
  492. package/dist/test/test.processor.js.map +1 -1
  493. package/dist/test/test.productBuilder.d.ts +0 -1
  494. package/dist/test/test.productBuilder.js +0 -660
  495. package/dist/test/test.productBuilder.js.map +1 -1
  496. package/dist/test/test.products.d.ts +0 -1
  497. package/dist/test/test.products.js +0 -48
  498. package/dist/test/test.products.js.map +1 -1
  499. package/dist/test/test.storage.js +332 -0
  500. package/dist/test/test.storage.js.map +1 -0
  501. package/dist/test/test.triggers.js +314 -0
  502. package/dist/test/test.triggers.js.map +1 -0
  503. package/dist/types/appBuilder.types.d.ts +1 -1
  504. package/dist/types/enums.d.ts +6 -1
  505. package/dist/types/enums.js +5 -0
  506. package/dist/types/enums.js.map +1 -1
  507. package/dist/types/processor.types.d.ts +197 -35
  508. package/dist/types/processor.types.js +9 -1
  509. package/dist/types/processor.types.js.map +1 -1
  510. package/dist/types/productsBuilder.types.d.ts +837 -75
  511. package/dist/types/productsBuilder.types.js +168 -62
  512. package/dist/types/productsBuilder.types.js.map +1 -1
  513. package/dist/utils/index.d.ts +0 -2
  514. package/dist/utils/index.js +2 -49
  515. package/dist/utils/index.js.map +1 -1
  516. package/dist/vector/adapters/base.adapter.d.ts +152 -0
  517. package/dist/vector/adapters/base.adapter.js +137 -0
  518. package/dist/vector/adapters/base.adapter.js.map +1 -0
  519. package/dist/vector/adapters/index.d.ts +10 -0
  520. package/dist/vector/adapters/index.js +19 -0
  521. package/dist/vector/adapters/index.js.map +1 -0
  522. package/dist/vector/adapters/memory.adapter.d.ts +85 -0
  523. package/dist/vector/adapters/memory.adapter.js +505 -0
  524. package/dist/vector/adapters/memory.adapter.js.map +1 -0
  525. package/dist/vector/adapters/pinecone.adapter.d.ts +52 -0
  526. package/dist/vector/adapters/pinecone.adapter.js +400 -0
  527. package/dist/vector/adapters/pinecone.adapter.js.map +1 -0
  528. package/dist/vector/adapters/qdrant.adapter.d.ts +56 -0
  529. package/dist/vector/adapters/qdrant.adapter.js +392 -0
  530. package/dist/vector/adapters/qdrant.adapter.js.map +1 -0
  531. package/dist/vector/adapters/weaviate.adapter.d.ts +64 -0
  532. package/dist/vector/adapters/weaviate.adapter.js +478 -0
  533. package/dist/vector/adapters/weaviate.adapter.js.map +1 -0
  534. package/dist/vector/index.d.ts +47 -0
  535. package/dist/vector/index.js +72 -0
  536. package/dist/vector/index.js.map +1 -0
  537. package/dist/vector/types/connection.interface.d.ts +151 -0
  538. package/dist/vector/types/connection.interface.js +8 -0
  539. package/dist/vector/types/connection.interface.js.map +1 -0
  540. package/dist/vector/types/embedding.interface.d.ts +144 -0
  541. package/dist/vector/types/embedding.interface.js +8 -0
  542. package/dist/vector/types/embedding.interface.js.map +1 -0
  543. package/dist/vector/types/enums.d.ts +104 -0
  544. package/dist/vector/types/enums.js +113 -0
  545. package/dist/vector/types/enums.js.map +1 -0
  546. package/dist/vector/types/index.d.ts +9 -0
  547. package/dist/vector/types/index.js +16 -0
  548. package/dist/vector/types/index.js.map +1 -0
  549. package/dist/vector/types/vector.interface.d.ts +315 -0
  550. package/dist/vector/types/vector.interface.js +8 -0
  551. package/dist/vector/types/vector.interface.js.map +1 -0
  552. package/dist/vector/utils/index.d.ts +6 -0
  553. package/dist/vector/utils/index.js +11 -0
  554. package/dist/vector/utils/index.js.map +1 -0
  555. package/dist/vector/utils/vector-error.d.ts +69 -0
  556. package/dist/vector/utils/vector-error.js +117 -0
  557. package/dist/vector/utils/vector-error.js.map +1 -0
  558. package/dist/vector/vector-database.service.d.ts +405 -0
  559. package/dist/vector/vector-database.service.js +544 -0
  560. package/dist/vector/vector-database.service.js.map +1 -0
  561. package/dist/vector/vector.service.d.ts +245 -0
  562. package/dist/vector/vector.service.js +381 -0
  563. package/dist/vector/vector.service.js.map +1 -0
  564. package/dist/workflows/index.d.ts +30 -0
  565. package/dist/workflows/index.js +64 -0
  566. package/dist/workflows/index.js.map +1 -0
  567. package/dist/workflows/types/index.d.ts +6 -0
  568. package/dist/workflows/types/index.js +23 -0
  569. package/dist/workflows/types/index.js.map +1 -0
  570. package/dist/workflows/types/workflows.types.d.ts +1035 -0
  571. package/dist/workflows/types/workflows.types.js +13 -0
  572. package/dist/workflows/types/workflows.types.js.map +1 -0
  573. package/dist/workflows/workflow-builder.d.ts +70 -0
  574. package/dist/workflows/workflow-builder.js +338 -0
  575. package/dist/workflows/workflow-builder.js.map +1 -0
  576. package/dist/workflows/workflow-executor.d.ts +205 -0
  577. package/dist/workflows/workflow-executor.js +1186 -0
  578. package/dist/workflows/workflow-executor.js.map +1 -0
  579. package/dist/workflows/workflows.service.d.ts +398 -0
  580. package/dist/workflows/workflows.service.js +1595 -0
  581. package/dist/workflows/workflows.service.js.map +1 -0
  582. package/package.json +16 -13
  583. package/dist/actions/actions.repo.d.ts +0 -0
  584. package/dist/actions/actions.repo.js +0 -13
  585. package/dist/actions/actions.repo.js.map +0 -1
  586. package/dist/actions/actions.service.d.ts +0 -0
  587. package/dist/actions/actions.service.js +0 -24
  588. package/dist/actions/actions.service.js.map +0 -1
  589. package/dist/actions/utils/actions.util.read.d.ts +0 -0
  590. package/dist/actions/utils/actions.util.read.js +0 -427
  591. package/dist/actions/utils/actions.util.read.js.map +0 -1
  592. package/dist/api/services/integrationsApi.service.d.ts +0 -18
  593. package/dist/api/services/integrationsApi.service.js +0 -80
  594. package/dist/api/services/integrationsApi.service.js.map +0 -1
  595. package/dist/api/services/workspaceSecretsApi.service.d.ts +0 -75
  596. package/dist/api/services/workspaceSecretsApi.service.js +0 -62
  597. package/dist/api/services/workspaceSecretsApi.service.js.map +0 -1
  598. package/dist/appBuilder/services/app.service.d.ts +0 -111
  599. package/dist/appBuilder/services/app.service.js +0 -737
  600. package/dist/appBuilder/services/app.service.js.map +0 -1
  601. package/dist/appBuilder/services/appBuilder.service.d.ts +0 -111
  602. package/dist/appBuilder/services/appBuilder.service.js +0 -662
  603. package/dist/appBuilder/services/appBuilder.service.js.map +0 -1
  604. package/dist/appBuilder/utils/objects.utils.d.ts +0 -3
  605. package/dist/appBuilder/utils/objects.utils.js +0 -9
  606. package/dist/appBuilder/utils/objects.utils.js.map +0 -1
  607. package/dist/appBuilder/utils/string.utils.d.ts +0 -2
  608. package/dist/appBuilder/utils/string.utils.js +0 -57
  609. package/dist/appBuilder/utils/string.utils.js.map +0 -1
  610. package/dist/appBuilder/validators/index.d.ts +0 -19
  611. package/dist/appBuilder/validators/index.js +0 -40
  612. package/dist/appBuilder/validators/index.js.map +0 -1
  613. package/dist/appBuilder/validators/joi-validators/create.app.validator.d.ts +0 -3
  614. package/dist/appBuilder/validators/joi-validators/create.app.validator.js +0 -10
  615. package/dist/appBuilder/validators/joi-validators/create.app.validator.js.map +0 -1
  616. package/dist/appBuilder/validators/joi-validators/create.appAction.validator.d.ts +0 -4
  617. package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js +0 -20
  618. package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js.map +0 -1
  619. package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.d.ts +0 -7
  620. package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js +0 -44
  621. package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js.map +0 -1
  622. package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.d.ts +0 -3
  623. package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js +0 -31
  624. package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js.map +0 -1
  625. package/dist/appBuilder/validators/joi-validators/create.appBody.validators.d.ts +0 -4
  626. package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js +0 -11
  627. package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js.map +0 -1
  628. package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.d.ts +0 -4
  629. package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js +0 -12
  630. package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js.map +0 -1
  631. package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.d.ts +0 -4
  632. package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js +0 -17
  633. package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js.map +0 -1
  634. package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
  635. package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js +0 -30
  636. package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js.map +0 -1
  637. package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.d.ts +0 -4
  638. package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js +0 -14
  639. package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js.map +0 -1
  640. package/dist/appBuilder/validators/joi-validators/sample.validator.d.ts +0 -5
  641. package/dist/appBuilder/validators/joi-validators/sample.validator.js +0 -26
  642. package/dist/appBuilder/validators/joi-validators/sample.validator.js.map +0 -1
  643. package/dist/appBuilder/validators/joi-validators/update.app.validator.d.ts +0 -4
  644. package/dist/appBuilder/validators/joi-validators/update.app.validator.js +0 -34
  645. package/dist/appBuilder/validators/joi-validators/update.app.validator.js.map +0 -1
  646. package/dist/appBuilder/validators/joi-validators/update.appAction.validator.d.ts +0 -4
  647. package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js +0 -23
  648. package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js.map +0 -1
  649. package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.d.ts +0 -3
  650. package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js +0 -21
  651. package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js.map +0 -1
  652. package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.d.ts +0 -4
  653. package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js +0 -19
  654. package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js.map +0 -1
  655. package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.d.ts +0 -4
  656. package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js +0 -12
  657. package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js.map +0 -1
  658. package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.d.ts +0 -4
  659. package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js +0 -17
  660. package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js.map +0 -1
  661. package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
  662. package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js +0 -16
  663. package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js.map +0 -1
  664. package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.d.ts +0 -4
  665. package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js +0 -14
  666. package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js.map +0 -1
  667. package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.d.ts +0 -3
  668. package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js +0 -27
  669. package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js.map +0 -1
  670. package/dist/apps/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
  671. package/dist/apps/validators/joi-validators/create.appEvent.validator.js +0 -30
  672. package/dist/apps/validators/joi-validators/create.appEvent.validator.js.map +0 -1
  673. package/dist/apps/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
  674. package/dist/apps/validators/joi-validators/update.appEvent.validator.js +0 -16
  675. package/dist/apps/validators/joi-validators/update.appEvent.validator.js.map +0 -1
  676. package/dist/clients/integrations.client.d.ts +0 -2
  677. package/dist/clients/integrations.client.js +0 -26
  678. package/dist/clients/integrations.client.js.map +0 -1
  679. package/dist/database/database.service.d.ts +0 -232
  680. package/dist/database/database.service.js +0 -802
  681. package/dist/database/database.service.js.map +0 -1
  682. package/dist/database/types/aggregation.types.d.ts +0 -261
  683. package/dist/database/types/aggregation.types.js +0 -21
  684. package/dist/database/types/aggregation.types.js.map +0 -1
  685. package/dist/database/types/connection.types.d.ts +0 -132
  686. package/dist/database/types/connection.types.js +0 -6
  687. package/dist/database/types/connection.types.js.map +0 -1
  688. package/dist/database/types/database.types.d.ts +0 -175
  689. package/dist/database/types/database.types.js +0 -75
  690. package/dist/database/types/database.types.js.map +0 -1
  691. package/dist/database/types/index.types.d.ts +0 -220
  692. package/dist/database/types/index.types.js +0 -27
  693. package/dist/database/types/index.types.js.map +0 -1
  694. package/dist/database/types/migration.types.d.ts +0 -205
  695. package/dist/database/types/migration.types.js +0 -44
  696. package/dist/database/types/migration.types.js.map +0 -1
  697. package/dist/database/types/query.types.d.ts +0 -305
  698. package/dist/database/types/query.types.js +0 -57
  699. package/dist/database/types/query.types.js.map +0 -1
  700. package/dist/database/types/result.types.d.ts +0 -220
  701. package/dist/database/types/result.types.js +0 -6
  702. package/dist/database/types/result.types.js.map +0 -1
  703. package/dist/database/types/schema.types.d.ts +0 -190
  704. package/dist/database/types/schema.types.js +0 -69
  705. package/dist/database/types/schema.types.js.map +0 -1
  706. package/dist/database/utils/helpers.d.ts +0 -66
  707. package/dist/database/utils/helpers.js +0 -501
  708. package/dist/database/utils/helpers.js.map +0 -1
  709. package/dist/database/utils/migration.utils.d.ts +0 -151
  710. package/dist/database/utils/migration.utils.js +0 -476
  711. package/dist/database/utils/migration.utils.js.map +0 -1
  712. package/dist/database/utils/transaction.d.ts +0 -64
  713. package/dist/database/utils/transaction.js +0 -130
  714. package/dist/database/utils/transaction.js.map +0 -1
  715. package/dist/database/validators/connection.validator.d.ts +0 -20
  716. package/dist/database/validators/connection.validator.js +0 -267
  717. package/dist/database/validators/connection.validator.js.map +0 -1
  718. package/dist/database/validators/query.validator.d.ts +0 -31
  719. package/dist/database/validators/query.validator.js +0 -305
  720. package/dist/database/validators/query.validator.js.map +0 -1
  721. package/dist/database/validators/schema.validator.d.ts +0 -31
  722. package/dist/database/validators/schema.validator.js +0 -334
  723. package/dist/database/validators/schema.validator.js.map +0 -1
  724. package/dist/graph/graph.service.d.ts +0 -278
  725. package/dist/graph/graph.service.js +0 -687
  726. package/dist/graph/graph.service.js.map +0 -1
  727. package/dist/graph/types/connection.types.d.ts +0 -158
  728. package/dist/graph/types/connection.types.js +0 -43
  729. package/dist/graph/types/connection.types.js.map +0 -1
  730. package/dist/graph/types/graph.types.d.ts +0 -144
  731. package/dist/graph/types/graph.types.js +0 -84
  732. package/dist/graph/types/graph.types.js.map +0 -1
  733. package/dist/graph/types/node.types.d.ts +0 -193
  734. package/dist/graph/types/node.types.js +0 -49
  735. package/dist/graph/types/node.types.js.map +0 -1
  736. package/dist/graph/types/path.types.d.ts +0 -224
  737. package/dist/graph/types/path.types.js +0 -38
  738. package/dist/graph/types/path.types.js.map +0 -1
  739. package/dist/graph/types/query.types.d.ts +0 -247
  740. package/dist/graph/types/query.types.js +0 -23
  741. package/dist/graph/types/query.types.js.map +0 -1
  742. package/dist/graph/types/relationship.types.d.ts +0 -224
  743. package/dist/graph/types/relationship.types.js +0 -35
  744. package/dist/graph/types/relationship.types.js.map +0 -1
  745. package/dist/graph/types/result.types.d.ts +0 -237
  746. package/dist/graph/types/result.types.js +0 -7
  747. package/dist/graph/types/result.types.js.map +0 -1
  748. package/dist/graph/validators/index.d.ts +0 -81
  749. package/dist/graph/validators/index.js +0 -243
  750. package/dist/graph/validators/index.js.map +0 -1
  751. package/dist/integrationsBuilder/services/integration.service.d.ts +0 -138
  752. package/dist/integrationsBuilder/services/integration.service.js +0 -1148
  753. package/dist/integrationsBuilder/services/integration.service.js.map +0 -1
  754. package/dist/integrationsBuilder/services/integrationBuilder.service.d.ts +0 -130
  755. package/dist/integrationsBuilder/services/integrationBuilder.service.js +0 -1017
  756. package/dist/integrationsBuilder/services/integrationBuilder.service.js.map +0 -1
  757. package/dist/integrationsBuilder/utils/objects.utils.d.ts +0 -2
  758. package/dist/integrationsBuilder/utils/objects.utils.js +0 -48
  759. package/dist/integrationsBuilder/utils/objects.utils.js.map +0 -1
  760. package/dist/integrationsBuilder/utils/string.utils.d.ts +0 -1
  761. package/dist/integrationsBuilder/utils/string.utils.js +0 -9
  762. package/dist/integrationsBuilder/utils/string.utils.js.map +0 -1
  763. package/dist/integrationsBuilder/validators/index.d.ts +0 -18
  764. package/dist/integrationsBuilder/validators/index.js +0 -38
  765. package/dist/integrationsBuilder/validators/index.js.map +0 -1
  766. package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.d.ts +0 -3
  767. package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js +0 -10
  768. package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js.map +0 -1
  769. package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.d.ts +0 -4
  770. package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js +0 -26
  771. package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js.map +0 -1
  772. package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.d.ts +0 -3
  773. package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js +0 -8
  774. package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js.map +0 -1
  775. package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.d.ts +0 -3
  776. package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js +0 -8
  777. package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js.map +0 -1
  778. package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.d.ts +0 -3
  779. package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js +0 -10
  780. package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js.map +0 -1
  781. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.d.ts +0 -3
  782. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js +0 -60
  783. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js.map +0 -1
  784. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.d.ts +0 -3
  785. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js +0 -8
  786. package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js.map +0 -1
  787. package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.d.ts +0 -3
  788. package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js +0 -8
  789. package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js.map +0 -1
  790. package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.d.ts +0 -3
  791. package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js +0 -8
  792. package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js.map +0 -1
  793. package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.d.ts +0 -3
  794. package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js +0 -9
  795. package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js.map +0 -1
  796. package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.d.ts +0 -3
  797. package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js +0 -8
  798. package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js.map +0 -1
  799. package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.d.ts +0 -3
  800. package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js +0 -8
  801. package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js.map +0 -1
  802. package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.d.ts +0 -3
  803. package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js +0 -8
  804. package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js.map +0 -1
  805. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.d.ts +0 -3
  806. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js +0 -8
  807. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js.map +0 -1
  808. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.d.ts +0 -3
  809. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js +0 -8
  810. package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js.map +0 -1
  811. package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.d.ts +0 -3
  812. package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js +0 -8
  813. package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js.map +0 -1
  814. package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.d.ts +0 -3
  815. package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js +0 -8
  816. package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js.map +0 -1
  817. package/dist/postman.d.ts +0 -1
  818. package/dist/postman.js +0 -21674
  819. package/dist/postman.js.map +0 -1
  820. package/dist/processor/utils/mongo.util.d.ts +0 -0
  821. package/dist/processor/utils/mongo.util.js +0 -152
  822. package/dist/processor/utils/mongo.util.js.map +0 -1
  823. package/dist/processor/utils/postgres.util.d.ts +0 -14
  824. package/dist/processor/utils/postgres.util.js +0 -83
  825. package/dist/processor/utils/postgres.util.js.map +0 -1
  826. package/dist/products/services/utils/crypt.utils.d.ts +0 -1
  827. package/dist/products/services/utils/crypt.utils.js +0 -17
  828. package/dist/products/services/utils/crypt.utils.js.map +0 -1
  829. package/dist/products/services/utils/functions.utils.d.ts +0 -13
  830. package/dist/products/services/utils/functions.utils.js +0 -289
  831. package/dist/products/services/utils/functions.utils.js.map +0 -1
  832. package/dist/products/services/utils/objects.utils.d.ts +0 -13
  833. package/dist/products/services/utils/objects.utils.js +0 -89
  834. package/dist/products/services/utils/objects.utils.js.map +0 -1
  835. package/dist/products/services/utils/string.utils.d.ts +0 -12
  836. package/dist/products/services/utils/string.utils.js +0 -168
  837. package/dist/products/services/utils/string.utils.js.map +0 -1
  838. package/dist/products/validators/joi-validators/create.product.validator.d.ts +0 -3
  839. package/dist/products/validators/joi-validators/create.product.validator.js +0 -10
  840. package/dist/products/validators/joi-validators/create.product.validator.js.map +0 -1
  841. package/dist/products/validators/joi-validators/create.productGraphAction.validator.d.ts +0 -14
  842. package/dist/products/validators/joi-validators/create.productGraphAction.validator.js +0 -696
  843. package/dist/products/validators/joi-validators/create.productGraphAction.validator.js.map +0 -1
  844. package/dist/products/validators/joi-validators/update.productGraphAction.validator.d.ts +0 -7
  845. package/dist/products/validators/joi-validators/update.productGraphAction.validator.js +0 -72
  846. package/dist/products/validators/joi-validators/update.productGraphAction.validator.js.map +0 -1
  847. package/dist/test.appBuilder.js +0 -14
  848. package/dist/test.appBuilder.js.map +0 -1
  849. package/dist/test.import.d.ts +0 -0
  850. package/dist/test.import.js +0 -24
  851. package/dist/test.import.js.map +0 -1
  852. package/dist/test.imports.js +0 -28
  853. package/dist/test.imports.js.map +0 -1
  854. package/dist/test.integrationBuilder.js +0 -276
  855. package/dist/test.integrationBuilder.js.map +0 -1
  856. package/dist/test.processor.d.ts +0 -1
  857. package/dist/test.processor.js +0 -23
  858. package/dist/test.processor.js.map +0 -1
  859. package/dist/test.utils.d.ts +0 -1
  860. package/dist/test.utils.js +0 -25
  861. package/dist/test.utils.js.map +0 -1
  862. package/dist/tsconfig.tsbuildinfo +0 -1
  863. package/dist/types/integrationsBuilder.types.d.ts +0 -276
  864. package/dist/types/integrationsBuilder.types.js +0 -51
  865. package/dist/types/integrationsBuilder.types.js.map +0 -1
  866. /package/dist/{test.appBuilder.d.ts → test/test.database.d.ts} +0 -0
  867. /package/dist/{test.imports.d.ts → test/test.storage.d.ts} +0 -0
  868. /package/dist/{test.integrationBuilder.d.ts → test/test.triggers.d.ts} +0 -0
@@ -1,1430 +1,1297 @@
1
1
  "use strict";
2
2
  /**
3
- * AWS Neptune Graph Database Adapter
4
- * Implements the BaseGraphAdapter for Amazon Neptune using Gremlin or openCypher
3
+ * Amazon Neptune Graph Database Adapter
4
+ *
5
+ * Implements the BaseGraphAdapter for Amazon Neptune using Gremlin.
6
+ * Neptune is a fully managed graph database service that supports
7
+ * both property graph (Gremlin) and RDF (SPARQL) query languages.
8
+ *
9
+ * Key features:
10
+ * - Apache TinkerPop Gremlin support
11
+ * - WebSocket connection support
12
+ * - IAM authentication support
13
+ * - High availability and replication
5
14
  */
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() { return m[k]; } };
20
+ }
21
+ Object.defineProperty(o, k2, desc);
22
+ }) : (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ o[k2] = m[k];
25
+ }));
26
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
27
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
28
+ }) : function(o, v) {
29
+ o["default"] = v;
30
+ });
31
+ var __importStar = (this && this.__importStar) || (function () {
32
+ var ownKeys = function(o) {
33
+ ownKeys = Object.getOwnPropertyNames || function (o) {
34
+ var ar = [];
35
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
36
+ return ar;
37
+ };
38
+ return ownKeys(o);
39
+ };
40
+ return function (mod) {
41
+ if (mod && mod.__esModule) return mod;
42
+ var result = {};
43
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
44
+ __setModuleDefault(result, mod);
45
+ return result;
46
+ };
47
+ })();
6
48
  Object.defineProperty(exports, "__esModule", { value: true });
7
49
  exports.NeptuneAdapter = void 0;
8
50
  const base_adapter_1 = require("./base.adapter");
9
- const graph_types_1 = require("../types/graph.types");
10
- const relationship_types_1 = require("../types/relationship.types");
11
- /**
12
- * Neptune connection implementation
13
- */
14
- class NeptuneConnection {
15
- constructor(config, id) {
16
- this.config = config;
17
- this.type = graph_types_1.GraphDatabaseType.NEPTUNE;
18
- this.status = graph_types_1.GraphConnectionStatus.DISCONNECTED;
19
- this.httpClient = null;
20
- this.awsCredentials = null;
21
- this.id = id || `neptune-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
22
- this.createdAt = new Date();
23
- this.queryLanguage = config.queryLanguage;
24
- }
25
- async connect() {
26
- var _a;
27
- if (this.status === graph_types_1.GraphConnectionStatus.CONNECTED) {
28
- return;
29
- }
30
- this.status = graph_types_1.GraphConnectionStatus.CONNECTING;
31
- try {
32
- // Build endpoint URL
33
- const port = this.config.port || 8182;
34
- const protocol = this.config.ssl !== false ? 'https' : 'http';
35
- const baseUrl = `${protocol}://${this.config.endpoint}:${port}`;
36
- // If using IAM auth, set up AWS signing
37
- if (this.config.useIAM) {
38
- this.awsCredentials = {
39
- accessKeyId: this.config.accessKeyId,
40
- secretAccessKey: this.config.secretAccessKey,
41
- sessionToken: this.config.sessionToken,
42
- region: this.config.region,
43
- };
44
- }
45
- this.httpClient = {
46
- baseUrl,
47
- headers: Object.assign({ 'Content-Type': 'application/json' }, (_a = this.config.options) === null || _a === void 0 ? void 0 : _a.headers),
48
- };
49
- // Verify connectivity with a simple query
50
- await this.executeQuery(this.queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN
51
- ? 'g.V().limit(1).count()'
52
- : 'MATCH (n) RETURN count(n) LIMIT 1');
53
- this.status = graph_types_1.GraphConnectionStatus.CONNECTED;
54
- this.lastUsedAt = new Date();
55
- }
56
- catch (error) {
57
- this.status = graph_types_1.GraphConnectionStatus.ERROR;
58
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.CONNECTION_ERROR, `Failed to connect to Neptune: ${error.message}`, error);
59
- }
60
- }
61
- async disconnect() {
62
- this.httpClient = null;
63
- this.awsCredentials = null;
64
- this.status = graph_types_1.GraphConnectionStatus.DISCONNECTED;
65
- }
66
- isConnected() {
67
- return this.status === graph_types_1.GraphConnectionStatus.CONNECTED && this.httpClient !== null;
68
- }
69
- getClient() {
70
- if (!this.httpClient) {
71
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.CONNECTION_ERROR, 'Neptune client not initialized. Call connect() first.');
72
- }
73
- return this.httpClient;
74
- }
75
- getSession() {
76
- return this.getClient();
77
- }
78
- getConfig() {
79
- return this.config;
80
- }
81
- async executeQuery(query, params) {
82
- if (!this.httpClient) {
83
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.CONNECTION_ERROR, 'Neptune client not initialized');
84
- }
85
- this.lastUsedAt = new Date();
86
- const endpoint = this.queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN
87
- ? '/gremlin'
88
- : '/openCypher';
89
- const body = this.queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN
90
- ? { gremlin: query, bindings: params || {} }
91
- : { query, parameters: params || {} };
92
- try {
93
- // Make HTTP request to Neptune
94
- const response = await this.makeRequest(endpoint, body);
95
- return response;
96
- }
97
- catch (error) {
98
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.QUERY_ERROR, `Neptune query failed: ${error.message}`, error, query, params);
99
- }
100
- }
101
- async makeRequest(endpoint, body) {
102
- const url = `${this.httpClient.baseUrl}${endpoint}`;
103
- const headers = Object.assign({}, this.httpClient.headers);
104
- // Sign request if using IAM auth
105
- if (this.awsCredentials) {
106
- const signedHeaders = await this.signRequest('POST', url, JSON.stringify(body));
107
- Object.assign(headers, signedHeaders);
108
- }
109
- // Using fetch for HTTP requests
110
- const response = await fetch(url, {
111
- method: 'POST',
112
- headers,
113
- body: JSON.stringify(body),
114
- });
115
- if (!response.ok) {
116
- const errorBody = await response.text();
117
- throw new Error(`HTTP ${response.status}: ${errorBody}`);
118
- }
119
- return response.json();
120
- }
121
- async signRequest(method, url, body) {
122
- // AWS Signature V4 signing
123
- // In production, use aws-sdk or @aws-sdk/signature-v4
124
- // This is a placeholder for the signing logic
125
- const timestamp = new Date().toISOString().replace(/[:-]|\.\d{3}/g, '');
126
- const date = timestamp.slice(0, 8);
127
- return {
128
- 'X-Amz-Date': timestamp,
129
- 'X-Amz-Security-Token': this.awsCredentials.sessionToken || '',
130
- // In production, add proper Authorization header with signature
131
- };
132
- }
133
- }
51
+ const enums_1 = require("../types/enums");
52
+ const graph_error_1 = require("../utils/graph-error");
134
53
  /**
135
- * Neptune transaction implementation
136
- * Note: Neptune has limited transaction support, primarily for Gremlin
137
- */
138
- class NeptuneTransaction {
139
- constructor(connection, transactionId) {
140
- this.connection = connection;
141
- this.status = graph_types_1.GraphTransactionStatus.PENDING;
142
- this.id = transactionId || `tx-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
143
- this.createdAt = new Date();
144
- this.status = graph_types_1.GraphTransactionStatus.ACTIVE;
145
- this.native = { transactionId: this.id };
146
- }
147
- async commit() {
148
- if (this.status !== graph_types_1.GraphTransactionStatus.ACTIVE) {
149
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.TRANSACTION_ERROR, `Cannot commit transaction in ${this.status} state`);
150
- }
151
- // Neptune auto-commits each query, so this is a no-op
152
- this.status = graph_types_1.GraphTransactionStatus.COMMITTED;
153
- }
154
- async rollback() {
155
- if (this.status !== graph_types_1.GraphTransactionStatus.ACTIVE) {
156
- return;
157
- }
158
- // Neptune doesn't support rollback in the traditional sense
159
- this.status = graph_types_1.GraphTransactionStatus.ROLLED_BACK;
160
- }
161
- isActive() {
162
- return this.status === graph_types_1.GraphTransactionStatus.ACTIVE;
163
- }
164
- }
165
- /**
166
- * AWS Neptune Graph Database Adapter
54
+ * Neptune adapter using Gremlin
55
+ * Uses the gremlin package for TinkerPop connectivity
167
56
  */
168
57
  class NeptuneAdapter extends base_adapter_1.BaseGraphAdapter {
169
58
  constructor() {
170
59
  super(...arguments);
171
- this.type = graph_types_1.GraphDatabaseType.NEPTUNE;
172
- this.supportedLanguages = [graph_types_1.GraphQueryLanguage.GREMLIN, graph_types_1.GraphQueryLanguage.OPENCYPHER];
173
- this.defaultLanguage = graph_types_1.GraphQueryLanguage.GREMLIN;
174
- }
175
- // ==================== CONNECTION METHODS ====================
176
- async connect(config) {
177
- if (config.type !== graph_types_1.GraphDatabaseType.NEPTUNE) {
178
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, `Invalid config type ${config.type}. Expected ${graph_types_1.GraphDatabaseType.NEPTUNE}`);
179
- }
180
- const connection = new NeptuneConnection(config);
181
- await connection.connect();
182
- return connection;
183
- }
184
- async disconnect(connection) {
185
- await connection.disconnect();
186
- }
187
- async testConnection(connection) {
188
- const startTime = Date.now();
189
- const neptuneConn = connection;
190
- const queryLanguage = neptuneConn.getConfig().queryLanguage;
60
+ this.graphType = enums_1.GraphType.NEPTUNE;
61
+ this.supportedFeatures = new Set([
62
+ enums_1.GraphFeature.SCHEMA_INDEXES,
63
+ enums_1.GraphFeature.GRAPH_ALGORITHMS,
64
+ ]);
65
+ this.connection = null;
66
+ this.g = null; // Gremlin graph traversal source
67
+ this.gremlin = null;
68
+ }
69
+ // ==================== CONNECTION MANAGEMENT ====================
70
+ async connect(options) {
191
71
  try {
192
- const testQuery = queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN
193
- ? 'g.V().limit(1).count()'
194
- : 'MATCH (n) RETURN count(n) AS count LIMIT 1';
195
- await neptuneConn.executeQuery(testQuery);
72
+ // Dynamic import of gremlin package
73
+ this.gremlin = await Promise.resolve().then(() => __importStar(require('gremlin')));
74
+ const { DriverRemoteConnection } = this.gremlin.driver;
75
+ // Neptune WebSocket connection URL
76
+ const wsUrl = options.connectionUrl.replace(/^https?:\/\//, 'wss://').replace(/\/?$/, '/gremlin');
77
+ // Connection options for Neptune
78
+ const connectionOptions = {
79
+ mimeType: 'application/vnd.gremlin-v2.0+json',
80
+ pingEnabled: true,
81
+ pingInterval: 30000,
82
+ };
83
+ // Add authentication if provided
84
+ if (options.auth) {
85
+ // For IAM auth, you'd typically use AWS4 signing
86
+ // This is a simplified version - production would need proper IAM signing
87
+ connectionOptions.headers = {
88
+ Authorization: `Basic ${Buffer.from(`${options.auth.username}:${options.auth.password}`).toString('base64')}`,
89
+ };
90
+ }
91
+ this.connection = new DriverRemoteConnection(wsUrl, connectionOptions);
92
+ // Create graph traversal source
93
+ const { Graph } = this.gremlin.structure;
94
+ const graph = new Graph();
95
+ this.g = graph.traversal().withRemote(this.connection);
96
+ // Test the connection
97
+ await this.g.V().limit(1).toList();
98
+ this.connected = true;
99
+ this.connectionUrl = options.connectionUrl;
196
100
  return {
197
101
  connected: true,
198
- message: 'Connection successful',
199
- databaseType: graph_types_1.GraphDatabaseType.NEPTUNE,
200
- queryLanguage,
201
- responseTime: Date.now() - startTime,
102
+ type: enums_1.GraphType.NEPTUNE,
103
+ latency: 0,
202
104
  };
203
105
  }
204
106
  catch (error) {
205
- return {
206
- connected: false,
207
- message: 'Connection failed',
208
- databaseType: graph_types_1.GraphDatabaseType.NEPTUNE,
209
- queryLanguage,
210
- responseTime: Date.now() - startTime,
211
- error: error.message,
212
- };
107
+ this.connected = false;
108
+ throw graph_error_1.GraphError.connectionError(`Failed to connect to Neptune: ${error.message}`, error);
213
109
  }
214
110
  }
215
- async getDatabaseInfo(connection) {
216
- const neptuneConn = connection;
111
+ async testConnection(options) {
217
112
  try {
218
- // Neptune doesn't have a direct version query, use status endpoint
219
- const response = await neptuneConn.executeQuery('g.V().limit(0)');
113
+ const gremlin = await Promise.resolve().then(() => __importStar(require('gremlin')));
114
+ const { DriverRemoteConnection } = gremlin.driver;
115
+ const startTime = Date.now();
116
+ const wsUrl = options.connectionUrl.replace(/^https?:\/\//, 'wss://').replace(/\/?$/, '/gremlin');
117
+ const testConnection = new DriverRemoteConnection(wsUrl, {
118
+ mimeType: 'application/vnd.gremlin-v2.0+json',
119
+ });
120
+ const { Graph } = gremlin.structure;
121
+ const graph = new Graph();
122
+ const testG = graph.traversal().withRemote(testConnection);
123
+ // Test query
124
+ await testG.V().limit(1).toList();
125
+ await testConnection.close();
220
126
  return {
127
+ connected: true,
128
+ type: enums_1.GraphType.NEPTUNE,
221
129
  version: 'Neptune',
222
- edition: 'AWS Neptune',
223
- features: ['gremlin', 'openCypher', 'sparql'],
130
+ latency: Date.now() - startTime,
224
131
  };
225
132
  }
226
- catch (_a) {
227
- return {
228
- version: 'Unknown',
229
- edition: 'AWS Neptune',
230
- features: [],
231
- };
232
- }
233
- }
234
- // ==================== TRANSACTION METHODS ====================
235
- async beginTransaction(connection, options) {
236
- // Neptune has limited transaction support
237
- return new NeptuneTransaction(connection);
238
- }
239
- async commitTransaction(connection, transaction) {
240
- await transaction.commit();
241
- }
242
- async rollbackTransaction(connection, transaction) {
243
- await transaction.rollback();
244
- }
245
- // ==================== RAW QUERY METHODS ====================
246
- async executeRaw(connection, options, transaction) {
247
- const startTime = Date.now();
248
- const neptuneConn = connection;
249
- try {
250
- const response = await neptuneConn.executeQuery(options.query, options.params);
251
- const data = this.parseQueryResponse(response, neptuneConn.getConfig().queryLanguage);
133
+ catch (error) {
252
134
  return {
253
- success: true,
254
- executionTime: Date.now() - startTime,
255
- data: data,
256
- count: data.length,
135
+ connected: false,
136
+ type: enums_1.GraphType.NEPTUNE,
137
+ error: error.message,
257
138
  };
258
139
  }
259
- catch (error) {
260
- throw this.wrapError(error, graph_types_1.GraphErrorType.QUERY_ERROR, `Query execution failed: ${error.message}`, options.query, options.params);
261
- }
262
140
  }
263
- parseQueryResponse(response, language) {
264
- if (language === graph_types_1.GraphQueryLanguage.GREMLIN) {
265
- return this.parseGremlinResponse(response);
141
+ async disconnect() {
142
+ if (this.connection) {
143
+ await this.connection.close();
144
+ this.connection = null;
145
+ this.g = null;
266
146
  }
267
- return this.parseOpenCypherResponse(response);
268
- }
269
- parseGremlinResponse(response) {
270
- if (!response || !response.result)
271
- return [];
272
- const data = response.result.data;
273
- if (!data || !data['@value'])
274
- return [];
275
- return data['@value'].map((item) => this.parseGremlinValue(item));
147
+ this.connected = false;
276
148
  }
277
- parseGremlinValue(value) {
278
- if (!value)
279
- return value;
280
- if (value['@type']) {
281
- const type = value['@type'];
282
- const val = value['@value'];
283
- switch (type) {
284
- case 'g:Vertex':
285
- return this.parseGremlinVertex(val);
286
- case 'g:Edge':
287
- return this.parseGremlinEdge(val);
288
- case 'g:Path':
289
- return this.parseGremlinPath(val);
290
- case 'g:Int64':
291
- case 'g:Int32':
292
- case 'g:Double':
293
- case 'g:Float':
294
- return Number(val);
295
- case 'g:List':
296
- return val.map((v) => this.parseGremlinValue(v));
297
- case 'g:Map':
298
- return this.parseGremlinMap(val);
299
- case 'g:Set':
300
- return val.map((v) => this.parseGremlinValue(v));
301
- case 'g:UUID':
302
- return val;
303
- case 'g:Date':
304
- return new Date(val);
305
- default:
306
- return val;
307
- }
149
+ ensureTraversal() {
150
+ this.ensureConnected();
151
+ if (!this.g) {
152
+ throw new Error('Graph traversal source not initialized');
308
153
  }
309
- if (Array.isArray(value)) {
310
- return value.map(v => this.parseGremlinValue(v));
311
- }
312
- if (typeof value === 'object') {
313
- const result = {};
314
- Object.entries(value).forEach(([k, v]) => {
315
- result[k] = this.parseGremlinValue(v);
316
- });
317
- return result;
318
- }
319
- return value;
154
+ return this.g;
320
155
  }
321
- parseGremlinVertex(val) {
322
- const properties = {};
323
- if (val.properties) {
324
- Object.entries(val.properties).forEach(([key, propArray]) => {
325
- var _a, _b, _c;
326
- if (Array.isArray(propArray) && propArray.length > 0) {
327
- properties[key] = ((_b = (_a = propArray[0]) === null || _a === void 0 ? void 0 : _a['@value']) === null || _b === void 0 ? void 0 : _b.value) || ((_c = propArray[0]) === null || _c === void 0 ? void 0 : _c.value);
156
+ // ==================== NODE OPERATIONS ====================
157
+ async createNode(options, _transaction) {
158
+ const g = this.ensureTraversal();
159
+ const { t } = this.gremlin.process;
160
+ // Start with addV for the first label
161
+ let traversal = g.addV(options.labels[0]);
162
+ // Add additional labels
163
+ for (let i = 1; i < options.labels.length; i++) {
164
+ traversal = traversal.property(t.label, options.labels[i]);
165
+ }
166
+ // Add properties
167
+ if (options.properties) {
168
+ for (const [key, value] of Object.entries(options.properties)) {
169
+ if (value !== undefined && value !== null) {
170
+ traversal = traversal.property(key, value);
328
171
  }
329
- });
330
- }
331
- return {
332
- id: val.id,
333
- labels: [val.label],
334
- properties,
335
- };
336
- }
337
- parseGremlinEdge(val) {
338
- const properties = {};
339
- if (val.properties) {
340
- Object.entries(val.properties).forEach(([key, propVal]) => {
341
- properties[key] = this.parseGremlinValue(propVal);
342
- });
343
- }
344
- return {
345
- id: val.id,
346
- type: val.label,
347
- startNodeId: val.outV,
348
- endNodeId: val.inV,
349
- properties,
350
- };
351
- }
352
- parseGremlinPath(val) {
353
- var _a;
354
- const objects = ((_a = val.objects) === null || _a === void 0 ? void 0 : _a.map((obj) => this.parseGremlinValue(obj))) || [];
355
- const nodes = [];
356
- const relationships = [];
357
- objects.forEach((obj) => {
358
- if (obj.labels) {
359
- nodes.push(obj);
360
- }
361
- else if (obj.type) {
362
- relationships.push(obj);
363
172
  }
364
- });
365
- return {
366
- nodes,
367
- relationships,
368
- length: relationships.length,
369
- start: nodes[0],
370
- end: nodes[nodes.length - 1],
371
- };
372
- }
373
- parseGremlinMap(val) {
374
- const result = {};
375
- for (let i = 0; i < val.length; i += 2) {
376
- const key = this.parseGremlinValue(val[i]);
377
- const value = this.parseGremlinValue(val[i + 1]);
378
- result[key] = value;
379
173
  }
380
- return result;
381
- }
382
- parseOpenCypherResponse(response) {
383
- if (!response || !response.results)
384
- return [];
385
- return response.results;
386
- }
387
- // ==================== NODE OPERATIONS ====================
388
- async createNode(connection, options, transaction) {
389
- const startTime = Date.now();
390
- const neptuneConn = connection;
391
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
392
- const labels = this.normalizeLabels(options.labels);
393
- let query;
394
- let params = {};
395
- if (isGremlin) {
396
- // Gremlin addV query
397
- const propsSteps = Object.entries(options.properties)
398
- .map(([key, value]) => `.property('${key}', ${this.gremlinValue(value)})`)
399
- .join('');
400
- query = `g.addV('${labels[0]}')${propsSteps}`;
401
- }
402
- else {
403
- // openCypher CREATE query
404
- const labelStr = labels.map(l => this.escapeIdentifier(l)).join(':');
405
- const propEntries = Object.entries(options.properties);
406
- const propStr = propEntries.map(([k], i) => `${k}: $prop${i}`).join(', ');
407
- propEntries.forEach(([, v], i) => { params[`prop${i}`] = v; });
408
- query = `CREATE (n:${labelStr} {${propStr}}) RETURN n`;
409
- }
410
- const result = await this.executeRaw(connection, { query, params }, transaction);
174
+ const result = await traversal.next();
175
+ const vertex = result.value;
176
+ // Fetch the complete vertex with properties
177
+ const fullVertex = await g.V(vertex.id).valueMap(true).next();
411
178
  return {
412
- success: true,
413
- executionTime: Date.now() - startTime,
414
- node: result.data.length > 0 ? this.parseNode(result.data[0]) : undefined,
179
+ node: this.mapGremlinVertex(vertex.id, fullVertex.value),
415
180
  created: true,
416
181
  };
417
182
  }
418
- async findNodes(connection, options, transaction) {
419
- const startTime = Date.now();
420
- const neptuneConn = connection;
421
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
422
- let query;
423
- const params = {};
424
- if (isGremlin) {
425
- query = this.buildGremlinFindNodesQuery(options);
183
+ async findNodes(options, _transaction) {
184
+ var _a, _b;
185
+ const g = this.ensureTraversal();
186
+ let traversal = g.V();
187
+ // Filter by labels
188
+ if ((_a = options.labels) === null || _a === void 0 ? void 0 : _a.length) {
189
+ traversal = traversal.hasLabel(...options.labels);
190
+ }
191
+ // Apply where conditions
192
+ if (options.where) {
193
+ traversal = this.applyWhereConditions(traversal, options.where);
194
+ }
195
+ // Apply ordering
196
+ if ((_b = options.orderBy) === null || _b === void 0 ? void 0 : _b.length) {
197
+ const { order } = this.gremlin.process;
198
+ for (const orderSpec of options.orderBy) {
199
+ const orderDir = orderSpec.direction.toUpperCase() === 'DESC' ? order.desc : order.asc;
200
+ traversal = traversal.order().by(orderSpec.property, orderDir);
201
+ }
426
202
  }
427
- else {
428
- query = this.buildCypherFindNodesQuery(options, params);
203
+ // Apply pagination
204
+ if (options.skip) {
205
+ traversal = traversal.skip(options.skip);
429
206
  }
430
- const result = await this.executeRaw(connection, { query, params }, transaction);
431
- const nodes = result.data.map(row => this.parseNode(isGremlin ? row : row.n || row));
207
+ if (options.limit) {
208
+ traversal = traversal.limit(options.limit);
209
+ }
210
+ // Get vertices with properties
211
+ const results = await traversal.valueMap(true).toList();
212
+ const nodes = results.map((v) => this.mapGremlinVertexFromValueMap(v));
432
213
  return {
433
- success: true,
434
- executionTime: Date.now() - startTime,
435
214
  nodes,
436
215
  count: nodes.length,
437
- hasMore: options.limit !== undefined && nodes.length === options.limit,
438
216
  };
439
217
  }
440
- buildGremlinFindNodesQuery(options) {
441
- let query = 'g.V()';
442
- if (options.labels) {
443
- const labels = this.normalizeLabels(options.labels);
444
- query += `.hasLabel('${labels.join("', '")}')`;
445
- }
446
- if (options.properties) {
447
- Object.entries(options.properties).forEach(([key, value]) => {
448
- query += `.has('${key}', ${this.gremlinValue(value)})`;
449
- });
450
- }
451
- if (options.orderBy && options.orderBy.length > 0) {
452
- const orderSteps = options.orderBy.map(o => `by('${o.property}', ${o.direction === 'DESC' ? 'desc' : 'asc'})`).join('.');
453
- query += `.order().${orderSteps}`;
454
- }
455
- if (options.skip) {
456
- query += `.skip(${options.skip})`;
457
- }
458
- if (options.limit) {
459
- query += `.limit(${options.limit})`;
460
- }
461
- return query;
462
- }
463
- buildCypherFindNodesQuery(options, params) {
464
- const labels = options.labels ? this.normalizeLabels(options.labels) : [];
465
- const labelStr = labels.length > 0 ? ':' + labels.map(l => this.escapeIdentifier(l)).join(':') : '';
466
- let query = `MATCH (n${labelStr})`;
467
- if (options.properties && Object.keys(options.properties).length > 0) {
468
- const whereParts = [];
469
- Object.entries(options.properties).forEach(([key, value], index) => {
470
- const paramName = `prop_${index}`;
471
- whereParts.push(`n.${key} = $${paramName}`);
472
- params[paramName] = value;
473
- });
474
- query += ` WHERE ${whereParts.join(' AND ')}`;
475
- }
476
- query += ' RETURN n';
477
- if (options.orderBy && options.orderBy.length > 0) {
478
- const orderParts = options.orderBy.map(o => `n.${o.property} ${o.direction}`);
479
- query += ` ORDER BY ${orderParts.join(', ')}`;
480
- }
481
- if (options.skip !== undefined) {
482
- query += ` SKIP ${options.skip}`;
483
- }
484
- if (options.limit !== undefined) {
485
- query += ` LIMIT ${options.limit}`;
486
- }
487
- return query;
488
- }
489
- async findNodeById(connection, id, transaction) {
490
- const neptuneConn = connection;
491
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
492
- const query = isGremlin
493
- ? `g.V('${id}')`
494
- : `MATCH (n) WHERE id(n) = $id RETURN n`;
495
- const result = await this.executeRaw(connection, { query, params: { id } }, transaction);
496
- if (result.data.length === 0) {
218
+ async findNodeById(id, _transaction) {
219
+ const g = this.ensureTraversal();
220
+ const results = await g.V(id).valueMap(true).toList();
221
+ if (results.length === 0) {
497
222
  return null;
498
223
  }
499
- return this.parseNode(isGremlin ? result.data[0] : result.data[0].n);
224
+ return this.mapGremlinVertexFromValueMap(results[0]);
500
225
  }
501
- async updateNode(connection, options, transaction) {
502
- const startTime = Date.now();
503
- const neptuneConn = connection;
504
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
505
- let query;
506
- const params = {};
507
- if (isGremlin) {
508
- query = `g.V('${options.id}')`;
509
- if (options.set) {
510
- Object.entries(options.set).forEach(([key, value]) => {
511
- query += `.property('${key}', ${this.gremlinValue(value)})`;
512
- });
513
- }
514
- if (options.remove && options.remove.length > 0) {
515
- options.remove.forEach(prop => {
516
- query += `.properties('${prop}').drop()`;
517
- });
518
- }
226
+ async updateNode(options, _transaction) {
227
+ var _a;
228
+ const g = this.ensureTraversal();
229
+ let traversal;
230
+ if (options.id) {
231
+ traversal = g.V(options.id);
519
232
  }
520
233
  else {
521
- query = `MATCH (n) WHERE id(n) = $nodeId`;
522
- params.nodeId = options.id;
523
- const setParts = [];
524
- if (options.set) {
525
- Object.entries(options.set).forEach(([key, value], index) => {
526
- const paramName = `set_${index}`;
527
- setParts.push(`n.${key} = $${paramName}`);
528
- params[paramName] = value;
529
- });
234
+ traversal = g.V();
235
+ if ((_a = options.labels) === null || _a === void 0 ? void 0 : _a.length) {
236
+ traversal = traversal.hasLabel(...options.labels);
530
237
  }
531
- if (setParts.length > 0) {
532
- query += ` SET ${setParts.join(', ')}`;
238
+ if (options.where) {
239
+ traversal = this.applyWhereConditions(traversal, options.where);
533
240
  }
534
- if (options.remove && options.remove.length > 0) {
535
- query += ` REMOVE ${options.remove.map(p => `n.${p}`).join(', ')}`;
241
+ }
242
+ // Update properties
243
+ if (options.properties) {
244
+ for (const [key, value] of Object.entries(options.properties)) {
245
+ if (value !== undefined && value !== null) {
246
+ traversal = traversal.property(this.gremlin.process.cardinality.single, key, value);
247
+ }
536
248
  }
537
- query += ' RETURN n';
538
249
  }
539
- const result = await this.executeRaw(connection, { query, params }, transaction);
250
+ const results = await traversal.valueMap(true).toList();
251
+ const nodes = results.map((v) => this.mapGremlinVertexFromValueMap(v));
540
252
  return {
541
- success: true,
542
- executionTime: Date.now() - startTime,
543
- node: result.data.length > 0 ? this.parseNode(isGremlin ? result.data[0] : result.data[0].n) : undefined,
544
- updated: result.data.length > 0,
545
- matchedCount: result.data.length,
546
- modifiedCount: Object.keys(options.set || {}).length,
253
+ node: nodes.length === 1 ? nodes[0] : undefined,
254
+ nodes: nodes.length > 1 ? nodes : undefined,
255
+ updatedCount: nodes.length,
256
+ updated: nodes.length > 0,
547
257
  };
548
258
  }
549
- async deleteNode(connection, options, transaction) {
550
- const startTime = Date.now();
551
- const neptuneConn = connection;
552
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
553
- let query;
554
- const params = {};
555
- if (isGremlin) {
556
- if (options.id) {
557
- query = `g.V('${options.id}').drop()`;
558
- }
559
- else if (options.labels) {
560
- const labels = this.normalizeLabels(options.labels);
561
- query = `g.V().hasLabel('${labels.join("', '")}').drop()`;
259
+ async deleteNode(options, _transaction) {
260
+ var _a, _b;
261
+ const g = this.ensureTraversal();
262
+ let traversal;
263
+ if (options.id) {
264
+ traversal = g.V(options.id);
265
+ }
266
+ else {
267
+ traversal = g.V();
268
+ if ((_a = options.labels) === null || _a === void 0 ? void 0 : _a.length) {
269
+ traversal = traversal.hasLabel(...options.labels);
562
270
  }
563
- else {
564
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Must specify id or labels for delete');
271
+ if (options.where) {
272
+ traversal = this.applyWhereConditions(traversal, options.where);
565
273
  }
566
274
  }
275
+ // Count before delete
276
+ const countResult = await traversal.count().next();
277
+ const count = countResult.value;
278
+ // In Gremlin, drop() removes the vertex and all connected edges
279
+ if (options.id) {
280
+ await g.V(options.id).drop().iterate();
281
+ }
567
282
  else {
568
- if (options.id) {
569
- query = `MATCH (n) WHERE id(n) = $nodeId ${options.detach ? 'DETACH DELETE' : 'DELETE'} n`;
570
- params.nodeId = options.id;
283
+ let dropTraversal = g.V();
284
+ if ((_b = options.labels) === null || _b === void 0 ? void 0 : _b.length) {
285
+ dropTraversal = dropTraversal.hasLabel(...options.labels);
571
286
  }
572
- else if (options.labels) {
573
- const labels = this.normalizeLabels(options.labels);
574
- query = `MATCH (n:${labels.join(':')}) ${options.detach ? 'DETACH DELETE' : 'DELETE'} n`;
575
- }
576
- else {
577
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Must specify id or labels for delete');
287
+ if (options.where) {
288
+ dropTraversal = this.applyWhereConditions(dropTraversal, options.where);
578
289
  }
290
+ await dropTraversal.drop().iterate();
579
291
  }
580
- await this.executeRaw(connection, { query, params }, transaction);
581
292
  return {
582
- success: true,
583
- executionTime: Date.now() - startTime,
584
- deletedCount: 1, // Neptune doesn't return count
293
+ deleted: count > 0,
294
+ deletedCount: count,
585
295
  };
586
296
  }
587
- async mergeNode(connection, options, transaction) {
588
- const startTime = Date.now();
589
- const neptuneConn = connection;
590
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
591
- const labels = this.normalizeLabels(options.labels);
592
- let query;
593
- const params = {};
594
- if (isGremlin) {
595
- // Gremlin coalesce pattern for merge
596
- const matchProps = Object.entries(options.matchProperties)
597
- .map(([k, v]) => `.has('${k}', ${this.gremlinValue(v)})`)
598
- .join('');
599
- const createProps = Object.entries(Object.assign(Object.assign({}, options.matchProperties), options.onCreate))
600
- .map(([k, v]) => `.property('${k}', ${this.gremlinValue(v)})`)
601
- .join('');
602
- const updateProps = Object.entries(options.onMatch || {})
603
- .map(([k, v]) => `.property('${k}', ${this.gremlinValue(v)})`)
604
- .join('');
605
- query = `g.V().hasLabel('${labels[0]}')${matchProps}.fold().coalesce(unfold()${updateProps}, addV('${labels[0]}')${createProps})`;
297
+ async mergeNode(options, _transaction) {
298
+ const g = this.ensureTraversal();
299
+ // Check if node exists
300
+ let matchTraversal = g.V().hasLabel(options.labels[0]);
301
+ for (const [key, value] of Object.entries(options.matchProperties)) {
302
+ matchTraversal = matchTraversal.has(key, value);
303
+ }
304
+ const existing = await matchTraversal.toList();
305
+ if (existing.length > 0) {
306
+ // Update existing node
307
+ let updateTraversal = g.V(existing[0].id);
308
+ if (options.onMatch) {
309
+ for (const [key, value] of Object.entries(options.onMatch)) {
310
+ if (value !== undefined && value !== null) {
311
+ updateTraversal = updateTraversal.property(this.gremlin.process.cardinality.single, key, value);
312
+ }
313
+ }
314
+ }
315
+ const updated = await updateTraversal.valueMap(true).next();
316
+ return {
317
+ node: this.mapGremlinVertexFromValueMap(updated.value),
318
+ created: false,
319
+ merged: true,
320
+ };
606
321
  }
607
322
  else {
608
- // openCypher MERGE
609
- const matchPropsStr = Object.entries(options.matchProperties)
610
- .map(([k], i) => `${k}: $match${i}`)
611
- .join(', ');
612
- Object.entries(options.matchProperties).forEach(([, v], i) => { params[`match${i}`] = v; });
613
- query = `MERGE (n:${labels.join(':')} {${matchPropsStr}})`;
614
- if (options.onCreate && Object.keys(options.onCreate).length > 0) {
615
- const createProps = Object.entries(options.onCreate)
616
- .map(([k], i) => `n.${k} = $create${i}`)
617
- .join(', ');
618
- Object.entries(options.onCreate).forEach(([, v], i) => { params[`create${i}`] = v; });
619
- query += ` ON CREATE SET ${createProps}`;
323
+ // Create new node
324
+ let createTraversal = g.addV(options.labels[0]);
325
+ // Add match properties
326
+ for (const [key, value] of Object.entries(options.matchProperties)) {
327
+ if (value !== undefined && value !== null) {
328
+ createTraversal = createTraversal.property(key, value);
329
+ }
620
330
  }
621
- if (options.onMatch && Object.keys(options.onMatch).length > 0) {
622
- const matchSetProps = Object.entries(options.onMatch)
623
- .map(([k], i) => `n.${k} = $update${i}`)
624
- .join(', ');
625
- Object.entries(options.onMatch).forEach(([, v], i) => { params[`update${i}`] = v; });
626
- query += ` ON MATCH SET ${matchSetProps}`;
331
+ // Add onCreate properties
332
+ if (options.onCreate) {
333
+ for (const [key, value] of Object.entries(options.onCreate)) {
334
+ if (value !== undefined && value !== null) {
335
+ createTraversal = createTraversal.property(key, value);
336
+ }
337
+ }
627
338
  }
628
- query += ' RETURN n';
339
+ const created = await createTraversal.next();
340
+ const fullVertex = await g.V(created.value.id).valueMap(true).next();
341
+ return {
342
+ node: this.mapGremlinVertexFromValueMap(fullVertex.value),
343
+ created: true,
344
+ merged: true,
345
+ };
629
346
  }
630
- const result = await this.executeRaw(connection, { query, params }, transaction);
347
+ }
348
+ // ==================== LABEL MANAGEMENT ====================
349
+ async addLabels(options, _transaction) {
350
+ const g = this.ensureTraversal();
351
+ // In Gremlin/Neptune, vertices have a single label
352
+ // We can add additional labels by adding them as properties or using multi-labels if supported
353
+ // Neptune supports multi-labels via the ::label property pattern
354
+ // For now, we'll treat it as a limitation - Neptune vertices typically have a single label
355
+ // Get the vertex first
356
+ const vertex = await g.V(options.id).next();
357
+ if (!vertex.value) {
358
+ throw graph_error_1.GraphError.notFoundError(`Node with ID ${options.id} not found`);
359
+ }
360
+ // Neptune doesn't natively support adding labels to existing vertices
361
+ // This is a limitation of the Gremlin model
362
+ // We store additional labels as a property
363
+ const existingLabelsResult = await g.V(options.id).values('_additionalLabels').toList();
364
+ const existingLabels = existingLabelsResult.length > 0
365
+ ? JSON.parse(existingLabelsResult[0])
366
+ : [];
367
+ const newLabels = [...new Set([...existingLabels, ...options.labels])];
368
+ await g.V(options.id)
369
+ .property('_additionalLabels', JSON.stringify(newLabels))
370
+ .next();
371
+ const fullVertex = await g.V(options.id).valueMap(true).next();
372
+ const node = this.mapGremlinVertexFromValueMap(fullVertex.value);
373
+ // Add the additional labels to the node's labels array
374
+ node.labels = [...new Set([...node.labels, ...options.labels])];
631
375
  return {
632
- success: true,
633
- executionTime: Date.now() - startTime,
634
- node: result.data.length > 0 ? this.parseNode(isGremlin ? result.data[0] : result.data[0].n) : undefined,
635
- created: true, // Neptune doesn't distinguish
636
- matched: false,
376
+ node,
377
+ addedLabels: options.labels,
378
+ };
379
+ }
380
+ async removeLabels(options, _transaction) {
381
+ const g = this.ensureTraversal();
382
+ // Get the vertex first
383
+ const vertex = await g.V(options.id).next();
384
+ if (!vertex.value) {
385
+ throw graph_error_1.GraphError.notFoundError(`Node with ID ${options.id} not found`);
386
+ }
387
+ // Get existing additional labels
388
+ const existingLabelsResult = await g.V(options.id).values('_additionalLabels').toList();
389
+ const existingLabels = existingLabelsResult.length > 0
390
+ ? JSON.parse(existingLabelsResult[0])
391
+ : [];
392
+ // Remove the specified labels
393
+ const newLabels = existingLabels.filter(l => !options.labels.includes(l));
394
+ await g.V(options.id)
395
+ .property('_additionalLabels', JSON.stringify(newLabels))
396
+ .next();
397
+ const fullVertex = await g.V(options.id).valueMap(true).next();
398
+ const node = this.mapGremlinVertexFromValueMap(fullVertex.value);
399
+ return {
400
+ node,
401
+ removedLabels: options.labels,
402
+ };
403
+ }
404
+ async setLabels(options, _transaction) {
405
+ const g = this.ensureTraversal();
406
+ // Get the vertex first
407
+ const vertex = await g.V(options.id).next();
408
+ if (!vertex.value) {
409
+ throw graph_error_1.GraphError.notFoundError(`Node with ID ${options.id} not found`);
410
+ }
411
+ // Get current labels (primary label + additional)
412
+ const primaryLabel = await g.V(options.id).label().next();
413
+ const existingLabelsResult = await g.V(options.id).values('_additionalLabels').toList();
414
+ const additionalLabels = existingLabelsResult.length > 0
415
+ ? JSON.parse(existingLabelsResult[0])
416
+ : [];
417
+ const previousLabels = [primaryLabel.value, ...additionalLabels];
418
+ // In Neptune, we can't change the primary label, so we store all labels as additional
419
+ // Filter out the primary label from the new labels
420
+ const newAdditionalLabels = options.labels.filter(l => l !== primaryLabel.value);
421
+ await g.V(options.id)
422
+ .property('_additionalLabels', JSON.stringify(newAdditionalLabels))
423
+ .next();
424
+ const fullVertex = await g.V(options.id).valueMap(true).next();
425
+ const node = this.mapGremlinVertexFromValueMap(fullVertex.value);
426
+ node.labels = [primaryLabel.value, ...newAdditionalLabels];
427
+ return {
428
+ node,
429
+ previousLabels,
430
+ newLabels: options.labels,
637
431
  };
638
432
  }
639
433
  // ==================== RELATIONSHIP OPERATIONS ====================
640
- async createRelationship(connection, options, transaction) {
641
- const startTime = Date.now();
642
- const neptuneConn = connection;
643
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
644
- let query;
645
- const params = {};
646
- if (isGremlin) {
647
- const fromId = options.fromNode.id;
648
- const toId = options.toNode.id;
649
- const propsSteps = options.properties
650
- ? Object.entries(options.properties)
651
- .map(([k, v]) => `.property('${k}', ${this.gremlinValue(v)})`)
652
- .join('')
653
- : '';
654
- query = `g.V('${fromId}').addE('${options.type}').to(g.V('${toId}'))${propsSteps}`;
655
- }
656
- else {
657
- const fromMatch = this.buildCypherNodeMatch(options.fromNode, 'from', params, 'from_');
658
- const toMatch = this.buildCypherNodeMatch(options.toNode, 'to', params, 'to_');
659
- let propsStr = '';
660
- if (options.properties && Object.keys(options.properties).length > 0) {
661
- propsStr = ' {' + Object.entries(options.properties)
662
- .map(([k], i) => { params[`rel${i}`] = options.properties[k]; return `${k}: $rel${i}`; })
663
- .join(', ') + '}';
434
+ async createRelationship(options, _transaction) {
435
+ const g = this.ensureTraversal();
436
+ const { __ } = this.gremlin.process;
437
+ let traversal = g.V(options.startNodeId)
438
+ .addE(options.type)
439
+ .to(__.V(options.endNodeId));
440
+ // Add properties
441
+ if (options.properties) {
442
+ for (const [key, value] of Object.entries(options.properties)) {
443
+ if (value !== undefined && value !== null) {
444
+ traversal = traversal.property(key, value);
445
+ }
664
446
  }
665
- query = `
666
- MATCH ${fromMatch}, ${toMatch}
667
- CREATE (from)-[r:${options.type}${propsStr}]->(to)
668
- RETURN r
669
- `;
670
447
  }
671
- const result = await this.executeRaw(connection, { query, params }, transaction);
448
+ const result = await traversal.next();
449
+ const edge = result.value;
450
+ // Fetch full edge with properties
451
+ const fullEdge = await g.E(edge.id).valueMap(true).next();
672
452
  return {
673
- success: true,
674
- executionTime: Date.now() - startTime,
675
- relationship: result.data.length > 0 ? this.parseRelationship(isGremlin ? result.data[0] : result.data[0].r) : undefined,
453
+ relationship: this.mapGremlinEdge(edge, fullEdge.value, options.startNodeId, options.endNodeId),
676
454
  created: true,
677
455
  };
678
456
  }
679
- async findRelationships(connection, options, transaction) {
680
- const startTime = Date.now();
681
- const neptuneConn = connection;
682
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
683
- let query;
684
- const params = {};
685
- if (isGremlin) {
686
- query = 'g.E()';
687
- if (options.type) {
688
- const types = Array.isArray(options.type) ? options.type : [options.type];
689
- query += `.hasLabel('${types.join("', '")}')`;
690
- }
691
- if (options.properties) {
692
- Object.entries(options.properties).forEach(([k, v]) => {
693
- query += `.has('${k}', ${this.gremlinValue(v)})`;
694
- });
695
- }
696
- if (options.limit) {
697
- query += `.limit(${options.limit})`;
698
- }
457
+ async findRelationships(options, _transaction) {
458
+ const g = this.ensureTraversal();
459
+ const { __ } = this.gremlin.process;
460
+ let traversal;
461
+ if (options.startNodeId) {
462
+ traversal = g.V(options.startNodeId).outE();
463
+ }
464
+ else if (options.endNodeId) {
465
+ traversal = g.V(options.endNodeId).inE();
699
466
  }
700
467
  else {
701
- let typeStr = '';
702
- if (options.type) {
703
- const types = Array.isArray(options.type) ? options.type : [options.type];
704
- typeStr = ':' + types.join('|');
705
- }
706
- const dirStart = options.direction === relationship_types_1.RelationshipDirection.INCOMING ? '<-' : '-';
707
- const dirEnd = options.direction === relationship_types_1.RelationshipDirection.INCOMING ? '-' :
708
- options.direction === relationship_types_1.RelationshipDirection.OUTGOING ? '->' : '-';
709
- query = `MATCH ()-[r${typeStr}]->() RETURN r`;
710
- if (options.limit) {
711
- query += ` LIMIT ${options.limit}`;
712
- }
468
+ traversal = g.E();
469
+ }
470
+ // Filter by type
471
+ const types = options.type
472
+ ? (Array.isArray(options.type) ? options.type : [options.type])
473
+ : (options.types || []);
474
+ if (types.length > 0) {
475
+ traversal = traversal.hasLabel(...types);
476
+ }
477
+ // Apply where conditions
478
+ if (options.where) {
479
+ traversal = this.applyWhereConditions(traversal, options.where);
480
+ }
481
+ // Apply endpoint filtering if both are specified
482
+ if (options.startNodeId && options.endNodeId) {
483
+ traversal = traversal.where(__.inV().hasId(options.endNodeId));
484
+ }
485
+ // Apply pagination
486
+ if (options.skip) {
487
+ traversal = traversal.skip(options.skip);
713
488
  }
714
- const result = await this.executeRaw(connection, { query, params }, transaction);
715
- const relationships = result.data.map(row => this.parseRelationship(isGremlin ? row : row.r || row));
489
+ if (options.limit) {
490
+ traversal = traversal.limit(options.limit);
491
+ }
492
+ // Get edges with in/out vertices
493
+ const results = await traversal.project('edge', 'outV', 'inV')
494
+ .by(__.valueMap(true))
495
+ .by(__.outV().id())
496
+ .by(__.inV().id())
497
+ .toList();
498
+ const relationships = results.map((r) => this.mapGremlinEdgeFromProject(r));
716
499
  return {
717
- success: true,
718
- executionTime: Date.now() - startTime,
719
500
  relationships,
720
501
  count: relationships.length,
721
- hasMore: options.limit !== undefined && relationships.length === options.limit,
722
502
  };
723
503
  }
724
- async findRelationshipById(connection, id, transaction) {
725
- const neptuneConn = connection;
726
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
727
- const query = isGremlin
728
- ? `g.E('${id}')`
729
- : `MATCH ()-[r]->() WHERE id(r) = $id RETURN r`;
730
- const result = await this.executeRaw(connection, { query, params: { id } }, transaction);
731
- if (result.data.length === 0) {
504
+ async findRelationshipById(id, _transaction) {
505
+ const g = this.ensureTraversal();
506
+ const { __ } = this.gremlin.process;
507
+ const results = await g.E(id)
508
+ .project('edge', 'outV', 'inV')
509
+ .by(__.valueMap(true))
510
+ .by(__.outV().id())
511
+ .by(__.inV().id())
512
+ .toList();
513
+ if (results.length === 0) {
732
514
  return null;
733
515
  }
734
- return this.parseRelationship(isGremlin ? result.data[0] : result.data[0].r);
516
+ return this.mapGremlinEdgeFromProject(results[0]);
735
517
  }
736
- async updateRelationship(connection, options, transaction) {
737
- const startTime = Date.now();
738
- const neptuneConn = connection;
739
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
740
- let query;
741
- const params = {};
742
- if (isGremlin) {
743
- query = `g.E('${options.id}')`;
744
- if (options.set) {
745
- Object.entries(options.set).forEach(([k, v]) => {
746
- query += `.property('${k}', ${this.gremlinValue(v)})`;
747
- });
748
- }
518
+ async updateRelationship(options, _transaction) {
519
+ const g = this.ensureTraversal();
520
+ const { __ } = this.gremlin.process;
521
+ let traversal;
522
+ if (options.id) {
523
+ traversal = g.E(options.id);
749
524
  }
750
525
  else {
751
- query = `MATCH ()-[r]->() WHERE id(r) = $relId`;
752
- params.relId = options.id;
753
- if (options.set && Object.keys(options.set).length > 0) {
754
- const setParts = Object.entries(options.set).map(([k], i) => {
755
- params[`set${i}`] = options.set[k];
756
- return `r.${k} = $set${i}`;
757
- });
758
- query += ` SET ${setParts.join(', ')}`;
526
+ traversal = g.E();
527
+ if (options.type) {
528
+ traversal = traversal.hasLabel(options.type);
529
+ }
530
+ if (options.where) {
531
+ traversal = this.applyWhereConditions(traversal, options.where);
759
532
  }
760
- query += ' RETURN r';
761
533
  }
762
- const result = await this.executeRaw(connection, { query, params }, transaction);
534
+ // Update properties
535
+ if (options.properties) {
536
+ for (const [key, value] of Object.entries(options.properties)) {
537
+ if (value !== undefined && value !== null) {
538
+ traversal = traversal.property(key, value);
539
+ }
540
+ }
541
+ }
542
+ // Get updated edges
543
+ const results = await traversal.project('edge', 'outV', 'inV')
544
+ .by(__.valueMap(true))
545
+ .by(__.outV().id())
546
+ .by(__.inV().id())
547
+ .toList();
548
+ const relationships = results.map((r) => this.mapGremlinEdgeFromProject(r));
763
549
  return {
764
- success: true,
765
- executionTime: Date.now() - startTime,
766
- relationship: result.data.length > 0 ? this.parseRelationship(isGremlin ? result.data[0] : result.data[0].r) : undefined,
767
- updated: result.data.length > 0,
768
- matchedCount: result.data.length,
769
- modifiedCount: Object.keys(options.set || {}).length,
550
+ relationship: relationships.length === 1 ? relationships[0] : undefined,
551
+ relationships: relationships.length > 1 ? relationships : undefined,
552
+ updatedCount: relationships.length,
553
+ updated: relationships.length > 0,
770
554
  };
771
555
  }
772
- async deleteRelationship(connection, options, transaction) {
773
- const startTime = Date.now();
774
- const neptuneConn = connection;
775
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
776
- let query;
777
- const params = {};
778
- if (isGremlin) {
779
- if (options.id) {
780
- query = `g.E('${options.id}').drop()`;
781
- }
782
- else if (options.type) {
783
- const types = Array.isArray(options.type) ? options.type : [options.type];
784
- query = `g.E().hasLabel('${types.join("', '")}').drop()`;
556
+ async deleteRelationship(options, _transaction) {
557
+ const g = this.ensureTraversal();
558
+ let traversal;
559
+ if (options.id) {
560
+ traversal = g.E(options.id);
561
+ }
562
+ else {
563
+ if (options.startNodeId && options.endNodeId && options.type) {
564
+ traversal = g.V(options.startNodeId).outE(options.type).where(this.gremlin.process.__.inV().hasId(options.endNodeId));
785
565
  }
786
566
  else {
787
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Must specify id or type for delete');
567
+ traversal = g.E();
568
+ if (options.type) {
569
+ traversal = traversal.hasLabel(options.type);
570
+ }
571
+ if (options.where) {
572
+ traversal = this.applyWhereConditions(traversal, options.where);
573
+ }
788
574
  }
789
575
  }
576
+ // Count before delete
577
+ let countTraversal;
578
+ if (options.id) {
579
+ countTraversal = g.E(options.id);
580
+ }
581
+ else if (options.startNodeId && options.endNodeId && options.type) {
582
+ countTraversal = g.V(options.startNodeId).outE(options.type).where(this.gremlin.process.__.inV().hasId(options.endNodeId));
583
+ }
790
584
  else {
791
- if (options.id) {
792
- query = `MATCH ()-[r]->() WHERE id(r) = $relId DELETE r`;
793
- params.relId = options.id;
794
- }
795
- else if (options.type) {
796
- const types = Array.isArray(options.type) ? options.type : [options.type];
797
- query = `MATCH ()-[r:${types.join('|')}]->() DELETE r`;
798
- }
799
- else {
800
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Must specify id or type for delete');
585
+ countTraversal = g.E();
586
+ if (options.type) {
587
+ countTraversal = countTraversal.hasLabel(options.type);
801
588
  }
802
589
  }
803
- await this.executeRaw(connection, { query, params }, transaction);
590
+ const countResult = await countTraversal.count().next();
591
+ const count = countResult.value;
592
+ // Delete
593
+ await traversal.drop().iterate();
804
594
  return {
805
- success: true,
806
- executionTime: Date.now() - startTime,
807
- deletedCount: 1,
595
+ deleted: count > 0,
596
+ deletedCount: count,
808
597
  };
809
598
  }
810
- async mergeRelationship(connection, options, transaction) {
811
- const startTime = Date.now();
812
- const neptuneConn = connection;
813
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
814
- let query;
815
- const params = {};
816
- if (isGremlin) {
817
- // Gremlin coalesce pattern for edge merge
818
- const fromId = options.fromNode.id;
819
- const toId = options.toNode.id;
820
- const matchProps = options.matchProperties
821
- ? Object.entries(options.matchProperties)
822
- .map(([k, v]) => `.has('${k}', ${this.gremlinValue(v)})`)
823
- .join('')
824
- : '';
825
- const createProps = Object.entries(Object.assign(Object.assign({}, options.matchProperties), options.onCreate))
826
- .map(([k, v]) => `.property('${k}', ${this.gremlinValue(v)})`)
827
- .join('');
828
- query = `g.V('${fromId}').outE('${options.type}')${matchProps}.where(inV().hasId('${toId}')).fold().coalesce(unfold(), g.V('${fromId}').addE('${options.type}').to(g.V('${toId}'))${createProps})`;
599
+ async mergeRelationship(options, _transaction) {
600
+ const g = this.ensureTraversal();
601
+ const { __ } = this.gremlin.process;
602
+ // Check if relationship exists
603
+ let matchTraversal = g.V(options.startNodeId).outE(options.type).where(__.inV().hasId(options.endNodeId));
604
+ if (options.matchProperties) {
605
+ for (const [key, value] of Object.entries(options.matchProperties)) {
606
+ matchTraversal = matchTraversal.has(key, value);
607
+ }
608
+ }
609
+ const existing = await matchTraversal.toList();
610
+ if (existing.length > 0) {
611
+ // Update existing relationship
612
+ let updateTraversal = g.E(existing[0].id);
613
+ if (options.onMatch) {
614
+ for (const [key, value] of Object.entries(options.onMatch)) {
615
+ if (value !== undefined && value !== null) {
616
+ updateTraversal = updateTraversal.property(key, value);
617
+ }
618
+ }
619
+ }
620
+ const updated = await updateTraversal.project('edge', 'outV', 'inV')
621
+ .by(__.valueMap(true))
622
+ .by(__.outV().id())
623
+ .by(__.inV().id())
624
+ .next();
625
+ return {
626
+ relationship: this.mapGremlinEdgeFromProject(updated.value),
627
+ created: false,
628
+ merged: true,
629
+ };
829
630
  }
830
631
  else {
831
- const fromMatch = this.buildCypherNodeMatch(options.fromNode, 'from', params, 'from_');
832
- const toMatch = this.buildCypherNodeMatch(options.toNode, 'to', params, 'to_');
833
- query = `
834
- MATCH ${fromMatch}, ${toMatch}
835
- MERGE (from)-[r:${options.type}]->(to)
836
- `;
837
- if (options.onCreate && Object.keys(options.onCreate).length > 0) {
838
- const createProps = Object.entries(options.onCreate)
839
- .map(([k], i) => { params[`create${i}`] = options.onCreate[k]; return `r.${k} = $create${i}`; })
840
- .join(', ');
841
- query += ` ON CREATE SET ${createProps}`;
632
+ // Create new relationship
633
+ let createTraversal = g.V(options.startNodeId)
634
+ .addE(options.type)
635
+ .to(__.V(options.endNodeId));
636
+ // Add match properties
637
+ if (options.matchProperties) {
638
+ for (const [key, value] of Object.entries(options.matchProperties)) {
639
+ if (value !== undefined && value !== null) {
640
+ createTraversal = createTraversal.property(key, value);
641
+ }
642
+ }
842
643
  }
843
- if (options.onMatch && Object.keys(options.onMatch).length > 0) {
844
- const matchSetProps = Object.entries(options.onMatch)
845
- .map(([k], i) => { params[`update${i}`] = options.onMatch[k]; return `r.${k} = $update${i}`; })
846
- .join(', ');
847
- query += ` ON MATCH SET ${matchSetProps}`;
644
+ // Add onCreate properties
645
+ if (options.onCreate) {
646
+ for (const [key, value] of Object.entries(options.onCreate)) {
647
+ if (value !== undefined && value !== null) {
648
+ createTraversal = createTraversal.property(key, value);
649
+ }
650
+ }
848
651
  }
849
- query += ' RETURN r';
652
+ const created = await createTraversal.next();
653
+ const fullEdge = await g.E(created.value.id).project('edge', 'outV', 'inV')
654
+ .by(__.valueMap(true))
655
+ .by(__.outV().id())
656
+ .by(__.inV().id())
657
+ .next();
658
+ return {
659
+ relationship: this.mapGremlinEdgeFromProject(fullEdge.value),
660
+ created: true,
661
+ merged: true,
662
+ };
850
663
  }
851
- const result = await this.executeRaw(connection, { query, params }, transaction);
852
- return {
853
- success: true,
854
- executionTime: Date.now() - startTime,
855
- relationship: result.data.length > 0 ? this.parseRelationship(isGremlin ? result.data[0] : result.data[0].r) : undefined,
856
- created: true,
857
- matched: false,
858
- };
859
664
  }
860
- // ==================== PATH & TRAVERSAL OPERATIONS ====================
861
- async traverse(connection, options, transaction) {
862
- const startTime = Date.now();
863
- const neptuneConn = connection;
864
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
865
- let query;
866
- const params = {};
867
- const minDepth = options.minDepth || 1;
868
- const maxDepth = options.maxDepth || 10;
869
- if (isGremlin) {
870
- const startId = options.startNode.id;
871
- const direction = options.direction === relationship_types_1.RelationshipDirection.INCOMING ? 'in' :
872
- options.direction === relationship_types_1.RelationshipDirection.OUTGOING ? 'out' : 'both';
873
- query = `g.V('${startId}').repeat(${direction}()).times(${maxDepth}).emit().path()`;
874
- if (options.limit) {
875
- query += `.limit(${options.limit})`;
876
- }
665
+ // ==================== TRAVERSAL OPERATIONS ====================
666
+ async traverse(options, _transaction) {
667
+ var _a;
668
+ const g = this.ensureTraversal();
669
+ const { __ } = this.gremlin.process;
670
+ const maxDepth = options.maxDepth || 3;
671
+ // Build direction
672
+ let edgeDirection;
673
+ switch (options.direction) {
674
+ case enums_1.TraversalDirection.INCOMING:
675
+ case 'INCOMING':
676
+ edgeDirection = 'in';
677
+ break;
678
+ case enums_1.TraversalDirection.OUTGOING:
679
+ case 'OUTGOING':
680
+ edgeDirection = 'out';
681
+ break;
682
+ default:
683
+ edgeDirection = 'both';
684
+ }
685
+ // Build traversal
686
+ let traversal = g.V(options.startNodeId);
687
+ // Use repeat for variable-length traversal
688
+ const repeatStep = edgeDirection === 'out' ? __.out() :
689
+ edgeDirection === 'in' ? __.in_() :
690
+ __.both();
691
+ if ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.length) {
692
+ traversal = traversal.repeat(edgeDirection === 'out' ? __.out(...options.relationshipTypes) :
693
+ edgeDirection === 'in' ? __.in_(...options.relationshipTypes) :
694
+ __.both(...options.relationshipTypes)).times(maxDepth).emit();
877
695
  }
878
696
  else {
879
- const startMatch = this.buildCypherNodeMatch(options.startNode, 'start', params);
880
- const dirStart = options.direction === relationship_types_1.RelationshipDirection.INCOMING ? '<-' : '-';
881
- const dirEnd = options.direction === relationship_types_1.RelationshipDirection.INCOMING ? '-' :
882
- options.direction === relationship_types_1.RelationshipDirection.OUTGOING ? '->' : '-';
883
- query = `
884
- MATCH ${startMatch}
885
- MATCH path = (start)${dirStart}[*${minDepth}..${maxDepth}]${dirEnd}(end)
886
- RETURN path
887
- `;
888
- if (options.limit) {
889
- query += ` LIMIT ${options.limit}`;
890
- }
697
+ traversal = traversal.repeat(repeatStep).times(maxDepth).emit();
891
698
  }
892
- const result = await this.executeRaw(connection, { query, params }, transaction);
893
- const paths = result.data.map(row => this.parsePath(isGremlin ? row : row.path || row));
699
+ if (options.limit) {
700
+ traversal = traversal.limit(options.limit);
701
+ }
702
+ // Get paths
703
+ const results = await traversal.path().by(__.valueMap(true)).toList();
704
+ const paths = [];
894
705
  const nodesMap = new Map();
895
706
  const relsMap = new Map();
896
- paths.forEach(p => {
897
- p.nodes.forEach(n => nodesMap.set(String(n.id), n));
898
- p.relationships.forEach(r => relsMap.set(String(r.id), r));
899
- });
707
+ for (const pathResult of results) {
708
+ const pathNodes = [];
709
+ const pathRels = [];
710
+ if (pathResult.objects) {
711
+ for (const obj of pathResult.objects) {
712
+ if (obj.id) {
713
+ const node = this.mapGremlinVertexFromValueMap(obj);
714
+ pathNodes.push(node);
715
+ nodesMap.set(String(node.id), node);
716
+ }
717
+ }
718
+ }
719
+ if (pathNodes.length > 0) {
720
+ paths.push({
721
+ nodes: pathNodes,
722
+ relationships: pathRels,
723
+ length: pathNodes.length - 1,
724
+ });
725
+ }
726
+ }
900
727
  return {
901
- success: true,
902
- executionTime: Date.now() - startTime,
903
- paths: options.returnPaths ? paths : undefined,
904
- nodes: options.returnNodes ? Array.from(nodesMap.values()) : undefined,
728
+ paths,
729
+ nodes: Array.from(nodesMap.values()),
905
730
  relationships: Array.from(relsMap.values()),
906
731
  count: paths.length,
907
732
  };
908
733
  }
909
- async shortestPath(connection, options, transaction) {
910
- const startTime = Date.now();
911
- const neptuneConn = connection;
912
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
913
- let query;
914
- const params = {};
915
- if (isGremlin) {
916
- const startId = options.startNode.id;
917
- const endId = options.endNode.id;
918
- const maxDepth = options.maxDepth || 10;
919
- query = `g.V('${startId}').repeat(out().simplePath()).until(hasId('${endId}').or().loops().is(${maxDepth})).hasId('${endId}').path().limit(1)`;
734
+ async shortestPath(options, _transaction) {
735
+ var _a;
736
+ const g = this.ensureTraversal();
737
+ const { __ } = this.gremlin.process;
738
+ // Build shortest path query
739
+ let traversal = g.V(options.startNodeId);
740
+ if ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.length) {
741
+ traversal = traversal.repeat(__.both(...options.relationshipTypes).simplePath())
742
+ .until(__.hasId(options.endNodeId))
743
+ .limit(1)
744
+ .path();
920
745
  }
921
746
  else {
922
- const startMatch = this.buildCypherNodeMatch(options.startNode, 'start', params);
923
- const endMatch = this.buildCypherNodeMatch(options.endNode, 'end', params, 'end_');
924
- const maxDepth = options.maxDepth ? `*..${options.maxDepth}` : '*';
925
- query = `
926
- MATCH ${startMatch}, ${endMatch}
927
- MATCH path = shortestPath((start)-[${maxDepth}]-(end))
928
- RETURN path
929
- `;
930
- }
931
- const result = await this.executeRaw(connection, { query, params }, transaction);
932
- if (result.data.length === 0) {
933
- return {
934
- success: true,
935
- executionTime: Date.now() - startTime,
936
- found: false,
937
- };
747
+ traversal = traversal.repeat(__.both().simplePath())
748
+ .until(__.hasId(options.endNodeId))
749
+ .limit(1)
750
+ .path();
751
+ }
752
+ const results = await traversal.by(__.valueMap(true)).toList();
753
+ if (results.length === 0) {
754
+ return { path: null, found: false };
755
+ }
756
+ const pathResult = results[0];
757
+ const pathNodes = [];
758
+ if (pathResult.objects) {
759
+ for (const obj of pathResult.objects) {
760
+ if (obj.id) {
761
+ pathNodes.push(this.mapGremlinVertexFromValueMap(obj));
762
+ }
763
+ }
938
764
  }
939
- const path = this.parsePath(isGremlin ? result.data[0] : result.data[0].path);
765
+ const path = {
766
+ nodes: pathNodes,
767
+ relationships: [],
768
+ length: pathNodes.length - 1,
769
+ };
940
770
  return {
941
- success: true,
942
- executionTime: Date.now() - startTime,
943
771
  path,
944
- found: true,
945
772
  length: path.length,
773
+ found: true,
946
774
  };
947
775
  }
948
- async allPaths(connection, options, transaction) {
949
- const startTime = Date.now();
950
- const neptuneConn = connection;
951
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
776
+ async allPaths(options, _transaction) {
777
+ var _a;
778
+ const g = this.ensureTraversal();
779
+ const { __ } = this.gremlin.process;
952
780
  const minDepth = options.minDepth || 1;
953
- const maxDepth = options.maxDepth || 10;
954
- let query;
955
- const params = {};
956
- if (isGremlin) {
957
- const startId = options.startNode.id;
958
- const endId = options.endNode.id;
959
- query = `g.V('${startId}').repeat(out().simplePath()).until(hasId('${endId}').or().loops().is(${maxDepth})).hasId('${endId}').path()`;
960
- if (options.limit) {
961
- query += `.limit(${options.limit})`;
962
- }
781
+ const maxDepth = options.maxDepth || 5;
782
+ const limit = options.limit || options.maxPaths || 100;
783
+ // Build all paths query
784
+ let traversal = g.V(options.startNodeId);
785
+ if ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.length) {
786
+ traversal = traversal.repeat(__.both(...options.relationshipTypes).simplePath())
787
+ .until(__.hasId(options.endNodeId).or().loops().is(maxDepth))
788
+ .hasId(options.endNodeId)
789
+ .limit(limit)
790
+ .path();
963
791
  }
964
792
  else {
965
- const startMatch = this.buildCypherNodeMatch(options.startNode, 'start', params);
966
- const endMatch = this.buildCypherNodeMatch(options.endNode, 'end', params, 'end_');
967
- query = `
968
- MATCH ${startMatch}, ${endMatch}
969
- MATCH path = (start)-[*${minDepth}..${maxDepth}]-(end)
970
- RETURN path
971
- `;
972
- if (options.limit) {
973
- query += ` LIMIT ${options.limit}`;
793
+ traversal = traversal.repeat(__.both().simplePath())
794
+ .until(__.hasId(options.endNodeId).or().loops().is(maxDepth))
795
+ .hasId(options.endNodeId)
796
+ .limit(limit)
797
+ .path();
798
+ }
799
+ const results = await traversal.by(__.valueMap(true)).toList();
800
+ const paths = [];
801
+ for (const pathResult of results) {
802
+ const pathNodes = [];
803
+ if (pathResult.objects) {
804
+ for (const obj of pathResult.objects) {
805
+ if (obj.id) {
806
+ pathNodes.push(this.mapGremlinVertexFromValueMap(obj));
807
+ }
808
+ }
809
+ }
810
+ if (pathNodes.length >= minDepth + 1) {
811
+ paths.push({
812
+ nodes: pathNodes,
813
+ relationships: [],
814
+ length: pathNodes.length - 1,
815
+ });
974
816
  }
975
817
  }
976
- const result = await this.executeRaw(connection, { query, params }, transaction);
977
- const paths = result.data.map(row => this.parsePath(isGremlin ? row : row.path || row));
978
818
  return {
979
- success: true,
980
- executionTime: Date.now() - startTime,
981
819
  paths,
982
820
  count: paths.length,
821
+ total: paths.length,
983
822
  };
984
823
  }
985
- async matchPattern(connection, options, transaction) {
986
- const startTime = Date.now();
987
- const neptuneConn = connection;
988
- if (neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN) {
989
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Pattern matching is better supported with openCypher. Consider using traverse() for Gremlin.');
990
- }
991
- // Build openCypher pattern query
992
- const params = {};
993
- const { pattern } = options;
994
- const matchClauses = [];
995
- pattern.nodes.forEach(node => {
996
- const labels = node.labels
997
- ? ':' + (Array.isArray(node.labels) ? node.labels : [node.labels]).join(':')
998
- : '';
999
- matchClauses.push(`(${node.variable}${labels})`);
1000
- });
1001
- let query = `MATCH ${matchClauses.join(', ')}`;
1002
- if (pattern.relationships.length > 0) {
1003
- pattern.relationships.forEach(rel => {
1004
- const typeStr = rel.type
1005
- ? ':' + (Array.isArray(rel.type) ? rel.type : [rel.type]).join('|')
1006
- : '';
1007
- query += `, (${rel.startNode})-[${rel.variable || ''}${typeStr}]->(${rel.endNode})`;
1008
- });
1009
- }
1010
- const returnVars = options.return || pattern.nodes.map(n => n.variable);
1011
- query += ` RETURN ${returnVars.join(', ')}`;
824
+ async getNeighborhood(options, _transaction) {
825
+ var _a, _b, _c;
826
+ const g = this.ensureTraversal();
827
+ const { __ } = this.gremlin.process;
828
+ const depth = options.depth || 1;
829
+ // Build direction
830
+ let traversalStep;
831
+ switch (options.direction) {
832
+ case enums_1.TraversalDirection.INCOMING:
833
+ case 'INCOMING':
834
+ traversalStep = ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.length)
835
+ ? __.in_(...options.relationshipTypes)
836
+ : __.in_();
837
+ break;
838
+ case enums_1.TraversalDirection.OUTGOING:
839
+ case 'OUTGOING':
840
+ traversalStep = ((_b = options.relationshipTypes) === null || _b === void 0 ? void 0 : _b.length)
841
+ ? __.out(...options.relationshipTypes)
842
+ : __.out();
843
+ break;
844
+ default:
845
+ traversalStep = ((_c = options.relationshipTypes) === null || _c === void 0 ? void 0 : _c.length)
846
+ ? __.both(...options.relationshipTypes)
847
+ : __.both();
848
+ }
849
+ // Get neighbors
850
+ let traversal = g.V(options.nodeId)
851
+ .repeat(traversalStep)
852
+ .times(depth)
853
+ .emit()
854
+ .dedup();
1012
855
  if (options.limit) {
1013
- query += ` LIMIT ${options.limit}`;
1014
- }
1015
- const result = await this.executeRaw(connection, { query, params }, transaction);
856
+ traversal = traversal.limit(options.limit);
857
+ }
858
+ const nodeResults = await traversal.valueMap(true).toList();
859
+ const nodes = nodeResults.map((v) => this.mapGremlinVertexFromValueMap(v));
860
+ // Get relationships (simplified - just outgoing edges from source)
861
+ const edgeResults = await g.V(options.nodeId)
862
+ .bothE(...(options.relationshipTypes || []))
863
+ .project('edge', 'outV', 'inV')
864
+ .by(__.valueMap(true))
865
+ .by(__.outV().id())
866
+ .by(__.inV().id())
867
+ .toList();
868
+ const relationships = edgeResults.map((r) => this.mapGremlinEdgeFromProject(r));
1016
869
  return {
1017
- success: true,
1018
- executionTime: Date.now() - startTime,
1019
- matches: result.data,
1020
- count: result.data.length,
1021
- hasMore: options.limit !== undefined && result.data.length === options.limit,
870
+ nodes,
871
+ relationships,
872
+ depth,
1022
873
  };
1023
874
  }
1024
- async extractSubgraph(connection, options, transaction) {
1025
- const startTime = Date.now();
1026
- const neptuneConn = connection;
1027
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
1028
- const startNodes = Array.isArray(options.startNodes) ? options.startNodes : [options.startNodes];
1029
- const maxDepth = options.maxDepth || 3;
1030
- let query;
1031
- const params = {};
1032
- if (isGremlin) {
1033
- const startIds = startNodes.map(n => `'${n.id}'`).join(', ');
1034
- query = `g.V(${startIds}).repeat(both().simplePath()).times(${maxDepth}).emit().dedup().fold().as('nodes').V(${startIds}).repeat(bothE().dedup().by(id).otherV().simplePath()).times(${maxDepth}).emit().dedup().fold().as('edges').select('nodes', 'edges')`;
1035
- }
1036
- else {
1037
- const startMatches = startNodes.map((node, idx) => this.buildCypherNodeMatch(node, `start${idx}`, params, `start${idx}_`));
1038
- query = `
1039
- MATCH ${startMatches.join(', ')}
1040
- WITH [${startNodes.map((_, i) => `start${i}`).join(', ')}] AS starts
1041
- UNWIND starts AS start
1042
- MATCH path = (start)-[*0..${maxDepth}]-(n)
1043
- WITH COLLECT(DISTINCT n) AS nodes, COLLECT(DISTINCT relationships(path)) AS rels
1044
- UNWIND rels AS relList
1045
- UNWIND relList AS r
1046
- RETURN nodes, COLLECT(DISTINCT r) AS relationships
1047
- `;
1048
- }
1049
- const result = await this.executeRaw(connection, { query, params }, transaction);
1050
- const nodes = [];
1051
- const relationships = [];
1052
- if (result.data.length > 0) {
1053
- const row = result.data[0];
1054
- if (row.nodes) {
1055
- row.nodes.forEach((n) => nodes.push(this.parseNode(n)));
1056
- }
1057
- if (row.relationships || row.edges) {
1058
- (row.relationships || row.edges).forEach((r) => relationships.push(this.parseRelationship(r)));
1059
- }
875
+ async findConnectedComponents(options, _transaction) {
876
+ var _a;
877
+ const g = this.ensureTraversal();
878
+ const { __ } = this.gremlin.process;
879
+ // Neptune doesn't have built-in connected components algorithm
880
+ // We'll implement a basic version using Gremlin
881
+ let startTraversal = g.V();
882
+ if ((_a = options.labels) === null || _a === void 0 ? void 0 : _a.length) {
883
+ startTraversal = startTraversal.hasLabel(...options.labels);
884
+ }
885
+ // Get all vertices
886
+ const allVertices = await startTraversal.id().toList();
887
+ const visited = new Set();
888
+ const components = [];
889
+ for (const vertexId of allVertices) {
890
+ if (visited.has(String(vertexId)))
891
+ continue;
892
+ // BFS to find all connected vertices
893
+ const componentVertices = await g.V(vertexId)
894
+ .repeat(__.both(...(options.relationshipTypes || [])))
895
+ .until(__.not(__.both(...(options.relationshipTypes || []))))
896
+ .emit()
897
+ .dedup()
898
+ .valueMap(true)
899
+ .toList();
900
+ // Include the starting vertex
901
+ const startVertex = await g.V(vertexId).valueMap(true).next();
902
+ const allInComponent = [startVertex.value, ...componentVertices];
903
+ const nodes = allInComponent.map((v) => {
904
+ const node = this.mapGremlinVertexFromValueMap(v);
905
+ visited.add(String(node.id));
906
+ return node;
907
+ });
908
+ components.push({
909
+ nodes,
910
+ size: nodes.length,
911
+ });
1060
912
  }
1061
913
  return {
1062
- success: true,
1063
- executionTime: Date.now() - startTime,
1064
- subgraph: {
1065
- nodes,
1066
- relationships,
1067
- nodeCount: nodes.length,
1068
- relationshipCount: relationships.length,
1069
- },
914
+ components,
915
+ count: components.length,
1070
916
  };
1071
917
  }
1072
- async getNeighborhood(connection, options, transaction) {
1073
- const startTime = Date.now();
1074
- const neptuneConn = connection;
1075
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
1076
- const depth = options.depth || 1;
1077
- let query;
1078
- const params = {};
1079
- if (isGremlin) {
1080
- const nodeId = options.node.id;
1081
- const direction = options.direction === relationship_types_1.RelationshipDirection.INCOMING ? 'in' :
1082
- options.direction === relationship_types_1.RelationshipDirection.OUTGOING ? 'out' : 'both';
1083
- query = `g.V('${nodeId}').repeat(${direction}().simplePath()).times(${depth}).emit()${options.includeCenter ? '' : '.where(neq(V(\'' + nodeId + '\')))'}`;
918
+ // ==================== AGGREGATION OPERATIONS ====================
919
+ async countNodes(labels, where, _transaction) {
920
+ const g = this.ensureTraversal();
921
+ let traversal = g.V();
922
+ if (labels === null || labels === void 0 ? void 0 : labels.length) {
923
+ traversal = traversal.hasLabel(...labels);
1084
924
  }
1085
- else {
1086
- const centerMatch = this.buildCypherNodeMatch(options.node, 'center', params);
1087
- const dirStart = options.direction === relationship_types_1.RelationshipDirection.INCOMING ? '<-' : '-';
1088
- const dirEnd = options.direction === relationship_types_1.RelationshipDirection.INCOMING ? '-' :
1089
- options.direction === relationship_types_1.RelationshipDirection.OUTGOING ? '->' : '-';
1090
- query = `
1091
- MATCH ${centerMatch}
1092
- MATCH path = (center)${dirStart}[*0..${depth}]${dirEnd}(n)
1093
- WITH COLLECT(DISTINCT n) AS nodes, COLLECT(DISTINCT relationships(path)) AS rels
1094
- UNWIND rels AS relList
1095
- UNWIND relList AS r
1096
- RETURN nodes, COLLECT(DISTINCT r) AS relationships
1097
- `;
1098
- }
1099
- const result = await this.executeRaw(connection, { query, params }, transaction);
1100
- const nodes = [];
1101
- const relationships = [];
1102
- if (isGremlin) {
1103
- result.data.forEach((n) => nodes.push(this.parseNode(n)));
1104
- }
1105
- else if (result.data.length > 0) {
1106
- const row = result.data[0];
1107
- if (row.nodes) {
1108
- row.nodes.forEach((n) => nodes.push(this.parseNode(n)));
1109
- }
1110
- if (row.relationships) {
1111
- row.relationships.forEach((r) => relationships.push(this.parseRelationship(r)));
1112
- }
925
+ if (where) {
926
+ traversal = this.applyWhereConditions(traversal, where);
1113
927
  }
928
+ const result = await traversal.count().next();
1114
929
  return {
1115
- success: true,
1116
- executionTime: Date.now() - startTime,
1117
- nodes,
1118
- relationships,
1119
- levels: new Map(), // Would need additional queries to populate
930
+ count: result.value,
1120
931
  };
1121
932
  }
1122
- async findConnectedComponents(connection, options, transaction) {
1123
- const startTime = Date.now();
1124
- const neptuneConn = connection;
1125
- // Neptune doesn't have built-in connected components
1126
- // This is a simplified implementation
1127
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Connected components analysis requires Neptune Analytics or manual implementation');
1128
- }
1129
- // ==================== AGGREGATION OPERATIONS ====================
1130
- async countNodes(connection, labels, where, transaction) {
1131
- var _a;
1132
- const startTime = Date.now();
1133
- const neptuneConn = connection;
1134
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
1135
- let query;
1136
- const params = {};
1137
- if (isGremlin) {
1138
- query = 'g.V()';
1139
- if (labels) {
1140
- const labelArr = Array.isArray(labels) ? labels : [labels];
1141
- query += `.hasLabel('${labelArr.join("', '")}')`;
1142
- }
1143
- if (where) {
1144
- Object.entries(where).forEach(([k, v]) => {
1145
- query += `.has('${k}', ${this.gremlinValue(v)})`;
1146
- });
1147
- }
1148
- query += '.count()';
933
+ async countRelationships(types, where, _transaction) {
934
+ const g = this.ensureTraversal();
935
+ let traversal = g.E();
936
+ if (types === null || types === void 0 ? void 0 : types.length) {
937
+ traversal = traversal.hasLabel(...types);
1149
938
  }
1150
- else {
1151
- const labelStr = labels
1152
- ? ':' + (Array.isArray(labels) ? labels : [labels]).join(':')
1153
- : '';
1154
- query = `MATCH (n${labelStr})`;
1155
- if (where && Object.keys(where).length > 0) {
1156
- const whereParts = Object.entries(where).map(([k], i) => {
1157
- params[`w${i}`] = where[k];
1158
- return `n.${k} = $w${i}`;
1159
- });
1160
- query += ` WHERE ${whereParts.join(' AND ')}`;
1161
- }
1162
- query += ' RETURN count(n) AS count';
939
+ if (where) {
940
+ traversal = this.applyWhereConditions(traversal, where);
1163
941
  }
1164
- const result = await this.executeRaw(connection, { query, params }, transaction);
1165
- const count = isGremlin
1166
- ? result.data[0] || 0
1167
- : ((_a = result.data[0]) === null || _a === void 0 ? void 0 : _a.count) || 0;
942
+ const result = await traversal.count().next();
1168
943
  return {
1169
- success: true,
1170
- executionTime: Date.now() - startTime,
1171
- count: Number(count),
944
+ count: result.value,
1172
945
  };
1173
946
  }
1174
- async countRelationships(connection, type, where, transaction) {
1175
- var _a;
1176
- const startTime = Date.now();
1177
- const neptuneConn = connection;
1178
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
1179
- let query;
1180
- const params = {};
1181
- if (isGremlin) {
1182
- query = 'g.E()';
1183
- if (type) {
1184
- const typeArr = Array.isArray(type) ? type : [type];
1185
- query += `.hasLabel('${typeArr.join("', '")}')`;
1186
- }
1187
- if (where) {
1188
- Object.entries(where).forEach(([k, v]) => {
1189
- query += `.has('${k}', ${this.gremlinValue(v)})`;
1190
- });
1191
- }
1192
- query += '.count()';
1193
- }
1194
- else {
1195
- const typeStr = type
1196
- ? ':' + (Array.isArray(type) ? type : [type]).join('|')
1197
- : '';
1198
- query = `MATCH ()-[r${typeStr}]->() RETURN count(r) AS count`;
1199
- }
1200
- const result = await this.executeRaw(connection, { query, params }, transaction);
1201
- const count = isGremlin
1202
- ? result.data[0] || 0
1203
- : ((_a = result.data[0]) === null || _a === void 0 ? void 0 : _a.count) || 0;
947
+ async getStatistics(_transaction) {
948
+ const g = this.ensureTraversal();
949
+ const nodeCount = await g.V().count().next();
950
+ const relCount = await g.E().count().next();
1204
951
  return {
1205
- success: true,
1206
- executionTime: Date.now() - startTime,
1207
- count: Number(count),
952
+ nodeCount: nodeCount.value,
953
+ relationshipCount: relCount.value,
1208
954
  };
1209
955
  }
1210
- async getStatistics(connection, transaction) {
1211
- const startTime = Date.now();
1212
- const neptuneConn = connection;
1213
- const isGremlin = neptuneConn.getConfig().queryLanguage === graph_types_1.GraphQueryLanguage.GREMLIN;
1214
- let nodeCount = 0;
1215
- let relationshipCount = 0;
1216
- if (isGremlin) {
1217
- const nodeResult = await this.executeRaw(connection, { query: 'g.V().count()' }, transaction);
1218
- nodeCount = nodeResult.data[0] || 0;
1219
- const relResult = await this.executeRaw(connection, { query: 'g.E().count()' }, transaction);
1220
- relationshipCount = relResult.data[0] || 0;
1221
- }
1222
- else {
1223
- const result = await this.executeRaw(connection, {
1224
- query: `
1225
- MATCH (n)
1226
- WITH count(n) AS nodeCount
1227
- MATCH ()-[r]->()
1228
- RETURN nodeCount, count(r) AS relCount
1229
- `,
1230
- }, transaction);
1231
- if (result.data.length > 0) {
1232
- nodeCount = result.data[0].nodeCount || 0;
1233
- relationshipCount = result.data[0].relCount || 0;
1234
- }
956
+ // ==================== SEARCH OPERATIONS ====================
957
+ async fullTextSearch(options, _transaction) {
958
+ const g = this.ensureTraversal();
959
+ // Neptune supports text predicates via Neptune-specific features
960
+ // Basic implementation using contains predicate
961
+ const textPredicate = this.gremlin.process.P.containing(options.query);
962
+ let traversal = g.V().or(this.gremlin.process.__.has('name', textPredicate), this.gremlin.process.__.has('title', textPredicate), this.gremlin.process.__.has('description', textPredicate));
963
+ if (options.limit) {
964
+ traversal = traversal.limit(options.limit);
1235
965
  }
966
+ const results = await traversal.valueMap(true).toList();
967
+ const nodes = results.map((v) => this.mapGremlinVertexFromValueMap(v));
1236
968
  return {
1237
- success: true,
1238
- executionTime: Date.now() - startTime,
1239
- nodeCount: Number(nodeCount),
1240
- relationshipCount: Number(relationshipCount),
1241
- labelCounts: {},
1242
- relationshipTypeCounts: {},
969
+ nodes,
970
+ scores: nodes.map(() => 1.0),
1243
971
  };
1244
972
  }
1245
- // ==================== SEARCH OPERATIONS ====================
1246
- async fullTextSearch(connection, options, transaction) {
1247
- // Neptune doesn't have built-in full-text search
1248
- // Would need to use OpenSearch integration
1249
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Full-text search requires Neptune integration with OpenSearch');
1250
- }
1251
- async vectorSearch(connection, options, transaction) {
1252
- // Neptune Analytics supports vector search
1253
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Vector search requires Neptune Analytics');
1254
- }
1255
- // ==================== SCHEMA OPERATIONS ====================
1256
- // Note: Neptune has limited schema support compared to Neo4j
1257
- async createNodeConstraint(connection, constraint, transaction) {
1258
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Neptune does not support explicit constraints');
1259
- }
1260
- async createRelationshipConstraint(connection, constraint, transaction) {
1261
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Neptune does not support explicit constraints');
1262
- }
1263
- async dropConstraint(connection, name, transaction) {
1264
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Neptune does not support explicit constraints');
973
+ async vectorSearch(_options, _transaction) {
974
+ throw graph_error_1.GraphError.unsupportedOperationError('Vector search is not natively supported in Neptune. Consider using Amazon OpenSearch with Neptune.', this.graphType);
1265
975
  }
1266
- async listConstraints(connection, transaction) {
976
+ // ==================== RAW QUERY ====================
977
+ async query(options, _transaction) {
978
+ // For Gremlin, the query is a Gremlin script string
979
+ // Neptune supports script execution via the submit method
980
+ if (!this.connection) {
981
+ throw new Error('Not connected to Neptune');
982
+ }
983
+ const result = await this.connection.submit(options.query, options.params || {});
984
+ const records = await result.toArray();
1267
985
  return {
1268
- success: true,
1269
- executionTime: 0,
1270
- constraints: [],
986
+ records: records,
987
+ summary: {},
1271
988
  };
1272
989
  }
1273
- async createNodeIndex(connection, index, transaction) {
1274
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Neptune automatically indexes all properties');
1275
- }
1276
- async createRelationshipIndex(connection, index, transaction) {
1277
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Neptune automatically indexes all properties');
990
+ // ==================== SCHEMA OPERATIONS ====================
991
+ async createNodeIndex(options) {
992
+ // Neptune doesn't support user-created indexes in the same way as Neo4j
993
+ // Indexes are managed automatically by Neptune
994
+ // Return success as Neptune will handle optimization automatically
995
+ return { created: true, name: options.name };
996
+ }
997
+ async createNodeConstraint(_options) {
998
+ // Neptune doesn't support constraints like Neo4j
999
+ throw graph_error_1.GraphError.unsupportedOperationError('Neptune does not support user-defined constraints. Data validation should be handled at the application level.', this.graphType);
1000
+ }
1001
+ async createRelationshipIndex(options) {
1002
+ // Neptune handles indexes automatically
1003
+ return { created: true, name: options.name };
1004
+ }
1005
+ async listIndexes() {
1006
+ // Neptune indexes are managed internally
1007
+ return { indexes: [] };
1008
+ }
1009
+ async listConstraints() {
1010
+ // Neptune doesn't have user-defined constraints
1011
+ return { constraints: [] };
1012
+ }
1013
+ async dropIndex(_name) {
1014
+ // Neptune indexes are managed internally
1015
+ return { dropped: false };
1016
+ }
1017
+ async dropConstraint(_name) {
1018
+ // Neptune doesn't have user-defined constraints
1019
+ return { dropped: false };
1020
+ }
1021
+ // ==================== SCHEMA INTROSPECTION ====================
1022
+ async listLabels() {
1023
+ this.ensureConnected();
1024
+ try {
1025
+ // Get all distinct vertex labels
1026
+ const labelsTraversal = this.g.V().label().dedup();
1027
+ const labelNames = await labelsTraversal.toList();
1028
+ const labels = [];
1029
+ for (const labelName of labelNames) {
1030
+ // Get count for each label
1031
+ const countTraversal = this.g.V().hasLabel(labelName).count();
1032
+ const countResult = await countTraversal.next();
1033
+ const count = countResult.value || 0;
1034
+ // Get properties from a sample of vertices with this label
1035
+ const propsTraversal = this.g.V().hasLabel(labelName).limit(100).properties().key().dedup();
1036
+ const propertyNames = await propsTraversal.toList();
1037
+ const properties = propertyNames.map((name) => ({
1038
+ name,
1039
+ type: 'unknown',
1040
+ }));
1041
+ labels.push({
1042
+ name: String(labelName),
1043
+ count: Number(count),
1044
+ properties,
1045
+ });
1046
+ }
1047
+ return { labels };
1048
+ }
1049
+ catch (error) {
1050
+ throw graph_error_1.GraphError.queryError(`Failed to list labels: ${error.message}`);
1051
+ }
1278
1052
  }
1279
- async dropIndex(connection, name, transaction) {
1280
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.VALIDATION_ERROR, 'Neptune does not support dropping indexes');
1053
+ async listRelationshipTypes() {
1054
+ this.ensureConnected();
1055
+ try {
1056
+ // Get all distinct edge labels
1057
+ const typesTraversal = this.g.E().label().dedup();
1058
+ const typeNames = await typesTraversal.toList();
1059
+ const types = [];
1060
+ for (const typeName of typeNames) {
1061
+ // Get count for each edge label
1062
+ const countTraversal = this.g.E().hasLabel(typeName).count();
1063
+ const countResult = await countTraversal.next();
1064
+ const count = countResult.value || 0;
1065
+ // Get source and target vertex labels
1066
+ const endpointsTraversal = this.g.E().hasLabel(typeName).limit(100)
1067
+ .project('fromLabel', 'toLabel')
1068
+ .by(this.gremlin.process.statics.outV().label())
1069
+ .by(this.gremlin.process.statics.inV().label());
1070
+ const endpoints = await endpointsTraversal.toList();
1071
+ const fromLabelsSet = new Set();
1072
+ const toLabelsSet = new Set();
1073
+ for (const ep of endpoints) {
1074
+ if (ep.fromLabel)
1075
+ fromLabelsSet.add(String(ep.fromLabel));
1076
+ if (ep.toLabel)
1077
+ toLabelsSet.add(String(ep.toLabel));
1078
+ }
1079
+ // Get properties from a sample of edges
1080
+ const propsTraversal = this.g.E().hasLabel(typeName).limit(100).properties().key().dedup();
1081
+ const propertyNames = await propsTraversal.toList();
1082
+ const properties = propertyNames.map((name) => ({
1083
+ name,
1084
+ type: 'unknown',
1085
+ }));
1086
+ types.push({
1087
+ type: String(typeName),
1088
+ count: Number(count),
1089
+ fromLabels: Array.from(fromLabelsSet),
1090
+ toLabels: Array.from(toLabelsSet),
1091
+ properties: properties.length > 0 ? properties : undefined,
1092
+ });
1093
+ }
1094
+ return { types };
1095
+ }
1096
+ catch (error) {
1097
+ throw graph_error_1.GraphError.queryError(`Failed to list relationship types: ${error.message}`);
1098
+ }
1281
1099
  }
1282
- async listIndexes(connection, transaction) {
1100
+ // ==================== TRANSACTION OPERATIONS ====================
1101
+ async beginTransaction(_options) {
1102
+ // Neptune has limited transaction support via sessions
1103
+ // For now, we create a session-based pseudo-transaction
1104
+ this.ensureConnected();
1283
1105
  return {
1284
- success: true,
1285
- executionTime: 0,
1286
- indexes: [],
1106
+ id: `tx_${Date.now()}`,
1107
+ status: enums_1.GraphTransactionStatus.ACTIVE,
1108
+ client: this.g,
1109
+ nativeTransaction: null,
1110
+ startTime: new Date(),
1111
+ commit: async () => {
1112
+ // Neptune auto-commits each query
1113
+ },
1114
+ rollback: async () => {
1115
+ // Neptune doesn't support rollback for individual queries
1116
+ },
1287
1117
  };
1288
1118
  }
1289
- // ==================== UTILITY METHODS ====================
1290
- escapeIdentifier(identifier) {
1291
- return identifier.replace(/[^a-zA-Z0-9_]/g, '_');
1119
+ async commitTransaction(_transaction) {
1120
+ // Neptune auto-commits each query
1292
1121
  }
1293
- escapeValue(value) {
1294
- if (value === null)
1295
- return 'null';
1296
- if (typeof value === 'string')
1297
- return `'${value.replace(/'/g, "\\'")}'`;
1298
- if (typeof value === 'number')
1299
- return String(value);
1300
- if (typeof value === 'boolean')
1301
- return value ? 'true' : 'false';
1302
- if (value instanceof Date)
1303
- return `datetime('${value.toISOString()}')`;
1304
- if (Array.isArray(value))
1305
- return `[${value.map(v => this.escapeValue(v)).join(', ')}]`;
1306
- return String(value);
1122
+ async rollbackTransaction(_transaction) {
1123
+ // Neptune doesn't support rollback for individual queries
1307
1124
  }
1308
- buildWhereClause(where, variableName = 'n') {
1309
- const params = {};
1310
- const parts = [];
1311
- Object.entries(where).forEach(([key, value], index) => {
1312
- const paramName = `where_${index}`;
1313
- parts.push(`${variableName}.${key} = $${paramName}`);
1314
- params[paramName] = value;
1315
- });
1316
- return {
1317
- clause: parts.join(' AND '),
1318
- params,
1319
- };
1125
+ // ==================== UTILITY METHODS ====================
1126
+ buildWhereClause(where) {
1127
+ // For Gremlin, we return the where clause object as-is
1128
+ // The actual predicate building is done in applyWhereConditions
1129
+ return where;
1130
+ }
1131
+ applyWhereConditions(traversal, where) {
1132
+ const { P } = this.gremlin.process;
1133
+ for (const [key, value] of Object.entries(where)) {
1134
+ if (key === '$AND') {
1135
+ // Apply AND conditions
1136
+ traversal = traversal.and(...Object.entries(value).map(([k, v]) => this.gremlin.process.__.has(k, v)));
1137
+ }
1138
+ else if (key === '$OR') {
1139
+ // Apply OR conditions
1140
+ traversal = traversal.or(...Object.entries(value).map(([k, v]) => this.gremlin.process.__.has(k, v)));
1141
+ }
1142
+ else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
1143
+ // Apply operator conditions
1144
+ for (const [op, opValue] of Object.entries(value)) {
1145
+ switch (op) {
1146
+ case '$GT':
1147
+ traversal = traversal.has(key, P.gt(opValue));
1148
+ break;
1149
+ case '$GTE':
1150
+ traversal = traversal.has(key, P.gte(opValue));
1151
+ break;
1152
+ case '$LT':
1153
+ traversal = traversal.has(key, P.lt(opValue));
1154
+ break;
1155
+ case '$LTE':
1156
+ traversal = traversal.has(key, P.lte(opValue));
1157
+ break;
1158
+ case '$NE':
1159
+ traversal = traversal.has(key, P.neq(opValue));
1160
+ break;
1161
+ case '$IN':
1162
+ traversal = traversal.has(key, P.within(...opValue));
1163
+ break;
1164
+ case '$NOT_IN':
1165
+ traversal = traversal.has(key, P.without(...opValue));
1166
+ break;
1167
+ case '$CONTAINS':
1168
+ traversal = traversal.has(key, P.containing(opValue));
1169
+ break;
1170
+ case '$STARTS_WITH':
1171
+ traversal = traversal.has(key, P.startingWith(opValue));
1172
+ break;
1173
+ case '$ENDS_WITH':
1174
+ traversal = traversal.has(key, P.endingWith(opValue));
1175
+ break;
1176
+ case '$EXISTS':
1177
+ if (opValue) {
1178
+ traversal = traversal.has(key);
1179
+ }
1180
+ else {
1181
+ traversal = traversal.hasNot(key);
1182
+ }
1183
+ break;
1184
+ }
1185
+ }
1186
+ }
1187
+ else {
1188
+ // Simple equality
1189
+ traversal = traversal.has(key, value);
1190
+ }
1191
+ }
1192
+ return traversal;
1320
1193
  }
1321
- // ==================== PROTECTED PARSER METHODS ====================
1322
- parseNode(nativeNode) {
1323
- if (!nativeNode) {
1324
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.NODE_ERROR, 'Cannot parse null node');
1194
+ parseError(error) {
1195
+ if (error instanceof graph_error_1.GraphError) {
1196
+ return error;
1325
1197
  }
1326
- // Already parsed
1327
- if (nativeNode.labels && nativeNode.properties !== undefined) {
1328
- return nativeNode;
1198
+ return graph_error_1.GraphError.queryError(String(error));
1199
+ }
1200
+ // ==================== PRIVATE HELPER METHODS ====================
1201
+ mapGremlinVertex(id, properties) {
1202
+ const props = {};
1203
+ const labels = [];
1204
+ if (properties) {
1205
+ for (const [key, value] of properties) {
1206
+ if (key === 'label' || key === this.gremlin.process.t.label) {
1207
+ labels.push(Array.isArray(value) ? value[0] : value);
1208
+ }
1209
+ else if (key === 'id' || key === this.gremlin.process.t.id) {
1210
+ // Skip id as we have it separately
1211
+ }
1212
+ else {
1213
+ props[key] = Array.isArray(value) ? value[0] : value;
1214
+ }
1215
+ }
1329
1216
  }
1330
1217
  return {
1331
- id: nativeNode.id || '',
1332
- labels: nativeNode.labels || [nativeNode.label] || [],
1333
- properties: (nativeNode.properties || nativeNode),
1218
+ id: String(id),
1219
+ labels,
1220
+ properties: props,
1334
1221
  };
1335
1222
  }
1336
- parseRelationship(nativeRelationship) {
1337
- if (!nativeRelationship) {
1338
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.RELATIONSHIP_ERROR, 'Cannot parse null relationship');
1339
- }
1340
- // Already parsed
1341
- if (nativeRelationship.type && nativeRelationship.startNodeId !== undefined) {
1342
- return nativeRelationship;
1223
+ mapGremlinVertexFromValueMap(valueMap) {
1224
+ const props = {};
1225
+ const labels = [];
1226
+ let id = '';
1227
+ if (valueMap) {
1228
+ for (const [key, value] of Object.entries(valueMap)) {
1229
+ if (key === 'label' || String(key).includes('label')) {
1230
+ const labelValue = Array.isArray(value) ? value[0] : value;
1231
+ labels.push(String(labelValue));
1232
+ }
1233
+ else if (key === 'id' || String(key).includes('id')) {
1234
+ id = String(Array.isArray(value) ? value[0] : value);
1235
+ }
1236
+ else {
1237
+ props[key] = Array.isArray(value) ? value[0] : value;
1238
+ }
1239
+ }
1343
1240
  }
1344
1241
  return {
1345
- id: nativeRelationship.id || '',
1346
- type: nativeRelationship.type || nativeRelationship.label || '',
1347
- startNodeId: nativeRelationship.startNodeId || nativeRelationship.outV || '',
1348
- endNodeId: nativeRelationship.endNodeId || nativeRelationship.inV || '',
1349
- properties: (nativeRelationship.properties || nativeRelationship),
1242
+ id,
1243
+ labels,
1244
+ properties: props,
1350
1245
  };
1351
1246
  }
1352
- parsePath(nativePath) {
1353
- if (!nativePath) {
1354
- throw new graph_types_1.GraphError(graph_types_1.GraphErrorType.PATH_ERROR, 'Cannot parse null path');
1355
- }
1356
- // Already parsed
1357
- if (nativePath.nodes && nativePath.relationships !== undefined) {
1358
- return nativePath;
1359
- }
1360
- const nodes = [];
1361
- const relationships = [];
1362
- if (nativePath.objects) {
1363
- // Gremlin path
1364
- nativePath.objects.forEach((obj) => {
1365
- if (obj.labels || obj.label) {
1366
- nodes.push(this.parseNode(obj));
1247
+ mapGremlinEdge(edge, properties, startId, endId) {
1248
+ const props = {};
1249
+ let type = '';
1250
+ if (properties) {
1251
+ for (const [key, value] of Object.entries(properties)) {
1252
+ if (key === 'label' || String(key).includes('label')) {
1253
+ type = String(Array.isArray(value) ? value[0] : value);
1367
1254
  }
1368
- else if (obj.type || obj.outV) {
1369
- relationships.push(this.parseRelationship(obj));
1255
+ else if (key === 'id' || String(key).includes('id')) {
1256
+ // Skip id
1370
1257
  }
1371
- });
1372
- }
1373
- else if (nativePath.nodes && nativePath.relationships) {
1374
- // Already structured
1375
- nativePath.nodes.forEach((n) => nodes.push(this.parseNode(n)));
1376
- nativePath.relationships.forEach((r) => relationships.push(this.parseRelationship(r)));
1258
+ else {
1259
+ props[key] = Array.isArray(value) ? value[0] : value;
1260
+ }
1261
+ }
1377
1262
  }
1378
1263
  return {
1379
- nodes,
1380
- relationships,
1381
- length: relationships.length,
1382
- start: nodes[0],
1383
- end: nodes[nodes.length - 1],
1264
+ id: String(edge.id),
1265
+ type: type || edge.label,
1266
+ startNodeId: String(startId),
1267
+ endNodeId: String(endId),
1268
+ properties: props,
1384
1269
  };
1385
1270
  }
1386
- // ==================== PRIVATE HELPER METHODS ====================
1387
- normalizeLabels(labels) {
1388
- return Array.isArray(labels) ? labels : [labels];
1389
- }
1390
- gremlinValue(value) {
1391
- if (value === null)
1392
- return 'null';
1393
- if (typeof value === 'string')
1394
- return `'${value.replace(/'/g, "\\'")}'`;
1395
- if (typeof value === 'number')
1396
- return String(value);
1397
- if (typeof value === 'boolean')
1398
- return value.toString();
1399
- if (value instanceof Date)
1400
- return `datetime('${value.toISOString()}')`;
1401
- if (Array.isArray(value))
1402
- return `[${value.map(v => this.gremlinValue(v)).join(', ')}]`;
1403
- return String(value);
1404
- }
1405
- buildCypherNodeMatch(ref, alias, params, prefix = '') {
1406
- let pattern = `(${alias}`;
1407
- if (ref.labels) {
1408
- const labels = this.normalizeLabels(ref.labels);
1409
- pattern += ':' + labels.join(':');
1410
- }
1411
- if (ref.id !== undefined) {
1412
- const paramName = `${prefix}id`;
1413
- params[paramName] = ref.id;
1414
- pattern += ` {id: $${paramName}}`;
1415
- }
1416
- else if (ref.properties && Object.keys(ref.properties).length > 0) {
1417
- const propParts = Object.entries(ref.properties).map(([k], i) => {
1418
- const paramName = `${prefix}prop${i}`;
1419
- params[paramName] = ref.properties[k];
1420
- return `${k}: $${paramName}`;
1421
- });
1422
- pattern += ` {${propParts.join(', ')}}`;
1271
+ mapGremlinEdgeFromProject(result) {
1272
+ const edge = result.edge || {};
1273
+ const props = {};
1274
+ let type = '';
1275
+ let id = '';
1276
+ for (const [key, value] of Object.entries(edge)) {
1277
+ if (key === 'label' || String(key).includes('label')) {
1278
+ type = String(Array.isArray(value) ? value[0] : value);
1279
+ }
1280
+ else if (key === 'id' || String(key).includes('id')) {
1281
+ id = String(Array.isArray(value) ? value[0] : value);
1282
+ }
1283
+ else {
1284
+ props[key] = Array.isArray(value) ? value[0] : value;
1285
+ }
1423
1286
  }
1424
- pattern += ')';
1425
- return pattern;
1287
+ return {
1288
+ id,
1289
+ type,
1290
+ startNodeId: String(result.outV),
1291
+ endNodeId: String(result.inV),
1292
+ properties: props,
1293
+ };
1426
1294
  }
1427
1295
  }
1428
1296
  exports.NeptuneAdapter = NeptuneAdapter;
1429
- exports.default = NeptuneAdapter;
1430
1297
  //# sourceMappingURL=neptune.adapter.js.map