@ductape/sdk 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (973) hide show
  1. package/package.json +4 -2
  2. package/dist/agents/agent-context.d.ts +0 -100
  3. package/dist/agents/agent-context.js +0 -604
  4. package/dist/agents/agent-context.js.map +0 -1
  5. package/dist/agents/agent-executor.d.ts +0 -180
  6. package/dist/agents/agent-executor.js +0 -715
  7. package/dist/agents/agent-executor.js.map +0 -1
  8. package/dist/agents/agents.service.d.ts +0 -310
  9. package/dist/agents/agents.service.js +0 -1255
  10. package/dist/agents/agents.service.js.map +0 -1
  11. package/dist/agents/index.d.ts +0 -55
  12. package/dist/agents/index.js +0 -110
  13. package/dist/agents/index.js.map +0 -1
  14. package/dist/agents/memory-manager.d.ts +0 -182
  15. package/dist/agents/memory-manager.js +0 -383
  16. package/dist/agents/memory-manager.js.map +0 -1
  17. package/dist/agents/tool-registry.d.ts +0 -141
  18. package/dist/agents/tool-registry.js +0 -355
  19. package/dist/agents/tool-registry.js.map +0 -1
  20. package/dist/agents/types/agents.types.d.ts +0 -1240
  21. package/dist/agents/types/agents.types.js +0 -12
  22. package/dist/agents/types/agents.types.js.map +0 -1
  23. package/dist/agents/types/index.d.ts +0 -6
  24. package/dist/agents/types/index.js +0 -23
  25. package/dist/agents/types/index.js.map +0 -1
  26. package/dist/agents/vector-store-adapter.d.ts +0 -108
  27. package/dist/agents/vector-store-adapter.js +0 -213
  28. package/dist/agents/vector-store-adapter.js.map +0 -1
  29. package/dist/api/services/appApi.service.d.ts +0 -78
  30. package/dist/api/services/appApi.service.js +0 -303
  31. package/dist/api/services/appApi.service.js.map +0 -1
  32. package/dist/api/services/logsApi.service.d.ts +0 -62
  33. package/dist/api/services/logsApi.service.js +0 -67
  34. package/dist/api/services/logsApi.service.js.map +0 -1
  35. package/dist/api/services/pricingApi.service.d.ts +0 -10
  36. package/dist/api/services/pricingApi.service.js +0 -34
  37. package/dist/api/services/pricingApi.service.js.map +0 -1
  38. package/dist/api/services/processorApi.service.d.ts +0 -927
  39. package/dist/api/services/processorApi.service.js +0 -787
  40. package/dist/api/services/processorApi.service.js.map +0 -1
  41. package/dist/api/services/productsApi.service.d.ts +0 -150
  42. package/dist/api/services/productsApi.service.js +0 -279
  43. package/dist/api/services/productsApi.service.js.map +0 -1
  44. package/dist/api/services/resilienceApi.service.d.ts +0 -106
  45. package/dist/api/services/resilienceApi.service.js +0 -224
  46. package/dist/api/services/resilienceApi.service.js.map +0 -1
  47. package/dist/api/services/secretsApi.service.d.ts +0 -51
  48. package/dist/api/services/secretsApi.service.js +0 -126
  49. package/dist/api/services/secretsApi.service.js.map +0 -1
  50. package/dist/api/services/userApi.service.d.ts +0 -10
  51. package/dist/api/services/userApi.service.js +0 -20
  52. package/dist/api/services/userApi.service.js.map +0 -1
  53. package/dist/api/services/webhooksApi.service.d.ts +0 -14
  54. package/dist/api/services/webhooksApi.service.js +0 -65
  55. package/dist/api/services/webhooksApi.service.js.map +0 -1
  56. package/dist/api/services/workflowApi.service.d.ts +0 -199
  57. package/dist/api/services/workflowApi.service.js +0 -201
  58. package/dist/api/services/workflowApi.service.js.map +0 -1
  59. package/dist/api/services/workspaceApi.service.d.ts +0 -20
  60. package/dist/api/services/workspaceApi.service.js +0 -54
  61. package/dist/api/services/workspaceApi.service.js.map +0 -1
  62. package/dist/api/urls.d.ts +0 -136
  63. package/dist/api/urls.js +0 -185
  64. package/dist/api/urls.js.map +0 -1
  65. package/dist/api/utils/auth.utils.d.ts +0 -10
  66. package/dist/api/utils/auth.utils.js +0 -24
  67. package/dist/api/utils/auth.utils.js.map +0 -1
  68. package/dist/api/utils/cache.utils.d.ts +0 -3
  69. package/dist/api/utils/cache.utils.js +0 -18
  70. package/dist/api/utils/cache.utils.js.map +0 -1
  71. package/dist/api/utils/strings.utils.d.ts +0 -7
  72. package/dist/api/utils/strings.utils.js +0 -64
  73. package/dist/api/utils/strings.utils.js.map +0 -1
  74. package/dist/apps/services/app.service.d.ts +0 -126
  75. package/dist/apps/services/app.service.js +0 -1436
  76. package/dist/apps/services/app.service.js.map +0 -1
  77. package/dist/apps/utils/auth-context-manager.d.ts +0 -137
  78. package/dist/apps/utils/auth-context-manager.js +0 -248
  79. package/dist/apps/utils/auth-context-manager.js.map +0 -1
  80. package/dist/apps/utils/credential-manager.d.ts +0 -128
  81. package/dist/apps/utils/credential-manager.js +0 -199
  82. package/dist/apps/utils/credential-manager.js.map +0 -1
  83. package/dist/apps/utils/index.d.ts +0 -10
  84. package/dist/apps/utils/index.js +0 -54
  85. package/dist/apps/utils/index.js.map +0 -1
  86. package/dist/apps/utils/input-helpers.d.ts +0 -67
  87. package/dist/apps/utils/input-helpers.js +0 -185
  88. package/dist/apps/utils/input-helpers.js.map +0 -1
  89. package/dist/apps/utils/input-resolver.d.ts +0 -165
  90. package/dist/apps/utils/input-resolver.js +0 -477
  91. package/dist/apps/utils/input-resolver.js.map +0 -1
  92. package/dist/apps/utils/oauth-manager.d.ts +0 -196
  93. package/dist/apps/utils/oauth-manager.js +0 -429
  94. package/dist/apps/utils/oauth-manager.js.map +0 -1
  95. package/dist/apps/utils/objects.utils.d.ts +0 -4
  96. package/dist/apps/utils/objects.utils.js +0 -59
  97. package/dist/apps/utils/objects.utils.js.map +0 -1
  98. package/dist/apps/utils/string.utils.d.ts +0 -9
  99. package/dist/apps/utils/string.utils.js +0 -89
  100. package/dist/apps/utils/string.utils.js.map +0 -1
  101. package/dist/apps/validators/index.d.ts +0 -17
  102. package/dist/apps/validators/index.js +0 -39
  103. package/dist/apps/validators/index.js.map +0 -1
  104. package/dist/apps/validators/joi-validators/create.app.validator.d.ts +0 -3
  105. package/dist/apps/validators/joi-validators/create.app.validator.js +0 -43
  106. package/dist/apps/validators/joi-validators/create.app.validator.js.map +0 -1
  107. package/dist/apps/validators/joi-validators/create.appAction.validator.d.ts +0 -3
  108. package/dist/apps/validators/joi-validators/create.appAction.validator.js +0 -72
  109. package/dist/apps/validators/joi-validators/create.appAction.validator.js.map +0 -1
  110. package/dist/apps/validators/joi-validators/create.appActionResponse.validator.d.ts +0 -7
  111. package/dist/apps/validators/joi-validators/create.appActionResponse.validator.js +0 -81
  112. package/dist/apps/validators/joi-validators/create.appActionResponse.validator.js.map +0 -1
  113. package/dist/apps/validators/joi-validators/create.appAuth.validator.d.ts +0 -3
  114. package/dist/apps/validators/joi-validators/create.appAuth.validator.js +0 -64
  115. package/dist/apps/validators/joi-validators/create.appAuth.validator.js.map +0 -1
  116. package/dist/apps/validators/joi-validators/create.appBody.validators.d.ts +0 -4
  117. package/dist/apps/validators/joi-validators/create.appBody.validators.js +0 -44
  118. package/dist/apps/validators/joi-validators/create.appBody.validators.js.map +0 -1
  119. package/dist/apps/validators/joi-validators/create.appConstants.validator.d.ts +0 -4
  120. package/dist/apps/validators/joi-validators/create.appConstants.validator.js +0 -45
  121. package/dist/apps/validators/joi-validators/create.appConstants.validator.js.map +0 -1
  122. package/dist/apps/validators/joi-validators/create.appEnv.validator.d.ts +0 -4
  123. package/dist/apps/validators/joi-validators/create.appEnv.validator.js +0 -50
  124. package/dist/apps/validators/joi-validators/create.appEnv.validator.js.map +0 -1
  125. package/dist/apps/validators/joi-validators/create.appVariable.validator.d.ts +0 -4
  126. package/dist/apps/validators/joi-validators/create.appVariable.validator.js +0 -47
  127. package/dist/apps/validators/joi-validators/create.appVariable.validator.js.map +0 -1
  128. package/dist/apps/validators/joi-validators/create.appWebhook.validator.d.ts +0 -4
  129. package/dist/apps/validators/joi-validators/create.appWebhook.validator.js +0 -60
  130. package/dist/apps/validators/joi-validators/create.appWebhook.validator.js.map +0 -1
  131. package/dist/apps/validators/joi-validators/create.appWebhookEvent.validator.d.ts +0 -3
  132. package/dist/apps/validators/joi-validators/create.appWebhookEvent.validator.js +0 -48
  133. package/dist/apps/validators/joi-validators/create.appWebhookEvent.validator.js.map +0 -1
  134. package/dist/apps/validators/joi-validators/sample.validator.d.ts +0 -6
  135. package/dist/apps/validators/joi-validators/sample.validator.js +0 -65
  136. package/dist/apps/validators/joi-validators/sample.validator.js.map +0 -1
  137. package/dist/apps/validators/joi-validators/update.app.validator.d.ts +0 -4
  138. package/dist/apps/validators/joi-validators/update.app.validator.js +0 -66
  139. package/dist/apps/validators/joi-validators/update.app.validator.js.map +0 -1
  140. package/dist/apps/validators/joi-validators/update.appAction.validator.d.ts +0 -4
  141. package/dist/apps/validators/joi-validators/update.appAction.validator.js +0 -76
  142. package/dist/apps/validators/joi-validators/update.appAction.validator.js.map +0 -1
  143. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.d.ts +0 -3
  144. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js +0 -57
  145. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js.map +0 -1
  146. package/dist/apps/validators/joi-validators/update.appAuth.validator.d.ts +0 -4
  147. package/dist/apps/validators/joi-validators/update.appAuth.validator.js +0 -52
  148. package/dist/apps/validators/joi-validators/update.appAuth.validator.js.map +0 -1
  149. package/dist/apps/validators/joi-validators/update.appConstants.validator.d.ts +0 -4
  150. package/dist/apps/validators/joi-validators/update.appConstants.validator.js +0 -45
  151. package/dist/apps/validators/joi-validators/update.appConstants.validator.js.map +0 -1
  152. package/dist/apps/validators/joi-validators/update.appEnv.validator.d.ts +0 -4
  153. package/dist/apps/validators/joi-validators/update.appEnv.validator.js +0 -50
  154. package/dist/apps/validators/joi-validators/update.appEnv.validator.js.map +0 -1
  155. package/dist/apps/validators/joi-validators/update.appVariables.validator.d.ts +0 -4
  156. package/dist/apps/validators/joi-validators/update.appVariables.validator.js +0 -47
  157. package/dist/apps/validators/joi-validators/update.appVariables.validator.js.map +0 -1
  158. package/dist/apps/validators/joi-validators/update.appWebhook.validator.d.ts +0 -4
  159. package/dist/apps/validators/joi-validators/update.appWebhook.validator.js +0 -59
  160. package/dist/apps/validators/joi-validators/update.appWebhook.validator.js.map +0 -1
  161. package/dist/apps/validators/joi-validators/update.appWebhookEvent.validator.d.ts +0 -3
  162. package/dist/apps/validators/joi-validators/update.appWebhookEvent.validator.js +0 -48
  163. package/dist/apps/validators/joi-validators/update.appWebhookEvent.validator.js.map +0 -1
  164. package/dist/apps/validators/joi-validators/update.validation.entityData.validator.d.ts +0 -3
  165. package/dist/apps/validators/joi-validators/update.validation.entityData.validator.js +0 -60
  166. package/dist/apps/validators/joi-validators/update.validation.entityData.validator.js.map +0 -1
  167. package/dist/bin.d.ts +0 -26
  168. package/dist/bin.js +0 -28
  169. package/dist/bin.js.map +0 -1
  170. package/dist/brokers/brokers.service.d.ts +0 -438
  171. package/dist/brokers/brokers.service.js +0 -1294
  172. package/dist/brokers/brokers.service.js.map +0 -1
  173. package/dist/brokers/index.d.ts +0 -46
  174. package/dist/brokers/index.js +0 -83
  175. package/dist/brokers/index.js.map +0 -1
  176. package/dist/brokers/types/index.d.ts +0 -569
  177. package/dist/brokers/types/index.js +0 -8
  178. package/dist/brokers/types/index.js.map +0 -1
  179. package/dist/brokers/utils/broker.util.d.ts +0 -33
  180. package/dist/brokers/utils/broker.util.js +0 -125
  181. package/dist/brokers/utils/broker.util.js.map +0 -1
  182. package/dist/brokers/utils/providers/aws-sqs.service.d.ts +0 -16
  183. package/dist/brokers/utils/providers/aws-sqs.service.js +0 -71
  184. package/dist/brokers/utils/providers/aws-sqs.service.js.map +0 -1
  185. package/dist/brokers/utils/providers/google-pubsub.service.d.ts +0 -16
  186. package/dist/brokers/utils/providers/google-pubsub.service.js +0 -43
  187. package/dist/brokers/utils/providers/google-pubsub.service.js.map +0 -1
  188. package/dist/brokers/utils/providers/index.d.ts +0 -6
  189. package/dist/brokers/utils/providers/index.js +0 -16
  190. package/dist/brokers/utils/providers/index.js.map +0 -1
  191. package/dist/brokers/utils/providers/kafka.service.d.ts +0 -23
  192. package/dist/brokers/utils/providers/kafka.service.js +0 -131
  193. package/dist/brokers/utils/providers/kafka.service.js.map +0 -1
  194. package/dist/brokers/utils/providers/nats.service.d.ts +0 -18
  195. package/dist/brokers/utils/providers/nats.service.js +0 -63
  196. package/dist/brokers/utils/providers/nats.service.js.map +0 -1
  197. package/dist/brokers/utils/providers/rabbitmq.service.d.ts +0 -25
  198. package/dist/brokers/utils/providers/rabbitmq.service.js +0 -138
  199. package/dist/brokers/utils/providers/rabbitmq.service.js.map +0 -1
  200. package/dist/brokers/utils/providers/redis.service.d.ts +0 -18
  201. package/dist/brokers/utils/providers/redis.service.js +0 -93
  202. package/dist/brokers/utils/providers/redis.service.js.map +0 -1
  203. package/dist/cache/cache.manager.d.ts +0 -308
  204. package/dist/cache/cache.manager.js +0 -900
  205. package/dist/cache/cache.manager.js.map +0 -1
  206. package/dist/cache/cache.service.d.ts +0 -192
  207. package/dist/cache/cache.service.js +0 -596
  208. package/dist/cache/cache.service.js.map +0 -1
  209. package/dist/cache/index.d.ts +0 -52
  210. package/dist/cache/index.js +0 -81
  211. package/dist/cache/index.js.map +0 -1
  212. package/dist/cache/types/index.d.ts +0 -112
  213. package/dist/cache/types/index.js +0 -6
  214. package/dist/cache/types/index.js.map +0 -1
  215. package/dist/clients/apps.client.d.ts +0 -4
  216. package/dist/clients/apps.client.js +0 -31
  217. package/dist/clients/apps.client.js.map +0 -1
  218. package/dist/clients/email.client.d.ts +0 -4
  219. package/dist/clients/email.client.js +0 -29
  220. package/dist/clients/email.client.js.map +0 -1
  221. package/dist/clients/expo.client.d.ts +0 -3
  222. package/dist/clients/expo.client.js +0 -28
  223. package/dist/clients/expo.client.js.map +0 -1
  224. package/dist/clients/function.client.d.ts +0 -3
  225. package/dist/clients/function.client.js +0 -27
  226. package/dist/clients/function.client.js.map +0 -1
  227. package/dist/clients/http.client.d.ts +0 -3
  228. package/dist/clients/http.client.js +0 -27
  229. package/dist/clients/http.client.js.map +0 -1
  230. package/dist/clients/logs.client.d.ts +0 -4
  231. package/dist/clients/logs.client.js +0 -34
  232. package/dist/clients/logs.client.js.map +0 -1
  233. package/dist/clients/pricing.client.d.ts +0 -4
  234. package/dist/clients/pricing.client.js +0 -34
  235. package/dist/clients/pricing.client.js.map +0 -1
  236. package/dist/clients/products.client.d.ts +0 -3
  237. package/dist/clients/products.client.js +0 -32
  238. package/dist/clients/products.client.js.map +0 -1
  239. package/dist/clients/users.client.d.ts +0 -4
  240. package/dist/clients/users.client.js +0 -34
  241. package/dist/clients/users.client.js.map +0 -1
  242. package/dist/clients/webhooks.client.d.ts +0 -4
  243. package/dist/clients/webhooks.client.js +0 -34
  244. package/dist/clients/webhooks.client.js.map +0 -1
  245. package/dist/clients/workspace.client.d.ts +0 -7
  246. package/dist/clients/workspace.client.js +0 -39
  247. package/dist/clients/workspace.client.js.map +0 -1
  248. package/dist/database/actions/action-manager.d.ts +0 -170
  249. package/dist/database/actions/action-manager.js +0 -465
  250. package/dist/database/actions/action-manager.js.map +0 -1
  251. package/dist/database/actions/index.d.ts +0 -6
  252. package/dist/database/actions/index.js +0 -13
  253. package/dist/database/actions/index.js.map +0 -1
  254. package/dist/database/adapters/adapter.factory.d.ts +0 -62
  255. package/dist/database/adapters/adapter.factory.js +0 -97
  256. package/dist/database/adapters/adapter.factory.js.map +0 -1
  257. package/dist/database/adapters/base.adapter.d.ts +0 -423
  258. package/dist/database/adapters/base.adapter.js +0 -260
  259. package/dist/database/adapters/base.adapter.js.map +0 -1
  260. package/dist/database/adapters/cassandra.adapter.d.ts +0 -92
  261. package/dist/database/adapters/cassandra.adapter.js +0 -1091
  262. package/dist/database/adapters/cassandra.adapter.js.map +0 -1
  263. package/dist/database/adapters/dynamodb.adapter.d.ts +0 -110
  264. package/dist/database/adapters/dynamodb.adapter.js +0 -1564
  265. package/dist/database/adapters/dynamodb.adapter.js.map +0 -1
  266. package/dist/database/adapters/index.d.ts +0 -11
  267. package/dist/database/adapters/index.js +0 -27
  268. package/dist/database/adapters/index.js.map +0 -1
  269. package/dist/database/adapters/mariadb.adapter.d.ts +0 -100
  270. package/dist/database/adapters/mariadb.adapter.js +0 -247
  271. package/dist/database/adapters/mariadb.adapter.js.map +0 -1
  272. package/dist/database/adapters/mongodb.adapter.d.ts +0 -121
  273. package/dist/database/adapters/mongodb.adapter.js +0 -1284
  274. package/dist/database/adapters/mongodb.adapter.js.map +0 -1
  275. package/dist/database/adapters/mysql.adapter.d.ts +0 -86
  276. package/dist/database/adapters/mysql.adapter.js +0 -1371
  277. package/dist/database/adapters/mysql.adapter.js.map +0 -1
  278. package/dist/database/adapters/postgresql.adapter.d.ts +0 -90
  279. package/dist/database/adapters/postgresql.adapter.js +0 -1487
  280. package/dist/database/adapters/postgresql.adapter.js.map +0 -1
  281. package/dist/database/databases.service.d.ts +0 -1496
  282. package/dist/database/databases.service.js +0 -3294
  283. package/dist/database/databases.service.js.map +0 -1
  284. package/dist/database/index.d.ts +0 -46
  285. package/dist/database/index.js +0 -109
  286. package/dist/database/index.js.map +0 -1
  287. package/dist/database/migrations/index.d.ts +0 -6
  288. package/dist/database/migrations/index.js +0 -12
  289. package/dist/database/migrations/index.js.map +0 -1
  290. package/dist/database/migrations/migration-engine.d.ts +0 -136
  291. package/dist/database/migrations/migration-engine.js +0 -1421
  292. package/dist/database/migrations/migration-engine.js.map +0 -1
  293. package/dist/database/operators/aggregation-builder.d.ts +0 -67
  294. package/dist/database/operators/aggregation-builder.js +0 -841
  295. package/dist/database/operators/aggregation-builder.js.map +0 -1
  296. package/dist/database/operators/index.d.ts +0 -7
  297. package/dist/database/operators/index.js +0 -15
  298. package/dist/database/operators/index.js.map +0 -1
  299. package/dist/database/operators/query-builder.d.ts +0 -69
  300. package/dist/database/operators/query-builder.js +0 -447
  301. package/dist/database/operators/query-builder.js.map +0 -1
  302. package/dist/database/presave/decrypt.d.ts +0 -25
  303. package/dist/database/presave/decrypt.js +0 -146
  304. package/dist/database/presave/decrypt.js.map +0 -1
  305. package/dist/database/presave/index.d.ts +0 -9
  306. package/dist/database/presave/index.js +0 -18
  307. package/dist/database/presave/index.js.map +0 -1
  308. package/dist/database/presave/presave-processor.d.ts +0 -148
  309. package/dist/database/presave/presave-processor.js +0 -702
  310. package/dist/database/presave/presave-processor.js.map +0 -1
  311. package/dist/database/schema/index.d.ts +0 -7
  312. package/dist/database/schema/index.js +0 -13
  313. package/dist/database/schema/index.js.map +0 -1
  314. package/dist/database/schema/schema-manager.d.ts +0 -258
  315. package/dist/database/schema/schema-manager.js +0 -638
  316. package/dist/database/schema/schema-manager.js.map +0 -1
  317. package/dist/database/transactions/index.d.ts +0 -6
  318. package/dist/database/transactions/index.js +0 -13
  319. package/dist/database/transactions/index.js.map +0 -1
  320. package/dist/database/transactions/transaction-manager.d.ts +0 -113
  321. package/dist/database/transactions/transaction-manager.js +0 -344
  322. package/dist/database/transactions/transaction-manager.js.map +0 -1
  323. package/dist/database/triggers/index.d.ts +0 -7
  324. package/dist/database/triggers/index.js +0 -14
  325. package/dist/database/triggers/index.js.map +0 -1
  326. package/dist/database/triggers/trigger-processor.d.ts +0 -239
  327. package/dist/database/triggers/trigger-processor.js +0 -1034
  328. package/dist/database/triggers/trigger-processor.js.map +0 -1
  329. package/dist/database/types/action.interface.d.ts +0 -148
  330. package/dist/database/types/action.interface.js +0 -6
  331. package/dist/database/types/action.interface.js.map +0 -1
  332. package/dist/database/types/aggregation.interface.d.ts +0 -185
  333. package/dist/database/types/aggregation.interface.js +0 -6
  334. package/dist/database/types/aggregation.interface.js.map +0 -1
  335. package/dist/database/types/connection.interface.d.ts +0 -137
  336. package/dist/database/types/connection.interface.js +0 -6
  337. package/dist/database/types/connection.interface.js.map +0 -1
  338. package/dist/database/types/dashboard.interface.d.ts +0 -74
  339. package/dist/database/types/dashboard.interface.js +0 -7
  340. package/dist/database/types/dashboard.interface.js.map +0 -1
  341. package/dist/database/types/enums.d.ts +0 -195
  342. package/dist/database/types/enums.js +0 -244
  343. package/dist/database/types/enums.js.map +0 -1
  344. package/dist/database/types/index.d.ts +0 -15
  345. package/dist/database/types/index.js +0 -31
  346. package/dist/database/types/index.js.map +0 -1
  347. package/dist/database/types/migration.interface.d.ts +0 -686
  348. package/dist/database/types/migration.interface.js +0 -9
  349. package/dist/database/types/migration.interface.js.map +0 -1
  350. package/dist/database/types/presave.interface.d.ts +0 -292
  351. package/dist/database/types/presave.interface.js +0 -60
  352. package/dist/database/types/presave.interface.js.map +0 -1
  353. package/dist/database/types/query.interface.d.ts +0 -205
  354. package/dist/database/types/query.interface.js +0 -6
  355. package/dist/database/types/query.interface.js.map +0 -1
  356. package/dist/database/types/schema.interface.d.ts +0 -412
  357. package/dist/database/types/schema.interface.js +0 -6
  358. package/dist/database/types/schema.interface.js.map +0 -1
  359. package/dist/database/types/transaction.interface.d.ts +0 -84
  360. package/dist/database/types/transaction.interface.js +0 -6
  361. package/dist/database/types/transaction.interface.js.map +0 -1
  362. package/dist/database/types/trigger.interface.d.ts +0 -612
  363. package/dist/database/types/trigger.interface.js +0 -121
  364. package/dist/database/types/trigger.interface.js.map +0 -1
  365. package/dist/database/types/write.interface.d.ts +0 -216
  366. package/dist/database/types/write.interface.js +0 -6
  367. package/dist/database/types/write.interface.js.map +0 -1
  368. package/dist/database/utils/database-error.d.ts +0 -96
  369. package/dist/database/utils/database-error.js +0 -221
  370. package/dist/database/utils/database-error.js.map +0 -1
  371. package/dist/database/utils/index.d.ts +0 -6
  372. package/dist/database/utils/index.js +0 -11
  373. package/dist/database/utils/index.js.map +0 -1
  374. package/dist/graph/adapters/adapter.factory.d.ts +0 -47
  375. package/dist/graph/adapters/adapter.factory.js +0 -77
  376. package/dist/graph/adapters/adapter.factory.js.map +0 -1
  377. package/dist/graph/adapters/arangodb.adapter.d.ts +0 -86
  378. package/dist/graph/adapters/arangodb.adapter.js +0 -1588
  379. package/dist/graph/adapters/arangodb.adapter.js.map +0 -1
  380. package/dist/graph/adapters/base.adapter.d.ts +0 -264
  381. package/dist/graph/adapters/base.adapter.js +0 -156
  382. package/dist/graph/adapters/base.adapter.js.map +0 -1
  383. package/dist/graph/adapters/index.d.ts +0 -11
  384. package/dist/graph/adapters/index.js +0 -21
  385. package/dist/graph/adapters/index.js.map +0 -1
  386. package/dist/graph/adapters/memgraph.adapter.d.ts +0 -110
  387. package/dist/graph/adapters/memgraph.adapter.js +0 -1452
  388. package/dist/graph/adapters/memgraph.adapter.js.map +0 -1
  389. package/dist/graph/adapters/neo4j.adapter.d.ts +0 -81
  390. package/dist/graph/adapters/neo4j.adapter.js +0 -1317
  391. package/dist/graph/adapters/neo4j.adapter.js.map +0 -1
  392. package/dist/graph/adapters/neptune.adapter.d.ts +0 -82
  393. package/dist/graph/adapters/neptune.adapter.js +0 -1369
  394. package/dist/graph/adapters/neptune.adapter.js.map +0 -1
  395. package/dist/graph/graphs.service.d.ts +0 -617
  396. package/dist/graph/graphs.service.js +0 -2594
  397. package/dist/graph/graphs.service.js.map +0 -1
  398. package/dist/graph/index.d.ts +0 -57
  399. package/dist/graph/index.js +0 -77
  400. package/dist/graph/index.js.map +0 -1
  401. package/dist/graph/transactions/index.d.ts +0 -4
  402. package/dist/graph/transactions/index.js +0 -9
  403. package/dist/graph/transactions/index.js.map +0 -1
  404. package/dist/graph/transactions/transaction-manager.d.ts +0 -61
  405. package/dist/graph/transactions/transaction-manager.js +0 -126
  406. package/dist/graph/transactions/transaction-manager.js.map +0 -1
  407. package/dist/graph/types/connection.interface.d.ts +0 -149
  408. package/dist/graph/types/connection.interface.js +0 -9
  409. package/dist/graph/types/connection.interface.js.map +0 -1
  410. package/dist/graph/types/enums.d.ts +0 -101
  411. package/dist/graph/types/enums.js +0 -114
  412. package/dist/graph/types/enums.js.map +0 -1
  413. package/dist/graph/types/index.d.ts +0 -13
  414. package/dist/graph/types/index.js +0 -20
  415. package/dist/graph/types/index.js.map +0 -1
  416. package/dist/graph/types/node.interface.d.ts +0 -248
  417. package/dist/graph/types/node.interface.js +0 -9
  418. package/dist/graph/types/node.interface.js.map +0 -1
  419. package/dist/graph/types/query.interface.d.ts +0 -175
  420. package/dist/graph/types/query.interface.js +0 -9
  421. package/dist/graph/types/query.interface.js.map +0 -1
  422. package/dist/graph/types/relationship.interface.d.ts +0 -207
  423. package/dist/graph/types/relationship.interface.js +0 -9
  424. package/dist/graph/types/relationship.interface.js.map +0 -1
  425. package/dist/graph/types/schema.interface.d.ts +0 -295
  426. package/dist/graph/types/schema.interface.js +0 -9
  427. package/dist/graph/types/schema.interface.js.map +0 -1
  428. package/dist/graph/types/transaction.interface.d.ts +0 -55
  429. package/dist/graph/types/transaction.interface.js +0 -9
  430. package/dist/graph/types/transaction.interface.js.map +0 -1
  431. package/dist/graph/types/traversal.interface.d.ts +0 -181
  432. package/dist/graph/types/traversal.interface.js +0 -9
  433. package/dist/graph/types/traversal.interface.js.map +0 -1
  434. package/dist/graph/utils/graph-error.d.ts +0 -71
  435. package/dist/graph/utils/graph-error.js +0 -142
  436. package/dist/graph/utils/graph-error.js.map +0 -1
  437. package/dist/graph/utils/index.d.ts +0 -4
  438. package/dist/graph/utils/index.js +0 -9
  439. package/dist/graph/utils/index.js.map +0 -1
  440. package/dist/imports/imports.repo.d.ts +0 -0
  441. package/dist/imports/imports.repo.js +0 -1
  442. package/dist/imports/imports.repo.js.map +0 -1
  443. package/dist/imports/imports.service.d.ts +0 -23
  444. package/dist/imports/imports.service.js +0 -71
  445. package/dist/imports/imports.service.js.map +0 -1
  446. package/dist/imports/imports.types.d.ts +0 -350
  447. package/dist/imports/imports.types.js +0 -33
  448. package/dist/imports/imports.types.js.map +0 -1
  449. package/dist/imports/openAPI3.0.types.d.ts +0 -52
  450. package/dist/imports/openAPI3.0.types.js +0 -3
  451. package/dist/imports/openAPI3.0.types.js.map +0 -1
  452. package/dist/imports/repos/openApi.repo.d.ts +0 -6
  453. package/dist/imports/repos/openApi.repo.js +0 -422
  454. package/dist/imports/repos/openApi.repo.js.map +0 -1
  455. package/dist/imports/repos/postmanV21.repo.d.ts +0 -14
  456. package/dist/imports/repos/postmanV21.repo.js +0 -257
  457. package/dist/imports/repos/postmanV21.repo.js.map +0 -1
  458. package/dist/imports/utils/imports.utils.d.ts +0 -80
  459. package/dist/imports/utils/imports.utils.js +0 -114
  460. package/dist/imports/utils/imports.utils.js.map +0 -1
  461. package/dist/imports/validators/index.d.ts +0 -0
  462. package/dist/imports/validators/index.js +0 -1
  463. package/dist/imports/validators/index.js.map +0 -1
  464. package/dist/imports/validators/joi-validators/postmanV21.validator.d.ts +0 -5
  465. package/dist/imports/validators/joi-validators/postmanV21.validator.js +0 -96
  466. package/dist/imports/validators/joi-validators/postmanV21.validator.js.map +0 -1
  467. package/dist/index.d.ts +0 -4021
  468. package/dist/index.js +0 -5895
  469. package/dist/index.js.map +0 -1
  470. package/dist/init.interface.d.ts +0 -407
  471. package/dist/init.interface.js +0 -3
  472. package/dist/init.interface.js.map +0 -1
  473. package/dist/inputs/inputs.repo.d.ts +0 -7
  474. package/dist/inputs/inputs.repo.js +0 -16
  475. package/dist/inputs/inputs.repo.js.map +0 -1
  476. package/dist/inputs/inputs.service.d.ts +0 -61
  477. package/dist/inputs/inputs.service.js +0 -468
  478. package/dist/inputs/inputs.service.js.map +0 -1
  479. package/dist/inputs/utils/inputs.utils.create.d.ts +0 -11
  480. package/dist/inputs/utils/inputs.utils.create.js +0 -273
  481. package/dist/inputs/utils/inputs.utils.create.js.map +0 -1
  482. package/dist/inputs/validators/inputs.validator.parse.d.ts +0 -4
  483. package/dist/inputs/validators/inputs.validator.parse.js +0 -53
  484. package/dist/inputs/validators/inputs.validator.parse.js.map +0 -1
  485. package/dist/jobs/index.d.ts +0 -38
  486. package/dist/jobs/index.js +0 -50
  487. package/dist/jobs/index.js.map +0 -1
  488. package/dist/jobs/jobs.service.d.ts +0 -154
  489. package/dist/jobs/jobs.service.js +0 -491
  490. package/dist/jobs/jobs.service.js.map +0 -1
  491. package/dist/jobs/jobs.state.d.ts +0 -113
  492. package/dist/jobs/jobs.state.js +0 -447
  493. package/dist/jobs/jobs.state.js.map +0 -1
  494. package/dist/jobs/types.d.ts +0 -449
  495. package/dist/jobs/types.js +0 -74
  496. package/dist/jobs/types.js.map +0 -1
  497. package/dist/logs/logs.repo.d.ts +0 -6
  498. package/dist/logs/logs.repo.js +0 -12
  499. package/dist/logs/logs.repo.js.map +0 -1
  500. package/dist/logs/logs.service.d.ts +0 -30
  501. package/dist/logs/logs.service.js +0 -89
  502. package/dist/logs/logs.service.js.map +0 -1
  503. package/dist/logs/logs.types.d.ts +0 -85
  504. package/dist/logs/logs.types.js +0 -52
  505. package/dist/logs/logs.types.js.map +0 -1
  506. package/dist/logs/utils/logs.utils.create.d.ts +0 -0
  507. package/dist/logs/utils/logs.utils.create.js +0 -1
  508. package/dist/logs/utils/logs.utils.create.js.map +0 -1
  509. package/dist/logs/utils/logs.utils.errors.d.ts +0 -2
  510. package/dist/logs/utils/logs.utils.errors.js +0 -8
  511. package/dist/logs/utils/logs.utils.errors.js.map +0 -1
  512. package/dist/models/index.d.ts +0 -6
  513. package/dist/models/index.js +0 -11
  514. package/dist/models/index.js.map +0 -1
  515. package/dist/models/models.service.d.ts +0 -137
  516. package/dist/models/models.service.js +0 -195
  517. package/dist/models/models.service.js.map +0 -1
  518. package/dist/notifications/index.d.ts +0 -13
  519. package/dist/notifications/index.js +0 -26
  520. package/dist/notifications/index.js.map +0 -1
  521. package/dist/notifications/notifications.service.d.ts +0 -268
  522. package/dist/notifications/notifications.service.js +0 -907
  523. package/dist/notifications/notifications.service.js.map +0 -1
  524. package/dist/notifications/types/index.d.ts +0 -4
  525. package/dist/notifications/types/index.js +0 -21
  526. package/dist/notifications/types/index.js.map +0 -1
  527. package/dist/notifications/types/notifications.types.d.ts +0 -454
  528. package/dist/notifications/types/notifications.types.js +0 -51
  529. package/dist/notifications/types/notifications.types.js.map +0 -1
  530. package/dist/parsers/index.d.ts +0 -3
  531. package/dist/parsers/index.js +0 -27
  532. package/dist/parsers/index.js.map +0 -1
  533. package/dist/parsers/pipelines/postman.pipelines.d.ts +0 -15
  534. package/dist/parsers/pipelines/postman.pipelines.js +0 -103
  535. package/dist/parsers/pipelines/postman.pipelines.js.map +0 -1
  536. package/dist/parsers/types/postman.types.d.ts +0 -200
  537. package/dist/parsers/types/postman.types.js +0 -3
  538. package/dist/parsers/types/postman.types.js.map +0 -1
  539. package/dist/parsers/utils/postman.utils.d.ts +0 -12
  540. package/dist/parsers/utils/postman.utils.js +0 -116
  541. package/dist/parsers/utils/postman.utils.js.map +0 -1
  542. package/dist/parsers/validators/postman-auth.validators.d.ts +0 -10
  543. package/dist/parsers/validators/postman-auth.validators.js +0 -127
  544. package/dist/parsers/validators/postman-auth.validators.js.map +0 -1
  545. package/dist/parsers/validators/postman-request.validators.d.ts +0 -13
  546. package/dist/parsers/validators/postman-request.validators.js +0 -139
  547. package/dist/parsers/validators/postman-request.validators.js.map +0 -1
  548. package/dist/parsers/validators/postman-response.validators.d.ts +0 -13
  549. package/dist/parsers/validators/postman-response.validators.js +0 -150
  550. package/dist/parsers/validators/postman-response.validators.js.map +0 -1
  551. package/dist/parsers/validators/postman-variable.validators.d.ts +0 -14
  552. package/dist/parsers/validators/postman-variable.validators.js +0 -163
  553. package/dist/parsers/validators/postman-variable.validators.js.map +0 -1
  554. package/dist/pricing/pricing.repo.d.ts +0 -0
  555. package/dist/pricing/pricing.repo.js +0 -1
  556. package/dist/pricing/pricing.repo.js.map +0 -1
  557. package/dist/pricing/pricing.service.d.ts +0 -24
  558. package/dist/pricing/pricing.service.js +0 -51
  559. package/dist/pricing/pricing.service.js.map +0 -1
  560. package/dist/pricing/pricing.types.d.ts +0 -76
  561. package/dist/pricing/pricing.types.js +0 -21
  562. package/dist/pricing/pricing.types.js.map +0 -1
  563. package/dist/pricing/utils/string.utils.d.ts +0 -1
  564. package/dist/pricing/utils/string.utils.js +0 -9
  565. package/dist/pricing/utils/string.utils.js.map +0 -1
  566. package/dist/processor/repos/mongo.repo.d.ts +0 -39
  567. package/dist/processor/repos/mongo.repo.js +0 -260
  568. package/dist/processor/repos/mongo.repo.js.map +0 -1
  569. package/dist/processor/repos/postgres.repo.d.ts +0 -31
  570. package/dist/processor/repos/postgres.repo.js +0 -185
  571. package/dist/processor/repos/postgres.repo.js.map +0 -1
  572. package/dist/processor/repos/sms.repo.d.ts +0 -39
  573. package/dist/processor/repos/sms.repo.js +0 -124
  574. package/dist/processor/repos/sms.repo.js.map +0 -1
  575. package/dist/processor/services/processor.service.d.ts +0 -465
  576. package/dist/processor/services/processor.service.js +0 -5343
  577. package/dist/processor/services/processor.service.js.map +0 -1
  578. package/dist/processor/services/request.service.d.ts +0 -36
  579. package/dist/processor/services/request.service.js +0 -304
  580. package/dist/processor/services/request.service.js.map +0 -1
  581. package/dist/processor/types/request.types.d.ts +0 -14
  582. package/dist/processor/types/request.types.js +0 -3
  583. package/dist/processor/types/request.types.js.map +0 -1
  584. package/dist/processor/utils/processor.utils.d.ts +0 -104
  585. package/dist/processor/utils/processor.utils.js +0 -1066
  586. package/dist/processor/utils/processor.utils.js.map +0 -1
  587. package/dist/processor/utils/request.utils.d.ts +0 -20
  588. package/dist/processor/utils/request.utils.js +0 -113
  589. package/dist/processor/utils/request.utils.js.map +0 -1
  590. package/dist/processor/utils/storage.util.d.ts +0 -8
  591. package/dist/processor/utils/storage.util.js +0 -106
  592. package/dist/processor/utils/storage.util.js.map +0 -1
  593. package/dist/products/services/products.service.d.ts +0 -577
  594. package/dist/products/services/products.service.js +0 -5845
  595. package/dist/products/services/products.service.js.map +0 -1
  596. package/dist/products/utils/crypt.utils.d.ts +0 -1
  597. package/dist/products/utils/crypt.utils.js +0 -17
  598. package/dist/products/utils/crypt.utils.js.map +0 -1
  599. package/dist/products/utils/functions.utils.d.ts +0 -13
  600. package/dist/products/utils/functions.utils.js +0 -294
  601. package/dist/products/utils/functions.utils.js.map +0 -1
  602. package/dist/products/utils/objects.utils.d.ts +0 -13
  603. package/dist/products/utils/objects.utils.js +0 -89
  604. package/dist/products/utils/objects.utils.js.map +0 -1
  605. package/dist/products/utils/string.utils.d.ts +0 -12
  606. package/dist/products/utils/string.utils.js +0 -168
  607. package/dist/products/utils/string.utils.js.map +0 -1
  608. package/dist/products/validators/index.d.ts +0 -33
  609. package/dist/products/validators/index.js +0 -75
  610. package/dist/products/validators/index.js.map +0 -1
  611. package/dist/products/validators/joi-validators/create.html.validator.d.ts +0 -2
  612. package/dist/products/validators/joi-validators/create.html.validator.js +0 -55
  613. package/dist/products/validators/joi-validators/create.html.validator.js.map +0 -1
  614. package/dist/products/validators/joi-validators/create.productAgent.validator.d.ts +0 -3
  615. package/dist/products/validators/joi-validators/create.productAgent.validator.js +0 -266
  616. package/dist/products/validators/joi-validators/create.productAgent.validator.js.map +0 -1
  617. package/dist/products/validators/joi-validators/create.productApp.validator.d.ts +0 -4
  618. package/dist/products/validators/joi-validators/create.productApp.validator.js +0 -61
  619. package/dist/products/validators/joi-validators/create.productApp.validator.js.map +0 -1
  620. package/dist/products/validators/joi-validators/create.productCache.validator.d.ts +0 -3
  621. package/dist/products/validators/joi-validators/create.productCache.validator.js +0 -46
  622. package/dist/products/validators/joi-validators/create.productCache.validator.js.map +0 -1
  623. package/dist/products/validators/joi-validators/create.productDatabase.validator.d.ts +0 -3
  624. package/dist/products/validators/joi-validators/create.productDatabase.validator.js +0 -77
  625. package/dist/products/validators/joi-validators/create.productDatabase.validator.js.map +0 -1
  626. package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.d.ts +0 -7
  627. package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.js +0 -194
  628. package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.js.map +0 -1
  629. package/dist/products/validators/joi-validators/create.productDatabaseMigration.validator.d.ts +0 -4
  630. package/dist/products/validators/joi-validators/create.productDatabaseMigration.validator.js +0 -63
  631. package/dist/products/validators/joi-validators/create.productDatabaseMigration.validator.js.map +0 -1
  632. package/dist/products/validators/joi-validators/create.productEnv.validator.d.ts +0 -3
  633. package/dist/products/validators/joi-validators/create.productEnv.validator.js +0 -45
  634. package/dist/products/validators/joi-validators/create.productEnv.validator.js.map +0 -1
  635. package/dist/products/validators/joi-validators/create.productFallback.validator.d.ts +0 -3
  636. package/dist/products/validators/joi-validators/create.productFallback.validator.js +0 -64
  637. package/dist/products/validators/joi-validators/create.productFallback.validator.js.map +0 -1
  638. package/dist/products/validators/joi-validators/create.productFeature.validator.d.ts +0 -14
  639. package/dist/products/validators/joi-validators/create.productFeature.validator.js +0 -140
  640. package/dist/products/validators/joi-validators/create.productFeature.validator.js.map +0 -1
  641. package/dist/products/validators/joi-validators/create.productFunction.validator.d.ts +0 -3
  642. package/dist/products/validators/joi-validators/create.productFunction.validator.js +0 -57
  643. package/dist/products/validators/joi-validators/create.productFunction.validator.js.map +0 -1
  644. package/dist/products/validators/joi-validators/create.productGraph.validator.d.ts +0 -3
  645. package/dist/products/validators/joi-validators/create.productGraph.validator.js +0 -89
  646. package/dist/products/validators/joi-validators/create.productGraph.validator.js.map +0 -1
  647. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.d.ts +0 -4
  648. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js +0 -58
  649. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +0 -1
  650. package/dist/products/validators/joi-validators/create.productJob.validator.d.ts +0 -12
  651. package/dist/products/validators/joi-validators/create.productJob.validator.js +0 -60
  652. package/dist/products/validators/joi-validators/create.productJob.validator.js.map +0 -1
  653. package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.d.ts +0 -3
  654. package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js +0 -52
  655. package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js.map +0 -1
  656. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.d.ts +0 -3
  657. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +0 -193
  658. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +0 -1
  659. package/dist/products/validators/joi-validators/create.productModel.validator.d.ts +0 -3
  660. package/dist/products/validators/joi-validators/create.productModel.validator.js +0 -132
  661. package/dist/products/validators/joi-validators/create.productModel.validator.js.map +0 -1
  662. package/dist/products/validators/joi-validators/create.productNotification.validator.d.ts +0 -4
  663. package/dist/products/validators/joi-validators/create.productNotification.validator.js +0 -241
  664. package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +0 -1
  665. package/dist/products/validators/joi-validators/create.productNotificationMessage.validator.d.ts +0 -3
  666. package/dist/products/validators/joi-validators/create.productNotificationMessage.validator.js +0 -57
  667. package/dist/products/validators/joi-validators/create.productNotificationMessage.validator.js.map +0 -1
  668. package/dist/products/validators/joi-validators/create.productNotifications.validator.d.ts +0 -0
  669. package/dist/products/validators/joi-validators/create.productNotifications.validator.js +0 -1
  670. package/dist/products/validators/joi-validators/create.productNotifications.validator.js.map +0 -1
  671. package/dist/products/validators/joi-validators/create.productQuota.validator.d.ts +0 -3
  672. package/dist/products/validators/joi-validators/create.productQuota.validator.js +0 -67
  673. package/dist/products/validators/joi-validators/create.productQuota.validator.js.map +0 -1
  674. package/dist/products/validators/joi-validators/create.productStorage.validator.d.ts +0 -3
  675. package/dist/products/validators/joi-validators/create.productStorage.validator.js +0 -158
  676. package/dist/products/validators/joi-validators/create.productStorage.validator.js.map +0 -1
  677. package/dist/products/validators/joi-validators/create.productVector.validator.d.ts +0 -3
  678. package/dist/products/validators/joi-validators/create.productVector.validator.js +0 -136
  679. package/dist/products/validators/joi-validators/create.productVector.validator.js.map +0 -1
  680. package/dist/products/validators/joi-validators/create.products.validator.d.ts +0 -3
  681. package/dist/products/validators/joi-validators/create.products.validator.js +0 -43
  682. package/dist/products/validators/joi-validators/create.products.validator.js.map +0 -1
  683. package/dist/products/validators/joi-validators/create.requestAction.validator.d.ts +0 -2
  684. package/dist/products/validators/joi-validators/create.requestAction.validator.js +0 -45
  685. package/dist/products/validators/joi-validators/create.requestAction.validator.js.map +0 -1
  686. package/dist/products/validators/joi-validators/create.userAuth.validator.d.ts +0 -3
  687. package/dist/products/validators/joi-validators/create.userAuth.validator.js +0 -48
  688. package/dist/products/validators/joi-validators/create.userAuth.validator.js.map +0 -1
  689. package/dist/products/validators/joi-validators/register.productWebhooks.validator.d.ts +0 -3
  690. package/dist/products/validators/joi-validators/register.productWebhooks.validator.js +0 -48
  691. package/dist/products/validators/joi-validators/register.productWebhooks.validator.js.map +0 -1
  692. package/dist/products/validators/joi-validators/update.dataValue.validator.d.ts +0 -3
  693. package/dist/products/validators/joi-validators/update.dataValue.validator.js +0 -103
  694. package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +0 -1
  695. package/dist/products/validators/joi-validators/update.productApp.validator.d.ts +0 -3
  696. package/dist/products/validators/joi-validators/update.productApp.validator.js +0 -42
  697. package/dist/products/validators/joi-validators/update.productApp.validator.js.map +0 -1
  698. package/dist/products/validators/joi-validators/update.productCache.validator.d.ts +0 -3
  699. package/dist/products/validators/joi-validators/update.productCache.validator.js +0 -45
  700. package/dist/products/validators/joi-validators/update.productCache.validator.js.map +0 -1
  701. package/dist/products/validators/joi-validators/update.productDatabase.validator.d.ts +0 -3
  702. package/dist/products/validators/joi-validators/update.productDatabase.validator.js +0 -76
  703. package/dist/products/validators/joi-validators/update.productDatabase.validator.js.map +0 -1
  704. package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.d.ts +0 -3
  705. package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.js +0 -79
  706. package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.js.map +0 -1
  707. package/dist/products/validators/joi-validators/update.productDatabaseMigration.validator.d.ts +0 -4
  708. package/dist/products/validators/joi-validators/update.productDatabaseMigration.validator.js +0 -64
  709. package/dist/products/validators/joi-validators/update.productDatabaseMigration.validator.js.map +0 -1
  710. package/dist/products/validators/joi-validators/update.productEnv.validator.d.ts +0 -3
  711. package/dist/products/validators/joi-validators/update.productEnv.validator.js +0 -46
  712. package/dist/products/validators/joi-validators/update.productEnv.validator.js.map +0 -1
  713. package/dist/products/validators/joi-validators/update.productFallback.validator.d.ts +0 -3
  714. package/dist/products/validators/joi-validators/update.productFallback.validator.js +0 -60
  715. package/dist/products/validators/joi-validators/update.productFallback.validator.js.map +0 -1
  716. package/dist/products/validators/joi-validators/update.productFeature.validator.d.ts +0 -3
  717. package/dist/products/validators/joi-validators/update.productFeature.validator.js +0 -53
  718. package/dist/products/validators/joi-validators/update.productFeature.validator.js.map +0 -1
  719. package/dist/products/validators/joi-validators/update.productFunction.validator.d.ts +0 -3
  720. package/dist/products/validators/joi-validators/update.productFunction.validator.js +0 -41
  721. package/dist/products/validators/joi-validators/update.productFunction.validator.js.map +0 -1
  722. package/dist/products/validators/joi-validators/update.productGraph.validator.d.ts +0 -3
  723. package/dist/products/validators/joi-validators/update.productGraph.validator.js +0 -88
  724. package/dist/products/validators/joi-validators/update.productGraph.validator.js.map +0 -1
  725. package/dist/products/validators/joi-validators/update.productJob.validator.d.ts +0 -3
  726. package/dist/products/validators/joi-validators/update.productJob.validator.js +0 -50
  727. package/dist/products/validators/joi-validators/update.productJob.validator.js.map +0 -1
  728. package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.d.ts +0 -3
  729. package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.js +0 -52
  730. package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.js.map +0 -1
  731. package/dist/products/validators/joi-validators/update.productNotification.validator.d.ts +0 -3
  732. package/dist/products/validators/joi-validators/update.productNotification.validator.js +0 -47
  733. package/dist/products/validators/joi-validators/update.productNotification.validator.js.map +0 -1
  734. package/dist/products/validators/joi-validators/update.productNotificationMessage.validator.d.ts +0 -3
  735. package/dist/products/validators/joi-validators/update.productNotificationMessage.validator.js +0 -58
  736. package/dist/products/validators/joi-validators/update.productNotificationMessage.validator.js.map +0 -1
  737. package/dist/products/validators/joi-validators/update.productQuota.validator.d.ts +0 -3
  738. package/dist/products/validators/joi-validators/update.productQuota.validator.js +0 -64
  739. package/dist/products/validators/joi-validators/update.productQuota.validator.js.map +0 -1
  740. package/dist/products/validators/joi-validators/update.userAuth.validator.d.ts +0 -3
  741. package/dist/products/validators/joi-validators/update.userAuth.validator.js +0 -48
  742. package/dist/products/validators/joi-validators/update.userAuth.validator.js.map +0 -1
  743. package/dist/resilience/fallback.service.d.ts +0 -141
  744. package/dist/resilience/fallback.service.js +0 -766
  745. package/dist/resilience/fallback.service.js.map +0 -1
  746. package/dist/resilience/healthcheck.service.d.ts +0 -163
  747. package/dist/resilience/healthcheck.service.js +0 -1012
  748. package/dist/resilience/healthcheck.service.js.map +0 -1
  749. package/dist/resilience/index.d.ts +0 -104
  750. package/dist/resilience/index.js +0 -140
  751. package/dist/resilience/index.js.map +0 -1
  752. package/dist/resilience/quota.service.d.ts +0 -83
  753. package/dist/resilience/quota.service.js +0 -518
  754. package/dist/resilience/quota.service.js.map +0 -1
  755. package/dist/resilience/resilience.service.d.ts +0 -98
  756. package/dist/resilience/resilience.service.js +0 -560
  757. package/dist/resilience/resilience.service.js.map +0 -1
  758. package/dist/resilience/types/index.d.ts +0 -513
  759. package/dist/resilience/types/index.js +0 -29
  760. package/dist/resilience/types/index.js.map +0 -1
  761. package/dist/secrets/index.d.ts +0 -10
  762. package/dist/secrets/index.js +0 -33
  763. package/dist/secrets/index.js.map +0 -1
  764. package/dist/secrets/secrets.resolver.d.ts +0 -52
  765. package/dist/secrets/secrets.resolver.js +0 -236
  766. package/dist/secrets/secrets.resolver.js.map +0 -1
  767. package/dist/secrets/secrets.service.d.ts +0 -93
  768. package/dist/secrets/secrets.service.js +0 -246
  769. package/dist/secrets/secrets.service.js.map +0 -1
  770. package/dist/secrets/secrets.types.d.ts +0 -188
  771. package/dist/secrets/secrets.types.js +0 -87
  772. package/dist/secrets/secrets.types.js.map +0 -1
  773. package/dist/sessions/index.d.ts +0 -50
  774. package/dist/sessions/index.js +0 -96
  775. package/dist/sessions/index.js.map +0 -1
  776. package/dist/sessions/sessions.helper.d.ts +0 -88
  777. package/dist/sessions/sessions.helper.js +0 -190
  778. package/dist/sessions/sessions.helper.js.map +0 -1
  779. package/dist/sessions/sessions.resolver.d.ts +0 -188
  780. package/dist/sessions/sessions.resolver.js +0 -603
  781. package/dist/sessions/sessions.resolver.js.map +0 -1
  782. package/dist/sessions/sessions.service.d.ts +0 -194
  783. package/dist/sessions/sessions.service.js +0 -988
  784. package/dist/sessions/sessions.service.js.map +0 -1
  785. package/dist/sessions/types/index.d.ts +0 -344
  786. package/dist/sessions/types/index.js +0 -6
  787. package/dist/sessions/types/index.js.map +0 -1
  788. package/dist/storage/index.d.ts +0 -66
  789. package/dist/storage/index.js +0 -99
  790. package/dist/storage/index.js.map +0 -1
  791. package/dist/storage/storage.service.d.ts +0 -177
  792. package/dist/storage/storage.service.js +0 -905
  793. package/dist/storage/storage.service.js.map +0 -1
  794. package/dist/storage/types/index.d.ts +0 -270
  795. package/dist/storage/types/index.js +0 -6
  796. package/dist/storage/types/index.js.map +0 -1
  797. package/dist/storage/utils/storage.util.d.ts +0 -62
  798. package/dist/storage/utils/storage.util.js +0 -593
  799. package/dist/storage/utils/storage.util.js.map +0 -1
  800. package/dist/types/actions.types.d.ts +0 -0
  801. package/dist/types/actions.types.js +0 -1
  802. package/dist/types/actions.types.js.map +0 -1
  803. package/dist/types/appBuilder.types.d.ts +0 -316
  804. package/dist/types/appBuilder.types.js +0 -3
  805. package/dist/types/appBuilder.types.js.map +0 -1
  806. package/dist/types/database.types.d.ts +0 -9
  807. package/dist/types/database.types.js +0 -3
  808. package/dist/types/database.types.js.map +0 -1
  809. package/dist/types/enums.d.ts +0 -231
  810. package/dist/types/enums.js +0 -261
  811. package/dist/types/enums.js.map +0 -1
  812. package/dist/types/index.d.ts +0 -12
  813. package/dist/types/index.js +0 -29
  814. package/dist/types/index.js.map +0 -1
  815. package/dist/types/index.types.d.ts +0 -30
  816. package/dist/types/index.types.js +0 -9
  817. package/dist/types/index.types.js.map +0 -1
  818. package/dist/types/inputs.types.d.ts +0 -114
  819. package/dist/types/inputs.types.js +0 -44
  820. package/dist/types/inputs.types.js.map +0 -1
  821. package/dist/types/logs.types.d.ts +0 -19
  822. package/dist/types/logs.types.js +0 -8
  823. package/dist/types/logs.types.js.map +0 -1
  824. package/dist/types/pricing.types.d.ts +0 -4
  825. package/dist/types/pricing.types.js +0 -3
  826. package/dist/types/pricing.types.js.map +0 -1
  827. package/dist/types/processor.types.d.ts +0 -602
  828. package/dist/types/processor.types.js +0 -19
  829. package/dist/types/processor.types.js.map +0 -1
  830. package/dist/types/productsBuilder.types.d.ts +0 -1566
  831. package/dist/types/productsBuilder.types.js +0 -303
  832. package/dist/types/productsBuilder.types.js.map +0 -1
  833. package/dist/types/request-tracker.interface.d.ts +0 -0
  834. package/dist/types/request-tracker.interface.js +0 -1
  835. package/dist/types/request-tracker.interface.js.map +0 -1
  836. package/dist/types/requests.types.d.ts +0 -8
  837. package/dist/types/requests.types.js +0 -3
  838. package/dist/types/requests.types.js.map +0 -1
  839. package/dist/types/workspaces.types.d.ts +0 -28
  840. package/dist/types/workspaces.types.js +0 -4
  841. package/dist/types/workspaces.types.js.map +0 -1
  842. package/dist/utils/constants.d.ts +0 -1
  843. package/dist/utils/constants.js +0 -5
  844. package/dist/utils/constants.js.map +0 -1
  845. package/dist/utils/index.d.ts +0 -2
  846. package/dist/utils/index.js +0 -109
  847. package/dist/utils/index.js.map +0 -1
  848. package/dist/vector/actions/action-manager.d.ts +0 -140
  849. package/dist/vector/actions/action-manager.js +0 -356
  850. package/dist/vector/actions/action-manager.js.map +0 -1
  851. package/dist/vector/adapters/base.adapter.d.ts +0 -169
  852. package/dist/vector/adapters/base.adapter.js +0 -218
  853. package/dist/vector/adapters/base.adapter.js.map +0 -1
  854. package/dist/vector/adapters/index.d.ts +0 -10
  855. package/dist/vector/adapters/index.js +0 -19
  856. package/dist/vector/adapters/index.js.map +0 -1
  857. package/dist/vector/adapters/memory.adapter.d.ts +0 -85
  858. package/dist/vector/adapters/memory.adapter.js +0 -505
  859. package/dist/vector/adapters/memory.adapter.js.map +0 -1
  860. package/dist/vector/adapters/pinecone.adapter.d.ts +0 -52
  861. package/dist/vector/adapters/pinecone.adapter.js +0 -433
  862. package/dist/vector/adapters/pinecone.adapter.js.map +0 -1
  863. package/dist/vector/adapters/qdrant.adapter.d.ts +0 -56
  864. package/dist/vector/adapters/qdrant.adapter.js +0 -442
  865. package/dist/vector/adapters/qdrant.adapter.js.map +0 -1
  866. package/dist/vector/adapters/weaviate.adapter.d.ts +0 -68
  867. package/dist/vector/adapters/weaviate.adapter.js +0 -661
  868. package/dist/vector/adapters/weaviate.adapter.js.map +0 -1
  869. package/dist/vector/index.d.ts +0 -36
  870. package/dist/vector/index.js +0 -70
  871. package/dist/vector/index.js.map +0 -1
  872. package/dist/vector/types/action.interface.d.ts +0 -195
  873. package/dist/vector/types/action.interface.js +0 -100
  874. package/dist/vector/types/action.interface.js.map +0 -1
  875. package/dist/vector/types/connection.interface.d.ts +0 -151
  876. package/dist/vector/types/connection.interface.js +0 -8
  877. package/dist/vector/types/connection.interface.js.map +0 -1
  878. package/dist/vector/types/embedding.interface.d.ts +0 -144
  879. package/dist/vector/types/embedding.interface.js +0 -8
  880. package/dist/vector/types/embedding.interface.js.map +0 -1
  881. package/dist/vector/types/enums.d.ts +0 -104
  882. package/dist/vector/types/enums.js +0 -113
  883. package/dist/vector/types/enums.js.map +0 -1
  884. package/dist/vector/types/index.d.ts +0 -11
  885. package/dist/vector/types/index.js +0 -23
  886. package/dist/vector/types/index.js.map +0 -1
  887. package/dist/vector/types/vector.interface.d.ts +0 -315
  888. package/dist/vector/types/vector.interface.js +0 -8
  889. package/dist/vector/types/vector.interface.js.map +0 -1
  890. package/dist/vector/utils/index.d.ts +0 -6
  891. package/dist/vector/utils/index.js +0 -11
  892. package/dist/vector/utils/index.js.map +0 -1
  893. package/dist/vector/utils/vector-error.d.ts +0 -69
  894. package/dist/vector/utils/vector-error.js +0 -116
  895. package/dist/vector/utils/vector-error.js.map +0 -1
  896. package/dist/vector/vector-database.service.d.ts +0 -484
  897. package/dist/vector/vector-database.service.js +0 -1002
  898. package/dist/vector/vector-database.service.js.map +0 -1
  899. package/dist/vector/vector.service.d.ts +0 -283
  900. package/dist/vector/vector.service.js +0 -544
  901. package/dist/vector/vector.service.js.map +0 -1
  902. package/dist/warehouse/executor/index.d.ts +0 -5
  903. package/dist/warehouse/executor/index.js +0 -12
  904. package/dist/warehouse/executor/index.js.map +0 -1
  905. package/dist/warehouse/executor/joins/index.d.ts +0 -5
  906. package/dist/warehouse/executor/joins/index.js +0 -11
  907. package/dist/warehouse/executor/joins/index.js.map +0 -1
  908. package/dist/warehouse/executor/joins/join-executor.d.ts +0 -101
  909. package/dist/warehouse/executor/joins/join-executor.js +0 -493
  910. package/dist/warehouse/executor/joins/join-executor.js.map +0 -1
  911. package/dist/warehouse/executor/joins/semantic-join.d.ts +0 -64
  912. package/dist/warehouse/executor/joins/semantic-join.js +0 -241
  913. package/dist/warehouse/executor/joins/semantic-join.js.map +0 -1
  914. package/dist/warehouse/executor/single-source-executor.d.ts +0 -155
  915. package/dist/warehouse/executor/single-source-executor.js +0 -573
  916. package/dist/warehouse/executor/single-source-executor.js.map +0 -1
  917. package/dist/warehouse/index.d.ts +0 -79
  918. package/dist/warehouse/index.js +0 -111
  919. package/dist/warehouse/index.js.map +0 -1
  920. package/dist/warehouse/parser/index.d.ts +0 -4
  921. package/dist/warehouse/parser/index.js +0 -10
  922. package/dist/warehouse/parser/index.js.map +0 -1
  923. package/dist/warehouse/parser/query-parser.d.ts +0 -181
  924. package/dist/warehouse/parser/query-parser.js +0 -415
  925. package/dist/warehouse/parser/query-parser.js.map +0 -1
  926. package/dist/warehouse/registry/data-source-registry.d.ts +0 -207
  927. package/dist/warehouse/registry/data-source-registry.js +0 -396
  928. package/dist/warehouse/registry/data-source-registry.js.map +0 -1
  929. package/dist/warehouse/registry/index.d.ts +0 -4
  930. package/dist/warehouse/registry/index.js +0 -9
  931. package/dist/warehouse/registry/index.js.map +0 -1
  932. package/dist/warehouse/transactions/index.d.ts +0 -4
  933. package/dist/warehouse/transactions/index.js +0 -9
  934. package/dist/warehouse/transactions/index.js.map +0 -1
  935. package/dist/warehouse/transactions/saga-orchestrator.d.ts +0 -92
  936. package/dist/warehouse/transactions/saga-orchestrator.js +0 -383
  937. package/dist/warehouse/transactions/saga-orchestrator.js.map +0 -1
  938. package/dist/warehouse/types/index.d.ts +0 -9
  939. package/dist/warehouse/types/index.js +0 -33
  940. package/dist/warehouse/types/index.js.map +0 -1
  941. package/dist/warehouse/types/join.interface.d.ts +0 -225
  942. package/dist/warehouse/types/join.interface.js +0 -87
  943. package/dist/warehouse/types/join.interface.js.map +0 -1
  944. package/dist/warehouse/types/query.interface.d.ts +0 -232
  945. package/dist/warehouse/types/query.interface.js +0 -9
  946. package/dist/warehouse/types/query.interface.js.map +0 -1
  947. package/dist/warehouse/types/transaction.interface.d.ts +0 -236
  948. package/dist/warehouse/types/transaction.interface.js +0 -74
  949. package/dist/warehouse/types/transaction.interface.js.map +0 -1
  950. package/dist/warehouse/types/where.interface.d.ts +0 -208
  951. package/dist/warehouse/types/where.interface.js +0 -89
  952. package/dist/warehouse/types/where.interface.js.map +0 -1
  953. package/dist/warehouse/warehouse.service.d.ts +0 -200
  954. package/dist/warehouse/warehouse.service.js +0 -470
  955. package/dist/warehouse/warehouse.service.js.map +0 -1
  956. package/dist/workflows/index.d.ts +0 -30
  957. package/dist/workflows/index.js +0 -64
  958. package/dist/workflows/index.js.map +0 -1
  959. package/dist/workflows/types/index.d.ts +0 -6
  960. package/dist/workflows/types/index.js +0 -23
  961. package/dist/workflows/types/index.js.map +0 -1
  962. package/dist/workflows/types/workflows.types.d.ts +0 -1095
  963. package/dist/workflows/types/workflows.types.js +0 -13
  964. package/dist/workflows/types/workflows.types.js.map +0 -1
  965. package/dist/workflows/workflow-builder.d.ts +0 -70
  966. package/dist/workflows/workflow-builder.js +0 -353
  967. package/dist/workflows/workflow-builder.js.map +0 -1
  968. package/dist/workflows/workflow-executor.d.ts +0 -289
  969. package/dist/workflows/workflow-executor.js +0 -2467
  970. package/dist/workflows/workflow-executor.js.map +0 -1
  971. package/dist/workflows/workflows.service.d.ts +0 -412
  972. package/dist/workflows/workflows.service.js +0 -2233
  973. package/dist/workflows/workflows.service.js.map +0 -1
@@ -1,2594 +0,0 @@
1
- "use strict";
2
- /**
3
- * Graph Service
4
- *
5
- * Main service class for graph database operations.
6
- * Provides a unified API for working with different graph databases
7
- * (Neo4j, Neptune, ArangoDB, Memgraph).
8
- *
9
- * Based on Ductape Graph API documentation.
10
- */
11
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- var desc = Object.getOwnPropertyDescriptor(m, k);
14
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
- desc = { enumerable: true, get: function() { return m[k]; } };
16
- }
17
- Object.defineProperty(o, k2, desc);
18
- }) : (function(o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- o[k2] = m[k];
21
- }));
22
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
- Object.defineProperty(o, "default", { enumerable: true, value: v });
24
- }) : function(o, v) {
25
- o["default"] = v;
26
- });
27
- var __importStar = (this && this.__importStar) || (function () {
28
- var ownKeys = function(o) {
29
- ownKeys = Object.getOwnPropertyNames || function (o) {
30
- var ar = [];
31
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
- return ar;
33
- };
34
- return ownKeys(o);
35
- };
36
- return function (mod) {
37
- if (mod && mod.__esModule) return mod;
38
- var result = {};
39
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
- __setModuleDefault(result, mod);
41
- return result;
42
- };
43
- })();
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.GraphService = void 0;
49
- const adapter_factory_1 = require("./adapters/adapter.factory");
50
- const transaction_manager_1 = require("./transactions/transaction-manager");
51
- const graph_error_1 = require("./utils/graph-error");
52
- const products_service_1 = __importDefault(require("../products/services/products.service"));
53
- const productsBuilder_types_1 = require("../types/productsBuilder.types");
54
- const cache_manager_1 = require("../cache/cache.manager");
55
- const processor_service_1 = __importDefault(require("../processor/services/processor.service"));
56
- const crypto_1 = require("crypto");
57
- const logs_service_1 = __importDefault(require("../logs/logs.service"));
58
- const logs_types_1 = require("../logs/logs.types");
59
- const processor_utils_1 = require("../processor/utils/processor.utils");
60
- const secrets_1 = require("../secrets");
61
- const sharedGraphRegistry = new Map();
62
- const sharedGraphConnectInFlight = new Map();
63
- function getSharedGraphKey(workspaceId, product, graph, env) {
64
- return `${workspaceId}:${product}:${graph}:${env}`;
65
- }
66
- /** Log debounce: avoid duplicate connect logs across instances */
67
- const lastGraphConnectLogAt = new Map();
68
- const GRAPH_CONNECT_LOG_DEBOUNCE_MS = 15000;
69
- /**
70
- * Main graph database service
71
- */
72
- class GraphService {
73
- constructor(config) {
74
- /** Cache of adapters by connection key */
75
- this.adapters = new Map();
76
- /** Connection contexts */
77
- this.connectionContexts = new Map();
78
- /** Currently active connection context */
79
- this.currentContext = null;
80
- /** Transaction manager */
81
- this.transactionManager = null;
82
- /** Service configuration */
83
- this.config = null;
84
- /** Product builders cache */
85
- this.productBuilders = new Map();
86
- /** Local graph configurations */
87
- this.localConfigs = new Map();
88
- /** LogService instance for logging operations */
89
- this.logService = null;
90
- /** Current product ID for logging */
91
- this.productId = '';
92
- /** CacheManager for two-tier caching (Redis + remote) */
93
- this.cacheManager = null;
94
- /** Private keys cache for products (keyed by product tag) */
95
- this.privateKeys = new Map();
96
- // ==================== GRAPH ACTIONS ====================
97
- /** Local cache of graph actions */
98
- this.actions = new Map();
99
- // ==================== UTILITY METHODS ====================
100
- /** Maximum retry attempts for auto-reconnection */
101
- this.maxReconnectRetries = 2;
102
- /** Flag to track if reconnection is in progress */
103
- this.reconnecting = false;
104
- this.adapterFactory = new adapter_factory_1.GraphAdapterFactory();
105
- if (config) {
106
- this.config = config;
107
- this._privateKey = config.private_key || '';
108
- // Initialize CacheManager (Redis is optional - Tier 1 internal cache and Tier 3 remote cache always work)
109
- this.cacheManager = new cache_manager_1.CacheManager({
110
- workspace_id: config.workspace_id,
111
- public_key: config.public_key,
112
- user_id: config.user_id,
113
- token: config.token,
114
- env_type: config.env_type,
115
- redis_client: config.redis_client, // Optional - Tier 2 cache
116
- });
117
- }
118
- }
119
- // ==================== CONFIGURATION ====================
120
- /**
121
- * Update service configuration
122
- */
123
- updateConfig(config) {
124
- this.config = config;
125
- }
126
- /**
127
- * Get service configuration
128
- */
129
- getConfig() {
130
- return this.config;
131
- }
132
- // ==================== PRODUCT BUILDER MANAGEMENT ====================
133
- /**
134
- * Create a new ProductBuilder instance
135
- */
136
- createNewProductBuilder() {
137
- if (!this.config) {
138
- throw graph_error_1.GraphError.configurationError('GraphService not configured. Please provide config when initializing.');
139
- }
140
- return new products_service_1.default({
141
- workspace_id: this.config.workspace_id,
142
- public_key: this.config.public_key,
143
- user_id: this.config.user_id,
144
- token: this.config.token,
145
- env_type: this.config.env_type,
146
- access_key: this.config.access_key,
147
- });
148
- }
149
- /**
150
- * Get or create a ProductBuilder instance for the given product tag
151
- */
152
- async getProductBuilder(productTag) {
153
- let builder = this.productBuilders.get(productTag);
154
- if (!builder) {
155
- builder = this.createNewProductBuilder();
156
- await builder.initializeProductByTag(productTag);
157
- this.productBuilders.set(productTag, builder);
158
- // Update productId for logging
159
- this.productId = builder.fetchProductId() || '';
160
- // Cache private key for caching operations
161
- const privateKey = builder.fetchPrivateKey();
162
- if (privateKey) {
163
- this.privateKeys.set(productTag, privateKey);
164
- }
165
- }
166
- return builder;
167
- }
168
- /**
169
- * Initialize logging service
170
- */
171
- initializeLogService() {
172
- var _a;
173
- if (!this.logService && this.config) {
174
- this.logService = new logs_service_1.default({
175
- product_id: this.productId,
176
- workspace_id: this.config.workspace_id,
177
- public_key: this.config.public_key,
178
- user_id: this.config.user_id,
179
- token: this.config.token,
180
- env_type: this.config.env_type,
181
- workspace_private_key: (_a = this._privateKey) !== null && _a !== void 0 ? _a : undefined,
182
- });
183
- }
184
- }
185
- /**
186
- * Create a new ProcessorService instance for job scheduling
187
- */
188
- createNewProcessor() {
189
- if (!this.config) {
190
- throw graph_error_1.GraphError.configurationError('GraphService not configured. Please provide config when initializing.');
191
- }
192
- return new processor_service_1.default({
193
- workspace_id: this.config.workspace_id,
194
- public_key: this.config.public_key,
195
- user_id: this.config.user_id,
196
- token: this.config.token,
197
- env_type: this.config.env_type,
198
- private_key: this._privateKey,
199
- });
200
- }
201
- // ==================== GRAPH REGISTRATION ====================
202
- /**
203
- * Register a new graph database
204
- * As documented in getting-started.md
205
- *
206
- * @example
207
- * ```ts
208
- * await ductape.graph.create({
209
- * name: 'Social Graph',
210
- * tag: 'social-graph',
211
- * type: 'neo4j',
212
- * description: 'Stores user relationships',
213
- * envs: [
214
- * { slug: 'dev', connection_url: 'bolt://localhost:7687' },
215
- * { slug: 'prd', connection_url: 'bolt://neo4j-prod:7687' },
216
- * ],
217
- * });
218
- * ```
219
- */
220
- async create(graphConfig, productTag) {
221
- var _a;
222
- // Validate required fields
223
- if (!graphConfig.name || !graphConfig.tag || !graphConfig.type || !((_a = graphConfig.envs) === null || _a === void 0 ? void 0 : _a.length)) {
224
- throw graph_error_1.GraphError.validationError('Graph configuration requires name, tag, type, and at least one environment');
225
- }
226
- const exists = await this.fetchGraphByTag(productTag, graphConfig.tag);
227
- if (exists) {
228
- return;
229
- }
230
- // Validate graph type
231
- if (!this.adapterFactory.isSupported(graphConfig.type)) {
232
- throw graph_error_1.GraphError.validationError(`Unsupported graph type: ${graphConfig.type}. ` +
233
- `Supported types: ${this.adapterFactory.getSupportedTypes().join(', ')}`);
234
- }
235
- // Process sensitive fields - store as secrets if not already secret references
236
- const processedEnvs = [];
237
- for (const env of graphConfig.envs) {
238
- // Store all sensitive fields as secrets
239
- const connectionUrl = productTag
240
- ? await this.storeAsSecretIfNeeded(env.connection_url, productTag, graphConfig.tag, env.slug, 'url', `Graph connection URL for ${graphConfig.tag} in ${env.slug}`)
241
- : env.connection_url;
242
- const graphName = productTag
243
- ? await this.storeAsSecretIfNeeded(env.graphName, productTag, graphConfig.tag, env.slug, 'graphName', `Graph name for ${graphConfig.tag} in ${env.slug}`)
244
- : env.graphName;
245
- const region = productTag
246
- ? await this.storeAsSecretIfNeeded(env.region, productTag, graphConfig.tag, env.slug, 'region', `AWS region for ${graphConfig.tag} in ${env.slug}`)
247
- : env.region;
248
- const username = productTag
249
- ? await this.storeAsSecretIfNeeded(env.username, productTag, graphConfig.tag, env.slug, 'username', `Username for ${graphConfig.tag} in ${env.slug}`)
250
- : env.username;
251
- const password = productTag
252
- ? await this.storeAsSecretIfNeeded(env.password, productTag, graphConfig.tag, env.slug, 'password', `Password for ${graphConfig.tag} in ${env.slug}`)
253
- : env.password;
254
- processedEnvs.push(Object.assign(Object.assign({}, env), { connection_url: connectionUrl || env.connection_url, graphName,
255
- region,
256
- username,
257
- password }));
258
- }
259
- // If productTag is provided, use ProductBuilder to persist to backend
260
- if (productTag) {
261
- const builder = await this.getProductBuilder(productTag);
262
- const productGraph = {
263
- name: graphConfig.name,
264
- tag: graphConfig.tag,
265
- description: graphConfig.description,
266
- type: graphConfig.type,
267
- envs: processedEnvs.map((env) => ({
268
- slug: env.slug,
269
- connection_url: env.connection_url,
270
- description: env.description,
271
- database: env.database,
272
- graphName: env.graphName,
273
- region: env.region,
274
- username: env.username,
275
- password: env.password,
276
- })),
277
- };
278
- await builder.createGraph(productGraph);
279
- }
280
- // Create local adapters and connection contexts
281
- const processedConfig = Object.assign(Object.assign({}, graphConfig), { envs: processedEnvs });
282
- this.createAdapter(processedConfig);
283
- }
284
- /**
285
- * Create local adapter and connection context for a graph configuration.
286
- * This is a lightweight operation that only sets up local state without API calls.
287
- * Use this when the graph config is already fetched/decrypted from the API.
288
- *
289
- * @param graphConfig - The graph configuration (already decrypted if from API)
290
- */
291
- createAdapter(graphConfig) {
292
- var _a;
293
- // Validate required fields
294
- if (!graphConfig.tag || !graphConfig.type || !((_a = graphConfig.envs) === null || _a === void 0 ? void 0 : _a.length)) {
295
- throw graph_error_1.GraphError.validationError('Graph configuration requires tag, type, and at least one environment');
296
- }
297
- // Validate graph type
298
- if (!this.adapterFactory.isSupported(graphConfig.type)) {
299
- throw graph_error_1.GraphError.validationError(`Unsupported graph type: ${graphConfig.type}. ` +
300
- `Supported types: ${this.adapterFactory.getSupportedTypes().join(', ')}`);
301
- }
302
- // Store in local configs
303
- this.localConfigs.set(graphConfig.tag, graphConfig);
304
- // Create adapters and contexts for each environment
305
- for (const envConfig of graphConfig.envs) {
306
- const contextKey = `${graphConfig.tag}:${envConfig.slug}`;
307
- // Skip if already exists
308
- if (this.adapters.has(contextKey) && this.connectionContexts.has(contextKey)) {
309
- continue;
310
- }
311
- const adapter = this.adapterFactory.create(graphConfig.type);
312
- this.adapters.set(contextKey, adapter);
313
- // Store connection context (not connected yet)
314
- this.connectionContexts.set(contextKey, {
315
- graph: graphConfig.tag,
316
- env: envConfig.slug,
317
- type: graphConfig.type,
318
- connectionUrl: envConfig.connection_url,
319
- connected: false,
320
- name: graphConfig.name,
321
- description: graphConfig.description,
322
- database: envConfig.database,
323
- graphName: envConfig.graphName,
324
- username: envConfig.username,
325
- password: envConfig.password,
326
- });
327
- }
328
- }
329
- /**
330
- * Generate a secret key for graph configuration field
331
- * Format: GRAPH_{PRODUCT}_{ASSET_TAG}_{ENV}_{KEY}
332
- *
333
- * Where:
334
- * - PRODUCT = productTag.split('.')[1] (second part after workspace)
335
- * - ASSET_TAG = if graphTag starts with same workspace prefix, use second part; otherwise sanitize full tag
336
- * - All parts are automatically capitalized
337
- */
338
- generateGraphSecretKey(productTag, graphTag, envSlug, field) {
339
- const sanitize = (str) => str.toUpperCase().replace(/[^A-Z0-9]/g, '_');
340
- // Support both ':' and '.' delimiters for product tags (e.g., 'ductape:rematch' or 'ductape.rematch')
341
- const productParts = productTag.includes(':') ? productTag.split(':') : productTag.split('.');
342
- const product = productParts[1] || productParts[0]; // Use product name (index 1), fallback to index 0
343
- const workspace = productParts[0];
344
- // Support both ':' and '.' delimiters for graph tags
345
- const graphParts = graphTag.includes(':') ? graphTag.split(':') : graphTag.split('.');
346
- let assetTag;
347
- if (graphParts.length > 1 && graphParts[0] === workspace) {
348
- // Same workspace prefix, use second part
349
- assetTag = graphParts[1];
350
- }
351
- else {
352
- // Different or no prefix, use full tag
353
- assetTag = graphTag;
354
- }
355
- return `GRAPH_${sanitize(product)}_${sanitize(assetTag)}_${sanitize(envSlug)}_${sanitize(field)}`;
356
- }
357
- /**
358
- * Store a value as a secret if it exists and is not already a secret reference
359
- * @returns The secret reference if stored, or the original value
360
- */
361
- async storeAsSecretIfNeeded(value, productTag, graphTag, envSlug, fieldName, description) {
362
- if (!value) {
363
- return undefined;
364
- }
365
- const secretsService = (0, secrets_1.getSecretsService)();
366
- const secretCheck = (0, secrets_1.isSecretReference)(value);
367
- console.log(`[GraphService.storeAsSecretIfNeeded] Processing '${fieldName}' for env '${envSlug}':`, {
368
- isSecretReference: secretCheck.isSecret,
369
- hasValue: !!value,
370
- });
371
- // If not already a secret reference and we have a secrets service, store it as a secret
372
- if (!secretCheck.isSecret && secretsService && productTag) {
373
- const secretKey = this.generateGraphSecretKey(productTag, graphTag, envSlug, fieldName);
374
- try {
375
- const exists = await secretsService.exists(secretKey);
376
- console.log(`[GraphService.storeAsSecretIfNeeded] Secret '${secretKey}' exists:`, exists);
377
- if (exists) {
378
- await secretsService.update(secretKey, { value });
379
- console.log(`[GraphService.storeAsSecretIfNeeded] Updated existing secret '${secretKey}'`);
380
- }
381
- else {
382
- await secretsService.create({
383
- key: secretKey,
384
- value,
385
- description,
386
- scope: [productTag, graphTag],
387
- envs: [envSlug],
388
- });
389
- console.log(`[GraphService.storeAsSecretIfNeeded] Created new secret '${secretKey}'`);
390
- }
391
- return `$Secret{${secretKey}}`;
392
- }
393
- catch (error) {
394
- console.warn(`[GraphService.storeAsSecretIfNeeded] Failed to store '${fieldName}' as secret: ${secretKey}`, error);
395
- // Continue with the original value
396
- return value;
397
- }
398
- }
399
- return value;
400
- }
401
- // ==================== PRODUCT COMPONENT FETCHING ====================
402
- /**
403
- * Fetch all graphs for a product using the product component fetcher
404
- * @param productTag - The product tag
405
- * @returns Array of IProductGraph objects
406
- */
407
- async fetchAllGraphs(productTag) {
408
- const builder = await this.getProductBuilder(productTag);
409
- return builder.fetchGraphs();
410
- }
411
- /**
412
- * Fetch a specific graph by tag using the product component fetcher
413
- * @param productTag - The product tag
414
- * @param graphTag - The graph tag
415
- * @returns The IProductGraph object or null if not found
416
- */
417
- async fetchGraphByTag(productTag, graphTag) {
418
- const builder = await this.getProductBuilder(productTag);
419
- return builder.fetchGraph(graphTag);
420
- }
421
- // ==================== GRAPH CONFIGURATION ====================
422
- /**
423
- * Fetch all registered graphs for a product
424
- */
425
- async fetchAll(productTag) {
426
- // Return local configs if no product tag
427
- if (!productTag) {
428
- return Array.from(this.localConfigs.values());
429
- }
430
- // Fetch from API using ProductBuilder
431
- try {
432
- const builder = await this.getProductBuilder(productTag);
433
- const graphs = await builder.fetchGraphs();
434
- // Convert IProductGraph[] to IGraphConfig[]
435
- return graphs.map((graph) => this.productGraphToConfig(graph));
436
- }
437
- catch (error) {
438
- // Fall back to local configs if API fails
439
- return Array.from(this.localConfigs.values());
440
- }
441
- }
442
- /**
443
- * Fetch a specific graph configuration
444
- */
445
- async fetch(graphTag, productTag) {
446
- // If productTag is provided, fetch from API
447
- if (productTag) {
448
- try {
449
- const builder = await this.getProductBuilder(productTag);
450
- const graph = await builder.fetchGraph(graphTag);
451
- if (graph) {
452
- const config = this.productGraphToConfig(graph);
453
- // Also update local cache
454
- this.localConfigs.set(graphTag, config);
455
- return config;
456
- }
457
- return null;
458
- }
459
- catch (error) {
460
- // Fall back to local config
461
- return this.localConfigs.get(graphTag) || null;
462
- }
463
- }
464
- return this.localConfigs.get(graphTag) || null;
465
- }
466
- /**
467
- * Update graph configuration
468
- */
469
- async update(graphTag, updates, productTag) {
470
- var _a;
471
- // If productTag is provided, use ProductBuilder to update in backend
472
- if (productTag) {
473
- const builder = await this.getProductBuilder(productTag);
474
- const productGraphUpdates = {
475
- name: updates.name,
476
- description: updates.description,
477
- type: updates.type,
478
- envs: (_a = updates.envs) === null || _a === void 0 ? void 0 : _a.map((env) => ({
479
- slug: env.slug,
480
- connection_url: env.connection_url,
481
- description: env.description,
482
- database: env.database,
483
- graphName: env.graphName,
484
- region: env.region,
485
- username: env.username,
486
- password: env.password,
487
- })),
488
- };
489
- await builder.updateGraph(graphTag, productGraphUpdates);
490
- }
491
- const existing = this.localConfigs.get(graphTag);
492
- if (!existing && !productTag) {
493
- throw graph_error_1.GraphError.notFoundError(`Graph '${graphTag}' not found`);
494
- }
495
- const updated = Object.assign(Object.assign(Object.assign({}, (existing || {})), updates), { tag: graphTag });
496
- this.localConfigs.set(graphTag, updated);
497
- // Update connection contexts
498
- if (updates.envs) {
499
- for (const envConfig of updates.envs) {
500
- const contextKey = `${graphTag}:${envConfig.slug}`;
501
- const existingContext = this.connectionContexts.get(contextKey);
502
- if (existingContext) {
503
- this.connectionContexts.set(contextKey, Object.assign(Object.assign({}, existingContext), { connectionUrl: envConfig.connection_url, database: envConfig.database, graphName: envConfig.graphName, username: envConfig.username, password: envConfig.password }));
504
- }
505
- }
506
- }
507
- }
508
- /**
509
- * Delete a graph configuration
510
- */
511
- async delete(graphTag, productTag) {
512
- var _a;
513
- // If productTag is provided, use ProductBuilder to delete from backend
514
- if (productTag) {
515
- const builder = await this.getProductBuilder(productTag);
516
- await builder.deleteGraph(graphTag);
517
- }
518
- // Get local config to clean up adapters and contexts
519
- const config = this.localConfigs.get(graphTag);
520
- if (config) {
521
- // Clean up adapters and contexts for each environment
522
- for (const envConfig of config.envs) {
523
- const contextKey = `${graphTag}:${envConfig.slug}`;
524
- // Disconnect adapter if connected
525
- const adapter = this.adapters.get(contextKey);
526
- if (adapter) {
527
- try {
528
- await adapter.disconnect();
529
- }
530
- catch (error) {
531
- // Ignore disconnect errors during cleanup
532
- }
533
- this.adapters.delete(contextKey);
534
- }
535
- // Remove connection context
536
- this.connectionContexts.delete(contextKey);
537
- }
538
- // Remove from local configs
539
- this.localConfigs.delete(graphTag);
540
- // Clear current context if it was the deleted graph
541
- if (((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph) === graphTag) {
542
- this.currentContext = null;
543
- this.transactionManager = null;
544
- }
545
- }
546
- else if (!productTag) {
547
- throw graph_error_1.GraphError.notFoundError(`Graph '${graphTag}' not found`);
548
- }
549
- }
550
- /**
551
- * Convert IProductGraph to IGraphConfig
552
- */
553
- productGraphToConfig(graph) {
554
- return {
555
- name: graph.name,
556
- tag: graph.tag,
557
- type: graph.type,
558
- description: graph.description,
559
- envs: graph.envs.map((env) => ({
560
- slug: env.slug,
561
- connection_url: env.connection_url,
562
- description: env.description,
563
- database: env.database,
564
- graphName: env.graphName,
565
- region: env.region,
566
- username: env.username,
567
- password: env.password,
568
- })),
569
- };
570
- }
571
- // ==================== CONNECTION MANAGEMENT ====================
572
- /**
573
- * Connect to a graph database
574
- * As documented in getting-started.md
575
- *
576
- * @example
577
- * ```ts
578
- * await ductape.graph.connect({
579
- * env: 'dev',
580
- * product: 'my-app',
581
- * graph: 'social-graph',
582
- * });
583
- * ```
584
- */
585
- async connect(config) {
586
- var _a, _b, _c;
587
- const process_id = (0, processor_utils_1.generateObjectId)();
588
- const start = Date.now();
589
- const contextKey = `${config.graph}:${config.env}`;
590
- const workspaceId = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) !== null && _b !== void 0 ? _b : '';
591
- const product = (_c = config.product) !== null && _c !== void 0 ? _c : '';
592
- const useShared = workspaceId !== '' && product !== '';
593
- if (useShared) {
594
- const sharedKey = getSharedGraphKey(workspaceId, product, config.graph, config.env);
595
- const existing = sharedGraphRegistry.get(sharedKey);
596
- if (existing === null || existing === void 0 ? void 0 : existing.context.connected) {
597
- this.adapters.set(contextKey, existing.adapter);
598
- this.connectionContexts.set(contextKey, existing.context);
599
- this.currentContext = existing.context;
600
- this.transactionManager = new transaction_manager_1.GraphTransactionManager(existing.adapter);
601
- return { connected: true, type: existing.context.type };
602
- }
603
- const inFlight = sharedGraphConnectInFlight.get(sharedKey);
604
- if (inFlight) {
605
- const entry = await inFlight;
606
- this.adapters.set(contextKey, entry.adapter);
607
- this.connectionContexts.set(contextKey, entry.context);
608
- this.currentContext = entry.context;
609
- this.transactionManager = new transaction_manager_1.GraphTransactionManager(entry.adapter);
610
- return { connected: true, type: entry.context.type };
611
- }
612
- const createPromise = this.connectAndRegisterGraphShared(sharedKey, config, contextKey);
613
- sharedGraphConnectInFlight.set(sharedKey, createPromise);
614
- try {
615
- const entry = await createPromise;
616
- this.adapters.set(contextKey, entry.adapter);
617
- this.connectionContexts.set(contextKey, entry.context);
618
- this.currentContext = entry.context;
619
- this.transactionManager = new transaction_manager_1.GraphTransactionManager(entry.adapter);
620
- return { connected: true, type: entry.context.type };
621
- }
622
- finally {
623
- sharedGraphConnectInFlight.delete(sharedKey);
624
- }
625
- }
626
- let adapter = this.adapters.get(contextKey);
627
- let context = this.connectionContexts.get(contextKey);
628
- if (!adapter || !context) {
629
- if (config.product)
630
- await this.getProductBuilder(config.product);
631
- const graphConfig = await this.fetchGraphFromProduct(config.product, config.graph);
632
- if (!graphConfig) {
633
- throw graph_error_1.GraphError.notFoundError(`Graph '${config.graph}' not found in product '${config.product}'`);
634
- }
635
- this.createAdapter(graphConfig);
636
- adapter = this.adapters.get(contextKey);
637
- context = this.connectionContexts.get(contextKey);
638
- }
639
- if (!adapter || !context) {
640
- throw graph_error_1.GraphError.configurationError(`Failed to initialize adapter for ${contextKey}`);
641
- }
642
- return this.runGraphConnect(config, contextKey, adapter, context, process_id, start);
643
- }
644
- /**
645
- * Disconnect any existing connection to this graph from the SDK (shared registry and this instance) before creating a fresh one.
646
- */
647
- async disconnectExistingForResource(sharedKey, contextKey, workspaceId, product, graph, env) {
648
- const existingInRegistry = sharedGraphRegistry.get(sharedKey);
649
- if (existingInRegistry) {
650
- try {
651
- await existingInRegistry.adapter.disconnect();
652
- existingInRegistry.context.connected = false;
653
- }
654
- catch (_a) {
655
- // Non-fatal
656
- }
657
- sharedGraphRegistry.delete(sharedKey);
658
- }
659
- const context = this.connectionContexts.get(contextKey);
660
- if (context === null || context === void 0 ? void 0 : context.connected) {
661
- const adapter = this.adapters.get(contextKey);
662
- if (adapter) {
663
- try {
664
- if (this.transactionManager)
665
- await this.transactionManager.rollbackAll();
666
- await adapter.disconnect();
667
- }
668
- catch (_b) {
669
- // Non-fatal
670
- }
671
- context.connected = false;
672
- if (workspaceId && product) {
673
- sharedGraphRegistry.delete(getSharedGraphKey(workspaceId, product, graph, env));
674
- }
675
- }
676
- }
677
- }
678
- async connectAndRegisterGraphShared(sharedKey, config, contextKey) {
679
- var _a, _b, _c;
680
- const workspaceId = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) !== null && _b !== void 0 ? _b : '';
681
- const product = (_c = config.product) !== null && _c !== void 0 ? _c : '';
682
- await this.disconnectExistingForResource(sharedKey, contextKey, workspaceId, product, config.graph, config.env);
683
- let adapter = this.adapters.get(contextKey);
684
- let context = this.connectionContexts.get(contextKey);
685
- if (!adapter || !context) {
686
- if (config.product)
687
- await this.getProductBuilder(config.product);
688
- const graphConfig = await this.fetchGraphFromProduct(config.product, config.graph);
689
- if (!graphConfig) {
690
- throw graph_error_1.GraphError.notFoundError(`Graph '${config.graph}' not found in product '${config.product}'`);
691
- }
692
- this.createAdapter(graphConfig);
693
- adapter = this.adapters.get(contextKey);
694
- context = this.connectionContexts.get(contextKey);
695
- }
696
- await this.runGraphConnect(config, contextKey, adapter, context, (0, processor_utils_1.generateObjectId)(), Date.now());
697
- const entry = { adapter, context };
698
- const raceExisting = sharedGraphRegistry.get(sharedKey);
699
- if (raceExisting) {
700
- try {
701
- await raceExisting.adapter.disconnect();
702
- raceExisting.context.connected = false;
703
- }
704
- catch (_d) {
705
- // Non-fatal
706
- }
707
- sharedGraphRegistry.delete(sharedKey);
708
- }
709
- sharedGraphRegistry.set(sharedKey, entry);
710
- return entry;
711
- }
712
- async runGraphConnect(config, contextKey, adapter, context, process_id, start) {
713
- var _a, _b, _c, _d, _e;
714
- this.initializeLogService();
715
- const envValue = config.env || '';
716
- const baseLogs = {
717
- product_tag: config.product || '',
718
- workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '',
719
- env: envValue,
720
- app_env: envValue,
721
- process_id,
722
- type: logs_types_1.LogEventTypes.GRAPH,
723
- parent_tag: config.graph,
724
- child_tag: 'connect',
725
- data: { graph: config.graph, env: envValue, operation: 'connect' },
726
- };
727
- const logKey = `${(_b = config.product) !== null && _b !== void 0 ? _b : ''}:${config.graph}:${config.env}`;
728
- const now = Date.now();
729
- const last = (_c = lastGraphConnectLogAt.get(logKey)) !== null && _c !== void 0 ? _c : {};
730
- if (this.logService && (!last.initiated || now - last.initiated >= GRAPH_CONNECT_LOG_DEBOUNCE_MS)) {
731
- lastGraphConnectLogAt.set(logKey, Object.assign(Object.assign({}, last), { initiated: now }));
732
- this.logService.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph connect - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
733
- }
734
- try {
735
- const secretsService = (0, secrets_1.getSecretsService)();
736
- const resolveSecret = async (value, fieldName) => {
737
- if (!value)
738
- return undefined;
739
- const secretCheck = (0, secrets_1.isSecretReference)(value);
740
- if (secretCheck.isSecret) {
741
- if (secretsService) {
742
- const resolved = await secretsService.resolve(value, { env: config.env });
743
- return resolved.value;
744
- }
745
- throw graph_error_1.GraphError.configurationError(`${fieldName} contains secret reference but secrets service is not initialized.`);
746
- }
747
- return value;
748
- };
749
- const connectionUrl = await resolveSecret(context.connectionUrl, 'connectionUrl');
750
- const graphName = await resolveSecret(context.graphName, 'graphName');
751
- const username = await resolveSecret(context.username, 'username');
752
- const password = await resolveSecret(context.password, 'password');
753
- if (!connectionUrl)
754
- throw graph_error_1.GraphError.configurationError('Connection URL is required');
755
- const result = await adapter.connect({
756
- connectionUrl,
757
- database: context.database,
758
- graphName: graphName || context.graphName,
759
- options: config.options,
760
- auth: username && password ? { username, password } : undefined,
761
- });
762
- context.connected = result.connected;
763
- context.product = config.product;
764
- this.connectionContexts.set(contextKey, context);
765
- this.currentContext = context;
766
- this.transactionManager = new transaction_manager_1.GraphTransactionManager(adapter);
767
- const end = Date.now();
768
- const lastSuccess = (_d = lastGraphConnectLogAt.get(logKey)) !== null && _d !== void 0 ? _d : {};
769
- if (this.logService && (!lastSuccess.success || end - lastSuccess.success >= GRAPH_CONNECT_LOG_DEBOUNCE_MS)) {
770
- lastGraphConnectLogAt.set(logKey, Object.assign(Object.assign({}, lastSuccess), { success: end }));
771
- this.logService.add(Object.assign(Object.assign({}, baseLogs), { start, end, message: 'Graph connect - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
772
- this.logService.publish();
773
- }
774
- return result;
775
- }
776
- catch (error) {
777
- const end = Date.now();
778
- const lastFail = (_e = lastGraphConnectLogAt.get(logKey)) !== null && _e !== void 0 ? _e : {};
779
- if (this.logService && (!lastFail.failed || end - lastFail.failed >= GRAPH_CONNECT_LOG_DEBOUNCE_MS)) {
780
- lastGraphConnectLogAt.set(logKey, Object.assign(Object.assign({}, lastFail), { failed: end }));
781
- this.logService.add(Object.assign(Object.assign({}, baseLogs), { start,
782
- end, message: 'Graph connect - failed', failed_execution: true, data: { graph: config.graph, env: config.env, error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
783
- await this.logService.publish();
784
- }
785
- throw error;
786
- }
787
- }
788
- /**
789
- * Test connection to a graph database
790
- */
791
- async testConnection(config) {
792
- const contextKey = `${config.graph}:${config.env}`;
793
- const context = this.connectionContexts.get(contextKey);
794
- if (!context) {
795
- throw graph_error_1.GraphError.notFoundError(`Graph configuration not found for ${config.graph}:${config.env}`);
796
- }
797
- const adapter = this.adapterFactory.create(context.type);
798
- return adapter.testConnection({
799
- connectionUrl: context.connectionUrl,
800
- database: context.database,
801
- graphName: context.graphName,
802
- options: config.options,
803
- auth: context.username && context.password ? { username: context.username, password: context.password } : undefined,
804
- });
805
- }
806
- /**
807
- * Disconnect from current graph
808
- */
809
- async disconnect() {
810
- var _a, _b, _c;
811
- if (this.currentContext) {
812
- const contextKey = `${this.currentContext.graph}:${this.currentContext.env}`;
813
- const adapter = this.adapters.get(contextKey);
814
- if (adapter) {
815
- if (this.transactionManager)
816
- await this.transactionManager.rollbackAll();
817
- await adapter.disconnect();
818
- this.currentContext.connected = false;
819
- const workspaceId = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) !== null && _b !== void 0 ? _b : '';
820
- const product = (_c = this.currentContext.product) !== null && _c !== void 0 ? _c : '';
821
- if (workspaceId && product) {
822
- sharedGraphRegistry.delete(getSharedGraphKey(workspaceId, product, this.currentContext.graph, this.currentContext.env));
823
- }
824
- }
825
- this.currentContext = null;
826
- }
827
- }
828
- /**
829
- * Disconnect from all graphs
830
- */
831
- async closeAll() {
832
- var _a, _b, _c;
833
- const workspaceId = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) !== null && _b !== void 0 ? _b : '';
834
- for (const [key, adapter] of this.adapters.entries()) {
835
- try {
836
- await adapter.disconnect();
837
- const context = this.connectionContexts.get(key);
838
- if (context) {
839
- context.connected = false;
840
- const product = (_c = context.product) !== null && _c !== void 0 ? _c : '';
841
- if (workspaceId && product) {
842
- sharedGraphRegistry.delete(getSharedGraphKey(workspaceId, product, context.graph, context.env));
843
- }
844
- }
845
- }
846
- catch (error) {
847
- console.error(`Failed to disconnect ${key}:`, error);
848
- }
849
- }
850
- if (this.transactionManager)
851
- await this.transactionManager.rollbackAll();
852
- this.currentContext = null;
853
- }
854
- // ==================== NODE OPERATIONS ====================
855
- /**
856
- * Create a node
857
- * As documented in nodes.md
858
- */
859
- async createNode(options, transaction) {
860
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
861
- await this.ensureConnectionFor(options);
862
- const process_id = (0, processor_utils_1.generateObjectId)();
863
- const start = Date.now();
864
- // Session log fields (will be populated if session is provided)
865
- let sessionLogFields = {};
866
- let resolvedOptions = options;
867
- // Process session if provided
868
- if (options.session && ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product)) {
869
- const builder = await this.getProductBuilder(this.currentContext.product);
870
- const privateKey = builder.fetchPrivateKey();
871
- if (privateKey) {
872
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
873
- const sessionResult = await processSessionForExecution(options.session, privateKey, options, this.currentContext.env, {
874
- fetchSessionSelector: async (sessionTag) => {
875
- const sessionConfig = await builder.fetchSession(sessionTag);
876
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
877
- },
878
- });
879
- if (sessionResult.error) {
880
- throw new Error(`Session validation failed: ${sessionResult.error}`);
881
- }
882
- resolvedOptions = sessionResult.input;
883
- sessionLogFields = sessionResult.logFields;
884
- }
885
- }
886
- this.initializeLogService();
887
- const envValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.env) || '';
888
- const graphValue = ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.graph) || '';
889
- const baseLogs = Object.assign({ product_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.product) || '', workspace_id: ((_e = this.config) === null || _e === void 0 ? void 0 : _e.workspace_id) || '', env: envValue, app_env: envValue, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: graphValue, child_tag: 'createNode', data: { labels: resolvedOptions.labels, operation: 'createNode', graph: graphValue, env: envValue, properties: resolvedOptions.properties } }, sessionLogFields);
890
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph createNode - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
891
- try {
892
- const adapter = this.getAdapter();
893
- const result = await adapter.createNode(resolvedOptions, transaction);
894
- const end = Date.now();
895
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { start,
896
- end, message: 'Graph createNode - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
897
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish();
898
- return result;
899
- }
900
- catch (error) {
901
- const end = Date.now();
902
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
903
- end, message: 'Graph createNode - failed', failed_execution: true, data: { labels: resolvedOptions.labels, operation: 'createNode', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
904
- await ((_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish());
905
- throw error;
906
- }
907
- }
908
- /**
909
- * Find nodes by criteria
910
- * As documented in nodes.md
911
- */
912
- async findNodes(options, transaction) {
913
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
914
- await this.ensureConnectionFor(options);
915
- const process_id = (0, processor_utils_1.generateObjectId)();
916
- const start = Date.now();
917
- // Session log fields (will be populated if session is provided)
918
- let sessionLogFields = {};
919
- let resolvedOptions = options;
920
- // Process session if provided
921
- if (options.session && ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product)) {
922
- const builder = await this.getProductBuilder(this.currentContext.product);
923
- const privateKey = builder.fetchPrivateKey();
924
- if (privateKey) {
925
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
926
- const sessionResult = await processSessionForExecution(options.session, privateKey, options, this.currentContext.env, {
927
- fetchSessionSelector: async (sessionTag) => {
928
- const sessionConfig = await builder.fetchSession(sessionTag);
929
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
930
- },
931
- });
932
- if (sessionResult.error) {
933
- throw new Error(`Session validation failed: ${sessionResult.error}`);
934
- }
935
- resolvedOptions = sessionResult.input;
936
- sessionLogFields = sessionResult.logFields;
937
- }
938
- }
939
- this.initializeLogService();
940
- const envValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.env) || '';
941
- const graphValue = ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.graph) || '';
942
- const baseLogs = Object.assign({ product_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.product) || '', workspace_id: ((_e = this.config) === null || _e === void 0 ? void 0 : _e.workspace_id) || '', env: envValue, app_env: envValue, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: graphValue, child_tag: 'findNodes', data: { labels: resolvedOptions.labels, operation: 'findNodes', graph: graphValue, env: envValue, where: resolvedOptions.where, select: resolvedOptions.select, orderBy: resolvedOptions.orderBy, limit: resolvedOptions.limit, offset: resolvedOptions.offset } }, sessionLogFields);
943
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph findNodes - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
944
- try {
945
- // Check cache if cache tag is provided
946
- const productTag = (_g = this.currentContext) === null || _g === void 0 ? void 0 : _g.product;
947
- const privateKey = productTag ? this.privateKeys.get(productTag) : undefined;
948
- if (resolvedOptions.cache && this.cacheManager && privateKey) {
949
- const cacheOptions = {
950
- cache_tag: resolvedOptions.cache,
951
- product_tag: productTag || '',
952
- component_tag: ((_h = this.currentContext) === null || _h === void 0 ? void 0 : _h.graph) || '',
953
- component_type: 'graph',
954
- input: {
955
- labels: resolvedOptions.labels,
956
- where: resolvedOptions.where,
957
- select: resolvedOptions.select,
958
- orderBy: resolvedOptions.orderBy,
959
- limit: resolvedOptions.limit,
960
- offset: resolvedOptions.offset,
961
- },
962
- privateKey,
963
- };
964
- const cached = await this.cacheManager.fetch(cacheOptions);
965
- if (cached.hit && cached.data) {
966
- const end = Date.now();
967
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
968
- end, message: `Graph findNodes - cache hit (${cached.source})`, successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS, cache_tag: resolvedOptions.cache, cache_key: cached.key, cache_status: true }));
969
- (_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish();
970
- return cached.data;
971
- }
972
- }
973
- const adapter = this.getAdapter();
974
- const result = await adapter.findNodes(resolvedOptions, transaction);
975
- // Store in cache if cache tag is provided
976
- if (resolvedOptions.cache && this.cacheManager && privateKey) {
977
- const cacheOptions = {
978
- cache_tag: resolvedOptions.cache,
979
- product_tag: productTag || '',
980
- component_tag: ((_l = this.currentContext) === null || _l === void 0 ? void 0 : _l.graph) || '',
981
- component_type: 'graph',
982
- input: {
983
- labels: resolvedOptions.labels,
984
- where: resolvedOptions.where,
985
- select: resolvedOptions.select,
986
- orderBy: resolvedOptions.orderBy,
987
- limit: resolvedOptions.limit,
988
- offset: resolvedOptions.offset,
989
- },
990
- privateKey,
991
- };
992
- this.cacheManager.store(cacheOptions, result); // Fire-and-forget
993
- }
994
- const end = Date.now();
995
- (_m = this.logService) === null || _m === void 0 ? void 0 : _m.add(Object.assign(Object.assign({}, baseLogs), { start,
996
- end, message: 'Graph findNodes - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
997
- (_o = this.logService) === null || _o === void 0 ? void 0 : _o.publish();
998
- return result;
999
- }
1000
- catch (error) {
1001
- const end = Date.now();
1002
- (_p = this.logService) === null || _p === void 0 ? void 0 : _p.add(Object.assign(Object.assign({}, baseLogs), { start,
1003
- end, message: 'Graph findNodes - failed', failed_execution: true, data: { labels: resolvedOptions.labels, operation: 'findNodes', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1004
- await ((_q = this.logService) === null || _q === void 0 ? void 0 : _q.publish());
1005
- throw error;
1006
- }
1007
- }
1008
- /**
1009
- * Find a node by ID
1010
- * As documented in nodes.md
1011
- */
1012
- async findNodeById(id, transaction) {
1013
- return this.executeWithRetry(async () => {
1014
- const adapter = this.getAdapter();
1015
- return adapter.findNodeById(id, transaction);
1016
- });
1017
- }
1018
- /**
1019
- * Update a node
1020
- * As documented in nodes.md
1021
- */
1022
- async updateNode(options, transaction) {
1023
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1024
- await this.ensureConnectionFor(options);
1025
- const process_id = (0, processor_utils_1.generateObjectId)();
1026
- const start = Date.now();
1027
- // Session log fields (will be populated if session is provided)
1028
- let sessionLogFields = {};
1029
- let resolvedOptions = options;
1030
- // Process session if provided
1031
- if (options.session && ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product)) {
1032
- const builder = await this.getProductBuilder(this.currentContext.product);
1033
- const privateKey = builder.fetchPrivateKey();
1034
- if (privateKey) {
1035
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
1036
- const sessionResult = await processSessionForExecution(options.session, privateKey, options, this.currentContext.env, {
1037
- fetchSessionSelector: async (sessionTag) => {
1038
- const sessionConfig = await builder.fetchSession(sessionTag);
1039
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
1040
- },
1041
- });
1042
- if (sessionResult.error) {
1043
- throw new Error(`Session validation failed: ${sessionResult.error}`);
1044
- }
1045
- resolvedOptions = sessionResult.input;
1046
- sessionLogFields = sessionResult.logFields;
1047
- }
1048
- }
1049
- this.initializeLogService();
1050
- const envValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.env) || '';
1051
- const graphValue = ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.graph) || '';
1052
- const baseLogs = Object.assign({ product_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.product) || '', workspace_id: ((_e = this.config) === null || _e === void 0 ? void 0 : _e.workspace_id) || '', env: envValue, app_env: envValue, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: graphValue, child_tag: 'updateNode', data: { id: resolvedOptions.id, operation: 'updateNode', graph: graphValue, env: envValue, properties: resolvedOptions.properties, labels: resolvedOptions.labels } }, sessionLogFields);
1053
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph updateNode - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
1054
- try {
1055
- const adapter = this.getAdapter();
1056
- const result = await adapter.updateNode(resolvedOptions, transaction);
1057
- const end = Date.now();
1058
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { start,
1059
- end, message: 'Graph updateNode - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
1060
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish();
1061
- return result;
1062
- }
1063
- catch (error) {
1064
- const end = Date.now();
1065
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
1066
- end, message: 'Graph updateNode - failed', failed_execution: true, data: { id: resolvedOptions.id, operation: 'updateNode', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1067
- await ((_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish());
1068
- throw error;
1069
- }
1070
- }
1071
- /**
1072
- * Delete a node
1073
- * As documented in nodes.md
1074
- */
1075
- async deleteNode(options, transaction) {
1076
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1077
- await this.ensureConnectionFor(options);
1078
- const process_id = (0, processor_utils_1.generateObjectId)();
1079
- const start = Date.now();
1080
- // Session log fields (will be populated if session is provided)
1081
- let sessionLogFields = {};
1082
- let resolvedOptions = options;
1083
- // Process session if provided
1084
- if (options.session && ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product)) {
1085
- const builder = await this.getProductBuilder(this.currentContext.product);
1086
- const privateKey = builder.fetchPrivateKey();
1087
- if (privateKey) {
1088
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
1089
- const sessionResult = await processSessionForExecution(options.session, privateKey, options, this.currentContext.env, {
1090
- fetchSessionSelector: async (sessionTag) => {
1091
- const sessionConfig = await builder.fetchSession(sessionTag);
1092
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
1093
- },
1094
- });
1095
- if (sessionResult.error) {
1096
- throw new Error(`Session validation failed: ${sessionResult.error}`);
1097
- }
1098
- resolvedOptions = sessionResult.input;
1099
- sessionLogFields = sessionResult.logFields;
1100
- }
1101
- }
1102
- this.initializeLogService();
1103
- const envValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.env) || '';
1104
- const graphValue = ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.graph) || '';
1105
- const baseLogs = Object.assign({ product_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.product) || '', workspace_id: ((_e = this.config) === null || _e === void 0 ? void 0 : _e.workspace_id) || '', env: envValue, app_env: envValue, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: graphValue, child_tag: 'deleteNode', data: { id: resolvedOptions.id, operation: 'deleteNode', graph: graphValue, env: envValue, detach: resolvedOptions.detach } }, sessionLogFields);
1106
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph deleteNode - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
1107
- try {
1108
- const adapter = this.getAdapter();
1109
- const result = await adapter.deleteNode(resolvedOptions, transaction);
1110
- const end = Date.now();
1111
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { start,
1112
- end, message: 'Graph deleteNode - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
1113
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish();
1114
- return result;
1115
- }
1116
- catch (error) {
1117
- const end = Date.now();
1118
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
1119
- end, message: 'Graph deleteNode - failed', failed_execution: true, data: { id: resolvedOptions.id, operation: 'deleteNode', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1120
- await ((_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish());
1121
- throw error;
1122
- }
1123
- }
1124
- /**
1125
- * Merge (upsert) a node
1126
- * As documented in nodes.md
1127
- */
1128
- async mergeNode(options, transaction) {
1129
- await this.ensureConnectionFor(options);
1130
- return this.executeWithRetry(async () => {
1131
- const adapter = this.getAdapter();
1132
- return adapter.mergeNode(options, transaction);
1133
- });
1134
- }
1135
- // ==================== LABEL MANAGEMENT ====================
1136
- /**
1137
- * Add labels to an existing node
1138
- *
1139
- * @example
1140
- * ```ts
1141
- * const result = await graphService.addLabels({
1142
- * id: 'node-123',
1143
- * labels: ['Admin', 'Verified'],
1144
- * });
1145
- * console.log(result.node.labels); // ['Person', 'Admin', 'Verified']
1146
- * ```
1147
- */
1148
- async addLabels(options, transaction) {
1149
- await this.ensureConnectionFor(options);
1150
- return this.executeWithRetry(async () => {
1151
- const adapter = this.getAdapter();
1152
- return adapter.addLabels(options, transaction);
1153
- });
1154
- }
1155
- /**
1156
- * Remove labels from an existing node
1157
- *
1158
- * @example
1159
- * ```ts
1160
- * const result = await graphService.removeLabels({
1161
- * id: 'node-123',
1162
- * labels: ['Temporary'],
1163
- * });
1164
- * console.log(result.removedLabels); // ['Temporary']
1165
- * ```
1166
- */
1167
- async removeLabels(options, transaction) {
1168
- await this.ensureConnectionFor(options);
1169
- return this.executeWithRetry(async () => {
1170
- const adapter = this.getAdapter();
1171
- return adapter.removeLabels(options, transaction);
1172
- });
1173
- }
1174
- /**
1175
- * Set labels on a node (replaces all existing labels)
1176
- *
1177
- * @example
1178
- * ```ts
1179
- * const result = await graphService.setLabels({
1180
- * id: 'node-123',
1181
- * labels: ['Person', 'Employee'],
1182
- * });
1183
- * console.log(result.previousLabels); // ['Person', 'Contractor']
1184
- * console.log(result.newLabels); // ['Person', 'Employee']
1185
- * ```
1186
- */
1187
- async setLabels(options, transaction) {
1188
- await this.ensureConnectionFor(options);
1189
- return this.executeWithRetry(async () => {
1190
- const adapter = this.getAdapter();
1191
- return adapter.setLabels(options, transaction);
1192
- });
1193
- }
1194
- // ==================== RELATIONSHIP OPERATIONS ====================
1195
- /**
1196
- * Create a relationship
1197
- * As documented in relationships.md
1198
- */
1199
- async createRelationship(options, transaction) {
1200
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1201
- await this.ensureConnectionFor(options);
1202
- const process_id = (0, processor_utils_1.generateObjectId)();
1203
- const start = Date.now();
1204
- this.initializeLogService();
1205
- // Session log fields (will be populated if session is provided)
1206
- let sessionLogFields = {};
1207
- let resolvedOptions = options;
1208
- // Process session if provided
1209
- if (options.session && ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product)) {
1210
- const builder = await this.getProductBuilder(this.currentContext.product);
1211
- const privateKey = builder.fetchPrivateKey();
1212
- if (privateKey) {
1213
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
1214
- const sessionResult = await processSessionForExecution(options.session, privateKey, options, this.currentContext.env, {
1215
- fetchSessionSelector: async (sessionTag) => {
1216
- const sessionConfig = await builder.fetchSession(sessionTag);
1217
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
1218
- },
1219
- });
1220
- if (sessionResult.error) {
1221
- throw new Error(`Session validation failed: ${sessionResult.error}`);
1222
- }
1223
- resolvedOptions = sessionResult.input;
1224
- sessionLogFields = sessionResult.logFields;
1225
- }
1226
- }
1227
- const envValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.env) || '';
1228
- const graphValue = ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.graph) || '';
1229
- const baseLogs = Object.assign({ product_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.product) || '', workspace_id: ((_e = this.config) === null || _e === void 0 ? void 0 : _e.workspace_id) || '', env: envValue, app_env: envValue, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: graphValue, child_tag: 'createRelationship', data: { type: resolvedOptions.type, operation: 'createRelationship', graph: graphValue, env: envValue, startNodeId: resolvedOptions.startNodeId, endNodeId: resolvedOptions.endNodeId, properties: resolvedOptions.properties } }, sessionLogFields);
1230
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph createRelationship - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
1231
- try {
1232
- const adapter = this.getAdapter();
1233
- const result = await adapter.createRelationship(resolvedOptions, transaction);
1234
- const end = Date.now();
1235
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { start,
1236
- end, message: 'Graph createRelationship - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
1237
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish();
1238
- return result;
1239
- }
1240
- catch (error) {
1241
- const end = Date.now();
1242
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
1243
- end, message: 'Graph createRelationship - failed', failed_execution: true, data: { type: resolvedOptions.type, operation: 'createRelationship', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1244
- await ((_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish());
1245
- throw error;
1246
- }
1247
- }
1248
- /**
1249
- * Find relationships by criteria
1250
- * As documented in relationships.md
1251
- */
1252
- async findRelationships(options, transaction) {
1253
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1254
- await this.ensureConnectionFor(options);
1255
- const process_id = (0, processor_utils_1.generateObjectId)();
1256
- const start = Date.now();
1257
- this.initializeLogService();
1258
- // Session log fields (will be populated if session is provided)
1259
- let sessionLogFields = {};
1260
- let resolvedOptions = options;
1261
- // Process session if provided
1262
- if (options.session && ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product)) {
1263
- const builder = await this.getProductBuilder(this.currentContext.product);
1264
- const privateKey = builder.fetchPrivateKey();
1265
- if (privateKey) {
1266
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
1267
- const sessionResult = await processSessionForExecution(options.session, privateKey, options, this.currentContext.env, {
1268
- fetchSessionSelector: async (sessionTag) => {
1269
- const sessionConfig = await builder.fetchSession(sessionTag);
1270
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
1271
- },
1272
- });
1273
- if (sessionResult.error) {
1274
- throw new Error(`Session validation failed: ${sessionResult.error}`);
1275
- }
1276
- resolvedOptions = sessionResult.input;
1277
- sessionLogFields = sessionResult.logFields;
1278
- }
1279
- }
1280
- const envValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.env) || '';
1281
- const graphValue = ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.graph) || '';
1282
- const baseLogs = Object.assign({ product_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.product) || '', workspace_id: ((_e = this.config) === null || _e === void 0 ? void 0 : _e.workspace_id) || '', env: envValue, app_env: envValue, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: graphValue, child_tag: 'findRelationships', data: { type: resolvedOptions.type, operation: 'findRelationships', graph: graphValue, env: envValue } }, sessionLogFields);
1283
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph findRelationships - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
1284
- try {
1285
- const adapter = this.getAdapter();
1286
- const result = await adapter.findRelationships(resolvedOptions, transaction);
1287
- const end = Date.now();
1288
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { start,
1289
- end, message: 'Graph findRelationships - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
1290
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish();
1291
- return result;
1292
- }
1293
- catch (error) {
1294
- const end = Date.now();
1295
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
1296
- end, message: 'Graph findRelationships - failed', failed_execution: true, data: { type: resolvedOptions.type, operation: 'findRelationships', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1297
- await ((_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish());
1298
- throw error;
1299
- }
1300
- }
1301
- /**
1302
- * Find a relationship by ID
1303
- */
1304
- async findRelationshipById(id, transaction) {
1305
- return this.executeWithRetry(async () => {
1306
- const adapter = this.getAdapter();
1307
- return adapter.findRelationshipById(id, transaction);
1308
- });
1309
- }
1310
- /**
1311
- * Update a relationship
1312
- * As documented in relationships.md
1313
- */
1314
- async updateRelationship(options, transaction) {
1315
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1316
- await this.ensureConnectionFor(options);
1317
- const process_id = (0, processor_utils_1.generateObjectId)();
1318
- const start = Date.now();
1319
- this.initializeLogService();
1320
- // Session log fields (will be populated if session is provided)
1321
- let sessionLogFields = {};
1322
- let resolvedOptions = options;
1323
- // Process session if provided
1324
- if (options.session && ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product)) {
1325
- const builder = await this.getProductBuilder(this.currentContext.product);
1326
- const privateKey = builder.fetchPrivateKey();
1327
- if (privateKey) {
1328
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
1329
- const sessionResult = await processSessionForExecution(options.session, privateKey, options, this.currentContext.env, {
1330
- fetchSessionSelector: async (sessionTag) => {
1331
- const sessionConfig = await builder.fetchSession(sessionTag);
1332
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
1333
- },
1334
- });
1335
- if (sessionResult.error) {
1336
- throw new Error(`Session validation failed: ${sessionResult.error}`);
1337
- }
1338
- resolvedOptions = sessionResult.input;
1339
- sessionLogFields = sessionResult.logFields;
1340
- }
1341
- }
1342
- const envValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.env) || '';
1343
- const graphValue = ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.graph) || '';
1344
- const baseLogs = Object.assign({ product_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.product) || '', workspace_id: ((_e = this.config) === null || _e === void 0 ? void 0 : _e.workspace_id) || '', env: envValue, app_env: envValue, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: graphValue, child_tag: 'updateRelationship', data: { id: resolvedOptions.id, operation: 'updateRelationship', graph: graphValue, env: envValue } }, sessionLogFields);
1345
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph updateRelationship - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
1346
- try {
1347
- const adapter = this.getAdapter();
1348
- const result = await adapter.updateRelationship(resolvedOptions, transaction);
1349
- const end = Date.now();
1350
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { start,
1351
- end, message: 'Graph updateRelationship - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
1352
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish();
1353
- return result;
1354
- }
1355
- catch (error) {
1356
- const end = Date.now();
1357
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
1358
- end, message: 'Graph updateRelationship - failed', failed_execution: true, data: { id: resolvedOptions.id, operation: 'updateRelationship', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1359
- await ((_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish());
1360
- throw error;
1361
- }
1362
- }
1363
- /**
1364
- * Delete a relationship
1365
- * As documented in relationships.md
1366
- */
1367
- async deleteRelationship(options, transaction) {
1368
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1369
- await this.ensureConnectionFor(options);
1370
- const process_id = (0, processor_utils_1.generateObjectId)();
1371
- const start = Date.now();
1372
- this.initializeLogService();
1373
- // Session log fields (will be populated if session is provided)
1374
- let sessionLogFields = {};
1375
- let resolvedOptions = options;
1376
- // Process session if provided
1377
- if (options.session && ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product)) {
1378
- const builder = await this.getProductBuilder(this.currentContext.product);
1379
- const privateKey = builder.fetchPrivateKey();
1380
- if (privateKey) {
1381
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
1382
- const sessionResult = await processSessionForExecution(options.session, privateKey, options, this.currentContext.env, {
1383
- fetchSessionSelector: async (sessionTag) => {
1384
- const sessionConfig = await builder.fetchSession(sessionTag);
1385
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
1386
- },
1387
- });
1388
- if (sessionResult.error) {
1389
- throw new Error(`Session validation failed: ${sessionResult.error}`);
1390
- }
1391
- resolvedOptions = sessionResult.input;
1392
- sessionLogFields = sessionResult.logFields;
1393
- }
1394
- }
1395
- const envValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.env) || '';
1396
- const graphValue = ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.graph) || '';
1397
- const baseLogs = Object.assign({ product_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.product) || '', workspace_id: ((_e = this.config) === null || _e === void 0 ? void 0 : _e.workspace_id) || '', env: envValue, app_env: envValue, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: graphValue, child_tag: 'deleteRelationship', data: { id: resolvedOptions.id, operation: 'deleteRelationship', graph: graphValue, env: envValue } }, sessionLogFields);
1398
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph deleteRelationship - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
1399
- try {
1400
- const adapter = this.getAdapter();
1401
- const result = await adapter.deleteRelationship(resolvedOptions, transaction);
1402
- const end = Date.now();
1403
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { start,
1404
- end, message: 'Graph deleteRelationship - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
1405
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish();
1406
- return result;
1407
- }
1408
- catch (error) {
1409
- const end = Date.now();
1410
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
1411
- end, message: 'Graph deleteRelationship - failed', failed_execution: true, data: { id: resolvedOptions.id, operation: 'deleteRelationship', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1412
- await ((_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish());
1413
- throw error;
1414
- }
1415
- }
1416
- /**
1417
- * Merge (upsert) a relationship
1418
- * As documented in relationships.md
1419
- */
1420
- async mergeRelationship(options, transaction) {
1421
- await this.ensureConnectionFor(options);
1422
- return this.executeWithRetry(async () => {
1423
- const adapter = this.getAdapter();
1424
- return adapter.mergeRelationship(options, transaction);
1425
- });
1426
- }
1427
- // ==================== TRAVERSAL OPERATIONS ====================
1428
- /**
1429
- * Traverse the graph from a starting node
1430
- * As documented in traversals.md
1431
- */
1432
- async traverse(options, transaction) {
1433
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1434
- await this.ensureConnectionFor(options);
1435
- const process_id = (0, processor_utils_1.generateObjectId)();
1436
- const start = Date.now();
1437
- this.initializeLogService();
1438
- const envValue = ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.env) || '';
1439
- const graphValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.graph) || '';
1440
- const baseLogs = {
1441
- product_tag: ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.product) || '',
1442
- workspace_id: ((_d = this.config) === null || _d === void 0 ? void 0 : _d.workspace_id) || '',
1443
- env: envValue,
1444
- app_env: envValue,
1445
- process_id,
1446
- type: logs_types_1.LogEventTypes.GRAPH,
1447
- parent_tag: graphValue,
1448
- child_tag: 'traverse',
1449
- data: { startNodeId: options.startNodeId, operation: 'traverse', graph: graphValue, env: envValue, direction: options.direction, maxDepth: options.maxDepth, relationshipTypes: options.relationshipTypes },
1450
- };
1451
- (_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph traverse - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
1452
- try {
1453
- const adapter = this.getAdapter();
1454
- const result = await adapter.traverse(options, transaction);
1455
- const end = Date.now();
1456
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start,
1457
- end, message: 'Graph traverse - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
1458
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.publish();
1459
- return result;
1460
- }
1461
- catch (error) {
1462
- const end = Date.now();
1463
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.add(Object.assign(Object.assign({}, baseLogs), { start,
1464
- end, message: 'Graph traverse - failed', failed_execution: true, data: { startNodeId: options.startNodeId, operation: 'traverse', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1465
- await ((_j = this.logService) === null || _j === void 0 ? void 0 : _j.publish());
1466
- throw error;
1467
- }
1468
- }
1469
- /**
1470
- * Find the shortest path between two nodes
1471
- * As documented in traversals.md
1472
- */
1473
- async shortestPath(options, transaction) {
1474
- await this.ensureConnectionFor(options);
1475
- return this.executeWithRetry(async () => {
1476
- const adapter = this.getAdapter();
1477
- return adapter.shortestPath(options, transaction);
1478
- });
1479
- }
1480
- /**
1481
- * Find all paths between two nodes
1482
- * As documented in traversals.md
1483
- */
1484
- async allPaths(options, transaction) {
1485
- await this.ensureConnectionFor(options);
1486
- return this.executeWithRetry(async () => {
1487
- const adapter = this.getAdapter();
1488
- return adapter.allPaths(options, transaction);
1489
- });
1490
- }
1491
- /**
1492
- * Get the neighborhood of a node
1493
- * As documented in traversals.md
1494
- */
1495
- async getNeighborhood(options, transaction) {
1496
- await this.ensureConnectionFor(options);
1497
- return this.executeWithRetry(async () => {
1498
- const adapter = this.getAdapter();
1499
- return adapter.getNeighborhood(options, transaction);
1500
- });
1501
- }
1502
- /**
1503
- * Find connected components in the graph
1504
- * As documented in traversals.md
1505
- */
1506
- async findConnectedComponents(options, transaction) {
1507
- await this.ensureConnectionFor(options);
1508
- return this.executeWithRetry(async () => {
1509
- const adapter = this.getAdapter();
1510
- return adapter.findConnectedComponents(options, transaction);
1511
- });
1512
- }
1513
- // ==================== AGGREGATION OPERATIONS ====================
1514
- /**
1515
- * Count nodes matching criteria
1516
- * As documented in overview.md
1517
- */
1518
- async countNodes(labels, where, transaction, session) {
1519
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1520
- const process_id = (0, processor_utils_1.generateObjectId)();
1521
- const start = Date.now();
1522
- this.initializeLogService();
1523
- // Session log fields (will be populated if session is provided)
1524
- let sessionLogFields = {};
1525
- let resolvedWhere = where;
1526
- // Process session if provided
1527
- if (session && ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product)) {
1528
- const builder = await this.getProductBuilder(this.currentContext.product);
1529
- const privateKey = builder.fetchPrivateKey();
1530
- if (privateKey) {
1531
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
1532
- const sessionResult = await processSessionForExecution(session, privateKey, { where }, this.currentContext.env, {
1533
- fetchSessionSelector: async (sessionTag) => {
1534
- const sessionConfig = await builder.fetchSession(sessionTag);
1535
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
1536
- },
1537
- });
1538
- if (sessionResult.error) {
1539
- throw new Error(`Session validation failed: ${sessionResult.error}`);
1540
- }
1541
- resolvedWhere = sessionResult.input.where;
1542
- sessionLogFields = sessionResult.logFields;
1543
- }
1544
- }
1545
- const envValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.env) || '';
1546
- const graphValue = ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.graph) || '';
1547
- const baseLogs = Object.assign({ product_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.product) || '', workspace_id: ((_e = this.config) === null || _e === void 0 ? void 0 : _e.workspace_id) || '', env: envValue, app_env: envValue, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: graphValue, child_tag: 'countNodes', data: { labels, operation: 'countNodes', graph: graphValue, env: envValue } }, sessionLogFields);
1548
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph countNodes - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
1549
- try {
1550
- const adapter = this.getAdapter();
1551
- const result = await adapter.countNodes(labels, resolvedWhere, transaction);
1552
- const end = Date.now();
1553
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { start,
1554
- end, message: 'Graph countNodes - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
1555
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish();
1556
- return result;
1557
- }
1558
- catch (error) {
1559
- const end = Date.now();
1560
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
1561
- end, message: 'Graph countNodes - failed', failed_execution: true, data: { labels, operation: 'countNodes', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1562
- await ((_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish());
1563
- throw error;
1564
- }
1565
- }
1566
- /**
1567
- * Count relationships matching criteria
1568
- * As documented in overview.md
1569
- */
1570
- async countRelationships(types, where, transaction) {
1571
- return this.executeWithRetry(async () => {
1572
- const adapter = this.getAdapter();
1573
- return adapter.countRelationships(types, where, transaction);
1574
- });
1575
- }
1576
- /**
1577
- * Get graph statistics
1578
- * As documented in overview.md
1579
- */
1580
- async getStatistics(transaction, session) {
1581
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1582
- const process_id = (0, processor_utils_1.generateObjectId)();
1583
- const start = Date.now();
1584
- this.initializeLogService();
1585
- // Session log fields (will be populated if session is provided)
1586
- let sessionLogFields = {};
1587
- // Process session if provided
1588
- if (session && ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product)) {
1589
- const builder = await this.getProductBuilder(this.currentContext.product);
1590
- const privateKey = builder.fetchPrivateKey();
1591
- if (privateKey) {
1592
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
1593
- const sessionResult = await processSessionForExecution(session, privateKey, {}, this.currentContext.env, {
1594
- fetchSessionSelector: async (sessionTag) => {
1595
- const sessionConfig = await builder.fetchSession(sessionTag);
1596
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
1597
- },
1598
- });
1599
- if (sessionResult.error) {
1600
- throw new Error(`Session validation failed: ${sessionResult.error}`);
1601
- }
1602
- sessionLogFields = sessionResult.logFields;
1603
- }
1604
- }
1605
- const envValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.env) || '';
1606
- const graphValue = ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.graph) || '';
1607
- const baseLogs = Object.assign({ product_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.product) || '', workspace_id: ((_e = this.config) === null || _e === void 0 ? void 0 : _e.workspace_id) || '', env: envValue, app_env: envValue, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: graphValue, child_tag: 'getStatistics', data: { operation: 'getStatistics', graph: graphValue, env: envValue } }, sessionLogFields);
1608
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph getStatistics - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
1609
- try {
1610
- const adapter = this.getAdapter();
1611
- const result = await adapter.getStatistics(transaction);
1612
- const end = Date.now();
1613
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { start,
1614
- end, message: 'Graph getStatistics - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
1615
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish();
1616
- return result;
1617
- }
1618
- catch (error) {
1619
- const end = Date.now();
1620
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
1621
- end, message: 'Graph getStatistics - failed', failed_execution: true, data: { operation: 'getStatistics', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1622
- await ((_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish());
1623
- throw error;
1624
- }
1625
- }
1626
- // ==================== SEARCH OPERATIONS ====================
1627
- /**
1628
- * Full-text search
1629
- * As documented in overview.md
1630
- */
1631
- async fullTextSearch(options, transaction) {
1632
- return this.executeWithRetry(async () => {
1633
- const adapter = this.getAdapter();
1634
- return adapter.fullTextSearch(options, transaction);
1635
- });
1636
- }
1637
- /**
1638
- * Vector similarity search
1639
- * As documented in overview.md
1640
- */
1641
- async vectorSearch(options, transaction) {
1642
- return this.executeWithRetry(async () => {
1643
- const adapter = this.getAdapter();
1644
- return adapter.vectorSearch(options, transaction);
1645
- });
1646
- }
1647
- // ==================== RAW QUERY ====================
1648
- /**
1649
- * Execute a raw query
1650
- * As documented in overview.md
1651
- *
1652
- * @example
1653
- * ```ts
1654
- * const result = await ductape.graph.query(
1655
- * 'MATCH (p:Person)-[:FRIENDS_WITH]->(f) WHERE p.name = $name RETURN f',
1656
- * { name: 'Alice' }
1657
- * );
1658
- * ```
1659
- */
1660
- async query(queryString, params, transaction) {
1661
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1662
- const process_id = (0, processor_utils_1.generateObjectId)();
1663
- const start = Date.now();
1664
- this.initializeLogService();
1665
- const envValue = ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.env) || '';
1666
- const graphValue = ((_b = this.currentContext) === null || _b === void 0 ? void 0 : _b.graph) || '';
1667
- const baseLogs = {
1668
- product_tag: ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.product) || '',
1669
- workspace_id: ((_d = this.config) === null || _d === void 0 ? void 0 : _d.workspace_id) || '',
1670
- env: envValue,
1671
- app_env: envValue,
1672
- process_id,
1673
- type: logs_types_1.LogEventTypes.GRAPH,
1674
- parent_tag: graphValue,
1675
- child_tag: 'query',
1676
- data: { operation: 'query', graph: graphValue, env: envValue, query: queryString.substring(0, 200) },
1677
- };
1678
- (_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph query - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
1679
- try {
1680
- const result = await this.executeWithRetry(async () => {
1681
- const adapter = this.getAdapter();
1682
- return adapter.query({ query: queryString, params }, transaction);
1683
- });
1684
- const end = Date.now();
1685
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { start,
1686
- end, message: 'Graph query - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS, data: { operation: 'query', graph: graphValue, env: envValue, recordCount: ((_g = result.records) === null || _g === void 0 ? void 0 : _g.length) || 0 } }));
1687
- (_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish();
1688
- return result;
1689
- }
1690
- catch (error) {
1691
- const end = Date.now();
1692
- (_j = this.logService) === null || _j === void 0 ? void 0 : _j.add(Object.assign(Object.assign({}, baseLogs), { start,
1693
- end, message: 'Graph query - failed', failed_execution: true, data: { operation: 'query', graph: graphValue, env: envValue, error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
1694
- await ((_k = this.logService) === null || _k === void 0 ? void 0 : _k.publish());
1695
- throw error;
1696
- }
1697
- }
1698
- // ==================== SCHEMA OPERATIONS ====================
1699
- /**
1700
- * Create a node index
1701
- * As documented in overview.md
1702
- */
1703
- async createNodeIndex(options) {
1704
- await this.ensureConnectionFor(options);
1705
- return this.executeWithRetry(async () => {
1706
- const adapter = this.getAdapter();
1707
- return adapter.createNodeIndex(options);
1708
- });
1709
- }
1710
- /**
1711
- * Create a node constraint
1712
- * As documented in overview.md
1713
- */
1714
- async createNodeConstraint(options) {
1715
- await this.ensureConnectionFor(options);
1716
- return this.executeWithRetry(async () => {
1717
- const adapter = this.getAdapter();
1718
- return adapter.createNodeConstraint(options);
1719
- });
1720
- }
1721
- /**
1722
- * Create a relationship index
1723
- */
1724
- async createRelationshipIndex(options) {
1725
- await this.ensureConnectionFor(options);
1726
- return this.executeWithRetry(async () => {
1727
- const adapter = this.getAdapter();
1728
- return adapter.createRelationshipIndex(options);
1729
- });
1730
- }
1731
- /**
1732
- * List all indexes
1733
- * As documented in overview.md
1734
- */
1735
- async listIndexes() {
1736
- return this.executeWithRetry(async () => {
1737
- const adapter = this.getAdapter();
1738
- return adapter.listIndexes();
1739
- });
1740
- }
1741
- /**
1742
- * List all constraints
1743
- */
1744
- async listConstraints() {
1745
- return this.executeWithRetry(async () => {
1746
- const adapter = this.getAdapter();
1747
- return adapter.listConstraints();
1748
- });
1749
- }
1750
- /**
1751
- * Drop an index
1752
- */
1753
- async dropIndex(name) {
1754
- return this.executeWithRetry(async () => {
1755
- const adapter = this.getAdapter();
1756
- return adapter.dropIndex(name);
1757
- });
1758
- }
1759
- /**
1760
- * Drop a constraint
1761
- */
1762
- async dropConstraint(name) {
1763
- return this.executeWithRetry(async () => {
1764
- const adapter = this.getAdapter();
1765
- return adapter.dropConstraint(name);
1766
- });
1767
- }
1768
- // ==================== SCHEMA INTROSPECTION ====================
1769
- /**
1770
- * List all node labels with counts and property information
1771
- * Used for GraphExplorer sidebar
1772
- */
1773
- async listLabels() {
1774
- return this.executeWithRetry(async () => {
1775
- const adapter = this.getAdapter();
1776
- return adapter.listLabels();
1777
- });
1778
- }
1779
- /**
1780
- * List all relationship types with counts
1781
- * Used for GraphExplorer sidebar
1782
- */
1783
- async listRelationshipTypes() {
1784
- return this.executeWithRetry(async () => {
1785
- const adapter = this.getAdapter();
1786
- return adapter.listRelationshipTypes();
1787
- });
1788
- }
1789
- /**
1790
- * Generate a URL-safe tag from a name
1791
- */
1792
- generateActionTag(name) {
1793
- return name
1794
- .toLowerCase()
1795
- .replace(/[^a-z0-9]+/g, '-')
1796
- .replace(/^-+|-+$/g, '');
1797
- }
1798
- /**
1799
- * Create a new graph action (saved parameterized query)
1800
- *
1801
- * @example
1802
- * ```ts
1803
- * const action = await graphService.createAction({
1804
- * name: 'Find Persons',
1805
- * description: 'Find persons with configurable limit',
1806
- * operation: 'findNodes',
1807
- * query: {
1808
- * operation: 'findNodes',
1809
- * options: { labels: ['Person'], limit: '{{limit}}' }
1810
- * },
1811
- * parameters: [
1812
- * { name: 'limit', path: 'options.limit', defaultValue: 25, type: 'number' }
1813
- * ]
1814
- * }, 'my-product');
1815
- * ```
1816
- */
1817
- async createAction(options, productTag) {
1818
- var _a;
1819
- const graphTag = options.graphTag || ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph);
1820
- if (!graphTag) {
1821
- throw graph_error_1.GraphError.configurationError('No graph specified. Please connect first or provide graphTag.');
1822
- }
1823
- const actionTag = this.generateActionTag(options.name);
1824
- const now = new Date().toISOString();
1825
- const action = {
1826
- id: `action_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
1827
- tag: actionTag,
1828
- name: options.name,
1829
- description: options.description,
1830
- operation: options.operation,
1831
- query: options.query,
1832
- parameters: options.parameters,
1833
- createdAt: now,
1834
- graphTag,
1835
- };
1836
- // If productTag is provided, persist to backend using ProductBuilder
1837
- if (productTag) {
1838
- try {
1839
- const builder = await this.getProductBuilder(productTag);
1840
- await builder.createGraphAction(graphTag, action);
1841
- }
1842
- catch (error) {
1843
- // Fall back to local storage if API fails
1844
- console.warn('Failed to persist action to backend, storing locally:', error);
1845
- }
1846
- }
1847
- // Store locally
1848
- const graphActions = this.actions.get(graphTag) || [];
1849
- graphActions.push(action);
1850
- this.actions.set(graphTag, graphActions);
1851
- return action;
1852
- }
1853
- /**
1854
- * List all actions for a graph
1855
- */
1856
- async listActions(graphTag, productTag) {
1857
- var _a;
1858
- const tag = graphTag || ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph);
1859
- if (!tag) {
1860
- throw graph_error_1.GraphError.configurationError('No graph specified. Please connect first or provide graphTag.');
1861
- }
1862
- // If productTag is provided, fetch from backend using ProductBuilder
1863
- if (productTag) {
1864
- try {
1865
- const builder = await this.getProductBuilder(productTag);
1866
- const actions = await builder.fetchGraphActions(tag);
1867
- // Update local cache
1868
- this.actions.set(tag, actions);
1869
- return { actions };
1870
- }
1871
- catch (error) {
1872
- // Fall back to local cache
1873
- console.warn('Failed to fetch actions from backend, using local cache:', error);
1874
- }
1875
- }
1876
- const actions = this.actions.get(tag) || [];
1877
- return { actions };
1878
- }
1879
- /**
1880
- * Get a specific action by tag
1881
- */
1882
- async getAction(actionTag, graphTag, productTag) {
1883
- var _a;
1884
- const tag = graphTag || ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph);
1885
- if (!tag) {
1886
- throw graph_error_1.GraphError.configurationError('No graph specified. Please connect first or provide graphTag.');
1887
- }
1888
- // If productTag is provided, fetch from backend using ProductBuilder
1889
- if (productTag) {
1890
- try {
1891
- const builder = await this.getProductBuilder(productTag);
1892
- const action = await builder.fetchGraphAction(tag, actionTag);
1893
- if (action) {
1894
- // Update local cache
1895
- const actions = this.actions.get(tag) || [];
1896
- const existingIndex = actions.findIndex((a) => a.tag === actionTag);
1897
- if (existingIndex >= 0) {
1898
- actions[existingIndex] = action;
1899
- }
1900
- else {
1901
- actions.push(action);
1902
- }
1903
- this.actions.set(tag, actions);
1904
- return action;
1905
- }
1906
- }
1907
- catch (error) {
1908
- // Fall back to local cache
1909
- console.warn('Failed to fetch action from backend, using local cache:', error);
1910
- }
1911
- }
1912
- const actions = this.actions.get(tag) || [];
1913
- return actions.find((a) => a.tag === actionTag) || null;
1914
- }
1915
- /**
1916
- * Update an existing action
1917
- */
1918
- async updateAction(actionTag, updates, graphTag, productTag) {
1919
- var _a, _b, _c, _d, _e;
1920
- const tag = graphTag || ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph);
1921
- if (!tag) {
1922
- throw graph_error_1.GraphError.configurationError('No graph specified. Please connect first or provide graphTag.');
1923
- }
1924
- const actions = this.actions.get(tag) || [];
1925
- const index = actions.findIndex((a) => a.tag === actionTag);
1926
- if (index === -1) {
1927
- throw graph_error_1.GraphError.notFoundError(`Action '${actionTag}' not found`);
1928
- }
1929
- const existing = actions[index];
1930
- const updated = Object.assign(Object.assign({}, existing), { name: (_b = updates.name) !== null && _b !== void 0 ? _b : existing.name, description: (_c = updates.description) !== null && _c !== void 0 ? _c : existing.description, query: (_d = updates.query) !== null && _d !== void 0 ? _d : existing.query, parameters: (_e = updates.parameters) !== null && _e !== void 0 ? _e : existing.parameters, updatedAt: new Date().toISOString() });
1931
- // If productTag is provided, persist to backend using ProductBuilder
1932
- if (productTag) {
1933
- try {
1934
- const builder = await this.getProductBuilder(productTag);
1935
- await builder.updateGraphAction(tag, actionTag, updated);
1936
- }
1937
- catch (error) {
1938
- console.warn('Failed to update action in backend:', error);
1939
- }
1940
- }
1941
- actions[index] = updated;
1942
- this.actions.set(tag, actions);
1943
- return updated;
1944
- }
1945
- /**
1946
- * Delete an action
1947
- */
1948
- async deleteAction(actionTag, graphTag, productTag) {
1949
- var _a;
1950
- const tag = graphTag || ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph);
1951
- if (!tag) {
1952
- throw graph_error_1.GraphError.configurationError('No graph specified. Please connect first or provide graphTag.');
1953
- }
1954
- // If productTag is provided, delete from backend using ProductBuilder
1955
- if (productTag) {
1956
- try {
1957
- const builder = await this.getProductBuilder(productTag);
1958
- await builder.deleteGraphAction(tag, actionTag);
1959
- }
1960
- catch (error) {
1961
- console.warn('Failed to delete action from backend:', error);
1962
- }
1963
- }
1964
- const actions = this.actions.get(tag) || [];
1965
- const filtered = actions.filter((a) => a.tag !== actionTag);
1966
- if (filtered.length === actions.length) {
1967
- throw graph_error_1.GraphError.notFoundError(`Action '${actionTag}' not found`);
1968
- }
1969
- this.actions.set(tag, filtered);
1970
- }
1971
- /**
1972
- * Execute a graph action with parameter substitution
1973
- *
1974
- * @example
1975
- * ```ts
1976
- * const result = await graphService.execute({
1977
- * product: 'my-app',
1978
- * env: 'dev',
1979
- * graph: 'social-graph',
1980
- * action: 'find-persons',
1981
- * input: { limit: 50 }
1982
- * });
1983
- * ```
1984
- */
1985
- async execute(options) {
1986
- var _a, _b, _c, _d, _e, _f, _g, _h;
1987
- const process_id = (0, processor_utils_1.generateObjectId)();
1988
- const startTime = Date.now();
1989
- // Session log fields (will be populated if session is provided)
1990
- let sessionLogFields = {};
1991
- let resolvedOptions = options;
1992
- // Initialize product builder and logging
1993
- if (options.product) {
1994
- const builder = await this.getProductBuilder(options.product);
1995
- // Process session if provided
1996
- if (options.session) {
1997
- const privateKey = builder.fetchPrivateKey();
1998
- if (privateKey) {
1999
- const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
2000
- const sessionResult = await processSessionForExecution(options.session, privateKey, options, options.env, {
2001
- fetchSessionSelector: async (sessionTag) => {
2002
- const sessionConfig = await builder.fetchSession(sessionTag);
2003
- return sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.selector;
2004
- },
2005
- });
2006
- if (sessionResult.error) {
2007
- throw new Error(`Session validation failed: ${sessionResult.error}`);
2008
- }
2009
- resolvedOptions = sessionResult.input;
2010
- sessionLogFields = sessionResult.logFields;
2011
- }
2012
- }
2013
- }
2014
- this.initializeLogService();
2015
- const baseLogs = Object.assign({ product_tag: options.product || '', workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '', env: options.env, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: options.graph, child_tag: options.action, data: { graph: options.graph, action: options.action, operation: 'execute' } }, sessionLogFields);
2016
- (_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { start: startTime, message: 'Graph action execute - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
2017
- // Get the action
2018
- const action = await this.getAction(resolvedOptions.action, resolvedOptions.graph);
2019
- if (!action) {
2020
- const end = Date.now();
2021
- (_c = this.logService) === null || _c === void 0 ? void 0 : _c.add(Object.assign(Object.assign({}, baseLogs), { start: startTime, end, message: 'Graph action execute - failed', failed_execution: true, data: { graph: options.graph, action: options.action, error: `Action '${options.action}' not found` }, status: logs_types_1.LogEventStatus.FAIL }));
2022
- await ((_d = this.logService) === null || _d === void 0 ? void 0 : _d.publish());
2023
- return {
2024
- success: false,
2025
- executionTime: end - startTime,
2026
- data: [],
2027
- count: 0,
2028
- error: `Action '${options.action}' not found`,
2029
- };
2030
- }
2031
- try {
2032
- // Build the query with parameter substitution
2033
- const query = this.substituteParameters(action.query, action.parameters, resolvedOptions.input || {});
2034
- // Execute based on operation type
2035
- const result = await this.executeOperation(query);
2036
- const end = Date.now();
2037
- (_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { start: startTime, end, message: 'Graph action execute - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
2038
- (_f = this.logService) === null || _f === void 0 ? void 0 : _f.publish();
2039
- return {
2040
- success: true,
2041
- executionTime: end - startTime,
2042
- data: result.data,
2043
- count: result.data.length,
2044
- };
2045
- }
2046
- catch (error) {
2047
- const end = Date.now();
2048
- (_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { start: startTime, end, message: 'Graph action execute - failed', failed_execution: true, data: { graph: options.graph, action: options.action, error: error.message || 'Execution failed' }, status: logs_types_1.LogEventStatus.FAIL }));
2049
- await ((_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish());
2050
- return {
2051
- success: false,
2052
- executionTime: end - startTime,
2053
- data: [],
2054
- count: 0,
2055
- error: error.message || 'Execution failed',
2056
- };
2057
- }
2058
- }
2059
- // ==================== DISPATCH OPERATIONS ====================
2060
- /**
2061
- * Action dispatch operations - for predefined graph actions.
2062
- */
2063
- get action() {
2064
- return {
2065
- /**
2066
- * Dispatches a graph action to run as a scheduled job.
2067
- * @param {IGraphActionDispatchInput} data - The graph action dispatch input.
2068
- * @returns {Promise<IDispatchResult>} The dispatch result with job ID and status.
2069
- * @example
2070
- * // Schedule a graph action to run in 1 hour
2071
- * await ductape.graph.action.dispatch({
2072
- * product: 'my-product',
2073
- * env: 'production',
2074
- * graph: 'social-graph',
2075
- * event: 'compute-recommendations',
2076
- * input: { userId: '123', limit: 10 },
2077
- * schedule: { start_at: Date.now() + 3600000 }
2078
- * });
2079
- *
2080
- * // Run on a cron schedule
2081
- * await ductape.graph.action.dispatch({
2082
- * product: 'my-product',
2083
- * env: 'production',
2084
- * graph: 'analytics-graph',
2085
- * event: 'aggregate-metrics',
2086
- * input: {},
2087
- * schedule: { cron: '0 0 * * *' } // Daily at midnight
2088
- * });
2089
- */
2090
- dispatch: async (data) => {
2091
- const processorService = this.createNewProcessor();
2092
- const productBuilder = await this.getProductBuilder(data.product);
2093
- const schedule = data.schedule || {};
2094
- const startAt = typeof schedule.start_at === 'string'
2095
- ? new Date(schedule.start_at).getTime()
2096
- : schedule.start_at || Date.now();
2097
- // Generate job tag based on type, graph, and event
2098
- const jobTag = `graph-action:${data.graph}:${data.event}`;
2099
- // Check if job exists, if not create it
2100
- const existingJob = await productBuilder.fetchJob(jobTag);
2101
- if (!existingJob) {
2102
- await productBuilder.createJob({
2103
- tag: jobTag,
2104
- name: `Graph Action: ${data.graph}/${data.event}`,
2105
- description: `Auto-created job for graph action ${data.event} on graph ${data.graph}`,
2106
- type: productsBuilder_types_1.JobEventTypes.GRAPH_ACTION,
2107
- app: data.graph,
2108
- event: data.event,
2109
- executions: 0,
2110
- intervals: schedule.every || 0,
2111
- start_at: startAt,
2112
- });
2113
- }
2114
- const jobInput = {
2115
- product: data.product,
2116
- env: data.env,
2117
- event: jobTag,
2118
- input: data.input,
2119
- retries: data.retries || 0,
2120
- start_at: startAt,
2121
- session: data.session,
2122
- cache: data.cache,
2123
- repeat: schedule.cron || schedule.every
2124
- ? {
2125
- cron: schedule.cron,
2126
- every: schedule.every,
2127
- limit: schedule.limit,
2128
- endDate: schedule.endDate,
2129
- tz: schedule.tz,
2130
- }
2131
- : undefined,
2132
- };
2133
- await processorService.processJob(jobInput);
2134
- const isRecurring = !!(schedule.cron || schedule.every);
2135
- let nextRunAt;
2136
- if (isRecurring && schedule.every) {
2137
- nextRunAt = startAt + schedule.every;
2138
- }
2139
- return {
2140
- job_id: (0, crypto_1.randomUUID)(),
2141
- status: startAt > Date.now() ? 'scheduled' : 'queued',
2142
- scheduled_at: startAt,
2143
- recurring: isRecurring,
2144
- next_run_at: nextRunAt,
2145
- };
2146
- },
2147
- };
2148
- }
2149
- /**
2150
- * Dispatches a graph operation to run as a scheduled job.
2151
- * Use this for direct graph operations (traverse, query, createNode, deleteNodes, etc.).
2152
- * @param {IGraphOperationDispatchInput} data - The graph operation dispatch input.
2153
- * @returns {Promise<IDispatchResult>} The dispatch result with job ID and status.
2154
- * @example
2155
- * // Schedule a graph traversal operation
2156
- * await ductape.graph.dispatch({
2157
- * product: 'my-product',
2158
- * env: 'production',
2159
- * graph: 'social-graph',
2160
- * operation: 'traverse',
2161
- * input: { startNode: 'user:123', direction: 'outgoing', depth: 3 },
2162
- * schedule: { start_at: Date.now() + 3600000 }
2163
- * });
2164
- *
2165
- * // Run periodic graph cleanup
2166
- * await ductape.graph.dispatch({
2167
- * product: 'my-product',
2168
- * env: 'production',
2169
- * graph: 'session-graph',
2170
- * operation: 'deleteNodes',
2171
- * input: { filter: { expired: true } },
2172
- * schedule: { cron: '0 4 * * *' } // Daily at 4 AM
2173
- * });
2174
- */
2175
- async dispatch(data) {
2176
- var _a, _b, _c, _d, _e, _f;
2177
- const process_id = (0, processor_utils_1.generateObjectId)();
2178
- const start = Date.now();
2179
- const processorService = this.createNewProcessor();
2180
- const productBuilder = await this.getProductBuilder(data.product);
2181
- const schedule = data.schedule || {};
2182
- const startAt = typeof schedule.start_at === 'string' ? new Date(schedule.start_at).getTime() : schedule.start_at || Date.now();
2183
- // Generate job tag based on type, graph, and operation
2184
- const jobTag = `graph-operation:${data.graph}:${data.operation}`;
2185
- // Initialize logging
2186
- this.initializeLogService();
2187
- const baseLogs = {
2188
- product_tag: data.product,
2189
- workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '',
2190
- env: data.env,
2191
- process_id,
2192
- type: logs_types_1.LogEventTypes.GRAPH,
2193
- parent_tag: data.graph,
2194
- child_tag: data.operation,
2195
- data: { graph: data.graph, operation: data.operation },
2196
- };
2197
- (_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { start, message: 'Graph dispatch - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
2198
- try {
2199
- // Check if job exists, if not create it
2200
- const existingJob = await productBuilder.fetchJob(jobTag);
2201
- if (!existingJob) {
2202
- await productBuilder.createJob({
2203
- tag: jobTag,
2204
- name: `Graph Operation: ${data.graph}/${data.operation}`,
2205
- description: `Auto-created job for graph operation ${data.operation} on graph ${data.graph}`,
2206
- type: productsBuilder_types_1.JobEventTypes.GRAPH_OPERATION,
2207
- app: data.graph,
2208
- event: data.operation,
2209
- executions: 0,
2210
- intervals: schedule.every || 0,
2211
- start_at: startAt,
2212
- });
2213
- }
2214
- const jobInput = {
2215
- product: data.product,
2216
- env: data.env,
2217
- event: jobTag,
2218
- input: data.input,
2219
- retries: data.retries || 0,
2220
- start_at: startAt,
2221
- session: data.session,
2222
- cache: data.cache,
2223
- repeat: schedule.cron || schedule.every
2224
- ? {
2225
- cron: schedule.cron,
2226
- every: schedule.every,
2227
- limit: schedule.limit,
2228
- endDate: schedule.endDate,
2229
- tz: schedule.tz,
2230
- }
2231
- : undefined,
2232
- };
2233
- await processorService.processJob(jobInput);
2234
- const isRecurring = !!(schedule.cron || schedule.every);
2235
- let nextRunAt;
2236
- if (isRecurring && schedule.every) {
2237
- nextRunAt = startAt + schedule.every;
2238
- }
2239
- const job_id = (0, crypto_1.randomUUID)();
2240
- const end = Date.now();
2241
- (_c = this.logService) === null || _c === void 0 ? void 0 : _c.add(Object.assign(Object.assign({}, baseLogs), { start,
2242
- end, message: 'Graph dispatch - success', successful_execution: true, data: { graph: data.graph, operation: data.operation, job_id }, status: logs_types_1.LogEventStatus.SUCCESS }));
2243
- (_d = this.logService) === null || _d === void 0 ? void 0 : _d.publish();
2244
- return {
2245
- job_id,
2246
- status: startAt > Date.now() ? 'scheduled' : 'queued',
2247
- scheduled_at: startAt,
2248
- recurring: isRecurring,
2249
- next_run_at: nextRunAt,
2250
- };
2251
- }
2252
- catch (error) {
2253
- const end = Date.now();
2254
- (_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { start,
2255
- end, message: 'Graph dispatch - failed', failed_execution: true, data: { graph: data.graph, operation: data.operation, error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
2256
- await ((_f = this.logService) === null || _f === void 0 ? void 0 : _f.publish());
2257
- throw error;
2258
- }
2259
- }
2260
- /**
2261
- * Substitute parameter placeholders in a query object
2262
- */
2263
- substituteParameters(query, parameters, input) {
2264
- var _a;
2265
- // Deep clone the query
2266
- const result = JSON.parse(JSON.stringify(query));
2267
- // Substitute each parameter
2268
- for (const param of parameters) {
2269
- const value = (_a = input[param.name]) !== null && _a !== void 0 ? _a : param.defaultValue;
2270
- this.setNestedValue(result, param.path, value);
2271
- }
2272
- return result;
2273
- }
2274
- /**
2275
- * Set a nested value in an object using a dot-notation path
2276
- */
2277
- setNestedValue(obj, path, value) {
2278
- const keys = path.replace(/\[(\d+)\]/g, '.$1').split('.');
2279
- let current = obj;
2280
- for (let i = 0; i < keys.length - 1; i++) {
2281
- const key = keys[i];
2282
- if (current[key] === undefined) {
2283
- current[key] = {};
2284
- }
2285
- current = current[key];
2286
- }
2287
- current[keys[keys.length - 1]] = value;
2288
- }
2289
- /**
2290
- * Execute an operation based on the query object
2291
- */
2292
- async executeOperation(query) {
2293
- const { operation, options } = query;
2294
- switch (operation) {
2295
- case 'findNodes': {
2296
- const result = await this.findNodes(options);
2297
- return { data: result.nodes };
2298
- }
2299
- case 'findRelationships': {
2300
- const result = await this.findRelationships(options);
2301
- return { data: result.relationships };
2302
- }
2303
- case 'traverse': {
2304
- const result = await this.traverse(options);
2305
- return { data: result.paths };
2306
- }
2307
- case 'shortestPath': {
2308
- const result = await this.shortestPath(options);
2309
- return { data: result.path ? [result.path] : [] };
2310
- }
2311
- case 'allPaths': {
2312
- const result = await this.allPaths(options);
2313
- return { data: result.paths };
2314
- }
2315
- case 'getNeighborhood': {
2316
- const result = await this.getNeighborhood(options);
2317
- return { data: result.nodes };
2318
- }
2319
- case 'countNodes': {
2320
- const result = await this.countNodes(options === null || options === void 0 ? void 0 : options.labels, options === null || options === void 0 ? void 0 : options.where);
2321
- return { data: [{ count: result.count }] };
2322
- }
2323
- case 'countRelationships': {
2324
- const result = await this.countRelationships(options === null || options === void 0 ? void 0 : options.types, options === null || options === void 0 ? void 0 : options.where);
2325
- return { data: [{ count: result.count }] };
2326
- }
2327
- case 'getStatistics': {
2328
- const result = await this.getStatistics();
2329
- return { data: [result] };
2330
- }
2331
- case 'executeRaw':
2332
- case 'query': {
2333
- const result = await this.query(options.query, options.params);
2334
- return { data: result.records };
2335
- }
2336
- default:
2337
- throw new Error(`Unsupported operation: ${operation}`);
2338
- }
2339
- }
2340
- // ==================== TRANSACTION OPERATIONS ====================
2341
- /**
2342
- * Execute operations within a transaction
2343
- * As documented in transactions.md
2344
- *
2345
- * @example
2346
- * ```ts
2347
- * const result = await ductape.graph.executeTransaction(async (transaction) => {
2348
- * const alice = await ductape.graph.createNode({
2349
- * labels: ['Person'],
2350
- * properties: { name: 'Alice' },
2351
- * }, transaction);
2352
- *
2353
- * const bob = await ductape.graph.createNode({
2354
- * labels: ['Person'],
2355
- * properties: { name: 'Bob' },
2356
- * }, transaction);
2357
- *
2358
- * await ductape.graph.createRelationship({
2359
- * type: 'FRIENDS_WITH',
2360
- * startNodeId: alice.node.id,
2361
- * endNodeId: bob.node.id,
2362
- * }, transaction);
2363
- *
2364
- * return { alice, bob };
2365
- * });
2366
- * ```
2367
- */
2368
- async executeTransaction(callback, options) {
2369
- if (!this.transactionManager) {
2370
- throw graph_error_1.GraphError.configurationError('No connection established. Please connect first.');
2371
- }
2372
- return this.transactionManager.executeTransaction(callback, options);
2373
- }
2374
- /**
2375
- * Begin a manual transaction
2376
- * As documented in transactions.md
2377
- */
2378
- async beginTransaction(options) {
2379
- if (!this.transactionManager) {
2380
- throw graph_error_1.GraphError.configurationError('No connection established. Please connect first.');
2381
- }
2382
- return this.transactionManager.beginTransaction(options);
2383
- }
2384
- /**
2385
- * Commit a transaction
2386
- */
2387
- async commitTransaction(transaction) {
2388
- if (!this.transactionManager) {
2389
- throw graph_error_1.GraphError.configurationError('No connection established.');
2390
- }
2391
- return this.transactionManager.commitTransaction(transaction);
2392
- }
2393
- /**
2394
- * Rollback a transaction
2395
- */
2396
- async rollbackTransaction(transaction) {
2397
- if (!this.transactionManager) {
2398
- throw graph_error_1.GraphError.configurationError('No connection established.');
2399
- }
2400
- return this.transactionManager.rollbackTransaction(transaction);
2401
- }
2402
- /**
2403
- * Get the current adapter (synchronous, throws if not connected)
2404
- */
2405
- getAdapter() {
2406
- if (!this.currentContext) {
2407
- throw graph_error_1.GraphError.configurationError('No connection established. Please call connect() first.');
2408
- }
2409
- const contextKey = `${this.currentContext.graph}:${this.currentContext.env}`;
2410
- const adapter = this.adapters.get(contextKey);
2411
- if (!adapter) {
2412
- throw graph_error_1.GraphError.configurationError(`Adapter not found for ${contextKey}`);
2413
- }
2414
- if (!this.currentContext.connected) {
2415
- throw graph_error_1.GraphError.connectionError('Not connected to graph database');
2416
- }
2417
- return adapter;
2418
- }
2419
- /**
2420
- * Ensure a connection exists for the given graph/env/product (connect on demand).
2421
- * Use before getAdapter() when options include graph+env+product (e.g. from proxy).
2422
- */
2423
- async ensureConnectionFor(options) {
2424
- if (!(options === null || options === void 0 ? void 0 : options.graph) || !(options === null || options === void 0 ? void 0 : options.env) || !(options === null || options === void 0 ? void 0 : options.product))
2425
- return;
2426
- const contextKey = `${options.graph}:${options.env}`;
2427
- const existingAdapter = this.adapters.get(contextKey);
2428
- const ctx = this.connectionContexts.get(contextKey);
2429
- if (existingAdapter && (ctx === null || ctx === void 0 ? void 0 : ctx.connected)) {
2430
- this.currentContext = ctx;
2431
- this.transactionManager = new transaction_manager_1.GraphTransactionManager(existingAdapter);
2432
- return;
2433
- }
2434
- await this.connect({ graph: options.graph, env: options.env, product: options.product });
2435
- }
2436
- /**
2437
- * Get the current adapter with automatic reconnection on failure
2438
- */
2439
- async getAdapterWithReconnect() {
2440
- if (!this.currentContext) {
2441
- throw graph_error_1.GraphError.configurationError('No connection established. Please call connect() first.');
2442
- }
2443
- const contextKey = `${this.currentContext.graph}:${this.currentContext.env}`;
2444
- const adapter = this.adapters.get(contextKey);
2445
- if (!adapter) {
2446
- throw graph_error_1.GraphError.configurationError(`Adapter not found for ${contextKey}`);
2447
- }
2448
- // If connected, return the adapter
2449
- if (this.currentContext.connected && adapter.isConnected()) {
2450
- return adapter;
2451
- }
2452
- // Connection lost - attempt to reconnect
2453
- await this.attemptReconnect();
2454
- // After reconnection, verify we're connected
2455
- if (!this.currentContext.connected) {
2456
- throw graph_error_1.GraphError.connectionError('Failed to reconnect to graph database');
2457
- }
2458
- return adapter;
2459
- }
2460
- /**
2461
- * Attempt to reconnect to the graph database
2462
- */
2463
- async attemptReconnect() {
2464
- var _a;
2465
- if (this.reconnecting) {
2466
- // Wait briefly if reconnection is already in progress
2467
- await new Promise(resolve => setTimeout(resolve, 1000));
2468
- if ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.connected)
2469
- return;
2470
- throw graph_error_1.GraphError.connectionError('Reconnection already in progress');
2471
- }
2472
- if (!this.currentContext) {
2473
- throw graph_error_1.GraphError.configurationError('Cannot reconnect: no connection context available');
2474
- }
2475
- this.reconnecting = true;
2476
- const { graph, env, product } = this.currentContext;
2477
- try {
2478
- console.log(`[GraphService] Attempting to reconnect to ${graph}:${env}...`);
2479
- // Attempt to reconnect using stored context
2480
- await this.connect({
2481
- graph,
2482
- env,
2483
- product: product || '',
2484
- });
2485
- console.log(`[GraphService] Successfully reconnected to ${graph}:${env}`);
2486
- }
2487
- catch (error) {
2488
- console.error(`[GraphService] Failed to reconnect to ${graph}:${env}:`, error);
2489
- throw error;
2490
- }
2491
- finally {
2492
- this.reconnecting = false;
2493
- }
2494
- }
2495
- /**
2496
- * Execute an operation with automatic retry on connection errors
2497
- */
2498
- async executeWithRetry(operation, retries = this.maxReconnectRetries) {
2499
- let lastError = null;
2500
- for (let attempt = 0; attempt <= retries; attempt++) {
2501
- try {
2502
- // Ensure we have a connected adapter before each attempt
2503
- await this.getAdapterWithReconnect();
2504
- return await operation();
2505
- }
2506
- catch (error) {
2507
- lastError = error;
2508
- // Check if this is a connection error
2509
- if (!this.isConnectionError(error) || attempt === retries) {
2510
- throw error;
2511
- }
2512
- console.log(`[GraphService] Connection error on attempt ${attempt + 1}/${retries + 1}, retrying...`);
2513
- // Mark as disconnected and try to reconnect
2514
- if (this.currentContext) {
2515
- this.currentContext.connected = false;
2516
- }
2517
- // Small delay before retry (exponential backoff)
2518
- await new Promise(resolve => setTimeout(resolve, 500 * (attempt + 1)));
2519
- }
2520
- }
2521
- throw lastError || new Error('Operation failed after retries');
2522
- }
2523
- /**
2524
- * Check if an error is a connection-related error that can be retried
2525
- * Note: "No connection established" errors are NOT retriable - they indicate
2526
- * connect() was never called, not that a connection was lost
2527
- */
2528
- isConnectionError(error) {
2529
- var _a, _b, _c;
2530
- const errorCode = ((_a = error.code) === null || _a === void 0 ? void 0 : _a.toString()) || '';
2531
- const errorMessage = ((_b = error.message) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || '';
2532
- const errorType = ((_c = error.type) === null || _c === void 0 ? void 0 : _c.toString()) || '';
2533
- // Configuration errors should NOT be retried - they require explicit connect() call
2534
- if (errorType === 'CONFIGURATION_ERROR' || errorMessage.includes('please call connect')) {
2535
- return false;
2536
- }
2537
- return (errorCode === 'ECONNRESET' ||
2538
- errorCode === 'ETIMEDOUT' ||
2539
- errorCode === 'ENOTFOUND' ||
2540
- errorCode === 'ECONNREFUSED' ||
2541
- errorCode === 'EPIPE' ||
2542
- errorCode === 'ServiceUnavailable' ||
2543
- errorCode === 'SessionExpired' ||
2544
- errorMessage.includes('connection terminated') ||
2545
- errorMessage.includes('connection timeout') ||
2546
- errorMessage.includes('connection refused') ||
2547
- errorMessage.includes('connection lost') ||
2548
- errorMessage.includes('connection closed') ||
2549
- errorMessage.includes('socket hang up') ||
2550
- errorMessage.includes('econnreset') ||
2551
- errorMessage.includes('network error') ||
2552
- errorMessage.includes('session expired') ||
2553
- errorMessage.includes('service unavailable') ||
2554
- errorMessage.includes('no longer valid') ||
2555
- errorMessage.includes('pool is closed'));
2556
- }
2557
- /**
2558
- * Fetch graph configuration from product API
2559
- */
2560
- async fetchGraphFromProduct(productTag, graphTag) {
2561
- try {
2562
- const builder = await this.getProductBuilder(productTag);
2563
- const graph = await builder.fetchGraph(graphTag);
2564
- if (graph) {
2565
- return this.productGraphToConfig(graph);
2566
- }
2567
- return null;
2568
- }
2569
- catch (error) {
2570
- console.warn(`[GraphService] Failed to fetch graph '${graphTag}' from product '${productTag}':`, error);
2571
- return null;
2572
- }
2573
- }
2574
- /**
2575
- * Get current connection context
2576
- */
2577
- getCurrentContext() {
2578
- return this.currentContext;
2579
- }
2580
- /**
2581
- * Check if a feature is supported by the current adapter
2582
- */
2583
- supportsFeature(feature) {
2584
- try {
2585
- const adapter = this.getAdapter();
2586
- return adapter.supportsFeature(feature);
2587
- }
2588
- catch (_a) {
2589
- return false;
2590
- }
2591
- }
2592
- }
2593
- exports.GraphService = GraphService;
2594
- //# sourceMappingURL=graphs.service.js.map