@owox/backend 0.37.0 → 0.39.0

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 (264) hide show
  1. package/dist/src/common/helpers/read-bounded-body.helper.d.ts +1 -0
  2. package/dist/src/common/helpers/read-bounded-body.helper.js +28 -0
  3. package/dist/src/common/scheduler/system-tasks/system-trigger-type.d.ts +3 -1
  4. package/dist/src/common/scheduler/system-tasks/system-trigger-type.js +2 -0
  5. package/dist/src/common/search/search.facade.d.ts +1 -0
  6. package/dist/src/config/data-source-options.config.d.ts +4 -3
  7. package/dist/src/config/data-source-options.config.js +10 -3
  8. package/dist/src/config/plugin-collections-body-parser.config.js +3 -0
  9. package/dist/src/data-marts/credentials/credential.types.d.ts +26 -2
  10. package/dist/src/data-marts/credentials/credential.types.js +18 -6
  11. package/dist/src/data-marts/credentials/dto/credential-api.dto.d.ts +5 -1
  12. package/dist/src/data-marts/credentials/dto/credential-api.dto.js +21 -0
  13. package/dist/src/data-marts/credentials/dto/credential.dto.d.ts +2 -1
  14. package/dist/src/data-marts/credentials/entities/credential.entity.d.ts +2 -1
  15. package/dist/src/data-marts/credentials/entities/credential.entity.js +5 -0
  16. package/dist/src/data-marts/credentials/facades/credential-consumer-binding.facade.impl.js +6 -1
  17. package/dist/src/data-marts/credentials/mappers/credential.mapper.js +2 -0
  18. package/dist/src/data-marts/credentials/services/builtin-credential-definitions.js +8 -0
  19. package/dist/src/data-marts/credentials/services/credential-external-definition-registry.service.d.ts +4 -0
  20. package/dist/src/data-marts/credentials/services/credential-external-definition-registry.service.js +36 -17
  21. package/dist/src/data-marts/credentials/services/credential-fetch.service.d.ts +8 -0
  22. package/dist/src/data-marts/credentials/services/credential-fetch.service.js +115 -46
  23. package/dist/src/data-marts/credentials/services/credential-validation-probe.service.d.ts +3 -1
  24. package/dist/src/data-marts/credentials/services/credential-validation-probe.service.js +10 -2
  25. package/dist/src/data-marts/credentials/services/credential.service.d.ts +4 -0
  26. package/dist/src/data-marts/credentials/services/credential.service.js +36 -0
  27. package/dist/src/data-marts/credentials/services/google-service-account-key.d.ts +6 -0
  28. package/dist/src/data-marts/credentials/services/google-service-account-key.js +46 -0
  29. package/dist/src/data-marts/credentials/services/google-service-account-token.service.d.ts +25 -0
  30. package/dist/src/data-marts/credentials/services/google-service-account-token.service.js +177 -0
  31. package/dist/src/data-marts/credentials/use-cases/create-credential.service.d.ts +1 -0
  32. package/dist/src/data-marts/credentials/use-cases/create-credential.service.js +10 -2
  33. package/dist/src/data-marts/credentials/use-cases/update-credential.service.d.ts +1 -0
  34. package/dist/src/data-marts/credentials/use-cases/update-credential.service.js +28 -4
  35. package/dist/src/data-marts/credentials/use-cases/validate-credential.service.js +2 -5
  36. package/dist/src/data-marts/data-destination-types/ee/email/services/email-credentials-validator.js +1 -3
  37. package/dist/src/data-marts/data-destination-types/ee/google-chat/services/google-chat-credentials-validator.js +1 -3
  38. package/dist/src/data-marts/data-destination-types/google-sheets/services/google-sheets-credentials-validator.js +1 -3
  39. package/dist/src/data-marts/data-destination-types/google-sheets/services/google-sheets-report-writer.d.ts +1 -0
  40. package/dist/src/data-marts/data-destination-types/google-sheets/services/google-sheets-report-writer.js +13 -1
  41. package/dist/src/data-marts/data-destination-types/interfaces/data-destination-credentials-validator.interface.d.ts +2 -0
  42. package/dist/src/data-marts/data-destination-types/interfaces/data-destination-credentials-validator.interface.js +7 -0
  43. package/dist/src/data-marts/data-destination-types/looker-studio-connector/services/looker-studio-connector-credentials-validator.js +1 -3
  44. package/dist/src/data-marts/data-marts.module.js +8 -0
  45. package/dist/src/data-marts/data-storage-types/athena/adapters/athena-api.adapter.js +2 -1
  46. package/dist/src/data-marts/data-storage-types/athena/adapters/s3-api.adapter.js +5 -3
  47. package/dist/src/data-marts/data-storage-types/athena/services/athena-access.validator.js +2 -4
  48. package/dist/src/data-marts/data-storage-types/athena/utils/athena-output-location.util.d.ts +5 -0
  49. package/dist/src/data-marts/data-storage-types/athena/utils/athena-output-location.util.js +13 -0
  50. package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-access.validator.js +2 -4
  51. package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-resource-location.util.d.ts +3 -0
  52. package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-resource-location.util.js +18 -0
  53. package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-sharded-tables.util.d.ts +1 -0
  54. package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-sharded-tables.util.js +4 -1
  55. package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-storage-resource-browser.service.js +12 -5
  56. package/dist/src/data-marts/data-storage-types/databricks/services/databricks-access.validator.js +2 -4
  57. package/dist/src/data-marts/data-storage-types/interfaces/data-storage-access-validator.interface.d.ts +3 -0
  58. package/dist/src/data-marts/data-storage-types/interfaces/data-storage-access-validator.interface.js +7 -0
  59. package/dist/src/data-marts/data-storage-types/interfaces/storage-resource-browser.interface.d.ts +2 -0
  60. package/dist/src/data-marts/data-storage-types/redshift/services/redshift-access.validator.js +2 -6
  61. package/dist/src/data-marts/data-storage-types/snowflake/adapters/snowflake-api.adapter.js +1 -0
  62. package/dist/src/data-marts/data-storage-types/snowflake/services/snowflake-access.validator.js +2 -4
  63. package/dist/src/data-marts/dto/domain/list-data-marts.command.d.ts +2 -1
  64. package/dist/src/data-marts/dto/domain/list-data-marts.command.js +3 -1
  65. package/dist/src/data-marts/dto/presentation/run-data-mart-request-api.dto.js +4 -2
  66. package/dist/src/data-marts/dto/presentation/sql-dry-run-request-api.dto.js +3 -0
  67. package/dist/src/data-marts/dto/presentation/storage-resources/list-storage-resources-response.dto.d.ts +2 -0
  68. package/dist/src/data-marts/dto/presentation/storage-resources/list-storage-resources-response.dto.js +17 -0
  69. package/dist/src/data-marts/errors/google-sheets-api-call.error.d.ts +6 -0
  70. package/dist/src/data-marts/errors/google-sheets-api-call.error.js +34 -0
  71. package/dist/src/data-marts/facades/mcp-contexts.facade.d.ts +13 -0
  72. package/dist/src/data-marts/facades/mcp-contexts.facade.impl.d.ts +9 -0
  73. package/dist/src/data-marts/facades/mcp-contexts.facade.impl.js +35 -0
  74. package/dist/src/data-marts/facades/mcp-contexts.facade.js +5 -0
  75. package/dist/src/data-marts/facades/mcp-data-marts.facade.d.ts +9 -0
  76. package/dist/src/data-marts/facades/mcp-data-marts.facade.impl.js +4 -1
  77. package/dist/src/data-marts/mappers/context.mapper.d.ts +4 -0
  78. package/dist/src/data-marts/mappers/context.mapper.js +12 -0
  79. package/dist/src/data-marts/search/engine/advanced-search.service.js +1 -0
  80. package/dist/src/data-marts/search/engine/in-memory-paginated.search.js +17 -1
  81. package/dist/src/data-marts/search/engine/vector-search.port.d.ts +1 -0
  82. package/dist/src/data-marts/services/connector/backfill-segment.d.ts +22 -0
  83. package/dist/src/data-marts/services/connector/backfill-segment.js +91 -0
  84. package/dist/src/data-marts/services/connector/connector-execution.service.d.ts +1 -0
  85. package/dist/src/data-marts/services/connector/connector-execution.service.js +3 -0
  86. package/dist/src/data-marts/services/connector/connector-executor.service.d.ts +4 -1
  87. package/dist/src/data-marts/services/connector/connector-executor.service.js +107 -23
  88. package/dist/src/data-marts/services/connector/connector-run.service.d.ts +3 -0
  89. package/dist/src/data-marts/services/connector/connector-run.service.js +98 -4
  90. package/dist/src/data-marts/services/context/context.service.d.ts +2 -0
  91. package/dist/src/data-marts/services/context/context.service.js +21 -0
  92. package/dist/src/data-marts/services/data-mart-run.service.d.ts +1 -0
  93. package/dist/src/data-marts/services/data-mart-run.service.js +9 -0
  94. package/dist/src/data-marts/services/data-mart.service.d.ts +1 -0
  95. package/dist/src/data-marts/services/data-mart.service.js +3 -0
  96. package/dist/src/data-marts/system-triggers/processors/repair-backfill-chains-processor.d.ts +14 -0
  97. package/dist/src/data-marts/system-triggers/processors/repair-backfill-chains-processor.js +45 -0
  98. package/dist/src/data-marts/use-cases/cancel-data-mart-run.service.d.ts +4 -0
  99. package/dist/src/data-marts/use-cases/cancel-data-mart-run.service.js +46 -1
  100. package/dist/src/data-marts/use-cases/list-data-marts.service.js +1 -0
  101. package/dist/src/data-marts/use-cases/stream-http-data.service.d.ts +0 -1
  102. package/dist/src/data-marts/use-cases/stream-http-data.service.js +2 -6
  103. package/dist/src/data-marts/use-cases/update-data-storage.service.js +7 -7
  104. package/dist/src/data-marts/utils/field-errors.utils.d.ts +9 -0
  105. package/dist/src/data-marts/utils/field-errors.utils.js +51 -0
  106. package/dist/src/data-marts/utils/manual-backfill-range.d.ts +52 -0
  107. package/dist/src/data-marts/utils/manual-backfill-range.js +110 -8
  108. package/dist/src/ee/mcp/instructions/mcp-system-instructions.d.ts +1 -1
  109. package/dist/src/ee/mcp/instructions/mcp-system-instructions.js +4 -0
  110. package/dist/src/ee/mcp/sdk/mcp-output-schema.d.ts +3 -0
  111. package/dist/src/ee/mcp/sdk/mcp-output-schema.js +53 -0
  112. package/dist/src/ee/mcp/sdk/mcp-schema-refresh.d.ts +8 -0
  113. package/dist/src/ee/mcp/sdk/mcp-schema-refresh.js +44 -0
  114. package/dist/src/ee/mcp/sdk/mcp-sdk-server.factory.d.ts +8 -1
  115. package/dist/src/ee/mcp/sdk/mcp-sdk-server.factory.js +35 -4
  116. package/dist/src/ee/mcp/tools/context-input.d.ts +6 -0
  117. package/dist/src/ee/mcp/tools/context-input.js +13 -0
  118. package/dist/src/ee/mcp/tools/data-mart-catalog.tool.d.ts +10 -2
  119. package/dist/src/ee/mcp/tools/data-mart-catalog.tool.js +17 -5
  120. package/dist/src/ee/mcp/tools/data-mart-details.tool.d.ts +5 -1
  121. package/dist/src/ee/mcp/tools/data-mart-details.tool.js +4 -1
  122. package/dist/src/ee/mcp/tools/list-contexts.tool.d.ts +131 -0
  123. package/dist/src/ee/mcp/tools/list-contexts.tool.js +50 -0
  124. package/dist/src/ee/mcp/tools/mcp-tool.providers.js +2 -0
  125. package/dist/src/ee/mcp/tools/search-data-marts.tool.d.ts +10 -2
  126. package/dist/src/ee/mcp/tools/search-data-marts.tool.js +17 -3
  127. package/dist/src/ee/mcp/transport/mcp-http-entry.service.js +1 -1
  128. package/dist/src/idp/decorators/auth-context.decorator.js +1 -0
  129. package/dist/src/idp/guards/idp.guard.d.ts +3 -0
  130. package/dist/src/idp/guards/idp.guard.js +38 -8
  131. package/dist/src/idp/oauth/controllers/oauth-authorization.controller.js +8 -6
  132. package/dist/src/idp/oauth/mcp-client-integration.d.ts +1 -0
  133. package/dist/src/idp/oauth/mcp-client-integration.js +15 -0
  134. package/dist/src/idp/ports/plugin-runtime-authorizer.port.d.ts +6 -0
  135. package/dist/src/idp/types/auth.types.d.ts +1 -0
  136. package/dist/src/migrations/1790830000000-widen-sql-dry-run-trigger-sql-column.d.ts +6 -0
  137. package/dist/src/migrations/1790830000000-widen-sql-dry-run-trigger-sql-column.js +21 -0
  138. package/dist/src/migrations/1790900000000-add-plugin-version-backend.d.ts +6 -0
  139. package/dist/src/migrations/1790900000000-add-plugin-version-backend.js +21 -0
  140. package/dist/src/migrations/1790900000001-create-plugin-action-execution.d.ts +6 -0
  141. package/dist/src/migrations/1790900000001-create-plugin-action-execution.js +77 -0
  142. package/dist/src/migrations/1791000000000-add-credential-public-metadata.d.ts +6 -0
  143. package/dist/src/migrations/1791000000000-add-credential-public-metadata.js +23 -0
  144. package/dist/src/plugin-host/collections/dto/domain/plugin-collection.types.d.ts +1 -0
  145. package/dist/src/plugin-host/collections/errors/plugin-collection.errors.d.ts +6 -0
  146. package/dist/src/plugin-host/collections/errors/plugin-collection.errors.js +19 -1
  147. package/dist/src/plugin-host/collections/services/plugin-collection-declaration.service.js +3 -3
  148. package/dist/src/plugin-host/collections/use-cases/put-plugin-collection-document.service.js +7 -0
  149. package/dist/src/plugin-host/constants/plugin-action-limits.d.ts +34 -0
  150. package/dist/src/plugin-host/constants/plugin-action-limits.js +51 -0
  151. package/dist/src/plugin-host/controllers/plugin-action-runtime.controller.d.ts +20 -0
  152. package/dist/src/plugin-host/controllers/plugin-action-runtime.controller.js +123 -0
  153. package/dist/src/plugin-host/controllers/plugin-credential-runtime.controller.js +11 -19
  154. package/dist/src/plugin-host/controllers/plugin-gallery.controller.d.ts +5 -1
  155. package/dist/src/plugin-host/controllers/plugin-gallery.controller.js +25 -1
  156. package/dist/src/plugin-host/controllers/plugin-history.controller.d.ts +10 -0
  157. package/dist/src/plugin-host/controllers/plugin-history.controller.js +57 -0
  158. package/dist/src/plugin-host/controllers/plugin-release-check.controller.d.ts +10 -0
  159. package/dist/src/plugin-host/controllers/plugin-release-check.controller.js +58 -0
  160. package/dist/src/plugin-host/dto/domain/check-plugin-release.command.d.ts +22 -0
  161. package/dist/src/plugin-host/dto/domain/check-plugin-release.command.js +17 -0
  162. package/dist/src/plugin-host/dto/domain/find-plugin-by-repository.command.d.ts +6 -0
  163. package/dist/src/plugin-host/dto/domain/find-plugin-by-repository.command.js +13 -0
  164. package/dist/src/plugin-host/dto/domain/list-plugin-history.command.d.ts +10 -0
  165. package/dist/src/plugin-host/dto/domain/list-plugin-history.command.js +18 -0
  166. package/dist/src/plugin-host/dto/domain/plugin-action-execution.command.d.ts +23 -0
  167. package/dist/src/plugin-host/dto/domain/plugin-action-execution.command.js +44 -0
  168. package/dist/src/plugin-host/dto/domain/plugin-action-execution.dto.d.ts +36 -0
  169. package/dist/src/plugin-host/dto/domain/plugin-action-execution.dto.js +3 -0
  170. package/dist/src/plugin-host/dto/domain/plugin-history.dto.d.ts +29 -0
  171. package/dist/src/plugin-host/dto/domain/plugin-history.dto.js +3 -0
  172. package/dist/src/plugin-host/dto/domain/plugin-view.dto.d.ts +1 -0
  173. package/dist/src/plugin-host/dto/presentation/plugin-action-api.dto.d.ts +44 -0
  174. package/dist/src/plugin-host/dto/presentation/plugin-action-api.dto.js +208 -0
  175. package/dist/src/plugin-host/dto/presentation/plugin-gallery-api.dto.d.ts +2 -0
  176. package/dist/src/plugin-host/dto/presentation/plugin-gallery-api.dto.js +7 -0
  177. package/dist/src/plugin-host/dto/presentation/plugin-history-api.dto.d.ts +29 -0
  178. package/dist/src/plugin-host/dto/presentation/plugin-history-api.dto.js +148 -0
  179. package/dist/src/plugin-host/dto/presentation/plugin-lookup-api.dto.d.ts +3 -0
  180. package/dist/src/plugin-host/dto/presentation/plugin-lookup-api.dto.js +22 -0
  181. package/dist/src/plugin-host/dto/presentation/publication-api.dto.d.ts +17 -0
  182. package/dist/src/plugin-host/dto/presentation/publication-api.dto.js +95 -1
  183. package/dist/src/plugin-host/entities/plugin-action-execution.entity.d.ts +24 -0
  184. package/dist/src/plugin-host/entities/plugin-action-execution.entity.js +136 -0
  185. package/dist/src/plugin-host/entities/plugin-version.entity.d.ts +2 -1
  186. package/dist/src/plugin-host/entities/plugin-version.entity.js +5 -0
  187. package/dist/src/plugin-host/enums/plugin-action-execution-status.enum.d.ts +9 -0
  188. package/dist/src/plugin-host/enums/plugin-action-execution-status.enum.js +22 -0
  189. package/dist/src/plugin-host/enums/release-rejection-code.enum.d.ts +3 -0
  190. package/dist/src/plugin-host/enums/release-rejection-code.enum.js +6 -0
  191. package/dist/src/plugin-host/errors/plugin-action.errors.d.ts +45 -0
  192. package/dist/src/plugin-host/errors/plugin-action.errors.js +70 -0
  193. package/dist/src/plugin-host/errors/plugin-host.errors.d.ts +6 -0
  194. package/dist/src/plugin-host/errors/plugin-host.errors.js +10 -1
  195. package/dist/src/plugin-host/filters/plugin-host-exception.filter.js +2 -2
  196. package/dist/src/plugin-host/mappers/plugin-action-execution.mapper.d.ts +3 -0
  197. package/dist/src/plugin-host/mappers/plugin-action-execution.mapper.js +22 -0
  198. package/dist/src/plugin-host/mappers/plugin-presentation.mapper.d.ts +22 -1
  199. package/dist/src/plugin-host/mappers/plugin-presentation.mapper.js +87 -1
  200. package/dist/src/plugin-host/plugin-host.module.js +34 -0
  201. package/dist/src/plugin-host/services/action-input-validator.service.d.ts +23 -0
  202. package/dist/src/plugin-host/services/action-input-validator.service.js +277 -0
  203. package/dist/src/plugin-host/services/external-credential-definition-sync.service.d.ts +3 -0
  204. package/dist/src/plugin-host/services/external-credential-definition-sync.service.js +47 -15
  205. package/dist/src/plugin-host/services/plugin-action-dispatcher.service.d.ts +13 -0
  206. package/dist/src/plugin-host/services/plugin-action-dispatcher.service.js +140 -0
  207. package/dist/src/plugin-host/services/plugin-action-execution.service.d.ts +69 -0
  208. package/dist/src/plugin-host/services/plugin-action-execution.service.js +239 -0
  209. package/dist/src/plugin-host/services/plugin-action-starter.service.d.ts +22 -0
  210. package/dist/src/plugin-host/services/plugin-action-starter.service.js +81 -0
  211. package/dist/src/plugin-host/services/plugin-audit.service.d.ts +13 -0
  212. package/dist/src/plugin-host/services/plugin-audit.service.js +78 -0
  213. package/dist/src/plugin-host/services/plugin-publication.service.d.ts +4 -0
  214. package/dist/src/plugin-host/services/plugin-publication.service.js +51 -23
  215. package/dist/src/plugin-host/services/plugin-runtime-authorizer.service.d.ts +5 -2
  216. package/dist/src/plugin-host/services/plugin-runtime-authorizer.service.js +31 -3
  217. package/dist/src/plugin-host/services/plugin-version.service.d.ts +2 -1
  218. package/dist/src/plugin-host/services/release-candidate-rules.service.d.ts +51 -0
  219. package/dist/src/plugin-host/services/release-candidate-rules.service.js +198 -0
  220. package/dist/src/plugin-host/services/remote-url-validator.service.d.ts +7 -0
  221. package/dist/src/plugin-host/services/remote-url-validator.service.js +4 -0
  222. package/dist/src/plugin-host/system-triggers/plugin-action-execution-sweep.processor.d.ts +14 -0
  223. package/dist/src/plugin-host/system-triggers/plugin-action-execution-sweep.processor.js +50 -0
  224. package/dist/src/plugin-host/use-cases/cancel-plugin-action-execution.service.d.ts +8 -0
  225. package/dist/src/plugin-host/use-cases/cancel-plugin-action-execution.service.js +39 -0
  226. package/dist/src/plugin-host/use-cases/check-plugin-release.service.d.ts +22 -0
  227. package/dist/src/plugin-host/use-cases/check-plugin-release.service.js +152 -0
  228. package/dist/src/plugin-host/use-cases/find-plugin-by-repository.service.d.ts +9 -0
  229. package/dist/src/plugin-host/use-cases/find-plugin-by-repository.service.js +35 -0
  230. package/dist/src/plugin-host/use-cases/get-current-plugin-action-execution.service.d.ts +14 -0
  231. package/dist/src/plugin-host/use-cases/get-current-plugin-action-execution.service.js +85 -0
  232. package/dist/src/plugin-host/use-cases/get-plugin-action-execution.service.d.ts +9 -0
  233. package/dist/src/plugin-host/use-cases/get-plugin-action-execution.service.js +67 -0
  234. package/dist/src/plugin-host/use-cases/get-plugin-installation-entry.service.js +2 -7
  235. package/dist/src/plugin-host/use-cases/install-plugin.service.js +4 -0
  236. package/dist/src/plugin-host/use-cases/list-installations.service.d.ts +3 -1
  237. package/dist/src/plugin-host/use-cases/list-installations.service.js +14 -3
  238. package/dist/src/plugin-host/use-cases/list-plugin-history.service.d.ts +25 -0
  239. package/dist/src/plugin-host/use-cases/list-plugin-history.service.js +147 -0
  240. package/dist/src/plugin-host/use-cases/plugin-publisher-access.d.ts +5 -0
  241. package/dist/src/plugin-host/use-cases/plugin-publisher-access.js +28 -0
  242. package/dist/src/plugin-host/use-cases/start-plugin-action-execution.service.d.ts +12 -0
  243. package/dist/src/plugin-host/use-cases/start-plugin-action-execution.service.js +64 -0
  244. package/dist/src/plugin-host/use-cases/sync-plugin-releases.service.d.ts +3 -5
  245. package/dist/src/plugin-host/use-cases/sync-plugin-releases.service.js +15 -59
  246. package/dist/src/plugin-host/use-cases/uninstall-plugin.service.js +3 -1
  247. package/dist/src/plugin-host/use-cases/update-plugin.service.d.ts +0 -1
  248. package/dist/src/plugin-host/use-cases/update-plugin.service.js +3 -25
  249. package/dist/src/plugin-host/utils/action-input-schema.util.d.ts +14 -0
  250. package/dist/src/plugin-host/utils/action-input-schema.util.js +133 -0
  251. package/dist/src/plugin-host/utils/credential-handles.util.d.ts +3 -0
  252. package/dist/src/plugin-host/utils/credential-handles.util.js +13 -0
  253. package/dist/src/plugin-host/utils/execution-token.util.d.ts +5 -0
  254. package/dist/src/plugin-host/utils/execution-token.util.js +13 -0
  255. package/dist/src/plugin-host/utils/github-repo-locator.util.js +1 -1
  256. package/dist/src/plugin-host/utils/json-shape.util.d.ts +1 -0
  257. package/dist/src/plugin-host/utils/json-shape.util.js +21 -0
  258. package/dist/src/plugin-host/utils/plugin-action-outcome.util.d.ts +10 -0
  259. package/dist/src/plugin-host/utils/plugin-action-outcome.util.js +67 -0
  260. package/dist/src/plugin-host/utils/plugin-manifest.util.d.ts +121 -0
  261. package/dist/src/plugin-host/utils/plugin-manifest.util.js +111 -1
  262. package/dist/src/plugin-host/utils/request-abort-signal.util.d.ts +5 -0
  263. package/dist/src/plugin-host/utils/request-abort-signal.util.js +19 -0
  264. package/package.json +10 -8
@@ -51,6 +51,7 @@ class SnowflakeApiAdapter {
51
51
  warehouse: config.warehouse,
52
52
  retryTimeout: 10000,
53
53
  sfRetryMaxLoginRetries: 1,
54
+ certRevocationCheckMode: 'ADVISORY',
54
55
  };
55
56
  if (credentials.authMethod === snowflake_auth_method_enum_1.SnowflakeAuthMethod.PASSWORD) {
56
57
  connectionOptions.username = credentials.username;
@@ -21,14 +21,12 @@ let SnowflakeAccessValidator = SnowflakeAccessValidator_1 = class SnowflakeAcces
21
21
  const configOpt = snowflake_config_schema_1.SnowflakeConfigSchema.safeParse(config);
22
22
  if (!configOpt.success) {
23
23
  this.logger.log('Invalid config', configOpt.error);
24
- return new data_storage_access_validator_interface_1.ValidationResult(false, 'Invalid config', { errors: configOpt.error.errors });
24
+ return data_storage_access_validator_interface_1.ValidationResult.invalidInput('config', configOpt.error);
25
25
  }
26
26
  const credentialsOpt = snowflake_credentials_schema_1.SnowflakeCredentialsSchema.safeParse(credentials);
27
27
  if (!credentialsOpt.success) {
28
28
  this.logger.log('Invalid credentials', credentialsOpt.error);
29
- return new data_storage_access_validator_interface_1.ValidationResult(false, 'Invalid credentials', {
30
- errors: credentialsOpt.error.errors,
31
- });
29
+ return data_storage_access_validator_interface_1.ValidationResult.invalidInput('credentials', credentialsOpt.error);
32
30
  }
33
31
  const snowflakeConfig = configOpt.data;
34
32
  const apiAdapter = new snowflake_api_adapter_1.SnowflakeApiAdapter(credentialsOpt.data, snowflakeConfig);
@@ -7,5 +7,6 @@ export declare class ListDataMartsCommand {
7
7
  readonly offset?: number | undefined;
8
8
  readonly ownerFilter?: OwnerFilter | undefined;
9
9
  readonly status?: DataMartStatus | undefined;
10
- constructor(projectId: string, userId: string, roles: string[], offset?: number | undefined, ownerFilter?: OwnerFilter | undefined, status?: DataMartStatus | undefined);
10
+ readonly contextIds?: string[] | undefined;
11
+ constructor(projectId: string, userId: string, roles: string[], offset?: number | undefined, ownerFilter?: OwnerFilter | undefined, status?: DataMartStatus | undefined, contextIds?: string[] | undefined);
11
12
  }
@@ -8,13 +8,15 @@ class ListDataMartsCommand {
8
8
  offset;
9
9
  ownerFilter;
10
10
  status;
11
- constructor(projectId, userId, roles, offset, ownerFilter, status) {
11
+ contextIds;
12
+ constructor(projectId, userId, roles, offset, ownerFilter, status, contextIds) {
12
13
  this.projectId = projectId;
13
14
  this.userId = userId;
14
15
  this.roles = roles;
15
16
  this.offset = offset;
16
17
  this.ownerFilter = ownerFilter;
17
18
  this.status = status;
19
+ this.contextIds = contextIds;
18
20
  }
19
21
  }
20
22
  exports.ListDataMartsCommand = ListDataMartsCommand;
@@ -171,8 +171,10 @@ __decorate([
171
171
  description: `Payload for the manual run. Omit it or select INCREMENTAL for an incremental run.
172
172
  MANUAL_BACKFILL can include connector-specific fields in data; connectors without backfill
173
173
  fields can omit data. StartDate and EndDate accept YYYY-MM-DD (or the date part of an
174
- ISO-8601 timestamp). A missing or future EndDate counts as today, and the resulting range
175
- may cover at most 31 days.`,
174
+ ISO-8601 timestamp). A missing or future EndDate counts as today. A StartDate earlier than
175
+ 2000-01-01 is rejected. The range has no other length limit: a range longer than 31 days runs
176
+ as a chain of runs, one segment of up to 31 days each. A segment counts as one connector run
177
+ once any of its accounts loads data.`,
176
178
  }),
177
179
  __metadata("design:type", Object)
178
180
  ], RunDataMartRequestApiDto.prototype, "payload", void 0);
@@ -12,6 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SqlDryRunRequestApiDto = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
14
  const class_validator_1 = require("class-validator");
15
+ const max_byte_length_validator_1 = require("../../../common/validators/max-byte-length.validator");
16
+ const MAX_MEDIUMTEXT_COLUMN_BYTES = 16777215;
15
17
  class SqlDryRunRequestApiDto {
16
18
  sql;
17
19
  }
@@ -23,6 +25,7 @@ __decorate([
23
25
  }),
24
26
  (0, class_validator_1.IsString)(),
25
27
  (0, class_validator_1.IsNotEmpty)(),
28
+ (0, max_byte_length_validator_1.MaxByteLength)(MAX_MEDIUMTEXT_COLUMN_BYTES),
26
29
  __metadata("design:type", String)
27
30
  ], SqlDryRunRequestApiDto.prototype, "sql", void 0);
28
31
  //# sourceMappingURL=sql-dry-run-request-api.dto.js.map
@@ -7,6 +7,8 @@ export declare class StorageResourceLeafDto {
7
7
  groupId: string;
8
8
  type: 'TABLE' | 'VIEW';
9
9
  fullyQualifiedName: string;
10
+ location?: string;
11
+ locationMismatch?: boolean;
10
12
  }
11
13
  export declare class ListStorageResourcesResponseDto {
12
14
  namespaces?: StorageNamespaceNodeDto[];
@@ -35,6 +35,8 @@ class StorageResourceLeafDto {
35
35
  groupId;
36
36
  type;
37
37
  fullyQualifiedName;
38
+ location;
39
+ locationMismatch;
38
40
  }
39
41
  exports.StorageResourceLeafDto = StorageResourceLeafDto;
40
42
  __decorate([
@@ -59,6 +61,21 @@ __decorate([
59
61
  }),
60
62
  __metadata("design:type", String)
61
63
  ], StorageResourceLeafDto.prototype, "fullyQualifiedName", void 0);
64
+ __decorate([
65
+ (0, swagger_1.ApiPropertyOptional)({
66
+ description: "Where the resource's data lives, e.g. a BigQuery dataset location",
67
+ example: 'EU',
68
+ }),
69
+ __metadata("design:type", String)
70
+ ], StorageResourceLeafDto.prototype, "location", void 0);
71
+ __decorate([
72
+ (0, swagger_1.ApiPropertyOptional)({
73
+ description: 'True when the resource lives in a different location than the one the storage runs ' +
74
+ 'queries in, so a data mart on this storage cannot read it. Omitted when either ' +
75
+ 'location is unknown.',
76
+ }),
77
+ __metadata("design:type", Boolean)
78
+ ], StorageResourceLeafDto.prototype, "locationMismatch", void 0);
62
79
  class ListStorageResourcesResponseDto {
63
80
  namespaces;
64
81
  resources;
@@ -0,0 +1,6 @@
1
+ export declare class GoogleSheetsApiCallError extends Error {
2
+ readonly status: number;
3
+ readonly cause: unknown;
4
+ constructor(message: string, status: number, cause: unknown);
5
+ }
6
+ export declare function googleSheetsApiCallMessage(step: string, status: number, googleMessage: string): string;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GoogleSheetsApiCallError = void 0;
4
+ exports.googleSheetsApiCallMessage = googleSheetsApiCallMessage;
5
+ class GoogleSheetsApiCallError extends Error {
6
+ status;
7
+ cause;
8
+ constructor(message, status, cause) {
9
+ super(message);
10
+ this.status = status;
11
+ this.cause = cause;
12
+ this.name = 'GoogleSheetsApiCallError';
13
+ }
14
+ }
15
+ exports.GoogleSheetsApiCallError = GoogleSheetsApiCallError;
16
+ function isUnfinishedUpdate(status) {
17
+ return status === 404 || status >= 500;
18
+ }
19
+ function googleSheetsApiCallMessage(step, status, googleMessage) {
20
+ const details = `Details: ${googleMessage.trim()}`;
21
+ if (isUnfinishedUpdate(status)) {
22
+ return (`Google Sheets couldn't finish updating the spreadsheet this report writes to. ` +
23
+ `A single failure can be a temporary problem on Google's side — run the report ` +
24
+ `again. If it fails on every run, the spreadsheet most likely recalculates heavy ` +
25
+ `formulas after every change, for example formulas on other sheets that read whole ` +
26
+ `columns of the report's sheet: limit them to the rows they need or send the report ` +
27
+ `to a separate spreadsheet. Circular references can cause this too: fix the formulas ` +
28
+ `that show a circular dependency error, and turn on Iterative calculation ` +
29
+ `(File → Settings → Calculation) only if a circular reference is intentional. ${details}`);
30
+ }
31
+ const whileStep = `while ${step.charAt(0).toLowerCase()}${step.slice(1)}`;
32
+ return `Google Sheets rejected an update ${whileStep}. ${details}`;
33
+ }
34
+ //# sourceMappingURL=google-sheets-api-call.error.js.map
@@ -0,0 +1,13 @@
1
+ export declare const MCP_CONTEXTS_FACADE: unique symbol;
2
+ export interface McpContextSummary {
3
+ id: string;
4
+ name: string;
5
+ }
6
+ export interface McpContext extends McpContextSummary {
7
+ description: string | null;
8
+ }
9
+ export interface McpContextsFacade {
10
+ listContexts(projectId: string): Promise<McpContext[]>;
11
+ validateContextIds(projectId: string, contextIds: string[]): Promise<void>;
12
+ getDataMartContexts(projectId: string, dataMartIds: string[]): Promise<Record<string, McpContextSummary[]>>;
13
+ }
@@ -0,0 +1,9 @@
1
+ import { ContextService } from '../services/context/context.service';
2
+ import type { McpContextsFacade, McpContext, McpContextSummary } from './mcp-contexts.facade';
3
+ export declare class McpContextsFacadeImpl implements McpContextsFacade {
4
+ private readonly contexts;
5
+ constructor(contexts: ContextService);
6
+ listContexts(projectId: string): Promise<McpContext[]>;
7
+ validateContextIds(projectId: string, contextIds: string[]): Promise<void>;
8
+ getDataMartContexts(projectId: string, dataMartIds: string[]): Promise<Record<string, McpContextSummary[]>>;
9
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.McpContextsFacadeImpl = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const context_service_1 = require("../services/context/context.service");
15
+ let McpContextsFacadeImpl = class McpContextsFacadeImpl {
16
+ contexts;
17
+ constructor(contexts) {
18
+ this.contexts = contexts;
19
+ }
20
+ listContexts(projectId) {
21
+ return this.contexts.listForMcp(projectId);
22
+ }
23
+ validateContextIds(projectId, contextIds) {
24
+ return this.contexts.validateContextIds([...new Set(contextIds)], projectId);
25
+ }
26
+ getDataMartContexts(projectId, dataMartIds) {
27
+ return this.contexts.getDataMartContextSummaries(projectId, dataMartIds);
28
+ }
29
+ };
30
+ exports.McpContextsFacadeImpl = McpContextsFacadeImpl;
31
+ exports.McpContextsFacadeImpl = McpContextsFacadeImpl = __decorate([
32
+ (0, common_1.Injectable)(),
33
+ __metadata("design:paramtypes", [context_service_1.ContextService])
34
+ ], McpContextsFacadeImpl);
35
+ //# sourceMappingURL=mcp-contexts.facade.impl.js.map
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MCP_CONTEXTS_FACADE = void 0;
4
+ exports.MCP_CONTEXTS_FACADE = Symbol('MCP_CONTEXTS_FACADE');
5
+ //# sourceMappingURL=mcp-contexts.facade.js.map
@@ -11,6 +11,7 @@ export interface McpListDataMartsRequest {
11
11
  userId: string;
12
12
  roles: string[];
13
13
  status?: McpDataMartCatalogStatus;
14
+ contextIds?: string[];
14
15
  }
15
16
  export interface McpSummarizeDataCatalogRequest {
16
17
  projectId: string;
@@ -31,6 +32,10 @@ export interface McpDataMartListItem {
31
32
  description: string | null;
32
33
  status: string;
33
34
  updatedAt: string;
35
+ contexts: Array<{
36
+ id: string;
37
+ name: string;
38
+ }>;
34
39
  }
35
40
  export interface McpListDataMartsResponse {
36
41
  dataMarts: McpDataMartListItem[];
@@ -60,6 +65,10 @@ export interface McpJoinDto {
60
65
  description?: string;
61
66
  }
62
67
  export interface McpDataMartDetailsResponse {
68
+ contexts: Array<{
69
+ id: string;
70
+ name: string;
71
+ }>;
63
72
  id: string;
64
73
  name: string;
65
74
  description: string;
@@ -14,6 +14,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
14
14
  var McpDataMartsFacadeImpl_1;
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.McpDataMartsFacadeImpl = void 0;
17
+ const extract_context_summaries_1 = require("../utils/extract-context-summaries");
17
18
  const common_1 = require("@nestjs/common");
18
19
  const internal_helpers_1 = require("@owox/internal-helpers");
19
20
  const type_resolver_1 = require("../../common/resolver/type-resolver");
@@ -60,7 +61,7 @@ let McpDataMartsFacadeImpl = McpDataMartsFacadeImpl_1 = class McpDataMartsFacade
60
61
  }
61
62
  async listDataMarts(request) {
62
63
  const status = request.status === 'draft' ? data_mart_status_enum_1.DataMartStatus.DRAFT : data_mart_status_enum_1.DataMartStatus.PUBLISHED;
63
- const result = await this.listDataMartsService.run(new list_data_marts_command_1.ListDataMartsCommand(request.projectId, request.userId, request.roles, undefined, undefined, status));
64
+ const result = await this.listDataMartsService.run(new list_data_marts_command_1.ListDataMartsCommand(request.projectId, request.userId, request.roles, undefined, undefined, status, request.contextIds));
64
65
  return {
65
66
  dataMarts: result.items
66
67
  .filter(item => item.status === status)
@@ -70,6 +71,7 @@ let McpDataMartsFacadeImpl = McpDataMartsFacadeImpl_1 = class McpDataMartsFacade
70
71
  description: item.description,
71
72
  status: item.status,
72
73
  updatedAt: item.modifiedAt.toISOString(),
74
+ contexts: item.contexts ?? [],
73
75
  })),
74
76
  };
75
77
  }
@@ -93,6 +95,7 @@ let McpDataMartsFacadeImpl = McpDataMartsFacadeImpl_1 = class McpDataMartsFacade
93
95
  return {
94
96
  id: dataMart.id,
95
97
  name: dataMart.title,
98
+ contexts: (0, extract_context_summaries_1.extractContextSummaries)(dataMart.contexts),
96
99
  description: dataMart.description ?? '',
97
100
  fields: this.withDisplayNames(schema?.fields ?? []),
98
101
  joinedFields,
@@ -1,8 +1,12 @@
1
+ import type { McpContext, McpContextSummary } from '../facades/mcp-contexts.facade';
2
+ import type { DataMartContext } from '../entities/data-mart-context.entity';
1
3
  import { UserProjectionsListDto } from '../../idp/dto/domain/user-projections-list.dto';
2
4
  import { ContextDto } from '../dto/domain/context.dto';
3
5
  import { ContextResponseApiDto } from '../dto/presentation/context-api.dto';
4
6
  import { Context } from '../entities/context.entity';
5
7
  export declare class ContextMapper {
8
+ toMcpContext(entity: Context): McpContext;
9
+ toDataMartContextSummaries(rows: DataMartContext[]): Record<string, McpContextSummary[]>;
6
10
  toDomainDto(entity: Context, userProjections?: UserProjectionsListDto): ContextDto;
7
11
  toApiResponse(dto: ContextDto): ContextResponseApiDto;
8
12
  }
@@ -10,6 +10,18 @@ exports.ContextMapper = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
11
  const context_dto_1 = require("../dto/domain/context.dto");
12
12
  let ContextMapper = class ContextMapper {
13
+ toMcpContext(entity) {
14
+ return { id: entity.id, name: entity.name, description: entity.description || null };
15
+ }
16
+ toDataMartContextSummaries(rows) {
17
+ const result = {};
18
+ for (const row of rows) {
19
+ if (!row.context || row.context.deletedAt)
20
+ continue;
21
+ (result[row.dataMartId] ??= []).push({ id: row.context.id, name: row.context.name });
22
+ }
23
+ return result;
24
+ }
13
25
  toDomainDto(entity, userProjections) {
14
26
  const projection = entity.createdById && userProjections
15
27
  ? userProjections.getByUserId(entity.createdById)
@@ -59,6 +59,7 @@ let AdvancedSearchService = AdvancedSearchService_1 = class AdvancedSearchServic
59
59
  vectorCandidateLimit: this.config.vectorCandidateMultiplier * topK,
60
60
  accessScope: options.accessScope,
61
61
  excludeDrafts: options.excludeDrafts,
62
+ ...(options.contextIds?.length ? { contextIds: options.contextIds } : {}),
62
63
  };
63
64
  const perTypeResults = await Promise.all(activeTypes.map(entityType => this.vectorSearch.search(entityType, projectId, prompt, promptVec, searchOptions)));
64
65
  const all = perTypeResults
@@ -12,6 +12,7 @@ var InMemoryPaginatedSearch_1;
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.InMemoryPaginatedSearch = void 0;
14
14
  const common_1 = require("@nestjs/common");
15
+ const search_facade_1 = require("../../../common/search/search.facade");
15
16
  const indexable_source_registry_1 = require("../sources/indexable-source.registry");
16
17
  const search_index_repository_1 = require("../schema/search-index.repository");
17
18
  const document_builder_1 = require("../indexing/document-builder");
@@ -102,7 +103,22 @@ let InMemoryPaginatedSearch = InMemoryPaginatedSearch_1 = class InMemoryPaginate
102
103
  excludeDrafts: options.excludeDrafts === true,
103
104
  }));
104
105
  const promptTokens = (0, tokenizer_1.tokenizePrompt)(prompt, entityType);
105
- const predicate = await source.accessPredicateProvider.build('idx', projectId, options.accessScope);
106
+ const accessPredicate = await source.accessPredicateProvider.build('idx', projectId, options.accessScope);
107
+ const predicate = { ...accessPredicate, parameters: { ...accessPredicate.parameters } };
108
+ if (entityType === search_facade_1.SearchableEntityType.DATA_MART && options.contextIds?.length) {
109
+ const contextParameters = Object.fromEntries(options.contextIds.map((id, i) => [`filterContext${String(i)}`, id]));
110
+ const placeholders = Object.keys(contextParameters)
111
+ .map(key => `:${key}`)
112
+ .join(', ');
113
+ predicate.whereSql = [
114
+ predicate.whereSql,
115
+ `EXISTS (SELECT 1 FROM data_mart_contexts filteredContext WHERE filteredContext.data_mart_id = idx.entity_id AND filteredContext.context_id IN (${placeholders}))`,
116
+ ]
117
+ .filter(Boolean)
118
+ .map(sql => `(${sql})`)
119
+ .join(' AND ');
120
+ Object.assign(predicate.parameters, contextParameters);
121
+ }
106
122
  const buffer = new top_k_buffer_1.TopKBuffer(options.topK);
107
123
  const page = await this.repository.searchCandidates(entityType, projectId, predicate, prompt, {
108
124
  candidateLimit: options.candidateLimit,
@@ -20,6 +20,7 @@ export interface VectorSearchOptions {
20
20
  vectorCandidateLimit?: number;
21
21
  accessScope?: SourceAccessScope;
22
22
  excludeDrafts?: boolean;
23
+ contextIds?: string[];
23
24
  }
24
25
  export interface VectorSearchPort {
25
26
  search(entityType: SearchableEntityType, projectId: string, prompt: string, promptVec: Float32Array | null, options: VectorSearchOptions): Promise<ScoredEntity[]>;
@@ -0,0 +1,22 @@
1
+ import { Repository } from 'typeorm';
2
+ import { ConnectorMessage } from '../../connector-types/connector-message/schemas/connector-message.schema';
3
+ import { ConnectorMessageType } from '../../connector-types/enums/connector-message-type-enum';
4
+ import { DataMart } from '../../entities/data-mart.entity';
5
+ import { DataMartRun } from '../../entities/data-mart-run.entity';
6
+ import { BackfillChainMeta, BackfillDateRange } from '../../utils/manual-backfill-range';
7
+ import { ConnectorRunTriggerService } from './connector-run-trigger.service';
8
+ export declare const BACKFILL_SEGMENT_METRIC = "backfill_segment";
9
+ export type SegmentMarkerPhase = 'started' | 'completed' | 'failed';
10
+ export type SegmentChainEnd = 'finished' | 'stopped';
11
+ export interface SegmentMarkerOutcome {
12
+ readonly loadedThrough?: string;
13
+ readonly configurationsLoaded?: number;
14
+ readonly configurationsTotal?: number;
15
+ readonly counted?: boolean;
16
+ readonly chainContinues?: boolean;
17
+ readonly chainEnd?: SegmentChainEnd;
18
+ }
19
+ export declare function buildSegmentMarker(meta: BackfillChainMeta, window: BackfillDateRange, phase: SegmentMarkerPhase, at: string, outcome?: SegmentMarkerOutcome): Extract<ConnectorMessage, {
20
+ type: ConnectorMessageType.LOG;
21
+ }>;
22
+ export declare function createNextSegmentRun(runRepository: Repository<DataMartRun>, triggerService: ConnectorRunTriggerService, previousRun: DataMartRun, dataMart: DataMart, meta: BackfillChainMeta, window: BackfillDateRange): Promise<DataMartRun>;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BACKFILL_SEGMENT_METRIC = void 0;
4
+ exports.buildSegmentMarker = buildSegmentMarker;
5
+ exports.createNextSegmentRun = createNextSegmentRun;
6
+ const connector_message_type_enum_1 = require("../../connector-types/enums/connector-message-type-enum");
7
+ const data_mart_run_status_enum_1 = require("../../enums/data-mart-run-status.enum");
8
+ const data_mart_run_type_enum_1 = require("../../enums/data-mart-run-type.enum");
9
+ const manual_backfill_range_1 = require("../../utils/manual-backfill-range");
10
+ exports.BACKFILL_SEGMENT_METRIC = 'backfill_segment';
11
+ function describeLoadedDays(outcome) {
12
+ if (!outcome.loadedThrough)
13
+ return 'no days of this segment were loaded';
14
+ const { configurationsLoaded, configurationsTotal } = outcome;
15
+ const isPartial = configurationsLoaded !== undefined &&
16
+ configurationsTotal !== undefined &&
17
+ configurationsLoaded < configurationsTotal;
18
+ const scope = isPartial
19
+ ? ` (${configurationsLoaded} of ${configurationsTotal} configurations)`
20
+ : '';
21
+ return `days through ${outcome.loadedThrough} were loaded${scope}`;
22
+ }
23
+ function describeUnloadedPeriod(meta, window) {
24
+ const isLastSegment = meta.segmentIndex >= meta.segmentsTotal;
25
+ const segments = isLastSegment
26
+ ? `segment ${meta.segmentIndex}`
27
+ : `segments ${meta.segmentIndex}–${meta.segmentsTotal}`;
28
+ return `${segments} (${window.startDate} – ${meta.requestedEnd}) ${isLastSegment ? 'was' : 'were'} not loaded`;
29
+ }
30
+ function buildSegmentMarker(meta, window, phase, at, outcome = {}) {
31
+ const period = `${meta.requestedStart} – ${meta.requestedEnd}`;
32
+ const position = `segment ${meta.segmentIndex} of ${meta.segmentsTotal} (${window.startDate} – ${window.endDate})`;
33
+ let message;
34
+ switch (phase) {
35
+ case 'started':
36
+ message = `Backfill ${period}: loading ${position}`;
37
+ break;
38
+ case 'completed':
39
+ message = `Backfill ${period}: ${position} completed — counted as 1 run`;
40
+ break;
41
+ case 'failed':
42
+ message =
43
+ outcome.chainEnd === 'stopped'
44
+ ? `Backfill stopped: the project is restricted; ${describeUnloadedPeriod(meta, window)}.`
45
+ : `Backfill ${period}: ${position} failed; ${describeLoadedDays(outcome)}${outcome.counted ? ' — counted as 1 run' : ''}`;
46
+ break;
47
+ }
48
+ return {
49
+ type: connector_message_type_enum_1.ConnectorMessageType.LOG,
50
+ at,
51
+ metric: exports.BACKFILL_SEGMENT_METRIC,
52
+ value: meta.segmentIndex,
53
+ tags: {
54
+ phase,
55
+ segmentStart: window.startDate,
56
+ segmentEnd: window.endDate,
57
+ backfillStart: meta.requestedStart,
58
+ backfillEnd: meta.requestedEnd,
59
+ segmentsTotal: meta.segmentsTotal,
60
+ ...(outcome.loadedThrough ? { loadedThrough: outcome.loadedThrough } : {}),
61
+ ...(outcome.chainContinues === undefined ? {} : { chainContinues: outcome.chainContinues }),
62
+ ...(outcome.chainEnd ? { chainEnd: outcome.chainEnd } : {}),
63
+ },
64
+ message,
65
+ toFormattedString: () => `[LOG] ${message}`,
66
+ };
67
+ }
68
+ async function createNextSegmentRun(runRepository, triggerService, previousRun, dataMart, meta, window) {
69
+ const additionalParams = (0, manual_backfill_range_1.nextSegmentAdditionalParams)(previousRun.additionalParams, meta, window);
70
+ const nextRun = await runRepository.save(runRepository.create({
71
+ dataMartId: previousRun.dataMartId,
72
+ type: data_mart_run_type_enum_1.DataMartRunType.CONNECTOR,
73
+ definitionRun: dataMart.definition,
74
+ status: data_mart_run_status_enum_1.DataMartRunStatus.PENDING,
75
+ createdById: previousRun.createdById ?? undefined,
76
+ runType: previousRun.runType,
77
+ logs: [],
78
+ errors: [],
79
+ additionalParams,
80
+ }));
81
+ await triggerService.createTrigger({
82
+ dataMartId: previousRun.dataMartId,
83
+ projectId: dataMart.projectId,
84
+ createdById: previousRun.createdById ?? 'system',
85
+ dataMartRunId: nextRun.id,
86
+ runType: previousRun.runType,
87
+ payload: additionalParams,
88
+ });
89
+ return nextRun;
90
+ }
91
+ //# sourceMappingURL=backfill-segment.js.map
@@ -9,5 +9,6 @@ export declare class ConnectorExecutionService {
9
9
  run(dataMart: DataMart, createdById: string, runType: RunType, payload?: Record<string, unknown>): Promise<string>;
10
10
  executeExistingRun(dataMart: DataMart, run: DataMartRun, payload?: Record<string, unknown> | null, signal?: AbortSignal): Promise<void>;
11
11
  executeInterruptedRuns(): Promise<void>;
12
+ repairBackfillChains(): Promise<void>;
12
13
  getDataMartConnectorRunsByStatus(status: DataMartRunStatus): Promise<DataMartRun[]>;
13
14
  }
@@ -26,6 +26,9 @@ let ConnectorExecutionService = class ConnectorExecutionService {
26
26
  async executeInterruptedRuns() {
27
27
  return this.connectorRunService.executeInterruptedRuns();
28
28
  }
29
+ async repairBackfillChains() {
30
+ return this.connectorRunService.repairBackfillChains();
31
+ }
29
32
  async getDataMartConnectorRunsByStatus(status) {
30
33
  return this.connectorRunService.getDataMartConnectorRunsByStatus(status);
31
34
  }
@@ -11,6 +11,7 @@ import { SystemTimeService } from '../../../common/scheduler/services/system-tim
11
11
  import { OwoxEventDispatcher } from '../../../common/event-dispatcher/owox-event-dispatcher';
12
12
  import { ProjectBillingService } from '../project-billing/project-billing.service';
13
13
  import { ConnectorDefinitionService } from './connector-definition.service';
14
+ import { ConnectorRunTriggerService } from './connector-run-trigger.service';
14
15
  import { ConnectorProcessSpawnerService } from './connector-process-spawner.service';
15
16
  import { ConnectorStorageConfigService } from './connector-storage-config.service';
16
17
  import { ConnectorSourceConfigService } from './connector-source-config.service';
@@ -32,8 +33,9 @@ export declare class ConnectorExecutorService {
32
33
  private readonly connectorDefinitionService;
33
34
  private readonly connectorSourceCredentialsService;
34
35
  private readonly configService;
36
+ private readonly connectorRunTriggerService;
35
37
  private readonly logger;
36
- constructor(dataMartRunRepository: Repository<DataMartRun>, processSpawner: ConnectorProcessSpawnerService, storageConfigService: ConnectorStorageConfigService, sourceConfigService: ConnectorSourceConfigService, credentialInjector: ConnectorCredentialInjectorService, connectorOutputCaptureService: ConnectorOutputCaptureService, connectorStateService: ConnectorStateService, gracefulShutdownService: GracefulShutdownService, systemTimeService: SystemTimeService, eventDispatcher: OwoxEventDispatcher, projectBillingService: ProjectBillingService, dataMartService: DataMartService, connectorDefinitionService: ConnectorDefinitionService, connectorSourceCredentialsService: ConnectorSourceCredentialsService, configService: ConfigService);
38
+ constructor(dataMartRunRepository: Repository<DataMartRun>, processSpawner: ConnectorProcessSpawnerService, storageConfigService: ConnectorStorageConfigService, sourceConfigService: ConnectorSourceConfigService, credentialInjector: ConnectorCredentialInjectorService, connectorOutputCaptureService: ConnectorOutputCaptureService, connectorStateService: ConnectorStateService, gracefulShutdownService: GracefulShutdownService, systemTimeService: SystemTimeService, eventDispatcher: OwoxEventDispatcher, projectBillingService: ProjectBillingService, dataMartService: DataMartService, connectorDefinitionService: ConnectorDefinitionService, connectorSourceCredentialsService: ConnectorSourceCredentialsService, configService: ConfigService, connectorRunTriggerService: ConnectorRunTriggerService);
37
39
  executeInBackground(dataMart: DataMart, run: DataMartRun, payload?: Record<string, unknown> | null, signal?: AbortSignal): Promise<void>;
38
40
  private actualizeSchemaAfterConnectorExecution;
39
41
  private runConnectorConfigurations;
@@ -49,6 +51,7 @@ export declare class ConnectorExecutorService {
49
51
  private stripManifestForRunner;
50
52
  private createRunLogFlusher;
51
53
  private updateRunStatus;
54
+ private writeRunOutcome;
52
55
  private mergeWithPersistedOutput;
53
56
  private discountFlushedEntries;
54
57
  private capMergedEntries;