@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
@@ -13,6 +13,7 @@ exports.ListInstallationsService = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const plugin_presentation_mapper_1 = require("../mappers/plugin-presentation.mapper");
15
15
  const plugin_installation_service_1 = require("../services/plugin-installation.service");
16
+ const plugin_publication_service_1 = require("../services/plugin-publication.service");
16
17
  const plugin_version_service_1 = require("../services/plugin-version.service");
17
18
  const plugin_service_1 = require("../services/plugin.service");
18
19
  let ListInstallationsService = class ListInstallationsService {
@@ -20,11 +21,13 @@ let ListInstallationsService = class ListInstallationsService {
20
21
  pluginService;
21
22
  versionService;
22
23
  mapper;
23
- constructor(installations, pluginService, versionService, mapper) {
24
+ publications;
25
+ constructor(installations, pluginService, versionService, mapper, publications) {
24
26
  this.installations = installations;
25
27
  this.pluginService = pluginService;
26
28
  this.versionService = versionService;
27
29
  this.mapper = mapper;
30
+ this.publications = publications;
28
31
  }
29
32
  async run(command) {
30
33
  const rows = await this.installations.findByMember(command.context.projectId, command.context.userId);
@@ -35,6 +38,13 @@ let ListInstallationsService = class ListInstallationsService {
35
38
  const pluginById = new Map(plugins.map(plugin => [plugin.id, plugin]));
36
39
  const versions = await this.versionService.findByIds(plugins.map(plugin => plugin.currentVersionId).filter(id => id !== null));
37
40
  const versionById = new Map(versions.map(version => [version.id, version]));
41
+ const listed = await this.publications.findVisibleTo(command.context.projectId, command.context.userId);
42
+ const scopesByPlugin = new Map();
43
+ for (const publication of listed) {
44
+ const scopes = scopesByPlugin.get(publication.pluginId) ?? new Set();
45
+ scopes.add(publication.scope);
46
+ scopesByPlugin.set(publication.pluginId, scopes);
47
+ }
38
48
  const entries = [];
39
49
  for (const row of visible) {
40
50
  const plugin = pluginById.get(row.pluginId);
@@ -43,7 +53,7 @@ let ListInstallationsService = class ListInstallationsService {
43
53
  }
44
54
  entries.push({
45
55
  ...this.mapper.toMemberDto(plugin, plugin.currentVersionId ? (versionById.get(plugin.currentVersionId) ?? null) : null, {
46
- scopes: [],
56
+ scopes: [...(scopesByPlugin.get(plugin.id) ?? [])],
47
57
  installationState: row.uninstalledAt === null ? 'installed' : 'uninstalled',
48
58
  }),
49
59
  installationId: row.id,
@@ -60,6 +70,7 @@ exports.ListInstallationsService = ListInstallationsService = __decorate([
60
70
  __metadata("design:paramtypes", [plugin_installation_service_1.PluginInstallationService,
61
71
  plugin_service_1.PluginService,
62
72
  plugin_version_service_1.PluginVersionService,
63
- plugin_presentation_mapper_1.PluginPresentationMapper])
73
+ plugin_presentation_mapper_1.PluginPresentationMapper,
74
+ plugin_publication_service_1.PluginPublicationService])
64
75
  ], ListInstallationsService);
65
76
  //# sourceMappingURL=list-installations.service.js.map
@@ -0,0 +1,25 @@
1
+ import { IdpProjectionsFacade } from '../../idp/facades/idp-projections.facade';
2
+ import { ListPluginHistoryCommand } from '../dto/domain/list-plugin-history.command';
3
+ import { PluginHistoryPageDto } from '../dto/domain/plugin-history.dto';
4
+ import { PluginPresentationMapper } from '../mappers/plugin-presentation.mapper';
5
+ import { PluginAuditService } from '../services/plugin-audit.service';
6
+ import { PluginInstallationService } from '../services/plugin-installation.service';
7
+ import { PluginPublicationService } from '../services/plugin-publication.service';
8
+ import { PluginVersionService } from '../services/plugin-version.service';
9
+ import { PluginService } from '../services/plugin.service';
10
+ export declare class ListPluginHistoryService {
11
+ private readonly audit;
12
+ private readonly publications;
13
+ private readonly installations;
14
+ private readonly pluginService;
15
+ private readonly versionService;
16
+ private readonly mapper;
17
+ private readonly idpProjections;
18
+ constructor(audit: PluginAuditService, publications: PluginPublicationService, installations: PluginInstallationService, pluginService: PluginService, versionService: PluginVersionService, mapper: PluginPresentationMapper, idpProjections: IdpProjectionsFacade);
19
+ run(command: ListPluginHistoryCommand): Promise<PluginHistoryPageDto>;
20
+ private toItems;
21
+ private actorOf;
22
+ private isNameable;
23
+ private isNoOp;
24
+ private versionIdAfter;
25
+ }
@@ -0,0 +1,147 @@
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.ListPluginHistoryService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const idp_projections_facade_1 = require("../../idp/facades/idp-projections.facade");
15
+ const plugin_audit_action_enum_1 = require("../enums/plugin-audit-action.enum");
16
+ const plugin_publication_scope_enum_1 = require("../enums/plugin-publication-scope.enum");
17
+ const plugin_presentation_mapper_1 = require("../mappers/plugin-presentation.mapper");
18
+ const plugin_audit_service_1 = require("../services/plugin-audit.service");
19
+ const plugin_installation_service_1 = require("../services/plugin-installation.service");
20
+ const plugin_publication_service_1 = require("../services/plugin-publication.service");
21
+ const plugin_version_service_1 = require("../services/plugin-version.service");
22
+ const plugin_service_1 = require("../services/plugin.service");
23
+ const unique = (ids) => [...new Set(ids)];
24
+ const isPublication = (row) => row.action === plugin_audit_action_enum_1.PluginAuditAction.PUBLISH || row.action === plugin_audit_action_enum_1.PluginAuditAction.UNPUBLISH;
25
+ let ListPluginHistoryService = class ListPluginHistoryService {
26
+ audit;
27
+ publications;
28
+ installations;
29
+ pluginService;
30
+ versionService;
31
+ mapper;
32
+ idpProjections;
33
+ constructor(audit, publications, installations, pluginService, versionService, mapper, idpProjections) {
34
+ this.audit = audit;
35
+ this.publications = publications;
36
+ this.installations = installations;
37
+ this.pluginService = pluginService;
38
+ this.versionService = versionService;
39
+ this.mapper = mapper;
40
+ this.idpProjections = idpProjections;
41
+ }
42
+ async run(command) {
43
+ const { projectId, userId } = command.context;
44
+ if (command.cursor && !(await this.audit.exists(command.cursor))) {
45
+ throw new common_1.BadRequestException('cursor does not point to a plugin history entry');
46
+ }
47
+ const [listed, installed] = await Promise.all([
48
+ this.publications.findEverVisibleTo(projectId, userId),
49
+ this.installations.findByMember(projectId, userId),
50
+ ]);
51
+ const rows = await this.audit.findHistory({
52
+ projectId,
53
+ userId,
54
+ installations: command.type !== 'publications',
55
+ publications: command.type !== 'installations',
56
+ changes: command.type === 'all',
57
+ deploymentPluginIds: unique(listed
58
+ .filter(publication => publication.scope === plugin_publication_scope_enum_1.PluginPublicationScope.DEPLOYMENT)
59
+ .map(publication => publication.pluginId)),
60
+ relevantPluginIds: unique([...listed, ...installed].map(row => row.pluginId)),
61
+ afterId: command.cursor,
62
+ take: command.limit + 1,
63
+ });
64
+ const page = rows.slice(0, command.limit);
65
+ const items = await this.toItems(page, projectId, userId);
66
+ return {
67
+ items,
68
+ nextCursor: rows.length > command.limit ? page[page.length - 1].id : null,
69
+ };
70
+ }
71
+ async toItems(page, projectId, userId) {
72
+ const plugins = await this.pluginService.findByIds(unique(page.map(row => row.pluginId)));
73
+ const pluginById = new Map(plugins.map(plugin => [plugin.id, plugin]));
74
+ const versions = await this.versionService.findByIds(unique([
75
+ ...plugins.map(plugin => plugin.currentVersionId),
76
+ ...page.map(row => this.versionIdAfter(row)),
77
+ ].filter((id) => typeof id === 'string')));
78
+ const versionById = new Map(versions.map(version => [version.id, version]));
79
+ const namedIds = unique(page.filter(row => this.isNameable(row, projectId, userId)).map(row => row.userId));
80
+ const names = await this.idpProjections.getUserProjectionList(namedIds);
81
+ return page.flatMap(row => {
82
+ const plugin = pluginById.get(row.pluginId);
83
+ if (!plugin || this.isNoOp(row)) {
84
+ return [];
85
+ }
86
+ const versionId = this.versionIdAfter(row);
87
+ return [
88
+ {
89
+ id: row.id,
90
+ occurredAt: row.createdAt,
91
+ action: row.action,
92
+ scope: isPublication(row) ? row.authorityScope : null,
93
+ plugin: this.mapper.toHistoryPlugin(plugin, plugin.currentVersionId ? (versionById.get(plugin.currentVersionId) ?? null) : null),
94
+ actor: this.actorOf(row, projectId, userId, names),
95
+ version: row.action === plugin_audit_action_enum_1.PluginAuditAction.UPDATE && versionId
96
+ ? (versionById.get(versionId)?.semver ?? null)
97
+ : null,
98
+ },
99
+ ];
100
+ });
101
+ }
102
+ actorOf(row, projectId, userId, names) {
103
+ if (row.action === plugin_audit_action_enum_1.PluginAuditAction.SUSPEND ||
104
+ row.action === plugin_audit_action_enum_1.PluginAuditAction.RESUME ||
105
+ (isPublication(row) && row.authorityScope === plugin_publication_scope_enum_1.PluginPublicationScope.DEPLOYMENT)) {
106
+ return { kind: 'deployment' };
107
+ }
108
+ if (row.userId === userId) {
109
+ return { kind: 'you' };
110
+ }
111
+ if (!this.isNameable(row, projectId, userId)) {
112
+ return null;
113
+ }
114
+ const projection = names.getByUserId(row.userId);
115
+ const name = projection?.fullName || projection?.email;
116
+ return name ? { kind: 'member', name } : null;
117
+ }
118
+ isNameable(row, projectId, userId) {
119
+ return (row.userId !== null &&
120
+ row.userId !== userId &&
121
+ row.projectId === projectId &&
122
+ row.authorityScope !== plugin_publication_scope_enum_1.PluginPublicationScope.DEPLOYMENT &&
123
+ row.action !== plugin_audit_action_enum_1.PluginAuditAction.SUSPEND &&
124
+ row.action !== plugin_audit_action_enum_1.PluginAuditAction.RESUME);
125
+ }
126
+ isNoOp(row) {
127
+ const uninstalled = row.beforeState?.uninstalled;
128
+ return ((row.action === plugin_audit_action_enum_1.PluginAuditAction.RESTORE && uninstalled === false) ||
129
+ (row.action === plugin_audit_action_enum_1.PluginAuditAction.UNINSTALL && uninstalled === true));
130
+ }
131
+ versionIdAfter(row) {
132
+ const id = row.afterState?.currentVersionId;
133
+ return typeof id === 'string' ? id : null;
134
+ }
135
+ };
136
+ exports.ListPluginHistoryService = ListPluginHistoryService;
137
+ exports.ListPluginHistoryService = ListPluginHistoryService = __decorate([
138
+ (0, common_1.Injectable)(),
139
+ __metadata("design:paramtypes", [plugin_audit_service_1.PluginAuditService,
140
+ plugin_publication_service_1.PluginPublicationService,
141
+ plugin_installation_service_1.PluginInstallationService,
142
+ plugin_service_1.PluginService,
143
+ plugin_version_service_1.PluginVersionService,
144
+ plugin_presentation_mapper_1.PluginPresentationMapper,
145
+ idp_projections_facade_1.IdpProjectionsFacade])
146
+ ], ListPluginHistoryService);
147
+ //# sourceMappingURL=list-plugin-history.service.js.map
@@ -0,0 +1,5 @@
1
+ import { AuthorizationContext } from '../../idp/types/auth.types';
2
+ import { Plugin } from '../entities/plugin.entity';
3
+ import { PluginPublicationService } from '../services/plugin-publication.service';
4
+ export declare function managesPublicationOf(publications: PluginPublicationService, pluginId: string, context: AuthorizationContext): Promise<boolean>;
5
+ export declare function visibleRepository(plugin: Plugin, repository: string, isPublisher: boolean): string;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.managesPublicationOf = managesPublicationOf;
4
+ exports.visibleRepository = visibleRepository;
5
+ const plugin_publication_scope_enum_1 = require("../enums/plugin-publication-scope.enum");
6
+ async function managesPublicationOf(publications, pluginId, context) {
7
+ const scopes = [];
8
+ if (context.roles?.includes('admin')) {
9
+ scopes.push(plugin_publication_scope_enum_1.PluginPublicationScope.PROJECT);
10
+ }
11
+ if (context.userId) {
12
+ scopes.push(plugin_publication_scope_enum_1.PluginPublicationScope.MEMBER);
13
+ }
14
+ for (const scope of scopes) {
15
+ const rows = await publications.listManageable(scope, {
16
+ projectId: context.projectId,
17
+ userId: scope === plugin_publication_scope_enum_1.PluginPublicationScope.MEMBER ? (context.userId ?? undefined) : undefined,
18
+ });
19
+ if (rows.some(row => row.pluginId === pluginId)) {
20
+ return true;
21
+ }
22
+ }
23
+ return false;
24
+ }
25
+ function visibleRepository(plugin, repository, isPublisher) {
26
+ return plugin.isPrivateRepo && !isPublisher ? `${plugin.repoOwner}/***` : repository;
27
+ }
28
+ //# sourceMappingURL=plugin-publisher-access.js.map
@@ -0,0 +1,12 @@
1
+ import { StartPluginActionExecutionCommand } from '../dto/domain/plugin-action-execution.command';
2
+ import type { StartedPluginActionExecution } from '../dto/domain/plugin-action-execution.dto';
3
+ import { PluginActionStarterService } from '../services/plugin-action-starter.service';
4
+ import { PluginVersionService } from '../services/plugin-version.service';
5
+ import { PluginService } from '../services/plugin.service';
6
+ export declare class StartPluginActionExecutionService {
7
+ private readonly plugins;
8
+ private readonly versions;
9
+ private readonly starter;
10
+ constructor(plugins: PluginService, versions: PluginVersionService, starter: PluginActionStarterService);
11
+ run(command: StartPluginActionExecutionCommand): Promise<StartedPluginActionExecution>;
12
+ }
@@ -0,0 +1,64 @@
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.StartPluginActionExecutionService = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const plugin_action_errors_1 = require("../errors/plugin-action.errors");
15
+ const plugin_action_starter_service_1 = require("../services/plugin-action-starter.service");
16
+ const plugin_version_service_1 = require("../services/plugin-version.service");
17
+ const plugin_service_1 = require("../services/plugin.service");
18
+ let StartPluginActionExecutionService = class StartPluginActionExecutionService {
19
+ plugins;
20
+ versions;
21
+ starter;
22
+ constructor(plugins, versions, starter) {
23
+ this.plugins = plugins;
24
+ this.versions = versions;
25
+ this.starter = starter;
26
+ }
27
+ async run(command) {
28
+ const { context, action } = command;
29
+ if (context.executionId) {
30
+ throw new plugin_action_errors_1.ExecutionTokenNotAllowedError();
31
+ }
32
+ const role = context.roles?.[0];
33
+ if (!context.pluginId || !context.installationId || !role) {
34
+ throw new common_1.ForbiddenException('Plugin runtime authentication is required');
35
+ }
36
+ const plugin = await this.plugins.findById(context.pluginId);
37
+ const version = plugin?.currentVersionId
38
+ ? await this.versions.findById(plugin.currentVersionId)
39
+ : null;
40
+ if (!version) {
41
+ throw new plugin_action_errors_1.ActionNotDeclaredError(action);
42
+ }
43
+ return this.starter.start({
44
+ installation: {
45
+ id: context.installationId,
46
+ projectId: context.projectId,
47
+ userId: context.userId,
48
+ },
49
+ version,
50
+ action,
51
+ input: command.input,
52
+ role,
53
+ trigger: 'frontend',
54
+ });
55
+ }
56
+ };
57
+ exports.StartPluginActionExecutionService = StartPluginActionExecutionService;
58
+ exports.StartPluginActionExecutionService = StartPluginActionExecutionService = __decorate([
59
+ (0, common_1.Injectable)(),
60
+ __metadata("design:paramtypes", [plugin_service_1.PluginService,
61
+ plugin_version_service_1.PluginVersionService,
62
+ plugin_action_starter_service_1.PluginActionStarterService])
63
+ ], StartPluginActionExecutionService);
64
+ //# sourceMappingURL=start-plugin-action-execution.service.js.map
@@ -1,21 +1,19 @@
1
1
  import { PluginHostConfigService } from '../config/plugin-host.config';
2
2
  import { PluginSyncResultDto, SyncPluginReleasesCommand } from '../dto/domain/plugin-sync.dto';
3
3
  import { GithubApiService } from '../services/github-api.service';
4
- import { ExternalCredentialDefinitionSyncService } from '../services/external-credential-definition-sync.service';
5
4
  import { PluginService } from '../services/plugin.service';
6
5
  import { PluginVersionService } from '../services/plugin-version.service';
7
6
  import { PluginCredentialBindingReconciliationService } from '../services/plugin-credential-binding-reconciliation.service';
8
- import { RemoteUrlValidatorService } from '../services/remote-url-validator.service';
7
+ import { ReleaseCandidateRulesService } from '../services/release-candidate-rules.service';
9
8
  export declare class SyncPluginReleasesService {
10
9
  private readonly githubApi;
11
- private readonly remoteUrlValidator;
10
+ private readonly candidateRules;
12
11
  private readonly pluginService;
13
12
  private readonly versionService;
14
13
  private readonly config;
15
14
  private readonly credentialBindingReconciliation;
16
- private readonly externalCredentialDefinitions?;
17
15
  private readonly logger;
18
- constructor(githubApi: GithubApiService, remoteUrlValidator: RemoteUrlValidatorService, pluginService: PluginService, versionService: PluginVersionService, config: PluginHostConfigService, credentialBindingReconciliation: PluginCredentialBindingReconciliationService, externalCredentialDefinitions?: ExternalCredentialDefinitionSyncService | undefined);
16
+ constructor(githubApi: GithubApiService, candidateRules: ReleaseCandidateRulesService, pluginService: PluginService, versionService: PluginVersionService, config: PluginHostConfigService, credentialBindingReconciliation: PluginCredentialBindingReconciliationService);
19
17
  run(command: SyncPluginReleasesCommand): Promise<PluginSyncResultDto>;
20
18
  private findOrCreatePlugin;
21
19
  private selectCandidates;
@@ -8,9 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
11
  var SyncPluginReleasesService_1;
15
12
  Object.defineProperty(exports, "__esModule", { value: true });
16
13
  exports.SyncPluginReleasesService = void 0;
@@ -20,31 +17,27 @@ const plugin_host_config_1 = require("../config/plugin-host.config");
20
17
  const release_rejection_code_enum_1 = require("../enums/release-rejection-code.enum");
21
18
  const plugin_host_errors_1 = require("../errors/plugin-host.errors");
22
19
  const github_api_service_1 = require("../services/github-api.service");
23
- const external_credential_definition_sync_service_1 = require("../services/external-credential-definition-sync.service");
24
20
  const plugin_service_1 = require("../services/plugin.service");
25
21
  const plugin_version_service_1 = require("../services/plugin-version.service");
26
22
  const plugin_credential_binding_reconciliation_service_1 = require("../services/plugin-credential-binding-reconciliation.service");
27
- const remote_url_validator_service_1 = require("../services/remote-url-validator.service");
23
+ const release_candidate_rules_service_1 = require("../services/release-candidate-rules.service");
28
24
  const github_repo_locator_util_1 = require("../utils/github-repo-locator.util");
29
- const plugin_manifest_util_1 = require("../utils/plugin-manifest.util");
30
25
  const semver_util_1 = require("../utils/semver.util");
31
26
  let SyncPluginReleasesService = SyncPluginReleasesService_1 = class SyncPluginReleasesService {
32
27
  githubApi;
33
- remoteUrlValidator;
28
+ candidateRules;
34
29
  pluginService;
35
30
  versionService;
36
31
  config;
37
32
  credentialBindingReconciliation;
38
- externalCredentialDefinitions;
39
33
  logger = new common_1.Logger(SyncPluginReleasesService_1.name);
40
- constructor(githubApi, remoteUrlValidator, pluginService, versionService, config, credentialBindingReconciliation, externalCredentialDefinitions) {
34
+ constructor(githubApi, candidateRules, pluginService, versionService, config, credentialBindingReconciliation) {
41
35
  this.githubApi = githubApi;
42
- this.remoteUrlValidator = remoteUrlValidator;
36
+ this.candidateRules = candidateRules;
43
37
  this.pluginService = pluginService;
44
38
  this.versionService = versionService;
45
39
  this.config = config;
46
40
  this.credentialBindingReconciliation = credentialBindingReconciliation;
47
- this.externalCredentialDefinitions = externalCredentialDefinitions;
48
41
  }
49
42
  async run(command) {
50
43
  const ref = (0, github_repo_locator_util_1.parseGithubRepoLocator)(command.repoLocator);
@@ -126,45 +119,12 @@ let SyncPluginReleasesService = SyncPluginReleasesService_1 = class SyncPluginRe
126
119
  into.rejections.push(this.rejection(release, release_rejection_code_enum_1.ReleaseRejectionCode.VERSION_CONFLICT, `Version ${semver} is already recorded from commit ${recorded.commitSha} (release ${recorded.githubReleaseId}); refusing to replace it with commit ${commitSha} (release ${release.githubReleaseId})`));
127
120
  return false;
128
121
  }
129
- const manifestSource = await this.githubApi.getFileAtCommit(ref, 'plugin.json', commitSha);
130
- const manifest = (0, plugin_manifest_util_1.parsePluginManifest)(manifestSource);
131
- if (!manifest.ok) {
132
- into.rejections.push(this.rejection(release, manifest.code, manifest.detail));
133
- return false;
134
- }
135
- const baseline = (await this.versionService.findAllByPluginId(pluginId))
136
- .filter(version => (0, semver_util_1.sameCompatibilityLine)(version.semver, semver))
137
- .reduce((highest, version) => (!highest || (0, semver_util_1.compareSemver)(version.semver, highest.semver) > 0 ? { semver: version.semver, collections: version.collections ?? [] } : highest), undefined);
138
- if (baseline) {
139
- const incompatibility = (0, plugin_manifest_util_1.findIncompatibleCollectionChange)(baseline.collections ?? [], manifest.manifest.collections);
140
- if (incompatibility) {
141
- const escape = (0, semver_util_1.majorOf)(semver) === 0
142
- ? 'bump the minor version to ship this breaking change while below 1.0.0'
143
- : 'publish a new major version to ship this breaking change';
144
- into.rejections.push(this.rejection(release, release_rejection_code_enum_1.ReleaseRejectionCode.COLLECTIONS_INCOMPATIBLE, `${incompatibility} within the ${baseline.semver} compatibility line; ${escape}`));
145
- return false;
146
- }
147
- }
148
- const delivery = await this.remoteUrlValidator.validate(manifest.manifest.delivery.url);
149
- if (!delivery.ok) {
150
- into.rejections.push(this.rejection(release, delivery.code, delivery.detail));
151
- return false;
152
- }
153
- let credentialRequirements = manifest.manifest.credentials;
154
- try {
155
- if (manifest.manifest.credentials.some(requirement => externalLocator(requirement))) {
156
- if (!this.externalCredentialDefinitions) {
157
- throw new Error('External Credential definitions are not available');
158
- }
159
- credentialRequirements = await this.externalCredentialDefinitions.resolveRequirements(manifest.manifest.credentials);
160
- }
161
- }
162
- catch (error) {
163
- if (!(error instanceof external_credential_definition_sync_service_1.ExternalCredentialRequirementError))
164
- throw error;
165
- into.rejections.push(this.rejection(release, release_rejection_code_enum_1.ReleaseRejectionCode.MANIFEST_SCHEMA, (0, internal_helpers_1.castError)(error).message));
122
+ const verdict = await this.candidateRules.firstFailure({ pluginId, ref, commitSha, semver });
123
+ if (!verdict.ok) {
124
+ into.rejections.push(this.rejection(release, verdict.code, verdict.detail));
166
125
  return false;
167
126
  }
127
+ const { manifest, credentialRequirements } = verdict;
168
128
  try {
169
129
  const inserted = await this.versionService.insertVersionForLease({
170
130
  pluginId,
@@ -172,11 +132,12 @@ let SyncPluginReleasesService = SyncPluginReleasesService_1 = class SyncPluginRe
172
132
  commitSha,
173
133
  githubReleaseId: release.githubReleaseId,
174
134
  tagName: release.tagName,
175
- displayName: manifest.manifest.name,
176
- description: manifest.manifest.description,
177
- deliveryUrl: manifest.manifest.delivery.url,
178
- collections: manifest.manifest.collections,
135
+ displayName: manifest.name,
136
+ description: manifest.description,
137
+ deliveryUrl: manifest.delivery.url,
138
+ collections: manifest.collections,
179
139
  credentialRequirements,
140
+ backend: manifest.backend ?? null,
180
141
  releasePublishedAt: release.publishedAt,
181
142
  }, syncLeaseId);
182
143
  if (!inserted)
@@ -266,16 +227,11 @@ let SyncPluginReleasesService = SyncPluginReleasesService_1 = class SyncPluginRe
266
227
  exports.SyncPluginReleasesService = SyncPluginReleasesService;
267
228
  exports.SyncPluginReleasesService = SyncPluginReleasesService = SyncPluginReleasesService_1 = __decorate([
268
229
  (0, common_1.Injectable)(),
269
- __param(6, (0, common_1.Optional)()),
270
230
  __metadata("design:paramtypes", [github_api_service_1.GithubApiService,
271
- remote_url_validator_service_1.RemoteUrlValidatorService,
231
+ release_candidate_rules_service_1.ReleaseCandidateRulesService,
272
232
  plugin_service_1.PluginService,
273
233
  plugin_version_service_1.PluginVersionService,
274
234
  plugin_host_config_1.PluginHostConfigService,
275
- plugin_credential_binding_reconciliation_service_1.PluginCredentialBindingReconciliationService,
276
- external_credential_definition_sync_service_1.ExternalCredentialDefinitionSyncService])
235
+ plugin_credential_binding_reconciliation_service_1.PluginCredentialBindingReconciliationService])
277
236
  ], SyncPluginReleasesService);
278
- function externalLocator(requirement) {
279
- return (typeof requirement === 'string' ? requirement : requirement.id).startsWith('@');
280
- }
281
237
  //# sourceMappingURL=sync-plugin-releases.service.js.map
@@ -35,7 +35,8 @@ let UninstallPluginService = class UninstallPluginService {
35
35
  if (!installation) {
36
36
  throw new common_1.NotFoundException('You do not have this plugin installed');
37
37
  }
38
- if (installation.uninstalledAt === null) {
38
+ const wasUninstalled = installation.uninstalledAt !== null;
39
+ if (!wasUninstalled) {
39
40
  await this.installations.uninstall(installation.id);
40
41
  }
41
42
  await this.credentialBindings.deactivateConsumer('plugin-installation', installation.id, command.context.projectId);
@@ -45,6 +46,7 @@ let UninstallPluginService = class UninstallPluginService {
45
46
  authorityScope: plugin_publication_scope_enum_1.PluginPublicationScope.MEMBER,
46
47
  projectId: command.context.projectId,
47
48
  userId: command.context.userId,
49
+ beforeState: { uninstalled: wasUninstalled },
48
50
  });
49
51
  }
50
52
  };
@@ -17,6 +17,5 @@ export declare class UpdatePluginService {
17
17
  constructor(pluginService: PluginService, authorization: PublicationAuthorizationService, schedule: PluginUpdateScheduleService, check: RunPluginUpdateCheckService, versionService: PluginVersionService, publications: PluginPublicationService, installations: PluginInstallationService);
18
18
  run(command: UpdatePluginCommand): Promise<PluginUpdateResultDto>;
19
19
  private resolvePlugin;
20
- private managesPublicationOf;
21
20
  private mayReach;
22
21
  }
@@ -11,7 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.UpdatePluginService = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
- const plugin_publication_scope_enum_1 = require("../enums/plugin-publication-scope.enum");
15
14
  const plugin_service_1 = require("../services/plugin.service");
16
15
  const plugin_installation_service_1 = require("../services/plugin-installation.service");
17
16
  const plugin_publication_service_1 = require("../services/plugin-publication.service");
@@ -20,6 +19,7 @@ const plugin_version_service_1 = require("../services/plugin-version.service");
20
19
  const publication_authorization_service_1 = require("../services/publication-authorization.service");
21
20
  const github_repo_locator_util_1 = require("../utils/github-repo-locator.util");
22
21
  const plugin_publisher_diagnostics_1 = require("./plugin-publisher-diagnostics");
22
+ const plugin_publisher_access_1 = require("./plugin-publisher-access");
23
23
  const run_plugin_update_check_service_1 = require("./run-plugin-update-check.service");
24
24
  let UpdatePluginService = class UpdatePluginService {
25
25
  pluginService;
@@ -47,7 +47,7 @@ let UpdatePluginService = class UpdatePluginService {
47
47
  apiKeyId: command.context.apiKeyId ?? null,
48
48
  });
49
49
  const isPublisher = this.authorization.isDeploymentPublisher(command.context);
50
- const managesPublication = isPublisher || (await this.managesPublicationOf(plugin.id, command.context));
50
+ const managesPublication = isPublisher || (await (0, plugin_publisher_access_1.managesPublicationOf)(this.publications, plugin.id, command.context));
51
51
  let diagnostics = null;
52
52
  if (managesPublication) {
53
53
  const version = result.currentVersionId
@@ -59,7 +59,7 @@ let UpdatePluginService = class UpdatePluginService {
59
59
  const scheduled = await this.pluginService.findById(plugin.id);
60
60
  return {
61
61
  pluginId: result.pluginId,
62
- repository: visibleRepository(scheduled ?? plugin, result.repository, isPublisher),
62
+ repository: (0, plugin_publisher_access_1.visibleRepository)(scheduled ?? plugin, result.repository, isPublisher),
63
63
  currentVersionId: result.currentVersionId,
64
64
  currentSemver: result.currentSemver,
65
65
  outcome: result.outcome,
@@ -86,25 +86,6 @@ let UpdatePluginService = class UpdatePluginService {
86
86
  }
87
87
  throw new common_1.NotFoundException('A plugin id or repository is required');
88
88
  }
89
- async managesPublicationOf(pluginId, context) {
90
- const scopes = [];
91
- if (context.roles?.includes('admin')) {
92
- scopes.push(plugin_publication_scope_enum_1.PluginPublicationScope.PROJECT);
93
- }
94
- if (context.userId) {
95
- scopes.push(plugin_publication_scope_enum_1.PluginPublicationScope.MEMBER);
96
- }
97
- for (const scope of scopes) {
98
- const rows = await this.publications.listManageable(scope, {
99
- projectId: context.projectId,
100
- userId: scope === plugin_publication_scope_enum_1.PluginPublicationScope.MEMBER ? (context.userId ?? undefined) : undefined,
101
- });
102
- if (rows.some(row => row.pluginId === pluginId)) {
103
- return true;
104
- }
105
- }
106
- return false;
107
- }
108
89
  async mayReach(pluginId, context) {
109
90
  if (this.authorization.isDeploymentPublisher(context)) {
110
91
  return true;
@@ -128,7 +109,4 @@ exports.UpdatePluginService = UpdatePluginService = __decorate([
128
109
  plugin_publication_service_1.PluginPublicationService,
129
110
  plugin_installation_service_1.PluginInstallationService])
130
111
  ], UpdatePluginService);
131
- function visibleRepository(plugin, repository, isPublisher) {
132
- return plugin.isPrivateRepo && !isPublisher ? `${plugin.repoOwner}/***` : repository;
133
- }
134
112
  //# sourceMappingURL=update-plugin.service.js.map
@@ -0,0 +1,14 @@
1
+ export declare const ACTION_INPUT_AJV: {
2
+ readonly options: {
3
+ readonly strict: true;
4
+ readonly allErrors: true;
5
+ readonly logger: false;
6
+ readonly inlineRefs: false;
7
+ readonly ownProperties: true;
8
+ };
9
+ readonly metaSchema: "https://json-schema.org/draft/2020-12/schema";
10
+ readonly refusedKeywords: readonly ["pattern", "patternProperties", "format", "uniqueItems"];
11
+ };
12
+ type JsonObject = Record<string, unknown>;
13
+ export declare function assertBoundedSchema(root: JsonObject): void;
14
+ export {};