@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
@@ -26,6 +26,7 @@ const credential_context_entity_1 = require("../entities/credential-context.enti
26
26
  const credential_owner_entity_1 = require("../entities/credential-owner.entity");
27
27
  const credential_definition_service_1 = require("../services/credential-definition.service");
28
28
  const credential_service_1 = require("../services/credential.service");
29
+ const google_service_account_key_1 = require("../services/google-service-account-key");
29
30
  const credential_view_service_1 = require("../services/credential-view.service");
30
31
  const credential_validation_probe_service_1 = require("../services/credential-validation-probe.service");
31
32
  const credential_types_1 = require("../credential.types");
@@ -51,10 +52,16 @@ let CreateCredentialService = class CreateCredentialService {
51
52
  async run(context, input) {
52
53
  const definition = await this.definitions.get(input.definitionId);
53
54
  const aiConfiguration = normalizeAiConfiguration(input.aiModelMappings, input.aiModelMappingModes, definition.contract.ai);
55
+ const publicMetadata = definition.contract.auth.type === 'google-service-account'
56
+ ? (0, google_service_account_key_1.parseGoogleServiceAccountKey)(input.secret.value).metadata
57
+ : null;
54
58
  const validation = await this.validationProbe.run(definition, { value: input.secret.value });
55
59
  if (validation.state === 'rejected') {
56
60
  throw new common_1.BadRequestException(validation.message);
57
61
  }
62
+ return this.persist(context, input, definition, aiConfiguration, publicMetadata, validation);
63
+ }
64
+ async persist(context, input, definition, aiConfiguration, publicMetadata, validation) {
58
65
  const credential = await this.credentials.save(this.credentials.create({
59
66
  projectId: context.projectId,
60
67
  title: input.title.trim(),
@@ -71,6 +78,7 @@ let CreateCredentialService = class CreateCredentialService {
71
78
  validationState: validation.state,
72
79
  validationMessage: validation.message,
73
80
  validatedAt: validation.validatedAt,
81
+ publicMetadata,
74
82
  createdById: context.userId,
75
83
  }));
76
84
  const ownerIds = [...new Set([context.userId, ...(input.ownerIds ?? [])])];
@@ -90,9 +98,9 @@ exports.CreateCredentialService = CreateCredentialService;
90
98
  __decorate([
91
99
  (0, typeorm_transactional_1.Transactional)(),
92
100
  __metadata("design:type", Function),
93
- __metadata("design:paramtypes", [Object, Function]),
101
+ __metadata("design:paramtypes", [Object, Function, Object, void 0, Object, Object]),
94
102
  __metadata("design:returntype", Promise)
95
- ], CreateCredentialService.prototype, "run", null);
103
+ ], CreateCredentialService.prototype, "persist", null);
96
104
  exports.CreateCredentialService = CreateCredentialService = __decorate([
97
105
  (0, common_1.Injectable)(),
98
106
  __param(6, (0, typeorm_1.InjectRepository)(credential_owner_entity_1.CredentialOwner)),
@@ -21,5 +21,6 @@ export declare class UpdateCredentialService {
21
21
  private readonly owners;
22
22
  constructor(credentials: CredentialService, definitions: CredentialDefinitionService, access: AccessDecisionService, contextAccess: ContextAccessService, view: CredentialViewService, validationProbe: CredentialValidationProbeService, idpProjections: IdpProjectionsFacade, owners: Repository<CredentialOwner>);
23
23
  run(id: string, context: AuthorizationContext, input: UpdateCredentialApiDto): Promise<CredentialDto>;
24
+ private apply;
24
25
  private assertAccess;
25
26
  }
@@ -24,6 +24,7 @@ const sync_owners_1 = require("../../utils/sync-owners");
24
24
  const credential_owner_entity_1 = require("../entities/credential-owner.entity");
25
25
  const credential_definition_service_1 = require("../services/credential-definition.service");
26
26
  const credential_service_1 = require("../services/credential.service");
27
+ const google_service_account_key_1 = require("../services/google-service-account-key");
27
28
  const credential_view_service_1 = require("../services/credential-view.service");
28
29
  const credential_validation_probe_service_1 = require("../services/credential-validation-probe.service");
29
30
  const create_credential_service_1 = require("./create-credential.service");
@@ -65,14 +66,29 @@ let UpdateCredentialService = class UpdateCredentialService {
65
66
  ? await this.definitions.getForCredential(credential)
66
67
  : await this.definitions.getForView(credential);
67
68
  let validation;
68
- if (input.title !== undefined)
69
- credential.title = input.title.trim();
69
+ let publicMetadata = credential.publicMetadata;
70
70
  if (input.secret !== undefined) {
71
+ if (definition.contract.auth.type === 'google-service-account') {
72
+ publicMetadata = (0, google_service_account_key_1.parseGoogleServiceAccountKey)(input.secret.value).metadata;
73
+ const savedEmail = credential.publicMetadata?.clientEmail ?? storedClientEmail(credential.secret.value);
74
+ if (savedEmail && publicMetadata.clientEmail.toLowerCase() !== savedEmail.toLowerCase()) {
75
+ throw new common_1.BadRequestException(`The replacement key must belong to ${savedEmail}. Create another Credential for a different service account.`);
76
+ }
77
+ }
71
78
  validation = await this.validationProbe.run(definition, { value: input.secret.value });
72
79
  if (validation.state === 'rejected') {
73
80
  throw new common_1.BadRequestException(validation.message);
74
81
  }
82
+ }
83
+ return this.apply(id, context, input, definition, validation, publicMetadata);
84
+ }
85
+ async apply(id, context, input, definition, validation, publicMetadata) {
86
+ const credential = await this.credentials.getByIdAndProjectId(id, context.projectId);
87
+ if (input.title !== undefined)
88
+ credential.title = input.title.trim();
89
+ if (input.secret !== undefined && validation) {
75
90
  credential.secret = { value: input.secret.value };
91
+ credential.publicMetadata = publicMetadata;
76
92
  credential.validationState = validation.state;
77
93
  credential.validationMessage = validation.message;
78
94
  credential.validatedAt = validation.validatedAt;
@@ -113,9 +129,9 @@ exports.UpdateCredentialService = UpdateCredentialService;
113
129
  __decorate([
114
130
  (0, typeorm_transactional_1.Transactional)(),
115
131
  __metadata("design:type", Function),
116
- __metadata("design:paramtypes", [String, Object, Function]),
132
+ __metadata("design:paramtypes", [String, Object, Function, Object, Object, Object]),
117
133
  __metadata("design:returntype", Promise)
118
- ], UpdateCredentialService.prototype, "run", null);
134
+ ], UpdateCredentialService.prototype, "apply", null);
119
135
  exports.UpdateCredentialService = UpdateCredentialService = __decorate([
120
136
  (0, common_1.Injectable)(),
121
137
  __param(7, (0, typeorm_1.InjectRepository)(credential_owner_entity_1.CredentialOwner)),
@@ -128,4 +144,12 @@ exports.UpdateCredentialService = UpdateCredentialService = __decorate([
128
144
  idp_projections_facade_1.IdpProjectionsFacade,
129
145
  typeorm_2.Repository])
130
146
  ], UpdateCredentialService);
147
+ function storedClientEmail(secretValue) {
148
+ try {
149
+ return (0, google_service_account_key_1.parseGoogleServiceAccountKey)(secretValue).metadata.clientEmail;
150
+ }
151
+ catch {
152
+ return undefined;
153
+ }
154
+ }
131
155
  //# sourceMappingURL=update-credential.service.js.map
@@ -36,11 +36,8 @@ let ValidateCredentialService = class ValidateCredentialService {
36
36
  }
37
37
  const definition = await this.definitions.getForCredential(credential);
38
38
  const validation = await this.validationProbe.run(definition, credential.secret);
39
- credential.validationState = validation.state;
40
- credential.validationMessage = validation.message;
41
- credential.validatedAt = validation.validatedAt;
42
- await this.credentials.save(credential);
43
- return this.view.build(credential);
39
+ await this.credentials.writeValidation(id, credential.secret, validation);
40
+ return this.view.build(await this.credentials.getByIdAndProjectId(id, context.projectId));
44
41
  }
45
42
  };
46
43
  exports.ValidateCredentialService = ValidateCredentialService;
@@ -17,9 +17,7 @@ class BaseEmailCredentialsValidator {
17
17
  const credentialsOpt = email_credentials_schema_1.EmailCredentialsSchema.safeParse(credentials);
18
18
  if (!credentialsOpt.success) {
19
19
  this.logger.warn('Invalid credentials format', credentialsOpt.error);
20
- return new data_destination_credentials_validator_interface_1.ValidationResult(false, 'Invalid credentials', {
21
- errors: credentialsOpt.error.errors,
22
- });
20
+ return data_destination_credentials_validator_interface_1.ValidationResult.invalidCredentials(credentialsOpt.error);
23
21
  }
24
22
  return new data_destination_credentials_validator_interface_1.ValidationResult(true);
25
23
  }
@@ -22,9 +22,7 @@ let GoogleChatCredentialsValidator = GoogleChatCredentialsValidator_1 = class Go
22
22
  : google_chat_credentials_schema_1.GoogleChatCredentialsSchema.safeParse(credentials);
23
23
  if (!credentialsValidation.success) {
24
24
  this.logger.warn('Invalid Google Chat credentials format', credentialsValidation.error);
25
- return new data_destination_credentials_validator_interface_1.ValidationResult(false, 'Invalid Google Chat credentials', {
26
- errors: credentialsValidation.error.errors,
27
- });
25
+ return data_destination_credentials_validator_interface_1.ValidationResult.invalidCredentials(credentialsValidation.error);
28
26
  }
29
27
  return new data_destination_credentials_validator_interface_1.ValidationResult(true);
30
28
  }
@@ -20,9 +20,7 @@ let GoogleSheetsCredentialsValidator = GoogleSheetsCredentialsValidator_1 = clas
20
20
  const credentialsOpt = google_sheets_credentials_schema_1.GoogleSheetsCredentialsSchema.safeParse(credentials);
21
21
  if (!credentialsOpt.success) {
22
22
  this.logger.warn('Invalid credentials format', credentialsOpt.error);
23
- return new data_destination_credentials_validator_interface_1.ValidationResult(false, 'Invalid credentials', {
24
- errors: credentialsOpt.error.errors,
25
- });
23
+ return data_destination_credentials_validator_interface_1.ValidationResult.invalidCredentials(credentialsOpt.error);
26
24
  }
27
25
  try {
28
26
  const isValid = await google_sheets_api_adapter_1.GoogleSheetsApiAdapter.validateCredentials(credentialsOpt.data);
@@ -59,4 +59,5 @@ export declare class GoogleSheetsReportWriter implements DataDestinationReportWr
59
59
  private reorderRowsToFinalLayout;
60
60
  private buildFillDownRequests;
61
61
  private executeWithErrorHandling;
62
+ private describeGoogleApiError;
62
63
  }
@@ -26,6 +26,7 @@ const sheets_report_run_event_1 = require("../../../events/sheets-report-run.eve
26
26
  const owox_event_dispatcher_1 = require("../../../../common/event-dispatcher/owox-event-dispatcher");
27
27
  const google_sheet_not_found_error_1 = require("../../../errors/google-sheet-not-found.error");
28
28
  const business_violation_exception_1 = require("../../../../common/exceptions/business-violation.exception");
29
+ const google_sheets_api_call_error_1 = require("../../../errors/google-sheets-api-call.error");
29
30
  const app_edition_config_service_1 = require("../../../../common/config/app-edition-config.service");
30
31
  const public_origin_service_1 = require("../../../../common/config/public-origin.service");
31
32
  const data_mart_url_helper_1 = require("../../../../common/helpers/data-mart-url.helper");
@@ -538,9 +539,20 @@ let GoogleSheetsReportWriter = GoogleSheetsReportWriter_1 = class GoogleSheetsRe
538
539
  else {
539
540
  this.logger.error(`${operationName} failed: ${error.message}`, error.stack);
540
541
  }
541
- throw error;
542
+ throw this.describeGoogleApiError(error, operationName) ?? error;
542
543
  }
543
544
  }
545
+ describeGoogleApiError(error, operationName) {
546
+ if (error instanceof google_sheets_api_call_error_1.GoogleSheetsApiCallError || error instanceof business_violation_exception_1.BusinessViolationException) {
547
+ return undefined;
548
+ }
549
+ const status = google_sheets_api_adapter_1.GoogleSheetsApiAdapter.httpStatusOf(error);
550
+ if (status === undefined || status < 400) {
551
+ return undefined;
552
+ }
553
+ const googleMessage = error instanceof Error ? error.message : String(error);
554
+ return new google_sheets_api_call_error_1.GoogleSheetsApiCallError((0, google_sheets_api_call_error_1.googleSheetsApiCallMessage)(operationName, status, googleMessage), status, error);
555
+ }
544
556
  };
545
557
  exports.GoogleSheetsReportWriter = GoogleSheetsReportWriter;
546
558
  exports.GoogleSheetsReportWriter = GoogleSheetsReportWriter = GoogleSheetsReportWriter_1 = __decorate([
@@ -1,3 +1,4 @@
1
+ import { ZodError } from 'zod';
1
2
  import { TypedComponent } from '../../../common/resolver/typed-component.resolver';
2
3
  import { DataDestinationType } from '../enums/data-destination-type.enum';
3
4
  import { DataDestinationCredentials } from '../data-destination-credentials.type';
@@ -9,4 +10,5 @@ export declare class ValidationResult {
9
10
  readonly errorMessage?: string | undefined;
10
11
  readonly reason?: Record<string, unknown> | undefined;
11
12
  constructor(valid: boolean, errorMessage?: string | undefined, reason?: Record<string, unknown> | undefined);
13
+ static invalidCredentials(error: ZodError): ValidationResult;
12
14
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ValidationResult = void 0;
4
+ const field_errors_utils_1 = require("../../utils/field-errors.utils");
4
5
  class ValidationResult {
5
6
  valid;
6
7
  errorMessage;
@@ -10,6 +11,12 @@ class ValidationResult {
10
11
  this.errorMessage = errorMessage;
11
12
  this.reason = reason;
12
13
  }
14
+ static invalidCredentials(error) {
15
+ return new ValidationResult(false, (0, field_errors_utils_1.describeInvalidInput)('credentials', error), {
16
+ errors: (0, field_errors_utils_1.sanitizeIssues)(error.errors),
17
+ fieldErrors: (0, field_errors_utils_1.toFieldErrors)('credentials', error),
18
+ });
19
+ }
13
20
  }
14
21
  exports.ValidationResult = ValidationResult;
15
22
  //# sourceMappingURL=data-destination-credentials-validator.interface.js.map
@@ -19,9 +19,7 @@ let LookerStudioConnectorCredentialsValidator = LookerStudioConnectorCredentials
19
19
  const credentialsOpt = looker_studio_connector_credentials_schema_1.LookerStudioConnectorCredentialsSchema.safeParse(credentials);
20
20
  if (!credentialsOpt.success) {
21
21
  this.logger.warn('Invalid credentials format', credentialsOpt.error);
22
- return new data_destination_credentials_validator_interface_1.ValidationResult(false, 'Invalid credentials', {
23
- errors: credentialsOpt.error.errors,
24
- });
22
+ return data_destination_credentials_validator_interface_1.ValidationResult.invalidCredentials(credentialsOpt.error);
25
23
  }
26
24
  return new data_destination_credentials_validator_interface_1.ValidationResult(true);
27
25
  }
@@ -63,6 +63,8 @@ const preview_data_mart_service_1 = require("./use-cases/preview-data-mart.servi
63
63
  const data_mart_preview_controller_1 = require("./controllers/data-mart-preview.controller");
64
64
  const summarize_mcp_data_catalog_service_1 = require("./use-cases/summarize-mcp-data-catalog.service");
65
65
  const mcp_data_marts_facade_1 = require("./facades/mcp-data-marts.facade");
66
+ const mcp_contexts_facade_1 = require("./facades/mcp-contexts.facade");
67
+ const mcp_contexts_facade_impl_1 = require("./facades/mcp-contexts.facade.impl");
66
68
  const mcp_data_marts_facade_impl_1 = require("./facades/mcp-data-marts.facade.impl");
67
69
  const mcp_data_destinations_facade_1 = require("./facades/mcp-data-destinations.facade");
68
70
  const mcp_data_destinations_facade_impl_1 = require("./facades/mcp-data-destinations.facade.impl");
@@ -263,6 +265,7 @@ const update_insight_template_source_service_1 = require("./use-cases/update-ins
263
265
  const delete_insight_template_source_service_1 = require("./use-cases/delete-insight-template-source.service");
264
266
  const delete_insight_template_service_1 = require("./use-cases/delete-insight-template.service");
265
267
  const retry_interrupted_connector_runs_processor_1 = require("./system-triggers/processors/retry-interrupted-connector-runs-processor");
268
+ const repair_backfill_chains_processor_1 = require("./system-triggers/processors/repair-backfill-chains-processor");
266
269
  const sql_run_service_1 = require("./use-cases/sql-run.service");
267
270
  const create_view_service_1 = require("./use-cases/create-view.service");
268
271
  const ai_insights_providers_1 = require("./ai-insights/ai-insights-providers");
@@ -475,6 +478,7 @@ const validate_credential_service_1 = require("./credentials/use-cases/validate-
475
478
  const credential_consumer_binding_facade_1 = require("./credentials/facades/credential-consumer-binding.facade");
476
479
  const credential_consumer_binding_facade_impl_1 = require("./credentials/facades/credential-consumer-binding.facade.impl");
477
480
  const credential_fetch_service_1 = require("./credentials/services/credential-fetch.service");
481
+ const google_service_account_token_service_1 = require("./credentials/services/google-service-account-token.service");
478
482
  const credential_ai_service_1 = require("./credentials/services/credential-ai.service");
479
483
  const credential_validation_probe_service_1 = require("./credentials/services/credential-validation-probe.service");
480
484
  const credential_external_definition_registry_service_1 = require("./credentials/services/credential-external-definition-registry.service");
@@ -642,6 +646,7 @@ exports.DataMartsModule = DataMartsModule = __decorate([
642
646
  data_quality_api_service_1.DataQualityApiService,
643
647
  data_quality_summary_service_1.DataQualitySummaryService,
644
648
  mcp_data_catalog_summary_service_1.McpDataCatalogSummaryService,
649
+ { provide: mcp_contexts_facade_1.MCP_CONTEXTS_FACADE, useClass: mcp_contexts_facade_impl_1.McpContextsFacadeImpl },
645
650
  create_data_mart_service_1.CreateDataMartService,
646
651
  list_data_marts_service_1.ListDataMartsService,
647
652
  get_model_canvas_data_marts_service_1.GetModelCanvasDataMartsService,
@@ -815,6 +820,7 @@ exports.DataMartsModule = DataMartsModule = __decorate([
815
820
  ai_helper_trigger_service_1.AiHelperTriggerService,
816
821
  ai_helper_trigger_handler_service_1.AiHelperTriggerHandlerService,
817
822
  retry_interrupted_connector_runs_processor_1.RetryInterruptedConnectorRunsProcessor,
823
+ repair_backfill_chains_processor_1.RepairBackfillChainsProcessor,
818
824
  scheduled_trigger_service_1.ScheduledTriggerService,
819
825
  scheduled_trigger_mapper_1.ScheduledTriggerMapper,
820
826
  create_scheduled_trigger_service_1.CreateScheduledTriggerService,
@@ -991,12 +997,14 @@ exports.DataMartsModule = DataMartsModule = __decorate([
991
997
  delete_credential_service_1.DeleteCredentialService,
992
998
  validate_credential_service_1.ValidateCredentialService,
993
999
  credential_fetch_service_1.CredentialFetchService,
1000
+ google_service_account_token_service_1.GoogleServiceAccountTokenService,
994
1001
  credential_ai_service_1.CredentialAiService,
995
1002
  credential_validation_probe_service_1.CredentialValidationProbeService,
996
1003
  credential_external_definition_registry_service_1.CredentialExternalDefinitionRegistryService,
997
1004
  consent_credential_definition_service_1.ConsentCredentialDefinitionService,
998
1005
  ],
999
1006
  exports: [
1007
+ mcp_contexts_facade_1.MCP_CONTEXTS_FACADE,
1000
1008
  credential_consumer_binding_facade_1.CREDENTIAL_CONSUMER_BINDING_FACADE,
1001
1009
  credential_fetch_service_1.CredentialFetchService,
1002
1010
  credential_ai_service_1.CredentialAiService,
@@ -4,6 +4,7 @@ exports.AthenaApiAdapter = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const client_athena_1 = require("@aws-sdk/client-athena");
6
6
  const athena_execution_parameters_utils_1 = require("./athena-execution-parameters.utils");
7
+ const athena_output_location_util_1 = require("../utils/athena-output-location.util");
7
8
  class AthenaApiAdapter {
8
9
  static ATHENA_QUERY_ERROR_PREFIX = 'Query execution failed:';
9
10
  static DEFAULT_POLL_INTERVAL_MS = 1000;
@@ -23,7 +24,7 @@ class AthenaApiAdapter {
23
24
  const startQueryCommand = new client_athena_1.StartQueryExecutionCommand({
24
25
  QueryString: query,
25
26
  ResultConfiguration: {
26
- OutputLocation: `s3://${outputBucket}/${outputPrefix}`,
27
+ OutputLocation: (0, athena_output_location_util_1.athenaOutputLocation)(outputBucket, outputPrefix).uri,
27
28
  },
28
29
  ExecutionParameters: (0, athena_execution_parameters_utils_1.toAthenaExecutionParameters)(params),
29
30
  });
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.S3ApiAdapter = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const client_s3_1 = require("@aws-sdk/client-s3");
6
+ const athena_output_location_util_1 = require("../utils/athena-output-location.util");
6
7
  class S3ApiAdapter {
7
8
  logger = new common_1.Logger(S3ApiAdapter.name);
8
9
  s3Client;
@@ -21,10 +22,11 @@ class S3ApiAdapter {
21
22
  this.logger.debug('No output location to clean up');
22
23
  return;
23
24
  }
25
+ const { bucket, keyPrefix } = (0, athena_output_location_util_1.athenaOutputLocation)(outputBucket, outputPrefix);
24
26
  try {
25
27
  const listCommand = new client_s3_1.ListObjectsV2Command({
26
- Bucket: outputBucket,
27
- Prefix: outputPrefix,
28
+ Bucket: bucket,
29
+ Prefix: keyPrefix,
28
30
  });
29
31
  const listedObjects = await this.s3Client.send(listCommand);
30
32
  if (!listedObjects.Contents || listedObjects.Contents.length === 0) {
@@ -35,7 +37,7 @@ class S3ApiAdapter {
35
37
  if (!object.Key)
36
38
  continue;
37
39
  const deleteCommand = new client_s3_1.DeleteObjectCommand({
38
- Bucket: outputBucket,
40
+ Bucket: bucket,
39
41
  Key: object.Key,
40
42
  });
41
43
  await this.s3Client.send(deleteCommand);
@@ -28,14 +28,12 @@ let AthenaAccessValidator = AthenaAccessValidator_1 = class AthenaAccessValidato
28
28
  const configOpt = athena_config_schema_1.AthenaConfigSchema.safeParse(config);
29
29
  if (!configOpt.success) {
30
30
  this.logger.warn('Invalid config', configOpt.error);
31
- return new data_storage_access_validator_interface_1.ValidationResult(false, 'Invalid config', { errors: configOpt.error.errors });
31
+ return data_storage_access_validator_interface_1.ValidationResult.invalidInput('config', configOpt.error);
32
32
  }
33
33
  const credentialsOpt = athena_credentials_schema_1.AthenaCredentialsSchema.safeParse(credentials);
34
34
  if (!credentialsOpt.success) {
35
35
  this.logger.warn('Invalid credentials', credentialsOpt.error);
36
- return new data_storage_access_validator_interface_1.ValidationResult(false, 'Invalid credentials', {
37
- errors: credentialsOpt.error.errors,
38
- });
36
+ return data_storage_access_validator_interface_1.ValidationResult.invalidInput('credentials', credentialsOpt.error);
39
37
  }
40
38
  const athenaConfig = configOpt.data;
41
39
  const apiAdapter = this.adapterFactory.create(credentialsOpt.data, athenaConfig);
@@ -0,0 +1,5 @@
1
+ export declare function athenaOutputLocation(outputBucket: string, outputPrefix: string): {
2
+ uri: string;
3
+ bucket: string;
4
+ keyPrefix: string;
5
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.athenaOutputLocation = athenaOutputLocation;
4
+ function athenaOutputLocation(outputBucket, outputPrefix) {
5
+ const location = `${outputBucket}/${outputPrefix}`;
6
+ const slash = location.indexOf('/');
7
+ return {
8
+ uri: `s3://${location}`,
9
+ bucket: location.slice(0, slash),
10
+ keyPrefix: location.slice(slash + 1),
11
+ };
12
+ }
13
+ //# sourceMappingURL=athena-output-location.util.js.map
@@ -37,7 +37,7 @@ let BigQueryAccessValidator = BigQueryAccessValidator_1 = class BigQueryAccessVa
37
37
  const configOpt = bigquery_config_schema_1.BigQueryConfigSchema.safeParse(config);
38
38
  if (!configOpt.success) {
39
39
  this.logger.warn('Invalid config', configOpt.error);
40
- return new data_storage_access_validator_interface_1.ValidationResult(false, 'Invalid config', { errors: configOpt.error.errors });
40
+ return data_storage_access_validator_interface_1.ValidationResult.invalidInput('config', configOpt.error);
41
41
  }
42
42
  const bigQueryConfig = configOpt.data;
43
43
  if (credentials.type === bigquery_credentials_schema_1.BIGQUERY_OAUTH_TYPE) {
@@ -58,9 +58,7 @@ let BigQueryAccessValidator = BigQueryAccessValidator_1 = class BigQueryAccessVa
58
58
  const credentialsOpt = bigquery_credentials_schema_1.BigQueryServiceAccountCredentialsSchema.safeParse(credentials);
59
59
  if (!credentialsOpt.success) {
60
60
  this.logger.warn('Invalid credentials', credentialsOpt.error);
61
- return new data_storage_access_validator_interface_1.ValidationResult(false, 'Invalid credentials', {
62
- errors: credentialsOpt.error.errors,
63
- });
61
+ return data_storage_access_validator_interface_1.ValidationResult.invalidInput('credentials', credentialsOpt.error);
64
62
  }
65
63
  const apiAdapter = new bigquery_api_adapter_1.BigQueryApiAdapter(credentialsOpt.data, bigQueryConfig);
66
64
  try {
@@ -0,0 +1,3 @@
1
+ import type { StorageResourceLeaf } from '../../interfaces/storage-resource-browser.interface';
2
+ export declare function isOutsideStorageLocation(resourceLocation: string | undefined, storageLocation: string | undefined): boolean | undefined;
3
+ export declare function flagLocationMismatches(leaves: StorageResourceLeaf[], storageLocation: string | undefined): StorageResourceLeaf[];
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isOutsideStorageLocation = isOutsideStorageLocation;
4
+ exports.flagLocationMismatches = flagLocationMismatches;
5
+ function isOutsideStorageLocation(resourceLocation, storageLocation) {
6
+ if (!resourceLocation || !storageLocation)
7
+ return undefined;
8
+ return resourceLocation.toLowerCase() !== storageLocation.toLowerCase();
9
+ }
10
+ function flagLocationMismatches(leaves, storageLocation) {
11
+ if (!storageLocation)
12
+ return leaves;
13
+ return leaves.map(leaf => {
14
+ const locationMismatch = isOutsideStorageLocation(leaf.location, storageLocation);
15
+ return locationMismatch === undefined ? leaf : { ...leaf, locationMismatch };
16
+ });
17
+ }
18
+ //# sourceMappingURL=bigquery-resource-location.util.js.map
@@ -4,6 +4,7 @@ export interface RawTableListing {
4
4
  datasetId: string;
5
5
  type: 'TABLE' | 'VIEW';
6
6
  fullyQualifiedName: string;
7
+ location?: string;
7
8
  }
8
9
  export declare const GBQ_SHARD_SUFFIX_MIN_DIGITS = 4;
9
10
  export declare const GBQ_SHARD_SUFFIX_MAX_DIGITS = 8;
@@ -28,12 +28,13 @@ function buildWildcardRollups(rawTables, projectId) {
28
28
  groups.set(key, {
29
29
  datasetId: t.datasetId,
30
30
  prefix,
31
+ location: t.location,
31
32
  shardIds: [shardKey],
32
33
  });
33
34
  }
34
35
  }
35
36
  const rollups = [];
36
- for (const { datasetId, prefix, shardIds } of groups.values()) {
37
+ for (const { datasetId, prefix, location, shardIds } of groups.values()) {
37
38
  if (shardIds.length < exports.GBQ_MIN_SHARDS_FOR_WILDCARD)
38
39
  continue;
39
40
  const wildcardId = `${prefix}_*`;
@@ -43,6 +44,7 @@ function buildWildcardRollups(rawTables, projectId) {
43
44
  groupId: datasetId,
44
45
  type: 'TABLE',
45
46
  fullyQualifiedName: `${projectId}.${datasetId}.${wildcardId}`,
47
+ ...(location ? { location } : {}),
46
48
  },
47
49
  shardIds,
48
50
  });
@@ -63,6 +65,7 @@ function applyResourceFilter(rawTables, projectId, filter) {
63
65
  groupId: t.datasetId,
64
66
  type: t.type,
65
67
  fullyQualifiedName: t.fullyQualifiedName,
68
+ ...(t.location ? { location: t.location } : {}),
66
69
  };
67
70
  if (t.type === 'VIEW') {
68
71
  viewLeaves.push(leaf);
@@ -20,6 +20,7 @@ const data_storage_credentials_resolver_service_1 = require("../../data-storage-
20
20
  const data_storage_type_enum_1 = require("../../enums/data-storage-type.enum");
21
21
  const bigquery_config_schema_1 = require("../schemas/bigquery-config.schema");
22
22
  const bigquery_credentials_schema_1 = require("../schemas/bigquery-credentials.schema");
23
+ const bigquery_resource_location_util_1 = require("./bigquery-resource-location.util");
23
24
  const bigquery_sharded_tables_util_1 = require("./bigquery-sharded-tables.util");
24
25
  const GBQ_LIST_PAGE_SIZE = 500;
25
26
  const GBQ_LIST_RESULT_CAP = 2000;
@@ -48,7 +49,7 @@ let BigQueryStorageResourceBrowser = BigQueryStorageResourceBrowser_1 = class Bi
48
49
  const rawTables = await this.listTablesInProject(clients, namespaceId);
49
50
  this.logger.debug?.(`listLeafResources(${namespaceId}, ${filter ?? 'unfiltered'}): ` +
50
51
  `${rawTables.length} raw rows from BQ`);
51
- const result = (0, bigquery_sharded_tables_util_1.applyResourceFilter)(rawTables, namespaceId, filter);
52
+ const result = (0, bigquery_resource_location_util_1.flagLocationMismatches)((0, bigquery_sharded_tables_util_1.applyResourceFilter)(rawTables, namespaceId, filter), clients.location);
52
53
  this.logger.debug?.(`listLeafResources(${namespaceId}, ${filter ?? 'unfiltered'}): ` +
53
54
  `${result.length} leaves after wildcard collapsing`);
54
55
  return result;
@@ -144,11 +145,11 @@ let BigQueryStorageResourceBrowser = BigQueryStorageResourceBrowser_1 = class Bi
144
145
  .map(dataset => {
145
146
  const metadata = (dataset.metadata ?? {});
146
147
  const id = dataset.id ?? metadata.datasetReference?.datasetId ?? '';
147
- return { id, location: dataset.location ?? metadata.location };
148
+ return { id, location: metadata.location };
148
149
  })
149
150
  .filter(dataset => dataset.id);
150
151
  }
151
- async listTables(clients, projectId, datasetId) {
152
+ async listTables(clients, projectId, { id: datasetId, location }) {
152
153
  const bq = this.cloneForProject(clients, projectId);
153
154
  const [tables] = await bq
154
155
  .dataset(datasetId, { projectId })
@@ -160,7 +161,13 @@ let BigQueryStorageResourceBrowser = BigQueryStorageResourceBrowser_1 = class Bi
160
161
  const id = table.id ?? metadata.tableReference?.tableId ?? '';
161
162
  const rawType = metadata.type;
162
163
  const type = rawType === 'VIEW' || rawType === 'MATERIALIZED_VIEW' ? 'VIEW' : 'TABLE';
163
- return { id, datasetId, type, fullyQualifiedName: `${projectId}.${datasetId}.${id}` };
164
+ return {
165
+ id,
166
+ datasetId,
167
+ type,
168
+ fullyQualifiedName: `${projectId}.${datasetId}.${id}`,
169
+ location,
170
+ };
164
171
  })
165
172
  .filter(table => table.id);
166
173
  }
@@ -179,7 +186,7 @@ let BigQueryStorageResourceBrowser = BigQueryStorageResourceBrowser_1 = class Bi
179
186
  break;
180
187
  }
181
188
  const batch = datasets.slice(i, i + GBQ_PROJECT_FANOUT_CONCURRENCY);
182
- const settled = await Promise.allSettled(batch.map(dataset => (0, promise_util_1.raceWithTimeout)(this.listTables(clients, projectId, dataset.id), GBQ_PROJECT_TABLES_PER_DATASET_TIMEOUT_MS, `listTables ${projectId}.${dataset.id}`)));
189
+ const settled = await Promise.allSettled(batch.map(dataset => (0, promise_util_1.raceWithTimeout)(this.listTables(clients, projectId, dataset), GBQ_PROJECT_TABLES_PER_DATASET_TIMEOUT_MS, `listTables ${projectId}.${dataset.id}`)));
183
190
  for (const outcome of settled) {
184
191
  if (outcome.status === 'fulfilled') {
185
192
  for (const table of outcome.value) {
@@ -28,14 +28,12 @@ let DatabricksAccessValidator = DatabricksAccessValidator_1 = class DatabricksAc
28
28
  const configOpt = databricks_config_schema_1.DatabricksConfigSchema.safeParse(config);
29
29
  if (!configOpt.success) {
30
30
  this.logger.log('Invalid config', configOpt.error);
31
- return new data_storage_access_validator_interface_1.ValidationResult(false, 'Invalid config', { errors: configOpt.error.errors });
31
+ return data_storage_access_validator_interface_1.ValidationResult.invalidInput('config', configOpt.error);
32
32
  }
33
33
  const credentialsOpt = databricks_credentials_schema_1.DatabricksCredentialsSchema.safeParse(credentials);
34
34
  if (!credentialsOpt.success) {
35
35
  this.logger.log('Invalid credentials', credentialsOpt.error);
36
- return new data_storage_access_validator_interface_1.ValidationResult(false, 'Invalid credentials', {
37
- errors: credentialsOpt.error.errors,
38
- });
36
+ return data_storage_access_validator_interface_1.ValidationResult.invalidInput('credentials', credentialsOpt.error);
39
37
  }
40
38
  const apiAdapter = this.adapterFactory.create(credentialsOpt.data, configOpt.data);
41
39
  try {
@@ -1,4 +1,6 @@
1
+ import { ZodError } from 'zod';
1
2
  import { TypedComponent } from '../../../common/resolver/typed-component.resolver';
3
+ import { FieldErrorScope } from '../../utils/field-errors.utils';
2
4
  import { DataStorageType } from '../enums/data-storage-type.enum';
3
5
  import { DataStorageConfig } from '../data-storage-config.type';
4
6
  import { DataStorageCredentials } from '../data-storage-credentials.type';
@@ -17,6 +19,7 @@ export declare class ValidationResult {
17
19
  constructor(valid: boolean, errorMessage?: string | undefined, reason?: Record<string, unknown> | undefined, code?: ValidationResultCode | undefined);
18
20
  static success(): ValidationResult;
19
21
  static failure(errorMessage?: string, reason?: Record<string, unknown>): ValidationResult;
22
+ static invalidInput(scope: FieldErrorScope, error: ZodError): ValidationResult;
20
23
  static unconfigured(errorMessage: string): ValidationResult;
21
24
  static oauthReauthRequired(errorMessage: string): ValidationResult;
22
25
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ValidationResult = exports.ValidationResultCode = void 0;
4
+ const field_errors_utils_1 = require("../../utils/field-errors.utils");
4
5
  var ValidationResultCode;
5
6
  (function (ValidationResultCode) {
6
7
  ValidationResultCode["UNCONFIGURED"] = "UNCONFIGURED";
@@ -23,6 +24,12 @@ class ValidationResult {
23
24
  static failure(errorMessage, reason) {
24
25
  return new ValidationResult(false, errorMessage, reason);
25
26
  }
27
+ static invalidInput(scope, error) {
28
+ return new ValidationResult(false, (0, field_errors_utils_1.describeInvalidInput)(scope, error), {
29
+ errors: (0, field_errors_utils_1.sanitizeIssues)(error.errors),
30
+ fieldErrors: (0, field_errors_utils_1.toFieldErrors)(scope, error),
31
+ });
32
+ }
26
33
  static unconfigured(errorMessage) {
27
34
  return new ValidationResult(false, errorMessage, undefined, ValidationResultCode.UNCONFIGURED);
28
35
  }
@@ -9,6 +9,8 @@ export interface StorageResourceLeaf extends StorageResourceNode {
9
9
  groupId: string;
10
10
  type: 'TABLE' | 'VIEW';
11
11
  fullyQualifiedName: string;
12
+ location?: string;
13
+ locationMismatch?: boolean;
12
14
  }
13
15
  export type StorageResourceFilter = 'TABLE' | 'VIEW' | 'TABLE_PATTERN';
14
16
  export interface IStorageResourceBrowserProvider extends TypedComponent<DataStorageType> {
@@ -25,15 +25,11 @@ let RedshiftAccessValidator = class RedshiftAccessValidator {
25
25
  async validate(config, credentials) {
26
26
  const configResult = redshift_config_schema_1.RedshiftConfigSchema.safeParse(config);
27
27
  if (!configResult.success) {
28
- return new data_storage_access_validator_interface_1.ValidationResult(false, 'Invalid config', {
29
- errors: configResult.error.errors,
30
- });
28
+ return data_storage_access_validator_interface_1.ValidationResult.invalidInput('config', configResult.error);
31
29
  }
32
30
  const credentialsResult = redshift_credentials_schema_1.RedshiftCredentialsSchema.safeParse(credentials);
33
31
  if (!credentialsResult.success) {
34
- return new data_storage_access_validator_interface_1.ValidationResult(false, 'Invalid credentials', {
35
- errors: credentialsResult.error.errors,
36
- });
32
+ return data_storage_access_validator_interface_1.ValidationResult.invalidInput('credentials', credentialsResult.error);
37
33
  }
38
34
  const adapter = this.adapterFactory.create(credentialsResult.data, configResult.data);
39
35
  try {