@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.
- package/dist/src/common/helpers/read-bounded-body.helper.d.ts +1 -0
- package/dist/src/common/helpers/read-bounded-body.helper.js +28 -0
- package/dist/src/common/scheduler/system-tasks/system-trigger-type.d.ts +3 -1
- package/dist/src/common/scheduler/system-tasks/system-trigger-type.js +2 -0
- package/dist/src/common/search/search.facade.d.ts +1 -0
- package/dist/src/config/data-source-options.config.d.ts +4 -3
- package/dist/src/config/data-source-options.config.js +10 -3
- package/dist/src/config/plugin-collections-body-parser.config.js +3 -0
- package/dist/src/data-marts/credentials/credential.types.d.ts +26 -2
- package/dist/src/data-marts/credentials/credential.types.js +18 -6
- package/dist/src/data-marts/credentials/dto/credential-api.dto.d.ts +5 -1
- package/dist/src/data-marts/credentials/dto/credential-api.dto.js +21 -0
- package/dist/src/data-marts/credentials/dto/credential.dto.d.ts +2 -1
- package/dist/src/data-marts/credentials/entities/credential.entity.d.ts +2 -1
- package/dist/src/data-marts/credentials/entities/credential.entity.js +5 -0
- package/dist/src/data-marts/credentials/facades/credential-consumer-binding.facade.impl.js +6 -1
- package/dist/src/data-marts/credentials/mappers/credential.mapper.js +2 -0
- package/dist/src/data-marts/credentials/services/builtin-credential-definitions.js +8 -0
- package/dist/src/data-marts/credentials/services/credential-external-definition-registry.service.d.ts +4 -0
- package/dist/src/data-marts/credentials/services/credential-external-definition-registry.service.js +36 -17
- package/dist/src/data-marts/credentials/services/credential-fetch.service.d.ts +8 -0
- package/dist/src/data-marts/credentials/services/credential-fetch.service.js +115 -46
- package/dist/src/data-marts/credentials/services/credential-validation-probe.service.d.ts +3 -1
- package/dist/src/data-marts/credentials/services/credential-validation-probe.service.js +10 -2
- package/dist/src/data-marts/credentials/services/credential.service.d.ts +4 -0
- package/dist/src/data-marts/credentials/services/credential.service.js +36 -0
- package/dist/src/data-marts/credentials/services/google-service-account-key.d.ts +6 -0
- package/dist/src/data-marts/credentials/services/google-service-account-key.js +46 -0
- package/dist/src/data-marts/credentials/services/google-service-account-token.service.d.ts +25 -0
- package/dist/src/data-marts/credentials/services/google-service-account-token.service.js +177 -0
- package/dist/src/data-marts/credentials/use-cases/create-credential.service.d.ts +1 -0
- package/dist/src/data-marts/credentials/use-cases/create-credential.service.js +10 -2
- package/dist/src/data-marts/credentials/use-cases/update-credential.service.d.ts +1 -0
- package/dist/src/data-marts/credentials/use-cases/update-credential.service.js +28 -4
- package/dist/src/data-marts/credentials/use-cases/validate-credential.service.js +2 -5
- package/dist/src/data-marts/data-destination-types/ee/email/services/email-credentials-validator.js +1 -3
- package/dist/src/data-marts/data-destination-types/ee/google-chat/services/google-chat-credentials-validator.js +1 -3
- package/dist/src/data-marts/data-destination-types/google-sheets/services/google-sheets-credentials-validator.js +1 -3
- package/dist/src/data-marts/data-destination-types/google-sheets/services/google-sheets-report-writer.d.ts +1 -0
- package/dist/src/data-marts/data-destination-types/google-sheets/services/google-sheets-report-writer.js +13 -1
- package/dist/src/data-marts/data-destination-types/interfaces/data-destination-credentials-validator.interface.d.ts +2 -0
- package/dist/src/data-marts/data-destination-types/interfaces/data-destination-credentials-validator.interface.js +7 -0
- package/dist/src/data-marts/data-destination-types/looker-studio-connector/services/looker-studio-connector-credentials-validator.js +1 -3
- package/dist/src/data-marts/data-marts.module.js +8 -0
- package/dist/src/data-marts/data-storage-types/athena/adapters/athena-api.adapter.js +2 -1
- package/dist/src/data-marts/data-storage-types/athena/adapters/s3-api.adapter.js +5 -3
- package/dist/src/data-marts/data-storage-types/athena/services/athena-access.validator.js +2 -4
- package/dist/src/data-marts/data-storage-types/athena/utils/athena-output-location.util.d.ts +5 -0
- package/dist/src/data-marts/data-storage-types/athena/utils/athena-output-location.util.js +13 -0
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-access.validator.js +2 -4
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-resource-location.util.d.ts +3 -0
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-resource-location.util.js +18 -0
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-sharded-tables.util.d.ts +1 -0
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-sharded-tables.util.js +4 -1
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-storage-resource-browser.service.js +12 -5
- package/dist/src/data-marts/data-storage-types/databricks/services/databricks-access.validator.js +2 -4
- package/dist/src/data-marts/data-storage-types/interfaces/data-storage-access-validator.interface.d.ts +3 -0
- package/dist/src/data-marts/data-storage-types/interfaces/data-storage-access-validator.interface.js +7 -0
- package/dist/src/data-marts/data-storage-types/interfaces/storage-resource-browser.interface.d.ts +2 -0
- package/dist/src/data-marts/data-storage-types/redshift/services/redshift-access.validator.js +2 -6
- package/dist/src/data-marts/data-storage-types/snowflake/adapters/snowflake-api.adapter.js +1 -0
- package/dist/src/data-marts/data-storage-types/snowflake/services/snowflake-access.validator.js +2 -4
- package/dist/src/data-marts/dto/domain/list-data-marts.command.d.ts +2 -1
- package/dist/src/data-marts/dto/domain/list-data-marts.command.js +3 -1
- package/dist/src/data-marts/dto/presentation/run-data-mart-request-api.dto.js +4 -2
- package/dist/src/data-marts/dto/presentation/sql-dry-run-request-api.dto.js +3 -0
- package/dist/src/data-marts/dto/presentation/storage-resources/list-storage-resources-response.dto.d.ts +2 -0
- package/dist/src/data-marts/dto/presentation/storage-resources/list-storage-resources-response.dto.js +17 -0
- package/dist/src/data-marts/errors/google-sheets-api-call.error.d.ts +6 -0
- package/dist/src/data-marts/errors/google-sheets-api-call.error.js +34 -0
- package/dist/src/data-marts/facades/mcp-contexts.facade.d.ts +13 -0
- package/dist/src/data-marts/facades/mcp-contexts.facade.impl.d.ts +9 -0
- package/dist/src/data-marts/facades/mcp-contexts.facade.impl.js +35 -0
- package/dist/src/data-marts/facades/mcp-contexts.facade.js +5 -0
- package/dist/src/data-marts/facades/mcp-data-marts.facade.d.ts +9 -0
- package/dist/src/data-marts/facades/mcp-data-marts.facade.impl.js +4 -1
- package/dist/src/data-marts/mappers/context.mapper.d.ts +4 -0
- package/dist/src/data-marts/mappers/context.mapper.js +12 -0
- package/dist/src/data-marts/search/engine/advanced-search.service.js +1 -0
- package/dist/src/data-marts/search/engine/in-memory-paginated.search.js +17 -1
- package/dist/src/data-marts/search/engine/vector-search.port.d.ts +1 -0
- package/dist/src/data-marts/services/connector/backfill-segment.d.ts +22 -0
- package/dist/src/data-marts/services/connector/backfill-segment.js +91 -0
- package/dist/src/data-marts/services/connector/connector-execution.service.d.ts +1 -0
- package/dist/src/data-marts/services/connector/connector-execution.service.js +3 -0
- package/dist/src/data-marts/services/connector/connector-executor.service.d.ts +4 -1
- package/dist/src/data-marts/services/connector/connector-executor.service.js +107 -23
- package/dist/src/data-marts/services/connector/connector-run.service.d.ts +3 -0
- package/dist/src/data-marts/services/connector/connector-run.service.js +98 -4
- package/dist/src/data-marts/services/context/context.service.d.ts +2 -0
- package/dist/src/data-marts/services/context/context.service.js +21 -0
- package/dist/src/data-marts/services/data-mart-run.service.d.ts +1 -0
- package/dist/src/data-marts/services/data-mart-run.service.js +9 -0
- package/dist/src/data-marts/services/data-mart.service.d.ts +1 -0
- package/dist/src/data-marts/services/data-mart.service.js +3 -0
- package/dist/src/data-marts/system-triggers/processors/repair-backfill-chains-processor.d.ts +14 -0
- package/dist/src/data-marts/system-triggers/processors/repair-backfill-chains-processor.js +45 -0
- package/dist/src/data-marts/use-cases/cancel-data-mart-run.service.d.ts +4 -0
- package/dist/src/data-marts/use-cases/cancel-data-mart-run.service.js +46 -1
- package/dist/src/data-marts/use-cases/list-data-marts.service.js +1 -0
- package/dist/src/data-marts/use-cases/stream-http-data.service.d.ts +0 -1
- package/dist/src/data-marts/use-cases/stream-http-data.service.js +2 -6
- package/dist/src/data-marts/use-cases/update-data-storage.service.js +7 -7
- package/dist/src/data-marts/utils/field-errors.utils.d.ts +9 -0
- package/dist/src/data-marts/utils/field-errors.utils.js +51 -0
- package/dist/src/data-marts/utils/manual-backfill-range.d.ts +52 -0
- package/dist/src/data-marts/utils/manual-backfill-range.js +110 -8
- package/dist/src/ee/mcp/instructions/mcp-system-instructions.d.ts +1 -1
- package/dist/src/ee/mcp/instructions/mcp-system-instructions.js +4 -0
- package/dist/src/ee/mcp/sdk/mcp-output-schema.d.ts +3 -0
- package/dist/src/ee/mcp/sdk/mcp-output-schema.js +53 -0
- package/dist/src/ee/mcp/sdk/mcp-schema-refresh.d.ts +8 -0
- package/dist/src/ee/mcp/sdk/mcp-schema-refresh.js +44 -0
- package/dist/src/ee/mcp/sdk/mcp-sdk-server.factory.d.ts +8 -1
- package/dist/src/ee/mcp/sdk/mcp-sdk-server.factory.js +35 -4
- package/dist/src/ee/mcp/tools/context-input.d.ts +6 -0
- package/dist/src/ee/mcp/tools/context-input.js +13 -0
- package/dist/src/ee/mcp/tools/data-mart-catalog.tool.d.ts +10 -2
- package/dist/src/ee/mcp/tools/data-mart-catalog.tool.js +17 -5
- package/dist/src/ee/mcp/tools/data-mart-details.tool.d.ts +5 -1
- package/dist/src/ee/mcp/tools/data-mart-details.tool.js +4 -1
- package/dist/src/ee/mcp/tools/list-contexts.tool.d.ts +131 -0
- package/dist/src/ee/mcp/tools/list-contexts.tool.js +50 -0
- package/dist/src/ee/mcp/tools/mcp-tool.providers.js +2 -0
- package/dist/src/ee/mcp/tools/search-data-marts.tool.d.ts +10 -2
- package/dist/src/ee/mcp/tools/search-data-marts.tool.js +17 -3
- package/dist/src/ee/mcp/transport/mcp-http-entry.service.js +1 -1
- package/dist/src/idp/decorators/auth-context.decorator.js +1 -0
- package/dist/src/idp/guards/idp.guard.d.ts +3 -0
- package/dist/src/idp/guards/idp.guard.js +38 -8
- package/dist/src/idp/oauth/controllers/oauth-authorization.controller.js +8 -6
- package/dist/src/idp/oauth/mcp-client-integration.d.ts +1 -0
- package/dist/src/idp/oauth/mcp-client-integration.js +15 -0
- package/dist/src/idp/ports/plugin-runtime-authorizer.port.d.ts +6 -0
- package/dist/src/idp/types/auth.types.d.ts +1 -0
- package/dist/src/migrations/1790830000000-widen-sql-dry-run-trigger-sql-column.d.ts +6 -0
- package/dist/src/migrations/1790830000000-widen-sql-dry-run-trigger-sql-column.js +21 -0
- package/dist/src/migrations/1790900000000-add-plugin-version-backend.d.ts +6 -0
- package/dist/src/migrations/1790900000000-add-plugin-version-backend.js +21 -0
- package/dist/src/migrations/1790900000001-create-plugin-action-execution.d.ts +6 -0
- package/dist/src/migrations/1790900000001-create-plugin-action-execution.js +77 -0
- package/dist/src/migrations/1791000000000-add-credential-public-metadata.d.ts +6 -0
- package/dist/src/migrations/1791000000000-add-credential-public-metadata.js +23 -0
- package/dist/src/plugin-host/collections/dto/domain/plugin-collection.types.d.ts +1 -0
- package/dist/src/plugin-host/collections/errors/plugin-collection.errors.d.ts +6 -0
- package/dist/src/plugin-host/collections/errors/plugin-collection.errors.js +19 -1
- package/dist/src/plugin-host/collections/services/plugin-collection-declaration.service.js +3 -3
- package/dist/src/plugin-host/collections/use-cases/put-plugin-collection-document.service.js +7 -0
- package/dist/src/plugin-host/constants/plugin-action-limits.d.ts +34 -0
- package/dist/src/plugin-host/constants/plugin-action-limits.js +51 -0
- package/dist/src/plugin-host/controllers/plugin-action-runtime.controller.d.ts +20 -0
- package/dist/src/plugin-host/controllers/plugin-action-runtime.controller.js +123 -0
- package/dist/src/plugin-host/controllers/plugin-credential-runtime.controller.js +11 -19
- package/dist/src/plugin-host/controllers/plugin-gallery.controller.d.ts +5 -1
- package/dist/src/plugin-host/controllers/plugin-gallery.controller.js +25 -1
- package/dist/src/plugin-host/controllers/plugin-history.controller.d.ts +10 -0
- package/dist/src/plugin-host/controllers/plugin-history.controller.js +57 -0
- package/dist/src/plugin-host/controllers/plugin-release-check.controller.d.ts +10 -0
- package/dist/src/plugin-host/controllers/plugin-release-check.controller.js +58 -0
- package/dist/src/plugin-host/dto/domain/check-plugin-release.command.d.ts +22 -0
- package/dist/src/plugin-host/dto/domain/check-plugin-release.command.js +17 -0
- package/dist/src/plugin-host/dto/domain/find-plugin-by-repository.command.d.ts +6 -0
- package/dist/src/plugin-host/dto/domain/find-plugin-by-repository.command.js +13 -0
- package/dist/src/plugin-host/dto/domain/list-plugin-history.command.d.ts +10 -0
- package/dist/src/plugin-host/dto/domain/list-plugin-history.command.js +18 -0
- package/dist/src/plugin-host/dto/domain/plugin-action-execution.command.d.ts +23 -0
- package/dist/src/plugin-host/dto/domain/plugin-action-execution.command.js +44 -0
- package/dist/src/plugin-host/dto/domain/plugin-action-execution.dto.d.ts +36 -0
- package/dist/src/plugin-host/dto/domain/plugin-action-execution.dto.js +3 -0
- package/dist/src/plugin-host/dto/domain/plugin-history.dto.d.ts +29 -0
- package/dist/src/plugin-host/dto/domain/plugin-history.dto.js +3 -0
- package/dist/src/plugin-host/dto/domain/plugin-view.dto.d.ts +1 -0
- package/dist/src/plugin-host/dto/presentation/plugin-action-api.dto.d.ts +44 -0
- package/dist/src/plugin-host/dto/presentation/plugin-action-api.dto.js +208 -0
- package/dist/src/plugin-host/dto/presentation/plugin-gallery-api.dto.d.ts +2 -0
- package/dist/src/plugin-host/dto/presentation/plugin-gallery-api.dto.js +7 -0
- package/dist/src/plugin-host/dto/presentation/plugin-history-api.dto.d.ts +29 -0
- package/dist/src/plugin-host/dto/presentation/plugin-history-api.dto.js +148 -0
- package/dist/src/plugin-host/dto/presentation/plugin-lookup-api.dto.d.ts +3 -0
- package/dist/src/plugin-host/dto/presentation/plugin-lookup-api.dto.js +22 -0
- package/dist/src/plugin-host/dto/presentation/publication-api.dto.d.ts +17 -0
- package/dist/src/plugin-host/dto/presentation/publication-api.dto.js +95 -1
- package/dist/src/plugin-host/entities/plugin-action-execution.entity.d.ts +24 -0
- package/dist/src/plugin-host/entities/plugin-action-execution.entity.js +136 -0
- package/dist/src/plugin-host/entities/plugin-version.entity.d.ts +2 -1
- package/dist/src/plugin-host/entities/plugin-version.entity.js +5 -0
- package/dist/src/plugin-host/enums/plugin-action-execution-status.enum.d.ts +9 -0
- package/dist/src/plugin-host/enums/plugin-action-execution-status.enum.js +22 -0
- package/dist/src/plugin-host/enums/release-rejection-code.enum.d.ts +3 -0
- package/dist/src/plugin-host/enums/release-rejection-code.enum.js +6 -0
- package/dist/src/plugin-host/errors/plugin-action.errors.d.ts +45 -0
- package/dist/src/plugin-host/errors/plugin-action.errors.js +70 -0
- package/dist/src/plugin-host/errors/plugin-host.errors.d.ts +6 -0
- package/dist/src/plugin-host/errors/plugin-host.errors.js +10 -1
- package/dist/src/plugin-host/filters/plugin-host-exception.filter.js +2 -2
- package/dist/src/plugin-host/mappers/plugin-action-execution.mapper.d.ts +3 -0
- package/dist/src/plugin-host/mappers/plugin-action-execution.mapper.js +22 -0
- package/dist/src/plugin-host/mappers/plugin-presentation.mapper.d.ts +22 -1
- package/dist/src/plugin-host/mappers/plugin-presentation.mapper.js +87 -1
- package/dist/src/plugin-host/plugin-host.module.js +34 -0
- package/dist/src/plugin-host/services/action-input-validator.service.d.ts +23 -0
- package/dist/src/plugin-host/services/action-input-validator.service.js +277 -0
- package/dist/src/plugin-host/services/external-credential-definition-sync.service.d.ts +3 -0
- package/dist/src/plugin-host/services/external-credential-definition-sync.service.js +47 -15
- package/dist/src/plugin-host/services/plugin-action-dispatcher.service.d.ts +13 -0
- package/dist/src/plugin-host/services/plugin-action-dispatcher.service.js +140 -0
- package/dist/src/plugin-host/services/plugin-action-execution.service.d.ts +69 -0
- package/dist/src/plugin-host/services/plugin-action-execution.service.js +239 -0
- package/dist/src/plugin-host/services/plugin-action-starter.service.d.ts +22 -0
- package/dist/src/plugin-host/services/plugin-action-starter.service.js +81 -0
- package/dist/src/plugin-host/services/plugin-audit.service.d.ts +13 -0
- package/dist/src/plugin-host/services/plugin-audit.service.js +78 -0
- package/dist/src/plugin-host/services/plugin-publication.service.d.ts +4 -0
- package/dist/src/plugin-host/services/plugin-publication.service.js +51 -23
- package/dist/src/plugin-host/services/plugin-runtime-authorizer.service.d.ts +5 -2
- package/dist/src/plugin-host/services/plugin-runtime-authorizer.service.js +31 -3
- package/dist/src/plugin-host/services/plugin-version.service.d.ts +2 -1
- package/dist/src/plugin-host/services/release-candidate-rules.service.d.ts +51 -0
- package/dist/src/plugin-host/services/release-candidate-rules.service.js +198 -0
- package/dist/src/plugin-host/services/remote-url-validator.service.d.ts +7 -0
- package/dist/src/plugin-host/services/remote-url-validator.service.js +4 -0
- package/dist/src/plugin-host/system-triggers/plugin-action-execution-sweep.processor.d.ts +14 -0
- package/dist/src/plugin-host/system-triggers/plugin-action-execution-sweep.processor.js +50 -0
- package/dist/src/plugin-host/use-cases/cancel-plugin-action-execution.service.d.ts +8 -0
- package/dist/src/plugin-host/use-cases/cancel-plugin-action-execution.service.js +39 -0
- package/dist/src/plugin-host/use-cases/check-plugin-release.service.d.ts +22 -0
- package/dist/src/plugin-host/use-cases/check-plugin-release.service.js +152 -0
- package/dist/src/plugin-host/use-cases/find-plugin-by-repository.service.d.ts +9 -0
- package/dist/src/plugin-host/use-cases/find-plugin-by-repository.service.js +35 -0
- package/dist/src/plugin-host/use-cases/get-current-plugin-action-execution.service.d.ts +14 -0
- package/dist/src/plugin-host/use-cases/get-current-plugin-action-execution.service.js +85 -0
- package/dist/src/plugin-host/use-cases/get-plugin-action-execution.service.d.ts +9 -0
- package/dist/src/plugin-host/use-cases/get-plugin-action-execution.service.js +67 -0
- package/dist/src/plugin-host/use-cases/get-plugin-installation-entry.service.js +2 -7
- package/dist/src/plugin-host/use-cases/install-plugin.service.js +4 -0
- package/dist/src/plugin-host/use-cases/list-installations.service.d.ts +3 -1
- package/dist/src/plugin-host/use-cases/list-installations.service.js +14 -3
- package/dist/src/plugin-host/use-cases/list-plugin-history.service.d.ts +25 -0
- package/dist/src/plugin-host/use-cases/list-plugin-history.service.js +147 -0
- package/dist/src/plugin-host/use-cases/plugin-publisher-access.d.ts +5 -0
- package/dist/src/plugin-host/use-cases/plugin-publisher-access.js +28 -0
- package/dist/src/plugin-host/use-cases/start-plugin-action-execution.service.d.ts +12 -0
- package/dist/src/plugin-host/use-cases/start-plugin-action-execution.service.js +64 -0
- package/dist/src/plugin-host/use-cases/sync-plugin-releases.service.d.ts +3 -5
- package/dist/src/plugin-host/use-cases/sync-plugin-releases.service.js +15 -59
- package/dist/src/plugin-host/use-cases/uninstall-plugin.service.js +3 -1
- package/dist/src/plugin-host/use-cases/update-plugin.service.d.ts +0 -1
- package/dist/src/plugin-host/use-cases/update-plugin.service.js +3 -25
- package/dist/src/plugin-host/utils/action-input-schema.util.d.ts +14 -0
- package/dist/src/plugin-host/utils/action-input-schema.util.js +133 -0
- package/dist/src/plugin-host/utils/credential-handles.util.d.ts +3 -0
- package/dist/src/plugin-host/utils/credential-handles.util.js +13 -0
- package/dist/src/plugin-host/utils/execution-token.util.d.ts +5 -0
- package/dist/src/plugin-host/utils/execution-token.util.js +13 -0
- package/dist/src/plugin-host/utils/github-repo-locator.util.js +1 -1
- package/dist/src/plugin-host/utils/json-shape.util.d.ts +1 -0
- package/dist/src/plugin-host/utils/json-shape.util.js +21 -0
- package/dist/src/plugin-host/utils/plugin-action-outcome.util.d.ts +10 -0
- package/dist/src/plugin-host/utils/plugin-action-outcome.util.js +67 -0
- package/dist/src/plugin-host/utils/plugin-manifest.util.d.ts +121 -0
- package/dist/src/plugin-host/utils/plugin-manifest.util.js +111 -1
- package/dist/src/plugin-host/utils/request-abort-signal.util.d.ts +5 -0
- package/dist/src/plugin-host/utils/request-abort-signal.util.js +19 -0
- package/package.json +10 -8
|
@@ -8,9 +8,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.PluginPresentationMapper = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
|
+
const check_plugin_release_command_1 = require("../dto/domain/check-plugin-release.command");
|
|
12
|
+
const list_plugin_history_command_1 = require("../dto/domain/list-plugin-history.command");
|
|
13
|
+
const find_plugin_by_repository_command_1 = require("../dto/domain/find-plugin-by-repository.command");
|
|
11
14
|
const get_plugin_details_command_1 = require("../dto/domain/get-plugin-details.command");
|
|
12
15
|
const get_plugin_gallery_command_1 = require("../dto/domain/get-plugin-gallery.command");
|
|
13
16
|
const get_plugin_installation_entry_command_1 = require("../dto/domain/get-plugin-installation-entry.command");
|
|
17
|
+
const plugin_manifest_util_1 = require("../utils/plugin-manifest.util");
|
|
14
18
|
const install_plugin_command_1 = require("../dto/domain/install-plugin.command");
|
|
15
19
|
const list_installations_command_1 = require("../dto/domain/list-installations.command");
|
|
16
20
|
const list_publications_command_1 = require("../dto/domain/list-publications.command");
|
|
@@ -44,6 +48,26 @@ let PluginPresentationMapper = class PluginPresentationMapper {
|
|
|
44
48
|
toListInstallationsCommand(context, includeUninstalled) {
|
|
45
49
|
return new list_installations_command_1.ListInstallationsCommand(context, includeUninstalled);
|
|
46
50
|
}
|
|
51
|
+
toListPluginHistoryCommand(context, query) {
|
|
52
|
+
return new list_plugin_history_command_1.ListPluginHistoryCommand(context, query.type ?? 'all', query.limit ?? list_plugin_history_command_1.PLUGIN_HISTORY_DEFAULT_LIMIT, query.cursor ?? null);
|
|
53
|
+
}
|
|
54
|
+
toPluginHistoryResponse(page) {
|
|
55
|
+
return {
|
|
56
|
+
items: page.items.map(item => ({
|
|
57
|
+
id: item.id,
|
|
58
|
+
occurredAt: item.occurredAt.toISOString(),
|
|
59
|
+
action: item.action,
|
|
60
|
+
scope: item.scope,
|
|
61
|
+
plugin: { ...item.plugin },
|
|
62
|
+
actor: item.actor ? { ...item.actor } : null,
|
|
63
|
+
version: item.version,
|
|
64
|
+
})),
|
|
65
|
+
nextCursor: page.nextCursor,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
toFindPluginByRepositoryCommand(repository, context) {
|
|
69
|
+
return new find_plugin_by_repository_command_1.FindPluginByRepositoryCommand(repository, context);
|
|
70
|
+
}
|
|
47
71
|
toGetPluginInstallationEntryCommand(installationId, context) {
|
|
48
72
|
return new get_plugin_installation_entry_command_1.GetPluginInstallationEntryCommand(installationId, context);
|
|
49
73
|
}
|
|
@@ -56,6 +80,9 @@ let PluginPresentationMapper = class PluginPresentationMapper {
|
|
|
56
80
|
toUpdateByRepositoryCommand(context, dto) {
|
|
57
81
|
return new update_plugin_command_1.UpdatePluginCommand(context, undefined, dto.repository);
|
|
58
82
|
}
|
|
83
|
+
toCheckReleaseCommand(context, dto) {
|
|
84
|
+
return new check_plugin_release_command_1.CheckPluginReleaseCommand(context, dto.repository, dto.ref, dto.version);
|
|
85
|
+
}
|
|
59
86
|
toUninstallCommand(pluginId, context) {
|
|
60
87
|
return new uninstall_plugin_command_1.UninstallPluginCommand(pluginId, context);
|
|
61
88
|
}
|
|
@@ -68,7 +95,7 @@ let PluginPresentationMapper = class PluginPresentationMapper {
|
|
|
68
95
|
toMemberDto(plugin, version, context) {
|
|
69
96
|
return {
|
|
70
97
|
pluginId: plugin.id,
|
|
71
|
-
displayName:
|
|
98
|
+
displayName: this.displayNameOf(plugin, version),
|
|
72
99
|
description: version?.description ?? '',
|
|
73
100
|
currentSemver: version?.semver ?? null,
|
|
74
101
|
currentVersionId: version?.id ?? null,
|
|
@@ -79,8 +106,21 @@ let PluginPresentationMapper = class PluginPresentationMapper {
|
|
|
79
106
|
addedAt: plugin.createdAt.toISOString(),
|
|
80
107
|
nextCheckAt: plugin.nextUpdateCheckAt?.toISOString() ?? null,
|
|
81
108
|
credentialRequirements: version?.credentialRequirements ?? [],
|
|
109
|
+
...(version?.backend
|
|
110
|
+
? { backendOrigin: new URL((0, plugin_manifest_util_1.resolveBackendUrl)(version.backend, version.deliveryUrl)).origin }
|
|
111
|
+
: {}),
|
|
82
112
|
};
|
|
83
113
|
}
|
|
114
|
+
toHistoryPlugin(plugin, version) {
|
|
115
|
+
return {
|
|
116
|
+
pluginId: plugin.id,
|
|
117
|
+
displayName: this.displayNameOf(plugin, version),
|
|
118
|
+
ownerName: plugin.repoOwner,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
toLookupResponse(result) {
|
|
122
|
+
return { pluginId: result.pluginId };
|
|
123
|
+
}
|
|
84
124
|
toGalleryEntryResponse(dto) {
|
|
85
125
|
return {
|
|
86
126
|
pluginId: dto.pluginId,
|
|
@@ -95,6 +135,7 @@ let PluginPresentationMapper = class PluginPresentationMapper {
|
|
|
95
135
|
addedAt: dto.addedAt,
|
|
96
136
|
nextCheckAt: dto.nextCheckAt,
|
|
97
137
|
credentialRequirements: dto.credentialRequirements.map(requirement => typeof requirement === 'string' ? requirement : { ...requirement }),
|
|
138
|
+
...(dto.backendOrigin ? { backendOrigin: dto.backendOrigin } : {}),
|
|
98
139
|
};
|
|
99
140
|
}
|
|
100
141
|
toGalleryEntryResponseList(dtos) {
|
|
@@ -168,6 +209,17 @@ let PluginPresentationMapper = class PluginPresentationMapper {
|
|
|
168
209
|
diagnostics: dto.diagnostics ? this.toDiagnosticsResponse(dto.diagnostics) : null,
|
|
169
210
|
};
|
|
170
211
|
}
|
|
212
|
+
toReleaseCheckResponse(dto) {
|
|
213
|
+
return {
|
|
214
|
+
pluginId: dto.pluginId,
|
|
215
|
+
repository: dto.repository,
|
|
216
|
+
commitSha: dto.commitSha,
|
|
217
|
+
candidateVersion: dto.candidateVersion,
|
|
218
|
+
baselineVersion: dto.baselineVersion,
|
|
219
|
+
collectionsEvaluated: dto.collectionsEvaluated,
|
|
220
|
+
issues: dto.issues.map(issue => ({ code: issue.code, detail: issue.detail })),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
171
223
|
toSuspensionResponse(dto) {
|
|
172
224
|
return {
|
|
173
225
|
pluginId: dto.pluginId,
|
|
@@ -175,6 +227,40 @@ let PluginPresentationMapper = class PluginPresentationMapper {
|
|
|
175
227
|
note: dto.note,
|
|
176
228
|
};
|
|
177
229
|
}
|
|
230
|
+
toStartedActionExecutionResponse(dto) {
|
|
231
|
+
return { id: dto.id, status: dto.status };
|
|
232
|
+
}
|
|
233
|
+
toActionExecutionResponse(dto) {
|
|
234
|
+
return {
|
|
235
|
+
id: dto.id,
|
|
236
|
+
action: dto.action,
|
|
237
|
+
status: dto.status,
|
|
238
|
+
trigger: dto.trigger,
|
|
239
|
+
startedAt: dto.startedAt,
|
|
240
|
+
deadlineAt: dto.deadlineAt,
|
|
241
|
+
finishedAt: dto.finishedAt,
|
|
242
|
+
result: dto.result,
|
|
243
|
+
error: dto.error ? { code: dto.error.code, message: dto.error.message } : null,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
toActionWorkerContextResponse(dto) {
|
|
247
|
+
return {
|
|
248
|
+
executionId: dto.executionId,
|
|
249
|
+
action: dto.action,
|
|
250
|
+
input: dto.input,
|
|
251
|
+
trigger: dto.trigger,
|
|
252
|
+
deadlineAt: dto.deadlineAt,
|
|
253
|
+
plugin: { id: dto.plugin.id, repositoryId: dto.plugin.repositoryId },
|
|
254
|
+
pluginVersion: dto.pluginVersion,
|
|
255
|
+
installationId: dto.installationId,
|
|
256
|
+
projectId: dto.projectId,
|
|
257
|
+
userId: dto.userId,
|
|
258
|
+
credentialHandles: dto.credentialHandles.map(handle => ({ ...handle })),
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
displayNameOf(plugin, version) {
|
|
262
|
+
return version?.displayName ?? (plugin.isPrivateRepo ? plugin.repoOwner : plugin.repoName);
|
|
263
|
+
}
|
|
178
264
|
toSource(plugin) {
|
|
179
265
|
const owner = {
|
|
180
266
|
ownerName: plugin.repoOwner,
|
|
@@ -15,6 +15,7 @@ const data_marts_module_1 = require("../data-marts/data-marts.module");
|
|
|
15
15
|
const plugin_collections_data_source_options_config_1 = require("../config/plugin-collections-data-source-options.config");
|
|
16
16
|
const plugin_runtime_authorizer_port_1 = require("../idp/ports/plugin-runtime-authorizer.port");
|
|
17
17
|
const plugin_host_config_1 = require("./config/plugin-host.config");
|
|
18
|
+
const plugin_action_execution_entity_1 = require("./entities/plugin-action-execution.entity");
|
|
18
19
|
const plugin_audit_event_entity_1 = require("./entities/plugin-audit-event.entity");
|
|
19
20
|
const plugin_installation_entity_1 = require("./entities/plugin-installation.entity");
|
|
20
21
|
const plugin_publication_project_entity_1 = require("./entities/plugin-publication-project.entity");
|
|
@@ -23,15 +24,22 @@ const plugin_version_entity_1 = require("./entities/plugin-version.entity");
|
|
|
23
24
|
const plugin_entity_1 = require("./entities/plugin.entity");
|
|
24
25
|
const plugin_admin_controller_1 = require("./controllers/plugin-admin.controller");
|
|
25
26
|
const plugin_gallery_controller_1 = require("./controllers/plugin-gallery.controller");
|
|
27
|
+
const plugin_history_controller_1 = require("./controllers/plugin-history.controller");
|
|
26
28
|
const plugin_installations_controller_1 = require("./controllers/plugin-installations.controller");
|
|
29
|
+
const plugin_release_check_controller_1 = require("./controllers/plugin-release-check.controller");
|
|
27
30
|
const plugin_publications_controller_1 = require("./controllers/plugin-publications.controller");
|
|
28
31
|
const plugin_credential_runtime_controller_1 = require("./controllers/plugin-credential-runtime.controller");
|
|
32
|
+
const plugin_action_runtime_controller_1 = require("./controllers/plugin-action-runtime.controller");
|
|
29
33
|
const credential_definitions_github_controller_1 = require("./controllers/credential-definitions-github.controller");
|
|
30
34
|
const github_api_service_1 = require("./services/github-api.service");
|
|
31
35
|
const external_credential_definition_sync_service_1 = require("./services/external-credential-definition-sync.service");
|
|
32
36
|
const github_auth_service_1 = require("./services/github-auth.service");
|
|
33
37
|
const plugin_installation_lookup_facade_1 = require("./facades/plugin-installation-lookup.facade");
|
|
34
38
|
const plugin_installation_lookup_facade_impl_1 = require("./facades/plugin-installation-lookup.facade.impl");
|
|
39
|
+
const action_input_validator_service_1 = require("./services/action-input-validator.service");
|
|
40
|
+
const plugin_action_dispatcher_service_1 = require("./services/plugin-action-dispatcher.service");
|
|
41
|
+
const plugin_action_execution_service_1 = require("./services/plugin-action-execution.service");
|
|
42
|
+
const plugin_action_starter_service_1 = require("./services/plugin-action-starter.service");
|
|
35
43
|
const plugin_audit_service_1 = require("./services/plugin-audit.service");
|
|
36
44
|
const plugin_installation_service_1 = require("./services/plugin-installation.service");
|
|
37
45
|
const plugin_credential_binding_reconciliation_service_1 = require("./services/plugin-credential-binding-reconciliation.service");
|
|
@@ -42,14 +50,22 @@ const plugin_service_1 = require("./services/plugin.service");
|
|
|
42
50
|
const publication_authorization_service_1 = require("./services/publication-authorization.service");
|
|
43
51
|
const plugin_runtime_authorizer_service_1 = require("./services/plugin-runtime-authorizer.service");
|
|
44
52
|
const remote_url_validator_service_1 = require("./services/remote-url-validator.service");
|
|
53
|
+
const release_candidate_rules_service_1 = require("./services/release-candidate-rules.service");
|
|
45
54
|
const plugin_presentation_mapper_1 = require("./mappers/plugin-presentation.mapper");
|
|
55
|
+
const find_plugin_by_repository_service_1 = require("./use-cases/find-plugin-by-repository.service");
|
|
46
56
|
const get_plugin_details_service_1 = require("./use-cases/get-plugin-details.service");
|
|
47
57
|
const get_plugin_installation_entry_service_1 = require("./use-cases/get-plugin-installation-entry.service");
|
|
48
58
|
const install_plugin_service_1 = require("./use-cases/install-plugin.service");
|
|
49
59
|
const list_installations_service_1 = require("./use-cases/list-installations.service");
|
|
60
|
+
const list_plugin_history_service_1 = require("./use-cases/list-plugin-history.service");
|
|
50
61
|
const uninstall_plugin_service_1 = require("./use-cases/uninstall-plugin.service");
|
|
51
62
|
const update_plugin_service_1 = require("./use-cases/update-plugin.service");
|
|
63
|
+
const check_plugin_release_service_1 = require("./use-cases/check-plugin-release.service");
|
|
52
64
|
const issue_plugin_runtime_token_service_1 = require("./use-cases/issue-plugin-runtime-token.service");
|
|
65
|
+
const start_plugin_action_execution_service_1 = require("./use-cases/start-plugin-action-execution.service");
|
|
66
|
+
const cancel_plugin_action_execution_service_1 = require("./use-cases/cancel-plugin-action-execution.service");
|
|
67
|
+
const get_current_plugin_action_execution_service_1 = require("./use-cases/get-current-plugin-action-execution.service");
|
|
68
|
+
const get_plugin_action_execution_service_1 = require("./use-cases/get-plugin-action-execution.service");
|
|
53
69
|
const get_plugin_gallery_service_1 = require("./use-cases/get-plugin-gallery.service");
|
|
54
70
|
const list_publications_service_1 = require("./use-cases/list-publications.service");
|
|
55
71
|
const publish_plugin_service_1 = require("./use-cases/publish-plugin.service");
|
|
@@ -57,6 +73,7 @@ const resume_plugin_service_1 = require("./use-cases/resume-plugin.service");
|
|
|
57
73
|
const run_plugin_update_check_service_1 = require("./use-cases/run-plugin-update-check.service");
|
|
58
74
|
const plugin_update_check_processor_1 = require("./system-triggers/plugin-update-check.processor");
|
|
59
75
|
const credential_definition_update_check_processor_1 = require("./system-triggers/credential-definition-update-check.processor");
|
|
76
|
+
const plugin_action_execution_sweep_processor_1 = require("./system-triggers/plugin-action-execution-sweep.processor");
|
|
60
77
|
const suspend_plugin_service_1 = require("./use-cases/suspend-plugin.service");
|
|
61
78
|
const sync_plugin_releases_service_1 = require("./use-cases/sync-plugin-releases.service");
|
|
62
79
|
const unpublish_plugin_service_1 = require("./use-cases/unpublish-plugin.service");
|
|
@@ -88,6 +105,7 @@ exports.PluginHostModule = PluginHostModule = __decorate([
|
|
|
88
105
|
plugin_publication_project_entity_1.PluginPublicationProject,
|
|
89
106
|
plugin_installation_entity_1.PluginInstallation,
|
|
90
107
|
plugin_audit_event_entity_1.PluginAuditEvent,
|
|
108
|
+
plugin_action_execution_entity_1.PluginActionExecution,
|
|
91
109
|
]),
|
|
92
110
|
typeorm_1.TypeOrmModule.forFeature([plugin_collection_document_collection_entity_1.PluginCollectionDocument, plugin_collection_usage_collection_entity_1.PluginCollectionUsage, plugin_collection_audit_event_collection_entity_1.PluginCollectionAuditEvent], plugin_collections_data_source_options_config_1.PLUGIN_COLLECTIONS_DATA_SOURCE),
|
|
93
111
|
idp_module_1.IdpModule,
|
|
@@ -98,9 +116,12 @@ exports.PluginHostModule = PluginHostModule = __decorate([
|
|
|
98
116
|
plugin_collections_controller_1.PluginCollectionsController,
|
|
99
117
|
credential_definitions_github_controller_1.CredentialDefinitionsGithubController,
|
|
100
118
|
plugin_credential_runtime_controller_1.PluginCredentialRuntimeController,
|
|
119
|
+
plugin_action_runtime_controller_1.PluginActionRuntimeController,
|
|
101
120
|
plugin_publications_controller_1.PluginPublicationsController,
|
|
102
121
|
plugin_admin_controller_1.PluginAdminController,
|
|
122
|
+
plugin_release_check_controller_1.PluginReleaseCheckController,
|
|
103
123
|
plugin_installations_controller_1.PluginInstallationsController,
|
|
124
|
+
plugin_history_controller_1.PluginHistoryController,
|
|
104
125
|
plugin_gallery_controller_1.PluginGalleryController,
|
|
105
126
|
],
|
|
106
127
|
providers: [
|
|
@@ -120,6 +141,7 @@ exports.PluginHostModule = PluginHostModule = __decorate([
|
|
|
120
141
|
external_credential_definition_sync_service_1.ExternalCredentialDefinitionSyncService,
|
|
121
142
|
add_github_credential_definition_service_1.AddGithubCredentialDefinitionService,
|
|
122
143
|
remote_url_validator_service_1.RemoteUrlValidatorService,
|
|
144
|
+
release_candidate_rules_service_1.ReleaseCandidateRulesService,
|
|
123
145
|
plugin_service_1.PluginService,
|
|
124
146
|
plugin_version_service_1.PluginVersionService,
|
|
125
147
|
plugin_audit_service_1.PluginAuditService,
|
|
@@ -132,19 +154,31 @@ exports.PluginHostModule = PluginHostModule = __decorate([
|
|
|
132
154
|
plugin_presentation_mapper_1.PluginPresentationMapper,
|
|
133
155
|
get_plugin_gallery_service_1.GetPluginGalleryService,
|
|
134
156
|
get_plugin_details_service_1.GetPluginDetailsService,
|
|
157
|
+
find_plugin_by_repository_service_1.FindPluginByRepositoryService,
|
|
135
158
|
suspend_plugin_service_1.SuspendPluginService,
|
|
136
159
|
resume_plugin_service_1.ResumePluginService,
|
|
137
160
|
plugin_installation_service_1.PluginInstallationService,
|
|
161
|
+
plugin_action_execution_service_1.PluginActionExecutionService,
|
|
162
|
+
plugin_action_dispatcher_service_1.PluginActionDispatcherService,
|
|
163
|
+
action_input_validator_service_1.ActionInputValidatorService,
|
|
164
|
+
plugin_action_starter_service_1.PluginActionStarterService,
|
|
165
|
+
start_plugin_action_execution_service_1.StartPluginActionExecutionService,
|
|
166
|
+
get_plugin_action_execution_service_1.GetPluginActionExecutionService,
|
|
167
|
+
cancel_plugin_action_execution_service_1.CancelPluginActionExecutionService,
|
|
168
|
+
get_current_plugin_action_execution_service_1.GetCurrentPluginActionExecutionService,
|
|
138
169
|
plugin_credential_binding_reconciliation_service_1.PluginCredentialBindingReconciliationService,
|
|
139
170
|
plugin_update_schedule_service_1.PluginUpdateScheduleService,
|
|
140
171
|
run_plugin_update_check_service_1.RunPluginUpdateCheckService,
|
|
141
172
|
plugin_update_check_processor_1.PluginUpdateCheckProcessor,
|
|
142
173
|
credential_definition_update_check_processor_1.CredentialDefinitionUpdateCheckProcessor,
|
|
174
|
+
plugin_action_execution_sweep_processor_1.PluginActionExecutionSweepProcessor,
|
|
143
175
|
install_plugin_service_1.InstallPluginService,
|
|
144
176
|
uninstall_plugin_service_1.UninstallPluginService,
|
|
145
177
|
list_installations_service_1.ListInstallationsService,
|
|
178
|
+
list_plugin_history_service_1.ListPluginHistoryService,
|
|
146
179
|
get_plugin_installation_entry_service_1.GetPluginInstallationEntryService,
|
|
147
180
|
update_plugin_service_1.UpdatePluginService,
|
|
181
|
+
check_plugin_release_service_1.CheckPluginReleaseService,
|
|
148
182
|
issue_plugin_runtime_token_service_1.IssuePluginRuntimeTokenService,
|
|
149
183
|
plugin_installation_lookup_facade_impl_1.PluginInstallationLookupFacade,
|
|
150
184
|
{ provide: plugin_installation_lookup_facade_1.PLUGIN_INSTALLATION_LOOKUP, useExisting: plugin_installation_lookup_facade_impl_1.PluginInstallationLookupFacade },
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OnModuleDestroy } from '@nestjs/common';
|
|
2
|
+
import { type ActionInputError } from '../errors/plugin-action.errors';
|
|
3
|
+
export interface ActionInputSchema {
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly schema: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare class ActionInputValidatorService implements OnModuleDestroy {
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private readonly slots;
|
|
10
|
+
private readonly queue;
|
|
11
|
+
private readonly pendingByVersion;
|
|
12
|
+
private stopped;
|
|
13
|
+
validate(pluginVersionId: string, action: string, schema: Record<string, unknown>, input: unknown): Promise<readonly ActionInputError[]>;
|
|
14
|
+
compile(schemas: readonly ActionInputSchema[]): Promise<string | null>;
|
|
15
|
+
onModuleDestroy(): Promise<void>;
|
|
16
|
+
private refuseToQueue;
|
|
17
|
+
private drain;
|
|
18
|
+
private run;
|
|
19
|
+
private startBudget;
|
|
20
|
+
private spawn;
|
|
21
|
+
private replace;
|
|
22
|
+
private release;
|
|
23
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
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 ActionInputValidatorService_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ActionInputValidatorService = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const internal_helpers_1 = require("@owox/internal-helpers");
|
|
13
|
+
const node_worker_threads_1 = require("node:worker_threads");
|
|
14
|
+
const plugin_action_limits_1 = require("../constants/plugin-action-limits");
|
|
15
|
+
const plugin_action_errors_1 = require("../errors/plugin-action.errors");
|
|
16
|
+
const action_input_schema_util_1 = require("../utils/action-input-schema.util");
|
|
17
|
+
const AJV_PATH = require.resolve('ajv/dist/2020');
|
|
18
|
+
const WORKER_SOURCE = `
|
|
19
|
+
const { parentPort, workerData } = require('node:worker_threads');
|
|
20
|
+
const Ajv2020 = require(workerData.ajvPath).default;
|
|
21
|
+
const { ajv: setup, cacheSize, maxErrors } = workerData;
|
|
22
|
+
const compiled = new Map();
|
|
23
|
+
|
|
24
|
+
const reason = error => String((error && error.message) || error);
|
|
25
|
+
|
|
26
|
+
function build(schema) {
|
|
27
|
+
const ajv = new Ajv2020(setup.options);
|
|
28
|
+
ajv.getSchema(setup.metaSchema);
|
|
29
|
+
for (const keyword of setup.refusedKeywords) ajv.removeKeyword(keyword);
|
|
30
|
+
return ajv.compile(schema);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function compile(key, schema) {
|
|
34
|
+
const cached = compiled.get(key);
|
|
35
|
+
if (cached) {
|
|
36
|
+
compiled.delete(key);
|
|
37
|
+
compiled.set(key, cached);
|
|
38
|
+
return cached;
|
|
39
|
+
}
|
|
40
|
+
const validate = build(schema);
|
|
41
|
+
if (compiled.size >= cacheSize) compiled.delete(compiled.keys().next().value);
|
|
42
|
+
compiled.set(key, validate);
|
|
43
|
+
return validate;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// A release's schemas, as JSON text: the first one ajv refuses, or none. Not cached, it is no version yet.
|
|
47
|
+
function compileAll(schemas) {
|
|
48
|
+
for (let index = 0; index < schemas.length; index += 1) {
|
|
49
|
+
try {
|
|
50
|
+
build(JSON.parse(schemas[index]));
|
|
51
|
+
} catch (error) {
|
|
52
|
+
return parentPort.postMessage({ schemaError: reason(error), index });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
parentPort.postMessage({ schemaError: null });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
parentPort.on('message', message => {
|
|
59
|
+
if (message.schemas) return compileAll(message.schemas);
|
|
60
|
+
const { key, schema, input } = message;
|
|
61
|
+
let validate;
|
|
62
|
+
try {
|
|
63
|
+
validate = compile(key, schema);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
parentPort.postMessage({ schemaError: reason(error) });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
parentPort.postMessage({ compiled: true });
|
|
69
|
+
// A throw from here ends the worker, which the pool reads as an exceeded budget.
|
|
70
|
+
const valid = validate(input);
|
|
71
|
+
if (typeof valid !== 'boolean') {
|
|
72
|
+
// An async schema answers a Promise: no verdict in time. It answers once settled, so its work stays
|
|
73
|
+
// inside its own budget, and its rejection must not end the worker.
|
|
74
|
+
return Promise.resolve(valid).catch(() => {}).then(() => parentPort.postMessage({ overBudget: true }));
|
|
75
|
+
}
|
|
76
|
+
if (valid) return parentPort.postMessage({ errors: [] });
|
|
77
|
+
const errors = (validate.errors || []).slice(0, maxErrors).map(error => ({
|
|
78
|
+
instancePath: error.instancePath,
|
|
79
|
+
message: error.message || 'is invalid',
|
|
80
|
+
}));
|
|
81
|
+
parentPort.postMessage({
|
|
82
|
+
errors: errors.length > 0 ? errors : [{ instancePath: '', message: 'is invalid' }],
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
parentPort.postMessage({ ready: true });
|
|
87
|
+
`;
|
|
88
|
+
const OVER_BUDGET = [
|
|
89
|
+
{ instancePath: '', message: 'Input validation exceeded its budget' },
|
|
90
|
+
];
|
|
91
|
+
const COMPILE_OVER_BUDGET = 'Input schema compilation exceeded its budget';
|
|
92
|
+
function stoppedError() {
|
|
93
|
+
return new Error('Input validation stopped');
|
|
94
|
+
}
|
|
95
|
+
let ActionInputValidatorService = ActionInputValidatorService_1 = class ActionInputValidatorService {
|
|
96
|
+
logger = new common_1.Logger(ActionInputValidatorService_1.name);
|
|
97
|
+
slots = new Set();
|
|
98
|
+
queue = [];
|
|
99
|
+
pendingByVersion = new Map();
|
|
100
|
+
stopped = false;
|
|
101
|
+
validate(pluginVersionId, action, schema, input) {
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
103
|
+
const pending = this.pendingByVersion.get(pluginVersionId) ?? 0;
|
|
104
|
+
if (pending >= plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxValidationsPerVersion) {
|
|
105
|
+
this.logger.warn(`TOO_MANY_EXECUTIONS: ${plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxValidationsPerVersion} validations per version reached, pluginVersionId=${pluginVersionId}`);
|
|
106
|
+
reject(new plugin_action_errors_1.TooManyExecutionsError('Too many inputs of this plugin are being validated. Try again shortly.'));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const refusal = this.refuseToQueue(`pluginVersionId=${pluginVersionId}`);
|
|
110
|
+
if (refusal) {
|
|
111
|
+
reject(refusal);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this.pendingByVersion.set(pluginVersionId, pending + 1);
|
|
115
|
+
const release = () => this.release(pluginVersionId);
|
|
116
|
+
this.queue.push({
|
|
117
|
+
message: { key: `${pluginVersionId}:${action}`, schema, input },
|
|
118
|
+
budgetMs: plugin_action_limits_1.PLUGIN_ACTION_LIMITS.validationBootMs,
|
|
119
|
+
resolve: verdict => {
|
|
120
|
+
release();
|
|
121
|
+
if ('errors' in verdict)
|
|
122
|
+
resolve(verdict.errors);
|
|
123
|
+
else if ('overBudget' in verdict)
|
|
124
|
+
resolve(OVER_BUDGET);
|
|
125
|
+
else
|
|
126
|
+
reject(new Error(String(verdict.schemaError)));
|
|
127
|
+
},
|
|
128
|
+
reject: error => {
|
|
129
|
+
release();
|
|
130
|
+
reject(error);
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
this.drain();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async compile(schemas) {
|
|
137
|
+
if (schemas.length === 0)
|
|
138
|
+
return null;
|
|
139
|
+
const texts = [];
|
|
140
|
+
for (const { path, schema } of schemas) {
|
|
141
|
+
try {
|
|
142
|
+
texts.push(JSON.stringify(schema));
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
return `${path}: ${(0, internal_helpers_1.castError)(error).message}`;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return new Promise((resolve, reject) => {
|
|
149
|
+
const refusal = this.refuseToQueue('release compile');
|
|
150
|
+
if (refusal) {
|
|
151
|
+
reject(refusal);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.queue.push({
|
|
155
|
+
message: { schemas: texts },
|
|
156
|
+
budgetMs: plugin_action_limits_1.PLUGIN_ACTION_LIMITS.inputSchemaCompileBudgetMs,
|
|
157
|
+
resolve: verdict => {
|
|
158
|
+
if ('overBudget' in verdict)
|
|
159
|
+
resolve(COMPILE_OVER_BUDGET);
|
|
160
|
+
else if ('schemaError' in verdict && verdict.schemaError !== null) {
|
|
161
|
+
resolve(`${schemas[verdict.index ?? 0].path}: ${verdict.schemaError}`);
|
|
162
|
+
}
|
|
163
|
+
else
|
|
164
|
+
resolve(null);
|
|
165
|
+
},
|
|
166
|
+
reject,
|
|
167
|
+
});
|
|
168
|
+
this.drain();
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
async onModuleDestroy() {
|
|
172
|
+
this.stopped = true;
|
|
173
|
+
const slots = [...this.slots];
|
|
174
|
+
this.slots.clear();
|
|
175
|
+
for (const job of this.queue.splice(0))
|
|
176
|
+
job.reject(stoppedError());
|
|
177
|
+
for (const slot of slots) {
|
|
178
|
+
clearTimeout(slot.timer);
|
|
179
|
+
slot.job?.reject(stoppedError());
|
|
180
|
+
}
|
|
181
|
+
await Promise.all(slots.map(slot => slot.worker.terminate()));
|
|
182
|
+
}
|
|
183
|
+
refuseToQueue(subject) {
|
|
184
|
+
if (this.queue.length >= plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxQueuedValidations) {
|
|
185
|
+
this.logger.warn(`TOO_MANY_EXECUTIONS: ${plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxQueuedValidations} queued validations reached, ${subject}`);
|
|
186
|
+
return new plugin_action_errors_1.TooManyExecutionsError('Input validation is busy. Try again shortly.');
|
|
187
|
+
}
|
|
188
|
+
return this.stopped ? stoppedError() : null;
|
|
189
|
+
}
|
|
190
|
+
drain() {
|
|
191
|
+
for (const slot of this.slots) {
|
|
192
|
+
const next = slot.job ? undefined : this.queue.shift();
|
|
193
|
+
if (next)
|
|
194
|
+
this.run(slot, next);
|
|
195
|
+
}
|
|
196
|
+
while (this.queue.length > 0 && this.slots.size < plugin_action_limits_1.PLUGIN_ACTION_LIMITS.validationWorkers) {
|
|
197
|
+
this.run(this.spawn(), this.queue.shift());
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
run(slot, job) {
|
|
201
|
+
slot.job = job;
|
|
202
|
+
slot.worker.ref();
|
|
203
|
+
slot.worker.postMessage(job.message);
|
|
204
|
+
if (slot.ready)
|
|
205
|
+
this.startBudget(slot);
|
|
206
|
+
}
|
|
207
|
+
startBudget(slot, budgetMs = slot.job?.budgetMs) {
|
|
208
|
+
slot.timer = setTimeout(() => this.replace(slot), budgetMs);
|
|
209
|
+
}
|
|
210
|
+
spawn() {
|
|
211
|
+
const worker = new node_worker_threads_1.Worker(WORKER_SOURCE, {
|
|
212
|
+
eval: true,
|
|
213
|
+
workerData: {
|
|
214
|
+
ajvPath: AJV_PATH,
|
|
215
|
+
ajv: action_input_schema_util_1.ACTION_INPUT_AJV,
|
|
216
|
+
cacheSize: plugin_action_limits_1.PLUGIN_ACTION_LIMITS.validationWorkerCacheSize,
|
|
217
|
+
maxErrors: plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxReportedInputErrors,
|
|
218
|
+
},
|
|
219
|
+
resourceLimits: { maxOldGenerationSizeMb: plugin_action_limits_1.PLUGIN_ACTION_LIMITS.validationWorkerHeapMb },
|
|
220
|
+
});
|
|
221
|
+
const slot = { worker, ready: false };
|
|
222
|
+
slot.timer = setTimeout(() => setImmediate(() => {
|
|
223
|
+
if (!slot.ready)
|
|
224
|
+
this.replace(slot);
|
|
225
|
+
}), plugin_action_limits_1.PLUGIN_ACTION_LIMITS.validationBootMs);
|
|
226
|
+
worker.on('message', (reply) => {
|
|
227
|
+
if (!this.slots.has(slot))
|
|
228
|
+
return;
|
|
229
|
+
clearTimeout(slot.timer);
|
|
230
|
+
if ('ready' in reply) {
|
|
231
|
+
slot.ready = true;
|
|
232
|
+
if (slot.job)
|
|
233
|
+
this.startBudget(slot);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if ('compiled' in reply) {
|
|
237
|
+
this.startBudget(slot, plugin_action_limits_1.PLUGIN_ACTION_LIMITS.validationBudgetMs);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const { job } = slot;
|
|
241
|
+
slot.job = undefined;
|
|
242
|
+
worker.unref();
|
|
243
|
+
job?.resolve(reply);
|
|
244
|
+
this.drain();
|
|
245
|
+
});
|
|
246
|
+
worker.on('error', error => this.replace(slot, error));
|
|
247
|
+
worker.on('exit', () => this.replace(slot));
|
|
248
|
+
worker.unref();
|
|
249
|
+
this.slots.add(slot);
|
|
250
|
+
return slot;
|
|
251
|
+
}
|
|
252
|
+
replace(slot, error) {
|
|
253
|
+
if (!this.slots.delete(slot))
|
|
254
|
+
return;
|
|
255
|
+
clearTimeout(slot.timer);
|
|
256
|
+
const { job } = slot;
|
|
257
|
+
slot.job = undefined;
|
|
258
|
+
if (slot.ready)
|
|
259
|
+
job?.resolve({ overBudget: true });
|
|
260
|
+
else
|
|
261
|
+
job?.reject(error ?? new Error('The input validation worker did not start'));
|
|
262
|
+
void slot.worker.terminate();
|
|
263
|
+
this.drain();
|
|
264
|
+
}
|
|
265
|
+
release(pluginVersionId) {
|
|
266
|
+
const pending = (this.pendingByVersion.get(pluginVersionId) ?? 1) - 1;
|
|
267
|
+
if (pending > 0)
|
|
268
|
+
this.pendingByVersion.set(pluginVersionId, pending);
|
|
269
|
+
else
|
|
270
|
+
this.pendingByVersion.delete(pluginVersionId);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
exports.ActionInputValidatorService = ActionInputValidatorService;
|
|
274
|
+
exports.ActionInputValidatorService = ActionInputValidatorService = ActionInputValidatorService_1 = __decorate([
|
|
275
|
+
(0, common_1.Injectable)()
|
|
276
|
+
], ActionInputValidatorService);
|
|
277
|
+
//# sourceMappingURL=action-input-validator.service.js.map
|
|
@@ -11,5 +11,8 @@ export declare class ExternalCredentialDefinitionSyncService {
|
|
|
11
11
|
private readonly registry;
|
|
12
12
|
constructor(github: GithubApiService, registry: CredentialExternalDefinitionRegistryService);
|
|
13
13
|
syncLocator(locator: string): Promise<ResolvedCredentialDefinition>;
|
|
14
|
+
private settleLocator;
|
|
14
15
|
resolveRequirements(requirements: readonly PluginCredentialRequirement[]): Promise<StoredCredentialRequirement[]>;
|
|
16
|
+
previewRequirements(requirements: readonly PluginCredentialRequirement[]): Promise<void>;
|
|
17
|
+
private settleRequirements;
|
|
15
18
|
}
|