@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,1421 +0,0 @@
1
- "use strict";
2
- /**
3
- * Migration Engine
4
- *
5
- * Manages database migrations including running migrations,
6
- * rolling back, tracking migration history, and status checking.
7
- *
8
- * Executes platform-independent migration operations by translating
9
- * them to database-specific commands via the adapter.
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
- Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.MigrationHelpers = exports.MigrationEngine = void 0;
46
- const crypto = __importStar(require("crypto"));
47
- const enums_1 = require("../types/enums");
48
- const database_error_1 = require("../utils/database-error");
49
- /**
50
- * Migration tracking table/collection name
51
- */
52
- const MIGRATION_COLLECTION = '_ductape_migrations';
53
- /**
54
- * Migration Engine for managing database migrations
55
- */
56
- class MigrationEngine {
57
- constructor(adapter) {
58
- this.adapter = adapter;
59
- this.databaseType = adapter.getDatabaseType();
60
- }
61
- /**
62
- * Execute a raw query using the adapter's raw() method
63
- * This is a convenience wrapper that handles different query types
64
- */
65
- async rawQuery(query, params) {
66
- try {
67
- const result = await this.adapter.raw({
68
- table: MIGRATION_COLLECTION,
69
- query: query,
70
- params: params,
71
- });
72
- return result;
73
- }
74
- catch (error) {
75
- throw error;
76
- }
77
- }
78
- // ==================== INITIALIZATION ====================
79
- /**
80
- * Initialize migration tracking collection if it doesn't exist
81
- */
82
- async initialize() {
83
- const exists = await this.adapter.tableExists(MIGRATION_COLLECTION);
84
- if (exists)
85
- return;
86
- // Create migration tracking collection using raw operations
87
- await this.createMigrationTrackingCollection();
88
- }
89
- async createMigrationTrackingCollection() {
90
- switch (this.databaseType) {
91
- case enums_1.DatabaseType.POSTGRESQL:
92
- case enums_1.DatabaseType.MYSQL:
93
- case enums_1.DatabaseType.MARIADB:
94
- await this.createSQLMigrationTable();
95
- break;
96
- case enums_1.DatabaseType.MONGODB:
97
- await this.createMongoMigrationCollection();
98
- break;
99
- case enums_1.DatabaseType.DYNAMODB:
100
- await this.createDynamoMigrationTable();
101
- break;
102
- case enums_1.DatabaseType.CASSANDRA:
103
- await this.createCassandraMigrationTable();
104
- break;
105
- }
106
- }
107
- async createSQLMigrationTable() {
108
- const escapedTable = this.escapeIdentifier(MIGRATION_COLLECTION);
109
- const sql = `
110
- CREATE TABLE IF NOT EXISTS ${escapedTable} (
111
- id ${this.databaseType === enums_1.DatabaseType.POSTGRESQL ? 'SERIAL' : 'INT AUTO_INCREMENT'} PRIMARY KEY,
112
- tag VARCHAR(255) NOT NULL UNIQUE,
113
- name VARCHAR(255) NOT NULL,
114
- applied_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
115
- applied_by VARCHAR(255),
116
- checksum VARCHAR(64),
117
- execution_time INT
118
- )
119
- `;
120
- await this.rawQuery(sql);
121
- }
122
- async createMongoMigrationCollection() {
123
- // MongoDB will auto-create the collection on first insert
124
- // But we can create it explicitly with validation
125
- try {
126
- await this.rawQuery({
127
- create: MIGRATION_COLLECTION,
128
- validator: {
129
- $jsonSchema: {
130
- bsonType: 'object',
131
- required: ['tag', 'name', 'applied_at'],
132
- properties: {
133
- tag: { bsonType: 'string' },
134
- name: { bsonType: 'string' },
135
- applied_at: { bsonType: 'date' },
136
- applied_by: { bsonType: 'string' },
137
- checksum: { bsonType: 'string' },
138
- execution_time: { bsonType: 'int' },
139
- },
140
- },
141
- },
142
- });
143
- // Create unique index on tag
144
- await this.rawQuery({
145
- createIndexes: MIGRATION_COLLECTION,
146
- indexes: [{ key: { tag: 1 }, unique: true, name: 'tag_unique' }],
147
- });
148
- }
149
- catch (error) {
150
- // Collection might already exist
151
- }
152
- }
153
- async createDynamoMigrationTable() {
154
- await this.rawQuery({
155
- operation: 'CreateTable',
156
- params: {
157
- TableName: MIGRATION_COLLECTION,
158
- KeySchema: [{ AttributeName: 'tag', KeyType: 'HASH' }],
159
- AttributeDefinitions: [{ AttributeName: 'tag', AttributeType: 'S' }],
160
- BillingMode: 'PAY_PER_REQUEST',
161
- },
162
- });
163
- }
164
- async createCassandraMigrationTable() {
165
- const sql = `
166
- CREATE TABLE IF NOT EXISTS ${MIGRATION_COLLECTION} (
167
- tag text PRIMARY KEY,
168
- name text,
169
- applied_at timestamp,
170
- applied_by text,
171
- checksum text,
172
- execution_time int
173
- )
174
- `;
175
- await this.rawQuery(sql);
176
- }
177
- // ==================== MIGRATION EXECUTION ====================
178
- /**
179
- * Run all pending migrations
180
- */
181
- async migrate(migrations, options) {
182
- await this.initialize();
183
- const results = new Map();
184
- const pending = await this.getPendingMigrations(migrations);
185
- const sorted = this.sortByDependencies(pending);
186
- for (const migration of sorted) {
187
- if (options === null || options === void 0 ? void 0 : options.dryRun) {
188
- results.set(migration.tag, {
189
- success: true,
190
- operations: migration.up.map(op => this.getOperationDescription(op)),
191
- executionTime: 0,
192
- });
193
- continue;
194
- }
195
- const result = await this.runMigration(migration, 'up', options === null || options === void 0 ? void 0 : options.appliedBy);
196
- results.set(migration.tag, result);
197
- if (!result.success) {
198
- break;
199
- }
200
- }
201
- return results;
202
- }
203
- /**
204
- * Run a single migration
205
- */
206
- async runMigration(migration, direction, appliedBy) {
207
- const startTime = Date.now();
208
- const operations = [];
209
- try {
210
- const ops = direction === 'up' ? migration.up : migration.down;
211
- for (const operation of ops) {
212
- const description = this.getOperationDescription(operation);
213
- operations.push(description);
214
- await this.executeOperation(operation);
215
- }
216
- const executionTime = Date.now() - startTime;
217
- if (direction === 'up') {
218
- await this.recordMigration(migration, appliedBy, executionTime);
219
- }
220
- else {
221
- await this.removeMigrationRecord(migration.tag);
222
- }
223
- return { success: true, operations, executionTime };
224
- }
225
- catch (error) {
226
- return {
227
- success: false,
228
- operations,
229
- error: error.message,
230
- executionTime: Date.now() - startTime,
231
- };
232
- }
233
- }
234
- /**
235
- * Rollback the last N migrations
236
- */
237
- async rollback(migrations, count = 1) {
238
- await this.initialize();
239
- const results = new Map();
240
- const applied = await this.getAppliedMigrations();
241
- const toRollback = applied.slice(-count);
242
- for (const history of toRollback.reverse()) {
243
- const migration = migrations.find(m => m.tag === history.tag);
244
- if (!migration) {
245
- results.set(history.tag, {
246
- success: false,
247
- operations: [],
248
- error: `Migration definition not found for tag: ${history.tag}`,
249
- });
250
- continue;
251
- }
252
- const result = await this.runMigration(migration, 'down');
253
- results.set(history.tag, result);
254
- if (!result.success)
255
- break;
256
- }
257
- return results;
258
- }
259
- /**
260
- * Rollback all migrations
261
- */
262
- async rollbackAll(migrations) {
263
- const applied = await this.getAppliedMigrations();
264
- return this.rollback(migrations, applied.length);
265
- }
266
- /**
267
- * Reset database (rollback all and re-run all migrations)
268
- */
269
- async reset(migrations) {
270
- const rollbackResults = await this.rollbackAll(migrations);
271
- const migrateResults = await this.migrate(migrations);
272
- return { rollback: rollbackResults, migrate: migrateResults };
273
- }
274
- // ==================== STATUS & HISTORY ====================
275
- async getStatus(migrations) {
276
- await this.initialize();
277
- const applied = await this.getAppliedMigrations();
278
- const appliedTags = new Set(applied.map(m => m.tag));
279
- const pendingMigrations = migrations.filter(m => !appliedTags.has(m.tag)).map(m => m.tag);
280
- return {
281
- total: migrations.length,
282
- completed: applied.length,
283
- pending: pendingMigrations.length,
284
- lastApplied: applied[applied.length - 1] || undefined,
285
- pendingMigrations,
286
- appliedMigrations: applied.map(m => m.tag),
287
- };
288
- }
289
- async getAppliedMigrations() {
290
- await this.initialize();
291
- try {
292
- const result = await this.adapter.query({
293
- options: {
294
- table: MIGRATION_COLLECTION,
295
- orderBy: { column: 'applied_at', order: 'ASC' },
296
- },
297
- });
298
- return (result.data || []).map((row) => ({
299
- tag: row.tag,
300
- name: row.name,
301
- appliedAt: new Date(row.applied_at || row.appliedAt),
302
- appliedBy: row.applied_by || row.appliedBy,
303
- checksum: row.checksum,
304
- executionTime: row.execution_time || row.executionTime,
305
- }));
306
- }
307
- catch (error) {
308
- return [];
309
- }
310
- }
311
- async getPendingMigrations(migrations) {
312
- const applied = await this.getAppliedMigrations();
313
- const appliedTags = new Set(applied.map(m => m.tag));
314
- const pendingMigrations = [];
315
- for (const migration of migrations) {
316
- // If migration was never applied, it's pending
317
- if (!appliedTags.has(migration.tag)) {
318
- pendingMigrations.push(migration);
319
- continue;
320
- }
321
- // For createCollection migrations, verify the table actually exists
322
- // If it doesn't exist (e.g., was manually dropped), re-apply the migration
323
- const createOp = migration.up.find(op => op.type === 'createCollection');
324
- if (createOp) {
325
- try {
326
- const tableExists = await this.tableExists(createOp.name);
327
- if (!tableExists) {
328
- // Table doesn't exist but migration was marked as applied
329
- // Remove the stale migration record and mark as pending
330
- await this.removeMigrationRecord(migration.tag);
331
- pendingMigrations.push(migration);
332
- }
333
- }
334
- catch (_a) {
335
- // If we can't check, assume it needs to be re-applied
336
- await this.removeMigrationRecord(migration.tag);
337
- pendingMigrations.push(migration);
338
- }
339
- }
340
- }
341
- return pendingMigrations;
342
- }
343
- /**
344
- * Check if a table exists in the database
345
- */
346
- async tableExists(tableName) {
347
- var _a, _b, _c;
348
- try {
349
- switch (this.databaseType) {
350
- case enums_1.DatabaseType.POSTGRESQL:
351
- const pgResult = await this.rawQuery(`SELECT EXISTS (SELECT FROM information_schema.tables WHERE table_name = '${tableName}')`);
352
- return ((_a = pgResult === null || pgResult === void 0 ? void 0 : pgResult[0]) === null || _a === void 0 ? void 0 : _a.exists) === true;
353
- case enums_1.DatabaseType.MYSQL:
354
- case enums_1.DatabaseType.MARIADB:
355
- const mysqlResult = await this.rawQuery(`SHOW TABLES LIKE '${tableName}'`);
356
- return Array.isArray(mysqlResult) && mysqlResult.length > 0;
357
- case enums_1.DatabaseType.MONGODB:
358
- const collections = await this.rawQuery({ listCollections: 1, nameOnly: true });
359
- return ((_c = (_b = collections === null || collections === void 0 ? void 0 : collections.cursor) === null || _b === void 0 ? void 0 : _b.firstBatch) === null || _c === void 0 ? void 0 : _c.some((c) => c.name === tableName)) || false;
360
- default:
361
- return true; // Assume exists for other databases
362
- }
363
- }
364
- catch (_d) {
365
- return true; // On error, assume exists to avoid accidental re-creation
366
- }
367
- }
368
- async isMigrationApplied(tag) {
369
- await this.initialize();
370
- const applied = await this.getAppliedMigrations();
371
- return applied.some(m => m.tag === tag);
372
- }
373
- // ==================== OPERATION EXECUTION ====================
374
- async executeOperation(operation) {
375
- switch (operation.type) {
376
- // Common operations
377
- case 'createCollection':
378
- await this.executeCreateCollection(operation);
379
- break;
380
- case 'dropCollection':
381
- await this.executeDropCollection(operation);
382
- break;
383
- case 'createIndex':
384
- await this.executeCreateIndex(operation);
385
- break;
386
- case 'dropIndex':
387
- await this.executeDropIndex(operation);
388
- break;
389
- case 'addField':
390
- await this.executeAddField(operation);
391
- break;
392
- case 'dropField':
393
- await this.executeDropField(operation);
394
- break;
395
- case 'renameField':
396
- await this.executeRenameField(operation);
397
- break;
398
- case 'modifyField':
399
- await this.executeModifyField(operation);
400
- break;
401
- // SQL-specific
402
- case 'addConstraint':
403
- await this.executeAddConstraint(operation);
404
- break;
405
- case 'dropConstraint':
406
- await this.executeDropConstraint(operation);
407
- break;
408
- // MongoDB-specific
409
- case 'createMongoValidation':
410
- await this.executeCreateMongoValidation(operation);
411
- break;
412
- case 'dropMongoValidation':
413
- await this.executeDropMongoValidation(operation);
414
- break;
415
- case 'shardCollection':
416
- await this.executeShardCollection(operation);
417
- break;
418
- // DynamoDB-specific
419
- case 'createDynamoTable':
420
- await this.executeCreateDynamoTable(operation);
421
- break;
422
- case 'updateDynamoThroughput':
423
- await this.executeUpdateDynamoThroughput(operation);
424
- break;
425
- case 'addDynamoGSI':
426
- await this.executeAddDynamoGSI(operation);
427
- break;
428
- case 'removeDynamoGSI':
429
- await this.executeRemoveDynamoGSI(operation);
430
- break;
431
- case 'enableDynamoStream':
432
- await this.executeEnableDynamoStream(operation);
433
- break;
434
- case 'enableDynamoTTL':
435
- await this.executeEnableDynamoTTL(operation);
436
- break;
437
- // Cassandra-specific
438
- case 'alterCassandraTable':
439
- await this.executeAlterCassandraTable(operation);
440
- break;
441
- case 'createCassandraMaterializedView':
442
- await this.executeCreateCassandraMaterializedView(operation);
443
- break;
444
- case 'dropCassandraMaterializedView':
445
- await this.executeDropCassandraMaterializedView(operation);
446
- break;
447
- // Raw operations
448
- case 'raw':
449
- await this.executeRawOperation(operation);
450
- break;
451
- default:
452
- throw database_error_1.DatabaseError.migrationError(`Unknown migration operation type: ${operation.type}`);
453
- }
454
- }
455
- // ==================== COMMON OPERATION EXECUTORS ====================
456
- async executeCreateCollection(op) {
457
- switch (this.databaseType) {
458
- case enums_1.DatabaseType.POSTGRESQL:
459
- case enums_1.DatabaseType.MYSQL:
460
- case enums_1.DatabaseType.MARIADB:
461
- await this.createSQLTable(op);
462
- break;
463
- case enums_1.DatabaseType.MONGODB:
464
- await this.createMongoCollection(op);
465
- break;
466
- case enums_1.DatabaseType.DYNAMODB:
467
- await this.createDynamoTable(op);
468
- break;
469
- case enums_1.DatabaseType.CASSANDRA:
470
- await this.createCassandraTable(op);
471
- break;
472
- }
473
- }
474
- async executeDropCollection(op) {
475
- switch (this.databaseType) {
476
- case enums_1.DatabaseType.POSTGRESQL:
477
- case enums_1.DatabaseType.MYSQL:
478
- case enums_1.DatabaseType.MARIADB:
479
- let sql = 'DROP TABLE';
480
- if (op.ifExists)
481
- sql += ' IF EXISTS';
482
- sql += ` ${this.escapeIdentifier(op.name)}`;
483
- if (op.cascade)
484
- sql += ' CASCADE';
485
- await this.rawQuery(sql);
486
- break;
487
- case enums_1.DatabaseType.MONGODB:
488
- await this.rawQuery({ drop: op.name });
489
- break;
490
- case enums_1.DatabaseType.DYNAMODB:
491
- await this.rawQuery({
492
- operation: 'DeleteTable',
493
- params: { TableName: op.name },
494
- });
495
- break;
496
- case enums_1.DatabaseType.CASSANDRA:
497
- await this.rawQuery(`DROP TABLE ${op.ifExists ? 'IF EXISTS ' : ''}${op.name}`);
498
- break;
499
- }
500
- }
501
- async executeCreateIndex(op) {
502
- switch (this.databaseType) {
503
- case enums_1.DatabaseType.POSTGRESQL:
504
- case enums_1.DatabaseType.MYSQL:
505
- case enums_1.DatabaseType.MARIADB:
506
- await this.createSQLIndex(op);
507
- break;
508
- case enums_1.DatabaseType.MONGODB:
509
- await this.createMongoIndex(op);
510
- break;
511
- case enums_1.DatabaseType.CASSANDRA:
512
- await this.createCassandraIndex(op);
513
- break;
514
- case enums_1.DatabaseType.DYNAMODB:
515
- // DynamoDB indexes are created with the table or via GSI
516
- break;
517
- }
518
- }
519
- async executeDropIndex(op) {
520
- switch (this.databaseType) {
521
- case enums_1.DatabaseType.POSTGRESQL:
522
- let pgSql = 'DROP INDEX';
523
- if (op.ifExists)
524
- pgSql += ' IF EXISTS';
525
- if (op.concurrent)
526
- pgSql += ' CONCURRENTLY';
527
- pgSql += ` ${this.escapeIdentifier(op.name)}`;
528
- await this.rawQuery(pgSql);
529
- break;
530
- case enums_1.DatabaseType.MYSQL:
531
- case enums_1.DatabaseType.MARIADB:
532
- await this.rawQuery(`DROP INDEX ${this.escapeIdentifier(op.name)} ON ${this.escapeIdentifier(op.collection)}`);
533
- break;
534
- case enums_1.DatabaseType.MONGODB:
535
- await this.rawQuery({
536
- dropIndexes: op.collection,
537
- index: op.name,
538
- });
539
- break;
540
- case enums_1.DatabaseType.CASSANDRA:
541
- await this.rawQuery(`DROP INDEX ${op.ifExists ? 'IF EXISTS ' : ''}${op.name}`);
542
- break;
543
- }
544
- }
545
- async executeAddField(op) {
546
- switch (this.databaseType) {
547
- case enums_1.DatabaseType.POSTGRESQL:
548
- case enums_1.DatabaseType.MYSQL:
549
- case enums_1.DatabaseType.MARIADB:
550
- const colDef = this.buildColumnDefinition(op.field);
551
- await this.rawQuery(`ALTER TABLE ${this.escapeIdentifier(op.collection)} ADD COLUMN ${colDef}`);
552
- break;
553
- case enums_1.DatabaseType.MONGODB:
554
- // MongoDB is schemaless - fields are added on write
555
- // Optionally update validator
556
- break;
557
- case enums_1.DatabaseType.CASSANDRA:
558
- const cassDef = this.buildCassandraColumnDefinition(op.field);
559
- await this.rawQuery(`ALTER TABLE ${op.collection} ADD ${cassDef}`);
560
- break;
561
- case enums_1.DatabaseType.DYNAMODB:
562
- // DynamoDB is schemaless - fields are added on write
563
- break;
564
- }
565
- }
566
- async executeDropField(op) {
567
- switch (this.databaseType) {
568
- case enums_1.DatabaseType.POSTGRESQL:
569
- case enums_1.DatabaseType.MYSQL:
570
- case enums_1.DatabaseType.MARIADB:
571
- let sql = `ALTER TABLE ${this.escapeIdentifier(op.collection)} DROP COLUMN ${this.escapeIdentifier(op.fieldName)}`;
572
- if (op.cascade)
573
- sql += ' CASCADE';
574
- await this.rawQuery(sql);
575
- break;
576
- case enums_1.DatabaseType.MONGODB:
577
- // Use $unset to remove field from all documents
578
- await this.rawQuery({
579
- update: op.collection,
580
- updates: [{ q: {}, u: { $unset: { [op.fieldName]: '' } }, multi: true }],
581
- });
582
- break;
583
- case enums_1.DatabaseType.CASSANDRA:
584
- await this.rawQuery(`ALTER TABLE ${op.collection} DROP ${op.fieldName}`);
585
- break;
586
- }
587
- }
588
- async executeRenameField(op) {
589
- switch (this.databaseType) {
590
- case enums_1.DatabaseType.POSTGRESQL:
591
- await this.rawQuery(`ALTER TABLE ${this.escapeIdentifier(op.collection)} RENAME COLUMN ${this.escapeIdentifier(op.oldName)} TO ${this.escapeIdentifier(op.newName)}`);
592
- break;
593
- case enums_1.DatabaseType.MYSQL:
594
- case enums_1.DatabaseType.MARIADB:
595
- await this.rawQuery(`ALTER TABLE ${this.escapeIdentifier(op.collection)} RENAME COLUMN ${this.escapeIdentifier(op.oldName)} TO ${this.escapeIdentifier(op.newName)}`);
596
- break;
597
- case enums_1.DatabaseType.MONGODB:
598
- await this.rawQuery({
599
- update: op.collection,
600
- updates: [{ q: {}, u: { $rename: { [op.oldName]: op.newName } }, multi: true }],
601
- });
602
- break;
603
- case enums_1.DatabaseType.CASSANDRA:
604
- await this.rawQuery(`ALTER TABLE ${op.collection} RENAME ${op.oldName} TO ${op.newName}`);
605
- break;
606
- }
607
- }
608
- async executeModifyField(op) {
609
- switch (this.databaseType) {
610
- case enums_1.DatabaseType.POSTGRESQL:
611
- if (op.changes.type) {
612
- const pgType = this.mapFieldTypeToSQL(op.changes.type, op.changes);
613
- await this.rawQuery(`ALTER TABLE ${this.escapeIdentifier(op.collection)} ALTER COLUMN ${this.escapeIdentifier(op.fieldName)} TYPE ${pgType}`);
614
- }
615
- if (op.changes.nullable === false) {
616
- await this.rawQuery(`ALTER TABLE ${this.escapeIdentifier(op.collection)} ALTER COLUMN ${this.escapeIdentifier(op.fieldName)} SET NOT NULL`);
617
- }
618
- else if (op.changes.nullable === true) {
619
- await this.rawQuery(`ALTER TABLE ${this.escapeIdentifier(op.collection)} ALTER COLUMN ${this.escapeIdentifier(op.fieldName)} DROP NOT NULL`);
620
- }
621
- if (op.changes.defaultValue !== undefined) {
622
- await this.rawQuery(`ALTER TABLE ${this.escapeIdentifier(op.collection)} ALTER COLUMN ${this.escapeIdentifier(op.fieldName)} SET DEFAULT ${this.formatValue(op.changes.defaultValue)}`);
623
- }
624
- break;
625
- case enums_1.DatabaseType.MYSQL:
626
- case enums_1.DatabaseType.MARIADB:
627
- // MySQL requires full column definition for MODIFY
628
- const mysqlType = this.mapFieldTypeToSQL(op.changes.type || 'string', op.changes);
629
- await this.rawQuery(`ALTER TABLE ${this.escapeIdentifier(op.collection)} MODIFY COLUMN ${this.escapeIdentifier(op.fieldName)} ${mysqlType}`);
630
- break;
631
- case enums_1.DatabaseType.MONGODB:
632
- // MongoDB doesn't have schema modification - data is flexible
633
- break;
634
- case enums_1.DatabaseType.CASSANDRA:
635
- if (op.changes.type) {
636
- const cassType = this.mapFieldTypeToCassandra(op.changes.type);
637
- await this.rawQuery(`ALTER TABLE ${op.collection} ALTER ${op.fieldName} TYPE ${cassType}`);
638
- }
639
- break;
640
- }
641
- }
642
- // ==================== SQL-SPECIFIC EXECUTORS ====================
643
- async executeAddConstraint(op) {
644
- if (!this.isSQLDatabase()) {
645
- throw database_error_1.DatabaseError.migrationError('addConstraint is only supported for SQL databases');
646
- }
647
- const constraint = op.constraint;
648
- let sql = `ALTER TABLE ${this.escapeIdentifier(op.collection)} ADD CONSTRAINT ${this.escapeIdentifier(constraint.name)}`;
649
- switch (constraint.type) {
650
- case 'primaryKey':
651
- sql += ` PRIMARY KEY (${constraint.columns.map(c => this.escapeIdentifier(c)).join(', ')})`;
652
- break;
653
- case 'foreignKey':
654
- sql += ` FOREIGN KEY (${constraint.columns.map(c => this.escapeIdentifier(c)).join(', ')})`;
655
- if (constraint.references) {
656
- sql += ` REFERENCES ${this.escapeIdentifier(constraint.references.table)} (${constraint.references.columns.map(c => this.escapeIdentifier(c)).join(', ')})`;
657
- if (constraint.references.onDelete)
658
- sql += ` ON DELETE ${constraint.references.onDelete}`;
659
- if (constraint.references.onUpdate)
660
- sql += ` ON UPDATE ${constraint.references.onUpdate}`;
661
- }
662
- break;
663
- case 'unique':
664
- sql += ` UNIQUE (${constraint.columns.map(c => this.escapeIdentifier(c)).join(', ')})`;
665
- break;
666
- case 'check':
667
- sql += ` CHECK (${constraint.expression})`;
668
- break;
669
- }
670
- await this.rawQuery(sql);
671
- }
672
- async executeDropConstraint(op) {
673
- if (!this.isSQLDatabase()) {
674
- throw database_error_1.DatabaseError.migrationError('dropConstraint is only supported for SQL databases');
675
- }
676
- let sql = `ALTER TABLE ${this.escapeIdentifier(op.collection)} DROP CONSTRAINT ${this.escapeIdentifier(op.constraintName)}`;
677
- if (op.cascade)
678
- sql += ' CASCADE';
679
- await this.rawQuery(sql);
680
- }
681
- // ==================== MONGODB-SPECIFIC EXECUTORS ====================
682
- async executeCreateMongoValidation(op) {
683
- if (this.databaseType !== enums_1.DatabaseType.MONGODB) {
684
- throw database_error_1.DatabaseError.migrationError('createMongoValidation is only supported for MongoDB');
685
- }
686
- await this.rawQuery({
687
- collMod: op.collection,
688
- validator: op.validator,
689
- validationLevel: op.validationLevel || 'strict',
690
- validationAction: op.validationAction || 'error',
691
- });
692
- }
693
- async executeDropMongoValidation(op) {
694
- if (this.databaseType !== enums_1.DatabaseType.MONGODB) {
695
- throw database_error_1.DatabaseError.migrationError('dropMongoValidation is only supported for MongoDB');
696
- }
697
- await this.rawQuery({
698
- collMod: op.collection,
699
- validator: {},
700
- validationLevel: 'off',
701
- });
702
- }
703
- async executeShardCollection(op) {
704
- if (this.databaseType !== enums_1.DatabaseType.MONGODB) {
705
- throw database_error_1.DatabaseError.migrationError('shardCollection is only supported for MongoDB');
706
- }
707
- await this.rawQuery({
708
- shardCollection: op.collection,
709
- key: op.shardKey,
710
- unique: op.unique,
711
- });
712
- }
713
- // ==================== DYNAMODB-SPECIFIC EXECUTORS ====================
714
- async executeCreateDynamoTable(op) {
715
- if (this.databaseType !== enums_1.DatabaseType.DYNAMODB) {
716
- throw database_error_1.DatabaseError.migrationError('createDynamoTable is only supported for DynamoDB');
717
- }
718
- const params = {
719
- TableName: op.name,
720
- KeySchema: [{ AttributeName: op.partitionKey.name, KeyType: 'HASH' }],
721
- AttributeDefinitions: [{ AttributeName: op.partitionKey.name, AttributeType: op.partitionKey.type }],
722
- BillingMode: op.billingMode || 'PAY_PER_REQUEST',
723
- };
724
- if (op.sortKey) {
725
- params.KeySchema.push({ AttributeName: op.sortKey.name, KeyType: 'RANGE' });
726
- params.AttributeDefinitions.push({ AttributeName: op.sortKey.name, AttributeType: op.sortKey.type });
727
- }
728
- if (op.billingMode === 'PROVISIONED') {
729
- params.ProvisionedThroughput = {
730
- ReadCapacityUnits: op.readCapacity || 5,
731
- WriteCapacityUnits: op.writeCapacity || 5,
732
- };
733
- }
734
- if (op.globalSecondaryIndexes) {
735
- params.GlobalSecondaryIndexes = op.globalSecondaryIndexes.map(gsi => this.buildDynamoGSI(gsi, op.billingMode));
736
- // Add attribute definitions for GSI keys
737
- for (const gsi of op.globalSecondaryIndexes) {
738
- if (!params.AttributeDefinitions.find((a) => a.AttributeName === gsi.partitionKey.name)) {
739
- params.AttributeDefinitions.push({ AttributeName: gsi.partitionKey.name, AttributeType: gsi.partitionKey.type });
740
- }
741
- if (gsi.sortKey && !params.AttributeDefinitions.find((a) => a.AttributeName === gsi.sortKey.name)) {
742
- params.AttributeDefinitions.push({ AttributeName: gsi.sortKey.name, AttributeType: gsi.sortKey.type });
743
- }
744
- }
745
- }
746
- if (op.localSecondaryIndexes) {
747
- params.LocalSecondaryIndexes = op.localSecondaryIndexes.map(lsi => ({
748
- IndexName: lsi.name,
749
- KeySchema: [
750
- { AttributeName: op.partitionKey.name, KeyType: 'HASH' },
751
- { AttributeName: lsi.sortKey.name, KeyType: 'RANGE' },
752
- ],
753
- Projection: this.buildDynamoProjection(lsi.projection),
754
- }));
755
- // Add attribute definitions for LSI sort keys
756
- for (const lsi of op.localSecondaryIndexes) {
757
- if (!params.AttributeDefinitions.find((a) => a.AttributeName === lsi.sortKey.name)) {
758
- params.AttributeDefinitions.push({ AttributeName: lsi.sortKey.name, AttributeType: lsi.sortKey.type });
759
- }
760
- }
761
- }
762
- if (op.streamEnabled) {
763
- params.StreamSpecification = {
764
- StreamEnabled: true,
765
- StreamViewType: op.streamViewType || 'NEW_AND_OLD_IMAGES',
766
- };
767
- }
768
- await this.rawQuery({ operation: 'CreateTable', params });
769
- }
770
- async executeUpdateDynamoThroughput(op) {
771
- if (this.databaseType !== enums_1.DatabaseType.DYNAMODB) {
772
- throw database_error_1.DatabaseError.migrationError('updateDynamoThroughput is only supported for DynamoDB');
773
- }
774
- const params = { TableName: op.name };
775
- if (op.billingMode) {
776
- params.BillingMode = op.billingMode;
777
- }
778
- if (op.billingMode === 'PROVISIONED' && (op.readCapacity || op.writeCapacity)) {
779
- params.ProvisionedThroughput = {
780
- ReadCapacityUnits: op.readCapacity || 5,
781
- WriteCapacityUnits: op.writeCapacity || 5,
782
- };
783
- }
784
- await this.rawQuery({ operation: 'UpdateTable', params });
785
- }
786
- async executeAddDynamoGSI(op) {
787
- if (this.databaseType !== enums_1.DatabaseType.DYNAMODB) {
788
- throw database_error_1.DatabaseError.migrationError('addDynamoGSI is only supported for DynamoDB');
789
- }
790
- const params = {
791
- TableName: op.tableName,
792
- AttributeDefinitions: [
793
- { AttributeName: op.gsi.partitionKey.name, AttributeType: op.gsi.partitionKey.type },
794
- ],
795
- GlobalSecondaryIndexUpdates: [{
796
- Create: this.buildDynamoGSI(op.gsi),
797
- }],
798
- };
799
- if (op.gsi.sortKey) {
800
- params.AttributeDefinitions.push({ AttributeName: op.gsi.sortKey.name, AttributeType: op.gsi.sortKey.type });
801
- }
802
- await this.rawQuery({ operation: 'UpdateTable', params });
803
- }
804
- async executeRemoveDynamoGSI(op) {
805
- if (this.databaseType !== enums_1.DatabaseType.DYNAMODB) {
806
- throw database_error_1.DatabaseError.migrationError('removeDynamoGSI is only supported for DynamoDB');
807
- }
808
- await this.rawQuery({
809
- operation: 'UpdateTable',
810
- params: {
811
- TableName: op.tableName,
812
- GlobalSecondaryIndexUpdates: [{ Delete: { IndexName: op.gsiName } }],
813
- },
814
- });
815
- }
816
- async executeEnableDynamoStream(op) {
817
- if (this.databaseType !== enums_1.DatabaseType.DYNAMODB) {
818
- throw database_error_1.DatabaseError.migrationError('enableDynamoStream is only supported for DynamoDB');
819
- }
820
- await this.rawQuery({
821
- operation: 'UpdateTable',
822
- params: {
823
- TableName: op.tableName,
824
- StreamSpecification: {
825
- StreamEnabled: true,
826
- StreamViewType: op.streamViewType,
827
- },
828
- },
829
- });
830
- }
831
- async executeEnableDynamoTTL(op) {
832
- if (this.databaseType !== enums_1.DatabaseType.DYNAMODB) {
833
- throw database_error_1.DatabaseError.migrationError('enableDynamoTTL is only supported for DynamoDB');
834
- }
835
- await this.rawQuery({
836
- operation: 'UpdateTimeToLive',
837
- params: {
838
- TableName: op.tableName,
839
- TimeToLiveSpecification: {
840
- AttributeName: op.attributeName,
841
- Enabled: op.enabled,
842
- },
843
- },
844
- });
845
- }
846
- // ==================== CASSANDRA-SPECIFIC EXECUTORS ====================
847
- async executeAlterCassandraTable(op) {
848
- if (this.databaseType !== enums_1.DatabaseType.CASSANDRA) {
849
- throw database_error_1.DatabaseError.migrationError('alterCassandraTable is only supported for Cassandra');
850
- }
851
- const options = [];
852
- if (op.options.defaultTTL !== undefined)
853
- options.push(`default_time_to_live = ${op.options.defaultTTL}`);
854
- if (op.options.gcGraceSeconds !== undefined)
855
- options.push(`gc_grace_seconds = ${op.options.gcGraceSeconds}`);
856
- if (op.options.compaction)
857
- options.push(`compaction = ${JSON.stringify(op.options.compaction)}`);
858
- if (op.options.compression)
859
- options.push(`compression = ${JSON.stringify(op.options.compression)}`);
860
- if (op.options.caching)
861
- options.push(`caching = ${JSON.stringify(op.options.caching)}`);
862
- if (options.length > 0) {
863
- await this.rawQuery(`ALTER TABLE ${op.name} WITH ${options.join(' AND ')}`);
864
- }
865
- }
866
- async executeCreateCassandraMaterializedView(op) {
867
- if (this.databaseType !== enums_1.DatabaseType.CASSANDRA) {
868
- throw database_error_1.DatabaseError.migrationError('createCassandraMaterializedView is only supported for Cassandra');
869
- }
870
- const pk = op.partitionKey.join(', ');
871
- const clustering = op.clusteringColumns ? `, ${op.clusteringColumns.join(', ')}` : '';
872
- await this.rawQuery(`
873
- CREATE MATERIALIZED VIEW ${op.name} AS
874
- SELECT ${op.columns.join(', ')}
875
- FROM ${op.baseTable}
876
- WHERE ${op.where}
877
- PRIMARY KEY ((${pk})${clustering})
878
- `);
879
- }
880
- async executeDropCassandraMaterializedView(op) {
881
- if (this.databaseType !== enums_1.DatabaseType.CASSANDRA) {
882
- throw database_error_1.DatabaseError.migrationError('dropCassandraMaterializedView is only supported for Cassandra');
883
- }
884
- await this.rawQuery(`DROP MATERIALIZED VIEW ${op.ifExists ? 'IF EXISTS ' : ''}${op.name}`);
885
- }
886
- // ==================== RAW OPERATION EXECUTOR ====================
887
- async executeRawOperation(op) {
888
- const dbType = this.databaseType.toLowerCase();
889
- const dbOp = op.operations[dbType];
890
- if (!dbOp) {
891
- if (op.databases && !op.databases.includes(dbType)) {
892
- // Skip if database not in target list
893
- return;
894
- }
895
- throw database_error_1.DatabaseError.migrationError(`No raw operation defined for database type: ${dbType}`);
896
- }
897
- if ('sql' in dbOp) {
898
- await this.rawQuery(dbOp.sql, dbOp.params);
899
- }
900
- else if ('cql' in dbOp) {
901
- await this.rawQuery(dbOp.cql, dbOp.params);
902
- }
903
- else if ('command' in dbOp) {
904
- await this.rawQuery(dbOp.command);
905
- }
906
- else if ('operation' in dbOp) {
907
- await this.rawQuery(dbOp);
908
- }
909
- }
910
- // ==================== HELPER METHODS ====================
911
- async createSQLTable(op) {
912
- var _a, _b, _c, _d;
913
- const columns = op.fields.map(f => this.buildColumnDefinition(f));
914
- const constraints = [];
915
- // Handle composite primary key
916
- const pkFields = op.fields.filter(f => f.primaryKey);
917
- if (pkFields.length > 1) {
918
- const pkNames = pkFields.map(f => this.escapeIdentifier(f.name)).join(', ');
919
- constraints.push(`PRIMARY KEY (${pkNames})`);
920
- }
921
- else if ((_a = op.sqlOptions) === null || _a === void 0 ? void 0 : _a.primaryKey) {
922
- constraints.push(`PRIMARY KEY (${op.sqlOptions.primaryKey.map(c => this.escapeIdentifier(c)).join(', ')})`);
923
- }
924
- // Add constraints from options
925
- if ((_b = op.sqlOptions) === null || _b === void 0 ? void 0 : _b.constraints) {
926
- for (const c of op.sqlOptions.constraints) {
927
- const constraintSQL = this.buildConstraintSQL(c);
928
- constraints.push(constraintSQL);
929
- }
930
- }
931
- let sql = 'CREATE';
932
- if ((_c = op.sqlOptions) === null || _c === void 0 ? void 0 : _c.temporary)
933
- sql += ' TEMPORARY';
934
- if (((_d = op.sqlOptions) === null || _d === void 0 ? void 0 : _d.unlogged) && this.databaseType === enums_1.DatabaseType.POSTGRESQL)
935
- sql += ' UNLOGGED';
936
- sql += ' TABLE';
937
- if (op.ifNotExists)
938
- sql += ' IF NOT EXISTS';
939
- sql += ` ${this.escapeIdentifier(op.name)} (${[...columns, ...constraints].join(', ')})`;
940
- await this.rawQuery(sql);
941
- }
942
- async createMongoCollection(op) {
943
- var _a, _b;
944
- const createCmd = { create: op.name };
945
- if ((_a = op.mongoOptions) === null || _a === void 0 ? void 0 : _a.capped) {
946
- createCmd.capped = true;
947
- if (op.mongoOptions.size)
948
- createCmd.size = op.mongoOptions.size;
949
- if (op.mongoOptions.max)
950
- createCmd.max = op.mongoOptions.max;
951
- }
952
- if ((_b = op.mongoOptions) === null || _b === void 0 ? void 0 : _b.validator) {
953
- createCmd.validator = op.mongoOptions.validator;
954
- if (op.mongoOptions.validationLevel)
955
- createCmd.validationLevel = op.mongoOptions.validationLevel;
956
- }
957
- try {
958
- await this.rawQuery(createCmd);
959
- }
960
- catch (error) {
961
- // Collection might already exist
962
- if (!error.message.includes('already exists'))
963
- throw error;
964
- }
965
- // Process fields: create unique indexes and register auto-increment fields
966
- if (op.fields) {
967
- for (const field of op.fields) {
968
- // Create unique index for fields marked as unique (excluding _id which is already unique)
969
- if (field.unique && field.name !== '_id') {
970
- await this.createMongoUniqueIndex(op.name, field.name);
971
- }
972
- // Register auto-increment fields in the _ductape_counters collection
973
- if (field.autoGenerate) {
974
- await this.registerMongoAutoIncrementField(op.name, field.name);
975
- }
976
- }
977
- }
978
- // Store schema metadata for default values and other app-level features
979
- if (op.fields && op.fields.length > 0) {
980
- await this.storeMongoSchemaMetadata(op.name, op.fields);
981
- }
982
- }
983
- /**
984
- * Create a unique index on a MongoDB collection field.
985
- */
986
- async createMongoUniqueIndex(collectionName, fieldName) {
987
- try {
988
- await this.rawQuery({
989
- createIndexes: collectionName,
990
- indexes: [{
991
- key: { [fieldName]: 1 },
992
- name: `${collectionName}_${fieldName}_unique`,
993
- unique: true
994
- }]
995
- });
996
- }
997
- catch (error) {
998
- // Index might already exist - ignore this error
999
- const errMsg = error.message || '';
1000
- if (!errMsg.includes('already exists') && !errMsg.includes('duplicate key')) {
1001
- throw error;
1002
- }
1003
- }
1004
- }
1005
- /**
1006
- * Register an auto-increment field in the MongoDB counters collection.
1007
- * Uses atomic operations to ensure thread safety.
1008
- */
1009
- async registerMongoAutoIncrementField(collectionName, fieldName) {
1010
- await this.rawQuery({
1011
- findAndModify: '_ductape_counters',
1012
- query: { _id: `${collectionName}.${fieldName}` },
1013
- update: {
1014
- $setOnInsert: {
1015
- collection: collectionName,
1016
- field: fieldName,
1017
- currentValue: 0
1018
- }
1019
- },
1020
- upsert: true
1021
- });
1022
- }
1023
- /**
1024
- * Store schema metadata for MongoDB collections.
1025
- * This enables application-level features like default values.
1026
- */
1027
- async storeMongoSchemaMetadata(collectionName, fields) {
1028
- await this.rawQuery({
1029
- findAndModify: '_ductape_schema',
1030
- query: { _id: collectionName },
1031
- update: {
1032
- $set: {
1033
- collection: collectionName,
1034
- columns: fields.map(f => ({
1035
- name: f.name,
1036
- type: f.type,
1037
- defaultValue: f.defaultValue,
1038
- nullable: f.nullable,
1039
- unique: f.unique,
1040
- primaryKey: f.primaryKey,
1041
- autoIncrement: f.autoGenerate,
1042
- })),
1043
- updatedAt: new Date()
1044
- }
1045
- },
1046
- upsert: true
1047
- });
1048
- }
1049
- async createDynamoTable(op) {
1050
- if (!op.dynamoOptions) {
1051
- throw database_error_1.DatabaseError.migrationError('DynamoDB requires dynamoOptions with partitionKey');
1052
- }
1053
- // Convert to ICreateDynamoTableMigration format
1054
- await this.executeCreateDynamoTable(Object.assign({ type: 'createDynamoTable', name: op.name }, op.dynamoOptions));
1055
- }
1056
- async createCassandraTable(op) {
1057
- if (!op.cassandraOptions) {
1058
- throw database_error_1.DatabaseError.migrationError('Cassandra requires cassandraOptions with partitionKey');
1059
- }
1060
- const columns = op.fields.map(f => this.buildCassandraColumnDefinition(f));
1061
- const pk = op.cassandraOptions.partitionKey.join(', ');
1062
- const clustering = op.cassandraOptions.clusteringColumns
1063
- ? `, ${op.cassandraOptions.clusteringColumns.join(', ')}`
1064
- : '';
1065
- let sql = `CREATE TABLE ${op.ifNotExists ? 'IF NOT EXISTS ' : ''}${op.name} (${columns.join(', ')}, PRIMARY KEY ((${pk})${clustering}))`;
1066
- const withClauses = [];
1067
- if (op.cassandraOptions.clusteringOrder) {
1068
- const order = op.cassandraOptions.clusteringOrder.map(o => `${o.column} ${o.order}`).join(', ');
1069
- withClauses.push(`CLUSTERING ORDER BY (${order})`);
1070
- }
1071
- if (op.cassandraOptions.defaultTTL) {
1072
- withClauses.push(`default_time_to_live = ${op.cassandraOptions.defaultTTL}`);
1073
- }
1074
- if (withClauses.length > 0) {
1075
- sql += ` WITH ${withClauses.join(' AND ')}`;
1076
- }
1077
- await this.rawQuery(sql);
1078
- }
1079
- async createSQLIndex(op) {
1080
- var _a, _b, _c, _d;
1081
- let sql = 'CREATE';
1082
- if (op.unique)
1083
- sql += ' UNIQUE';
1084
- sql += ' INDEX';
1085
- if (op.ifNotExists && this.databaseType === enums_1.DatabaseType.POSTGRESQL)
1086
- sql += ' IF NOT EXISTS';
1087
- if (((_a = op.sqlOptions) === null || _a === void 0 ? void 0 : _a.concurrent) && this.databaseType === enums_1.DatabaseType.POSTGRESQL)
1088
- sql += ' CONCURRENTLY';
1089
- sql += ` ${this.escapeIdentifier(op.name)} ON ${this.escapeIdentifier(op.collection)}`;
1090
- if (((_b = op.sqlOptions) === null || _b === void 0 ? void 0 : _b.method) && this.databaseType === enums_1.DatabaseType.POSTGRESQL) {
1091
- sql += ` USING ${op.sqlOptions.method}`;
1092
- }
1093
- sql += ` (${op.fields.map(f => `${this.escapeIdentifier(f.name)}${f.order ? ' ' + f.order.toUpperCase() : ''}`).join(', ')})`;
1094
- if (((_c = op.sqlOptions) === null || _c === void 0 ? void 0 : _c.include) && this.databaseType === enums_1.DatabaseType.POSTGRESQL) {
1095
- sql += ` INCLUDE (${op.sqlOptions.include.map(c => this.escapeIdentifier(c)).join(', ')})`;
1096
- }
1097
- if (((_d = op.sqlOptions) === null || _d === void 0 ? void 0 : _d.where) && this.databaseType === enums_1.DatabaseType.POSTGRESQL) {
1098
- sql += ` WHERE ${op.sqlOptions.where}`;
1099
- }
1100
- await this.rawQuery(sql);
1101
- }
1102
- async createMongoIndex(op) {
1103
- var _a, _b, _c;
1104
- const keys = {};
1105
- for (const f of op.fields) {
1106
- keys[f.name] = f.type === 'text' ? 'text' : (f.order === 'desc' ? -1 : 1);
1107
- }
1108
- const indexOptions = { name: op.name };
1109
- if (op.unique)
1110
- indexOptions.unique = true;
1111
- if (op.sparse)
1112
- indexOptions.sparse = true;
1113
- if ((_a = op.mongoOptions) === null || _a === void 0 ? void 0 : _a.background)
1114
- indexOptions.background = true;
1115
- if (((_b = op.mongoOptions) === null || _b === void 0 ? void 0 : _b.expireAfterSeconds) !== undefined) {
1116
- indexOptions.expireAfterSeconds = op.mongoOptions.expireAfterSeconds;
1117
- }
1118
- if ((_c = op.mongoOptions) === null || _c === void 0 ? void 0 : _c.weights)
1119
- indexOptions.weights = op.mongoOptions.weights;
1120
- await this.rawQuery({
1121
- createIndexes: op.collection,
1122
- indexes: [Object.assign({ key: keys }, indexOptions)],
1123
- });
1124
- }
1125
- async createCassandraIndex(op) {
1126
- var _a;
1127
- const field = op.fields[0]; // Cassandra secondary indexes are single-column
1128
- let sql = `CREATE INDEX ${op.ifNotExists ? 'IF NOT EXISTS ' : ''}${op.name} ON ${op.collection} (${field.name})`;
1129
- if ((_a = op.cassandraOptions) === null || _a === void 0 ? void 0 : _a.sasiOptions) {
1130
- const opts = op.cassandraOptions.sasiOptions;
1131
- const using = [];
1132
- if (opts.mode)
1133
- using.push(`'mode': '${opts.mode}'`);
1134
- if (opts.analyzerClass)
1135
- using.push(`'analyzer_class': '${opts.analyzerClass}'`);
1136
- if (opts.caseSensitive !== undefined)
1137
- using.push(`'case_sensitive': '${opts.caseSensitive}'`);
1138
- sql += ` USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {${using.join(', ')}}`;
1139
- }
1140
- await this.rawQuery(sql);
1141
- }
1142
- buildColumnDefinition(field) {
1143
- const parts = [this.escapeIdentifier(field.name)];
1144
- parts.push(this.mapFieldTypeToSQL(field.type, field));
1145
- if (field.primaryKey && !field.autoGenerate)
1146
- parts.push('PRIMARY KEY');
1147
- if (field.autoGenerate) {
1148
- if (this.databaseType === enums_1.DatabaseType.POSTGRESQL) {
1149
- // Already handled in type mapping (SERIAL)
1150
- }
1151
- else {
1152
- parts.push('AUTO_INCREMENT');
1153
- if (field.primaryKey)
1154
- parts.push('PRIMARY KEY');
1155
- }
1156
- }
1157
- if (field.nullable === false && !field.primaryKey)
1158
- parts.push('NOT NULL');
1159
- if (field.unique && !field.primaryKey)
1160
- parts.push('UNIQUE');
1161
- if (field.defaultValue !== undefined)
1162
- parts.push(`DEFAULT ${this.formatValue(field.defaultValue)}`);
1163
- return parts.join(' ');
1164
- }
1165
- buildCassandraColumnDefinition(field) {
1166
- return `${field.name} ${this.mapFieldTypeToCassandra(field.type)}`;
1167
- }
1168
- buildConstraintSQL(constraint) {
1169
- let sql = `CONSTRAINT ${this.escapeIdentifier(constraint.name)}`;
1170
- switch (constraint.type) {
1171
- case 'primaryKey':
1172
- sql += ` PRIMARY KEY (${constraint.columns.map((c) => this.escapeIdentifier(c)).join(', ')})`;
1173
- break;
1174
- case 'unique':
1175
- sql += ` UNIQUE (${constraint.columns.map((c) => this.escapeIdentifier(c)).join(', ')})`;
1176
- break;
1177
- case 'foreignKey':
1178
- sql += ` FOREIGN KEY (${constraint.columns.map((c) => this.escapeIdentifier(c)).join(', ')})`;
1179
- if (constraint.references) {
1180
- sql += ` REFERENCES ${this.escapeIdentifier(constraint.references.table)} (${constraint.references.columns.map((c) => this.escapeIdentifier(c)).join(', ')})`;
1181
- }
1182
- break;
1183
- case 'check':
1184
- sql += ` CHECK (${constraint.expression})`;
1185
- break;
1186
- }
1187
- return sql;
1188
- }
1189
- buildDynamoGSI(gsi, billingMode) {
1190
- const result = {
1191
- IndexName: gsi.name,
1192
- KeySchema: [{ AttributeName: gsi.partitionKey.name, KeyType: 'HASH' }],
1193
- Projection: this.buildDynamoProjection(gsi.projection),
1194
- };
1195
- if (gsi.sortKey) {
1196
- result.KeySchema.push({ AttributeName: gsi.sortKey.name, KeyType: 'RANGE' });
1197
- }
1198
- if (billingMode === 'PROVISIONED') {
1199
- result.ProvisionedThroughput = {
1200
- ReadCapacityUnits: gsi.readCapacity || 5,
1201
- WriteCapacityUnits: gsi.writeCapacity || 5,
1202
- };
1203
- }
1204
- return result;
1205
- }
1206
- buildDynamoProjection(projection) {
1207
- if (projection === 'ALL')
1208
- return { ProjectionType: 'ALL' };
1209
- if (projection === 'KEYS_ONLY')
1210
- return { ProjectionType: 'KEYS_ONLY' };
1211
- if (typeof projection === 'object' && projection.type === 'INCLUDE') {
1212
- return { ProjectionType: 'INCLUDE', NonKeyAttributes: projection.attributes };
1213
- }
1214
- return { ProjectionType: 'ALL' };
1215
- }
1216
- mapFieldTypeToSQL(type, options) {
1217
- const isPG = this.databaseType === enums_1.DatabaseType.POSTGRESQL;
1218
- switch (type) {
1219
- case 'integer':
1220
- if ((options === null || options === void 0 ? void 0 : options.autoGenerate) && isPG)
1221
- return 'SERIAL';
1222
- return 'INTEGER';
1223
- case 'bigint':
1224
- if ((options === null || options === void 0 ? void 0 : options.autoGenerate) && isPG)
1225
- return 'BIGSERIAL';
1226
- return 'BIGINT';
1227
- case 'smallint': return 'SMALLINT';
1228
- case 'decimal': return `DECIMAL(${(options === null || options === void 0 ? void 0 : options.precision) || 10}, ${(options === null || options === void 0 ? void 0 : options.scale) || 2})`;
1229
- case 'float': return 'REAL';
1230
- case 'double': return 'DOUBLE PRECISION';
1231
- case 'string': return `VARCHAR(${(options === null || options === void 0 ? void 0 : options.maxLength) || 255})`;
1232
- case 'text': return 'TEXT';
1233
- case 'uuid': return isPG ? 'UUID' : 'CHAR(36)';
1234
- case 'boolean': return 'BOOLEAN';
1235
- case 'date': return 'DATE';
1236
- case 'time': return 'TIME';
1237
- case 'datetime': return isPG ? 'TIMESTAMP' : 'DATETIME';
1238
- case 'timestamp': return isPG ? 'TIMESTAMPTZ' : 'TIMESTAMP';
1239
- case 'binary': return 'BYTEA';
1240
- case 'blob': return isPG ? 'BYTEA' : 'BLOB';
1241
- case 'json': return isPG ? 'JSONB' : 'JSON';
1242
- case 'object': return isPG ? 'JSONB' : 'JSON';
1243
- case 'array': return isPG ? `${this.mapFieldTypeToSQL((options === null || options === void 0 ? void 0 : options.arrayElementType) || 'string', {})}[]` : 'JSON';
1244
- case 'enum': return (options === null || options === void 0 ? void 0 : options.enumValues) ? `ENUM(${options.enumValues.map(v => `'${v}'`).join(', ')})` : 'VARCHAR(255)';
1245
- default: return 'VARCHAR(255)';
1246
- }
1247
- }
1248
- mapFieldTypeToCassandra(type) {
1249
- switch (type) {
1250
- case 'integer': return 'int';
1251
- case 'bigint': return 'bigint';
1252
- case 'smallint': return 'smallint';
1253
- case 'decimal': return 'decimal';
1254
- case 'float': return 'float';
1255
- case 'double': return 'double';
1256
- case 'string': return 'text';
1257
- case 'text': return 'text';
1258
- case 'uuid': return 'uuid';
1259
- case 'boolean': return 'boolean';
1260
- case 'date': return 'date';
1261
- case 'time': return 'time';
1262
- case 'datetime': return 'timestamp';
1263
- case 'timestamp': return 'timestamp';
1264
- case 'binary': return 'blob';
1265
- case 'blob': return 'blob';
1266
- case 'json': return 'text';
1267
- case 'object': return 'text';
1268
- default: return 'text';
1269
- }
1270
- }
1271
- isSQLDatabase() {
1272
- return [enums_1.DatabaseType.POSTGRESQL, enums_1.DatabaseType.MYSQL, enums_1.DatabaseType.MARIADB].includes(this.databaseType);
1273
- }
1274
- async recordMigration(migration, appliedBy, executionTime) {
1275
- const checksum = this.calculateChecksum(migration);
1276
- await this.adapter.insert({
1277
- table: MIGRATION_COLLECTION,
1278
- data: {
1279
- tag: migration.tag,
1280
- name: migration.name,
1281
- applied_at: new Date(),
1282
- applied_by: appliedBy || null,
1283
- checksum,
1284
- execution_time: executionTime || null,
1285
- },
1286
- });
1287
- }
1288
- async removeMigrationRecord(tag) {
1289
- await this.adapter.delete({
1290
- table: MIGRATION_COLLECTION,
1291
- where: { tag },
1292
- });
1293
- }
1294
- calculateChecksum(migration) {
1295
- const content = JSON.stringify({ tag: migration.tag, name: migration.name, up: migration.up, down: migration.down });
1296
- return crypto.createHash('sha256').update(content).digest('hex').substring(0, 64);
1297
- }
1298
- sortByDependencies(migrations) {
1299
- const sorted = [];
1300
- const visited = new Set();
1301
- const visiting = new Set();
1302
- const visit = (migration) => {
1303
- if (visited.has(migration.tag))
1304
- return;
1305
- if (visiting.has(migration.tag)) {
1306
- throw database_error_1.DatabaseError.migrationError(`Circular dependency detected in migration: ${migration.tag}`);
1307
- }
1308
- visiting.add(migration.tag);
1309
- if (migration.dependencies) {
1310
- for (const depTag of migration.dependencies) {
1311
- const dep = migrations.find(m => m.tag === depTag);
1312
- if (dep)
1313
- visit(dep);
1314
- }
1315
- }
1316
- visiting.delete(migration.tag);
1317
- visited.add(migration.tag);
1318
- sorted.push(migration);
1319
- };
1320
- for (const migration of migrations)
1321
- visit(migration);
1322
- return sorted;
1323
- }
1324
- getOperationDescription(operation) {
1325
- switch (operation.type) {
1326
- case 'createCollection': return `Create collection: ${operation.name}`;
1327
- case 'dropCollection': return `Drop collection: ${operation.name}`;
1328
- case 'createIndex': return `Create index: ${operation.name} on ${operation.collection}`;
1329
- case 'dropIndex': return `Drop index: ${operation.name} from ${operation.collection}`;
1330
- case 'addField': return `Add field: ${operation.field.name} to ${operation.collection}`;
1331
- case 'dropField': return `Drop field: ${operation.fieldName} from ${operation.collection}`;
1332
- case 'renameField': return `Rename field: ${operation.oldName} to ${operation.newName} in ${operation.collection}`;
1333
- case 'modifyField': return `Modify field: ${operation.fieldName} in ${operation.collection}`;
1334
- case 'addConstraint': return `Add constraint: ${operation.constraint.name} to ${operation.collection}`;
1335
- case 'dropConstraint': return `Drop constraint: ${operation.constraintName} from ${operation.collection}`;
1336
- case 'createMongoValidation': return `Create validation on: ${operation.collection}`;
1337
- case 'dropMongoValidation': return `Drop validation from: ${operation.collection}`;
1338
- case 'shardCollection': return `Shard collection: ${operation.collection}`;
1339
- case 'createDynamoTable': return `Create DynamoDB table: ${operation.name}`;
1340
- case 'updateDynamoThroughput': return `Update DynamoDB throughput: ${operation.name}`;
1341
- case 'addDynamoGSI': return `Add GSI to: ${operation.tableName}`;
1342
- case 'removeDynamoGSI': return `Remove GSI from: ${operation.tableName}`;
1343
- case 'enableDynamoStream': return `Enable stream on: ${operation.tableName}`;
1344
- case 'enableDynamoTTL': return `Enable TTL on: ${operation.tableName}`;
1345
- case 'alterCassandraTable': return `Alter Cassandra table: ${operation.name}`;
1346
- case 'createCassandraMaterializedView': return `Create materialized view: ${operation.name}`;
1347
- case 'dropCassandraMaterializedView': return `Drop materialized view: ${operation.name}`;
1348
- case 'raw': return 'Execute raw operation';
1349
- default: return 'Unknown operation';
1350
- }
1351
- }
1352
- escapeIdentifier(identifier) {
1353
- switch (this.databaseType) {
1354
- case enums_1.DatabaseType.POSTGRESQL: return `"${identifier.replace(/"/g, '""')}"`;
1355
- case enums_1.DatabaseType.MYSQL:
1356
- case enums_1.DatabaseType.MARIADB: return `\`${identifier.replace(/`/g, '``')}\``;
1357
- case enums_1.DatabaseType.CASSANDRA:
1358
- if (/[^a-zA-Z0-9_]/.test(identifier))
1359
- return `"${identifier.replace(/"/g, '""')}"`;
1360
- return identifier;
1361
- default: return identifier;
1362
- }
1363
- }
1364
- formatValue(value) {
1365
- if (value === null)
1366
- return 'NULL';
1367
- if (typeof value === 'boolean')
1368
- return value ? 'TRUE' : 'FALSE';
1369
- if (typeof value === 'number')
1370
- return String(value);
1371
- if (typeof value === 'string') {
1372
- const upperValue = value.toUpperCase();
1373
- // Handle special datetime functions
1374
- if (upperValue.startsWith('CURRENT_') || upperValue === 'NOW()')
1375
- return value;
1376
- // Handle 'now' as CURRENT_TIMESTAMP for datetime defaults
1377
- if (upperValue === 'NOW')
1378
- return 'CURRENT_TIMESTAMP';
1379
- return `'${value.replace(/'/g, "''")}'`;
1380
- }
1381
- if (value instanceof Date)
1382
- return `'${value.toISOString()}'`;
1383
- return `'${JSON.stringify(value).replace(/'/g, "''")}'`;
1384
- }
1385
- }
1386
- exports.MigrationEngine = MigrationEngine;
1387
- /**
1388
- * Migration Helpers for creating common migrations
1389
- */
1390
- exports.MigrationHelpers = {
1391
- generateMigrationTag(name) {
1392
- const timestamp = new Date().toISOString().replace(/[-:T.Z]/g, '').substring(0, 14);
1393
- const sanitizedName = name.toLowerCase().replace(/[^a-z0-9]/g, '_');
1394
- return `${timestamp}_${sanitizedName}`;
1395
- },
1396
- createCollectionMigration(tag, name, fields) {
1397
- return {
1398
- tag,
1399
- name: `Create collection ${name}`,
1400
- up: [{ type: 'createCollection', name, fields }],
1401
- down: [{ type: 'dropCollection', name, ifExists: true }],
1402
- };
1403
- },
1404
- addFieldMigration(tag, collection, field) {
1405
- return {
1406
- tag,
1407
- name: `Add field ${field.name} to ${collection}`,
1408
- up: [{ type: 'addField', collection, field }],
1409
- down: [{ type: 'dropField', collection, fieldName: field.name }],
1410
- };
1411
- },
1412
- addIndexMigration(tag, collection, indexName, fields, unique) {
1413
- return {
1414
- tag,
1415
- name: `Add index ${indexName} on ${collection}`,
1416
- up: [{ type: 'createIndex', collection, name: indexName, fields: fields.map(f => ({ name: f })), unique }],
1417
- down: [{ type: 'dropIndex', collection, name: indexName, ifExists: true }],
1418
- };
1419
- },
1420
- };
1421
- //# sourceMappingURL=migration-engine.js.map