@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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ACTION_INPUT_AJV = void 0;
|
|
4
|
+
exports.assertBoundedSchema = assertBoundedSchema;
|
|
5
|
+
const plugin_action_limits_1 = require("../constants/plugin-action-limits");
|
|
6
|
+
const DRAFT_2020_12 = 'https://json-schema.org/draft/2020-12/schema';
|
|
7
|
+
const REFUSED_KEYWORDS = ['pattern', 'patternProperties', 'format', 'uniqueItems'];
|
|
8
|
+
const UNSUPPORTED_KEYWORDS = ['$async', '$dynamicRef', '$recursiveRef'];
|
|
9
|
+
const SUBSCHEMA_KEYWORDS = [
|
|
10
|
+
'additionalProperties',
|
|
11
|
+
'contains',
|
|
12
|
+
'else',
|
|
13
|
+
'if',
|
|
14
|
+
'items',
|
|
15
|
+
'not',
|
|
16
|
+
'propertyNames',
|
|
17
|
+
'then',
|
|
18
|
+
'unevaluatedItems',
|
|
19
|
+
'unevaluatedProperties',
|
|
20
|
+
];
|
|
21
|
+
const SUBSCHEMA_LIST_KEYWORDS = ['allOf', 'anyOf', 'oneOf', 'prefixItems'];
|
|
22
|
+
const SUBSCHEMA_MAP_KEYWORDS = [
|
|
23
|
+
'dependencies',
|
|
24
|
+
'dependentSchemas',
|
|
25
|
+
'patternProperties',
|
|
26
|
+
'properties',
|
|
27
|
+
];
|
|
28
|
+
const PREVENT_SCOPE_CHANGE = new Set([
|
|
29
|
+
'properties',
|
|
30
|
+
'patternProperties',
|
|
31
|
+
'enum',
|
|
32
|
+
'dependencies',
|
|
33
|
+
'definitions',
|
|
34
|
+
]);
|
|
35
|
+
exports.ACTION_INPUT_AJV = {
|
|
36
|
+
options: { strict: true, allErrors: true, logger: false, inlineRefs: false, ownProperties: true },
|
|
37
|
+
metaSchema: DRAFT_2020_12,
|
|
38
|
+
refusedKeywords: REFUSED_KEYWORDS,
|
|
39
|
+
};
|
|
40
|
+
function isObject(value) {
|
|
41
|
+
return typeof value === 'object' && value !== null;
|
|
42
|
+
}
|
|
43
|
+
function resolveLocalRef(root, ref) {
|
|
44
|
+
if (!ref.startsWith('#')) {
|
|
45
|
+
throw new Error(`$ref "${ref}" is not local`);
|
|
46
|
+
}
|
|
47
|
+
if (ref.includes('#', 1)) {
|
|
48
|
+
throw new Error(`$ref "${ref}" has "#" after its first character`);
|
|
49
|
+
}
|
|
50
|
+
if (ref === '#')
|
|
51
|
+
return root;
|
|
52
|
+
const unresolved = new Error(`$ref "${ref}" does not resolve`);
|
|
53
|
+
if (!ref.startsWith('#/'))
|
|
54
|
+
throw unresolved;
|
|
55
|
+
let node = root;
|
|
56
|
+
for (const part of ref.slice(2).split('/')) {
|
|
57
|
+
let key;
|
|
58
|
+
try {
|
|
59
|
+
key = decodeURIComponent(part).replace(/~1/g, '/').replace(/~0/g, '~');
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
throw unresolved;
|
|
63
|
+
}
|
|
64
|
+
if (!isObject(node) || !Object.hasOwn(node, key))
|
|
65
|
+
throw unresolved;
|
|
66
|
+
node = node[key];
|
|
67
|
+
if (!PREVENT_SCOPE_CHANGE.has(part) && isObject(node) && Object.hasOwn(node, '$id')) {
|
|
68
|
+
throw new Error('$id is supported only at the root');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return node;
|
|
72
|
+
}
|
|
73
|
+
function countPayload(schema) {
|
|
74
|
+
let entries = Array.isArray(schema.enum) ? schema.enum.length : 0;
|
|
75
|
+
for (const keyword of ['dependentRequired', 'dependencies']) {
|
|
76
|
+
const map = schema[keyword];
|
|
77
|
+
if (!isObject(map))
|
|
78
|
+
continue;
|
|
79
|
+
for (const names of Object.values(map)) {
|
|
80
|
+
if (Array.isArray(names))
|
|
81
|
+
entries += names.length;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return entries;
|
|
85
|
+
}
|
|
86
|
+
function assertBoundedSchema(root) {
|
|
87
|
+
const limit = plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxInputSchemaNodes;
|
|
88
|
+
const expanding = new Set();
|
|
89
|
+
let nodes = 0;
|
|
90
|
+
const count = (cost) => {
|
|
91
|
+
nodes += cost;
|
|
92
|
+
if (nodes > limit) {
|
|
93
|
+
throw new Error(`exceeds ${limit} subschemas, enum entries and dependency names with every $ref inlined`);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const visit = (schema) => {
|
|
97
|
+
count(1);
|
|
98
|
+
if (!isObject(schema))
|
|
99
|
+
return;
|
|
100
|
+
count(countPayload(schema));
|
|
101
|
+
const unsupported = UNSUPPORTED_KEYWORDS.find(keyword => Object.hasOwn(schema, keyword));
|
|
102
|
+
if (unsupported)
|
|
103
|
+
throw new Error(`unsupported keyword: "${unsupported}"`);
|
|
104
|
+
if (schema !== root && Object.hasOwn(schema, '$id')) {
|
|
105
|
+
throw new Error('$id is supported only at the root');
|
|
106
|
+
}
|
|
107
|
+
expanding.add(schema);
|
|
108
|
+
if (typeof schema.$ref === 'string') {
|
|
109
|
+
const target = resolveLocalRef(root, schema.$ref);
|
|
110
|
+
if (isObject(target) && expanding.has(target)) {
|
|
111
|
+
throw new Error(`$ref "${schema.$ref}" is recursive`);
|
|
112
|
+
}
|
|
113
|
+
visit(target);
|
|
114
|
+
}
|
|
115
|
+
for (const keyword of SUBSCHEMA_KEYWORDS) {
|
|
116
|
+
if (Object.hasOwn(schema, keyword))
|
|
117
|
+
visit(schema[keyword]);
|
|
118
|
+
}
|
|
119
|
+
for (const keyword of SUBSCHEMA_LIST_KEYWORDS) {
|
|
120
|
+
const list = schema[keyword];
|
|
121
|
+
if (Array.isArray(list))
|
|
122
|
+
list.forEach(visit);
|
|
123
|
+
}
|
|
124
|
+
for (const keyword of SUBSCHEMA_MAP_KEYWORDS) {
|
|
125
|
+
const map = schema[keyword];
|
|
126
|
+
if (isObject(map))
|
|
127
|
+
Object.values(map).forEach(visit);
|
|
128
|
+
}
|
|
129
|
+
expanding.delete(schema);
|
|
130
|
+
};
|
|
131
|
+
visit(root);
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=action-input-schema.util.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NormalizedCredentialRequirement } from '../../data-marts/credentials/credential.types';
|
|
2
|
+
import type { PluginCredentialHandleDto } from '../dto/domain/plugin-installation.dto';
|
|
3
|
+
export declare function toCredentialHandles(ready: readonly NormalizedCredentialRequirement[]): PluginCredentialHandleDto[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toCredentialHandles = toCredentialHandles;
|
|
4
|
+
function toCredentialHandles(ready) {
|
|
5
|
+
return ready.map(requirement => requirement.definitionId === null
|
|
6
|
+
? {
|
|
7
|
+
name: requirement.key,
|
|
8
|
+
kind: 'ai',
|
|
9
|
+
models: requirement.models,
|
|
10
|
+
}
|
|
11
|
+
: { name: requirement.key, kind: 'exact' });
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=credential-handles.util.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createExecutionToken = createExecutionToken;
|
|
4
|
+
exports.hashExecutionToken = hashExecutionToken;
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
function createExecutionToken() {
|
|
7
|
+
const token = (0, node_crypto_1.randomBytes)(32).toString('base64url');
|
|
8
|
+
return { token, tokenHash: hashExecutionToken(token) };
|
|
9
|
+
}
|
|
10
|
+
function hashExecutionToken(token) {
|
|
11
|
+
return (0, node_crypto_1.createHash)('sha256').update(token).digest('hex');
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=execution-token.util.js.map
|
|
@@ -6,7 +6,7 @@ const GITHUB_HOSTS = new Set(['github.com', 'www.github.com']);
|
|
|
6
6
|
const SEGMENT = /^[A-Za-z0-9._-]+$/;
|
|
7
7
|
const SCP_SYNTAX = /^git@([^:]+):(.+)$/;
|
|
8
8
|
function parseGithubRepoLocator(locator) {
|
|
9
|
-
const trimmed = locator
|
|
9
|
+
const trimmed = typeof locator === 'string' ? locator.trim() : '';
|
|
10
10
|
if (!trimmed) {
|
|
11
11
|
throw new plugin_host_errors_1.InvalidRepoLocatorError(locator);
|
|
12
12
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function findJsonShapeProblem(value: unknown): string | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findJsonShapeProblem = findJsonShapeProblem;
|
|
4
|
+
const plugin_action_limits_1 = require("../constants/plugin-action-limits");
|
|
5
|
+
function findJsonShapeProblem(value) {
|
|
6
|
+
const maxDepth = plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxJsonDepth;
|
|
7
|
+
const visit = (node, depth) => {
|
|
8
|
+
if (typeof node !== 'object' || node === null)
|
|
9
|
+
return null;
|
|
10
|
+
if (depth > maxDepth)
|
|
11
|
+
return `is nested deeper than ${maxDepth} levels`;
|
|
12
|
+
for (const child of Object.values(node)) {
|
|
13
|
+
const problem = visit(child, depth + 1);
|
|
14
|
+
if (problem)
|
|
15
|
+
return problem;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
};
|
|
19
|
+
return visit(value, 1);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=json-shape.util.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PluginActionExecutionStatus } from '../enums/plugin-action-execution-status.enum';
|
|
2
|
+
export type PluginActionOutcome = {
|
|
3
|
+
status: PluginActionExecutionStatus.SUCCEEDED;
|
|
4
|
+
result: unknown;
|
|
5
|
+
} | {
|
|
6
|
+
status: PluginActionExecutionStatus.FAILED;
|
|
7
|
+
errorCode: string;
|
|
8
|
+
errorMessage: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function classifyBackendResponse(status: number, body: string | null): PluginActionOutcome;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.classifyBackendResponse = classifyBackendResponse;
|
|
4
|
+
const plugin_action_limits_1 = require("../constants/plugin-action-limits");
|
|
5
|
+
const plugin_action_execution_status_enum_1 = require("../enums/plugin-action-execution-status.enum");
|
|
6
|
+
const json_shape_util_1 = require("./json-shape.util");
|
|
7
|
+
function classifyBackendResponse(status, body) {
|
|
8
|
+
try {
|
|
9
|
+
return classify(status, body);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return invalid('The backend answer could not be read');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function classify(status, body) {
|
|
16
|
+
if (body === null) {
|
|
17
|
+
return invalid('The backend answer is larger than allowed');
|
|
18
|
+
}
|
|
19
|
+
if (status >= 300 && status < 400) {
|
|
20
|
+
return invalid(`The backend answered ${status}`);
|
|
21
|
+
}
|
|
22
|
+
const parsed = parseJson(body);
|
|
23
|
+
if (status === 200) {
|
|
24
|
+
if (!isRecord(parsed) || !Object.hasOwn(parsed, 'result')) {
|
|
25
|
+
return invalid('The backend answered 200 without a result');
|
|
26
|
+
}
|
|
27
|
+
const problem = (0, json_shape_util_1.findJsonShapeProblem)(parsed.result);
|
|
28
|
+
if (problem) {
|
|
29
|
+
return invalid(`The result ${problem}`);
|
|
30
|
+
}
|
|
31
|
+
if (Buffer.byteLength(JSON.stringify(parsed.result)) > plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxResultBytes) {
|
|
32
|
+
return invalid('The result is larger than 1 MiB');
|
|
33
|
+
}
|
|
34
|
+
return { status: plugin_action_execution_status_enum_1.PluginActionExecutionStatus.SUCCEEDED, result: parsed.result };
|
|
35
|
+
}
|
|
36
|
+
if (status < 300) {
|
|
37
|
+
return invalid(`The backend answered ${status}`);
|
|
38
|
+
}
|
|
39
|
+
const error = isRecord(parsed) ? parsed.error : undefined;
|
|
40
|
+
if (isRecord(error) && (0, plugin_action_limits_1.isPluginOwnedErrorCode)(error.code)) {
|
|
41
|
+
return {
|
|
42
|
+
status: plugin_action_execution_status_enum_1.PluginActionExecutionStatus.FAILED,
|
|
43
|
+
errorCode: error.code,
|
|
44
|
+
errorMessage: String(error.message ?? '').slice(0, plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxErrorMessageChars),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return invalid(`The backend answered ${status} without a usable error code`);
|
|
48
|
+
}
|
|
49
|
+
function invalid(errorMessage) {
|
|
50
|
+
return {
|
|
51
|
+
status: plugin_action_execution_status_enum_1.PluginActionExecutionStatus.FAILED,
|
|
52
|
+
errorCode: 'BACKEND_INVALID_RESPONSE',
|
|
53
|
+
errorMessage,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function parseJson(body) {
|
|
57
|
+
try {
|
|
58
|
+
return JSON.parse(body);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function isRecord(value) {
|
|
65
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=plugin-action-outcome.util.js.map
|
|
@@ -69,16 +69,59 @@ export declare const PluginCredentialRequirementSchema: z.ZodUnion<[z.ZodString,
|
|
|
69
69
|
id: z.ZodString;
|
|
70
70
|
optional: z.ZodDefault<z.ZodBoolean>;
|
|
71
71
|
models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
72
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
72
73
|
}, "strip", z.ZodTypeAny, {
|
|
73
74
|
id: string;
|
|
74
75
|
optional: boolean;
|
|
76
|
+
scopes?: string[] | undefined;
|
|
75
77
|
models?: string[] | undefined;
|
|
76
78
|
}, {
|
|
77
79
|
id: string;
|
|
80
|
+
scopes?: string[] | undefined;
|
|
78
81
|
models?: string[] | undefined;
|
|
79
82
|
optional?: boolean | undefined;
|
|
80
83
|
}>]>;
|
|
81
84
|
export type PluginCredentialRequirement = z.infer<typeof PluginCredentialRequirementSchema>;
|
|
85
|
+
export declare const PLUGIN_ACTION_NAME_PATTERN: RegExp;
|
|
86
|
+
export declare const PluginBackendSchema: z.ZodObject<{
|
|
87
|
+
url: z.ZodString;
|
|
88
|
+
actions: z.ZodEffects<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
89
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
90
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
timeoutSeconds: number;
|
|
93
|
+
input?: Record<string, unknown> | undefined;
|
|
94
|
+
}, {
|
|
95
|
+
input?: Record<string, unknown> | undefined;
|
|
96
|
+
timeoutSeconds?: number | undefined;
|
|
97
|
+
}>>, Record<string, {
|
|
98
|
+
timeoutSeconds: number;
|
|
99
|
+
input?: Record<string, unknown> | undefined;
|
|
100
|
+
}>, Record<string, {
|
|
101
|
+
input?: Record<string, unknown> | undefined;
|
|
102
|
+
timeoutSeconds?: number | undefined;
|
|
103
|
+
}>>, Record<string, {
|
|
104
|
+
timeoutSeconds: number;
|
|
105
|
+
input?: Record<string, unknown> | undefined;
|
|
106
|
+
}>, Record<string, {
|
|
107
|
+
input?: Record<string, unknown> | undefined;
|
|
108
|
+
timeoutSeconds?: number | undefined;
|
|
109
|
+
}>>;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
url: string;
|
|
112
|
+
actions: Record<string, {
|
|
113
|
+
timeoutSeconds: number;
|
|
114
|
+
input?: Record<string, unknown> | undefined;
|
|
115
|
+
}>;
|
|
116
|
+
}, {
|
|
117
|
+
url: string;
|
|
118
|
+
actions: Record<string, {
|
|
119
|
+
input?: Record<string, unknown> | undefined;
|
|
120
|
+
timeoutSeconds?: number | undefined;
|
|
121
|
+
}>;
|
|
122
|
+
}>;
|
|
123
|
+
export type PluginBackendDeclaration = z.infer<typeof PluginBackendSchema>;
|
|
124
|
+
export type PluginBackendActionDeclaration = PluginBackendDeclaration['actions'][string];
|
|
82
125
|
export type PluginCollectionDeclaration = z.infer<typeof PluginCollectionDeclarationSchema>;
|
|
83
126
|
export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
84
127
|
name: z.ZodString;
|
|
@@ -160,21 +203,62 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
160
203
|
id: z.ZodString;
|
|
161
204
|
optional: z.ZodDefault<z.ZodBoolean>;
|
|
162
205
|
models: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
206
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
163
207
|
}, "strip", z.ZodTypeAny, {
|
|
164
208
|
id: string;
|
|
165
209
|
optional: boolean;
|
|
210
|
+
scopes?: string[] | undefined;
|
|
166
211
|
models?: string[] | undefined;
|
|
167
212
|
}, {
|
|
168
213
|
id: string;
|
|
214
|
+
scopes?: string[] | undefined;
|
|
169
215
|
models?: string[] | undefined;
|
|
170
216
|
optional?: boolean | undefined;
|
|
171
217
|
}>]>, "many">>;
|
|
218
|
+
backend: z.ZodOptional<z.ZodObject<{
|
|
219
|
+
url: z.ZodString;
|
|
220
|
+
actions: z.ZodEffects<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
221
|
+
timeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
222
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
223
|
+
}, "strip", z.ZodTypeAny, {
|
|
224
|
+
timeoutSeconds: number;
|
|
225
|
+
input?: Record<string, unknown> | undefined;
|
|
226
|
+
}, {
|
|
227
|
+
input?: Record<string, unknown> | undefined;
|
|
228
|
+
timeoutSeconds?: number | undefined;
|
|
229
|
+
}>>, Record<string, {
|
|
230
|
+
timeoutSeconds: number;
|
|
231
|
+
input?: Record<string, unknown> | undefined;
|
|
232
|
+
}>, Record<string, {
|
|
233
|
+
input?: Record<string, unknown> | undefined;
|
|
234
|
+
timeoutSeconds?: number | undefined;
|
|
235
|
+
}>>, Record<string, {
|
|
236
|
+
timeoutSeconds: number;
|
|
237
|
+
input?: Record<string, unknown> | undefined;
|
|
238
|
+
}>, Record<string, {
|
|
239
|
+
input?: Record<string, unknown> | undefined;
|
|
240
|
+
timeoutSeconds?: number | undefined;
|
|
241
|
+
}>>;
|
|
242
|
+
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
url: string;
|
|
244
|
+
actions: Record<string, {
|
|
245
|
+
timeoutSeconds: number;
|
|
246
|
+
input?: Record<string, unknown> | undefined;
|
|
247
|
+
}>;
|
|
248
|
+
}, {
|
|
249
|
+
url: string;
|
|
250
|
+
actions: Record<string, {
|
|
251
|
+
input?: Record<string, unknown> | undefined;
|
|
252
|
+
timeoutSeconds?: number | undefined;
|
|
253
|
+
}>;
|
|
254
|
+
}>>;
|
|
172
255
|
}, "strip", z.ZodTypeAny, {
|
|
173
256
|
name: string;
|
|
174
257
|
description: string;
|
|
175
258
|
credentials: (string | {
|
|
176
259
|
id: string;
|
|
177
260
|
optional: boolean;
|
|
261
|
+
scopes?: string[] | undefined;
|
|
178
262
|
models?: string[] | undefined;
|
|
179
263
|
})[];
|
|
180
264
|
delivery: {
|
|
@@ -194,6 +278,13 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
194
278
|
};
|
|
195
279
|
} | undefined;
|
|
196
280
|
}[];
|
|
281
|
+
backend?: {
|
|
282
|
+
url: string;
|
|
283
|
+
actions: Record<string, {
|
|
284
|
+
timeoutSeconds: number;
|
|
285
|
+
input?: Record<string, unknown> | undefined;
|
|
286
|
+
}>;
|
|
287
|
+
} | undefined;
|
|
197
288
|
}, {
|
|
198
289
|
name: string;
|
|
199
290
|
description: string;
|
|
@@ -203,6 +294,7 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
203
294
|
};
|
|
204
295
|
credentials?: (string | {
|
|
205
296
|
id: string;
|
|
297
|
+
scopes?: string[] | undefined;
|
|
206
298
|
models?: string[] | undefined;
|
|
207
299
|
optional?: boolean | undefined;
|
|
208
300
|
})[] | undefined;
|
|
@@ -219,12 +311,20 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
219
311
|
};
|
|
220
312
|
} | undefined;
|
|
221
313
|
}[] | undefined;
|
|
314
|
+
backend?: {
|
|
315
|
+
url: string;
|
|
316
|
+
actions: Record<string, {
|
|
317
|
+
input?: Record<string, unknown> | undefined;
|
|
318
|
+
timeoutSeconds?: number | undefined;
|
|
319
|
+
}>;
|
|
320
|
+
} | undefined;
|
|
222
321
|
}>, {
|
|
223
322
|
name: string;
|
|
224
323
|
description: string;
|
|
225
324
|
credentials: (string | {
|
|
226
325
|
id: string;
|
|
227
326
|
optional: boolean;
|
|
327
|
+
scopes?: string[] | undefined;
|
|
228
328
|
models?: string[] | undefined;
|
|
229
329
|
})[];
|
|
230
330
|
delivery: {
|
|
@@ -244,6 +344,13 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
244
344
|
};
|
|
245
345
|
} | undefined;
|
|
246
346
|
}[];
|
|
347
|
+
backend?: {
|
|
348
|
+
url: string;
|
|
349
|
+
actions: Record<string, {
|
|
350
|
+
timeoutSeconds: number;
|
|
351
|
+
input?: Record<string, unknown> | undefined;
|
|
352
|
+
}>;
|
|
353
|
+
} | undefined;
|
|
247
354
|
}, {
|
|
248
355
|
name: string;
|
|
249
356
|
description: string;
|
|
@@ -253,6 +360,7 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
253
360
|
};
|
|
254
361
|
credentials?: (string | {
|
|
255
362
|
id: string;
|
|
363
|
+
scopes?: string[] | undefined;
|
|
256
364
|
models?: string[] | undefined;
|
|
257
365
|
optional?: boolean | undefined;
|
|
258
366
|
})[] | undefined;
|
|
@@ -269,6 +377,13 @@ export declare const PluginManifestSchema: z.ZodEffects<z.ZodObject<{
|
|
|
269
377
|
};
|
|
270
378
|
} | undefined;
|
|
271
379
|
}[] | undefined;
|
|
380
|
+
backend?: {
|
|
381
|
+
url: string;
|
|
382
|
+
actions: Record<string, {
|
|
383
|
+
input?: Record<string, unknown> | undefined;
|
|
384
|
+
timeoutSeconds?: number | undefined;
|
|
385
|
+
}>;
|
|
386
|
+
} | undefined;
|
|
272
387
|
}>;
|
|
273
388
|
export type PluginManifest = z.infer<typeof PluginManifestSchema>;
|
|
274
389
|
export type ManifestParseResult = {
|
|
@@ -279,6 +394,12 @@ export type ManifestParseResult = {
|
|
|
279
394
|
readonly code: ReleaseRejectionCode;
|
|
280
395
|
readonly detail: string;
|
|
281
396
|
};
|
|
397
|
+
export declare function listActionInputSchemas(backend: PluginBackendDeclaration | null | undefined): {
|
|
398
|
+
readonly path: string;
|
|
399
|
+
readonly schema: Record<string, unknown>;
|
|
400
|
+
}[];
|
|
282
401
|
export declare function parsePluginManifest(rawFileContent: string | null): ManifestParseResult;
|
|
283
402
|
export declare function findIncompatibleCollectionChange(current: readonly PluginCollectionDeclaration[], candidate: readonly PluginCollectionDeclaration[]): string | null;
|
|
403
|
+
export declare function resolveBackendUrl(backend: PluginBackendDeclaration, deliveryUrl: string): string;
|
|
404
|
+
export declare function findIncompatibleActionChange(current: PluginBackendDeclaration | null | undefined, candidate: PluginBackendDeclaration | null | undefined): string | null;
|
|
284
405
|
export {};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PluginManifestSchema = exports.PluginCredentialRequirementSchema = exports.PluginCollectionActionSchema = exports.PluginCollectionEntityTypeSchema = void 0;
|
|
3
|
+
exports.PluginManifestSchema = exports.PluginBackendSchema = exports.PLUGIN_ACTION_NAME_PATTERN = exports.PluginCredentialRequirementSchema = exports.PluginCollectionActionSchema = exports.PluginCollectionEntityTypeSchema = void 0;
|
|
4
|
+
exports.listActionInputSchemas = listActionInputSchemas;
|
|
4
5
|
exports.parsePluginManifest = parsePluginManifest;
|
|
5
6
|
exports.findIncompatibleCollectionChange = findIncompatibleCollectionChange;
|
|
7
|
+
exports.resolveBackendUrl = resolveBackendUrl;
|
|
8
|
+
exports.findIncompatibleActionChange = findIncompatibleActionChange;
|
|
9
|
+
const internal_helpers_1 = require("@owox/internal-helpers");
|
|
6
10
|
const zod_1 = require("zod");
|
|
7
11
|
const builtin_credential_definitions_1 = require("../../data-marts/credentials/services/builtin-credential-definitions");
|
|
12
|
+
const plugin_action_limits_1 = require("../constants/plugin-action-limits");
|
|
8
13
|
const release_rejection_code_enum_1 = require("../enums/release-rejection-code.enum");
|
|
14
|
+
const action_input_schema_util_1 = require("./action-input-schema.util");
|
|
9
15
|
exports.PluginCollectionEntityTypeSchema = zod_1.z.enum([
|
|
10
16
|
'data-mart',
|
|
11
17
|
'storage',
|
|
@@ -49,8 +55,22 @@ exports.PluginCredentialRequirementSchema = zod_1.z.union([
|
|
|
49
55
|
id: zod_1.z.string().trim().min(1).max(255),
|
|
50
56
|
optional: zod_1.z.boolean().default(false),
|
|
51
57
|
models: zod_1.z.array(zod_1.z.string().trim().min(1).max(255)).max(20).optional(),
|
|
58
|
+
scopes: zod_1.z.array(zod_1.z.string().min(1).max(200).regex(/^\S+$/)).min(1).max(20).optional(),
|
|
52
59
|
}),
|
|
53
60
|
]);
|
|
61
|
+
exports.PLUGIN_ACTION_NAME_PATTERN = /^[a-z][a-z0-9-]{0,63}$/;
|
|
62
|
+
exports.PluginBackendSchema = zod_1.z.object({
|
|
63
|
+
url: zod_1.z.string().min(1).max(2048),
|
|
64
|
+
actions: zod_1.z
|
|
65
|
+
.record(zod_1.z
|
|
66
|
+
.string()
|
|
67
|
+
.regex(exports.PLUGIN_ACTION_NAME_PATTERN, 'action names are lower-case letters, digits and hyphens, start with a letter, and have at most 64 characters'), zod_1.z.object({
|
|
68
|
+
timeoutSeconds: zod_1.z.number().int().min(1).max(300).default(30),
|
|
69
|
+
input: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
70
|
+
}))
|
|
71
|
+
.refine(actions => Object.keys(actions).length >= 1, 'declare at least one action')
|
|
72
|
+
.refine(actions => Object.keys(actions).length <= plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxActions, `at most ${plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxActions} actions`),
|
|
73
|
+
});
|
|
54
74
|
const ENTITY_ACTIONS = {
|
|
55
75
|
'data-mart': new Set([
|
|
56
76
|
'SEE',
|
|
@@ -91,6 +111,7 @@ exports.PluginManifestSchema = zod_1.z
|
|
|
91
111
|
}),
|
|
92
112
|
collections: zod_1.z.array(PluginCollectionDeclarationSchema).max(50).default([]),
|
|
93
113
|
credentials: zod_1.z.array(exports.PluginCredentialRequirementSchema).max(50).default([]),
|
|
114
|
+
backend: exports.PluginBackendSchema.optional(),
|
|
94
115
|
})
|
|
95
116
|
.superRefine((manifest, context) => {
|
|
96
117
|
const names = new Set();
|
|
@@ -164,11 +185,84 @@ exports.PluginManifestSchema = zod_1.z
|
|
|
164
185
|
message: 'models are supported only for the logical ai requirement',
|
|
165
186
|
});
|
|
166
187
|
}
|
|
188
|
+
const scopes = typeof requirement === 'string' ? undefined : requirement.scopes;
|
|
189
|
+
if (key === 'google-service-account' && !scopes) {
|
|
190
|
+
context.addIssue({
|
|
191
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
192
|
+
path: ['credentials', index],
|
|
193
|
+
message: 'google-service-account requires scopes',
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
if (key !== 'google-service-account' && scopes) {
|
|
197
|
+
context.addIssue({
|
|
198
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
199
|
+
path: ['credentials', index, 'scopes'],
|
|
200
|
+
message: 'scopes are supported only for google-service-account',
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
if (scopes && new Set(scopes).size !== scopes.length) {
|
|
204
|
+
context.addIssue({
|
|
205
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
206
|
+
path: ['credentials', index, 'scopes'],
|
|
207
|
+
message: 'scopes must be unique',
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (manifest.backend) {
|
|
212
|
+
const problem = findBackendUrlProblem(manifest.backend.url, manifest.delivery.url);
|
|
213
|
+
if (problem) {
|
|
214
|
+
context.addIssue({
|
|
215
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
216
|
+
path: ['backend', 'url'],
|
|
217
|
+
message: problem,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
167
220
|
}
|
|
168
221
|
});
|
|
169
222
|
function isRecord(value) {
|
|
170
223
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
171
224
|
}
|
|
225
|
+
function parseUrl(value, base) {
|
|
226
|
+
try {
|
|
227
|
+
return new URL(value, base);
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function findBackendUrlProblem(url, deliveryUrl) {
|
|
234
|
+
const absolute = /^[a-z][a-z0-9+.-]*:/i.test(url);
|
|
235
|
+
if (absolute && !(url.startsWith('https://') && parseUrl(url))) {
|
|
236
|
+
return 'an absolute URL must use https';
|
|
237
|
+
}
|
|
238
|
+
const delivery = parseUrl(deliveryUrl);
|
|
239
|
+
if (!delivery)
|
|
240
|
+
return null;
|
|
241
|
+
const resolved = parseUrl(url, deliveryUrl);
|
|
242
|
+
if (!absolute && resolved?.origin !== delivery.origin) {
|
|
243
|
+
return 'a relative URL must stay on the delivery.url origin';
|
|
244
|
+
}
|
|
245
|
+
return resolved?.username || resolved?.password
|
|
246
|
+
? 'the URL must not contain a user name or password'
|
|
247
|
+
: null;
|
|
248
|
+
}
|
|
249
|
+
function listActionInputSchemas(backend) {
|
|
250
|
+
return Object.entries(backend?.actions ?? {}).flatMap(([name, action]) => action.input ? [{ path: `backend.actions.${name}.input`, schema: action.input }] : []);
|
|
251
|
+
}
|
|
252
|
+
function findUnsupportedActionInput(backend) {
|
|
253
|
+
for (const { path, schema } of listActionInputSchemas(backend)) {
|
|
254
|
+
try {
|
|
255
|
+
if (Buffer.byteLength(JSON.stringify(schema)) > plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxInputSchemaBytes) {
|
|
256
|
+
return `${path}: exceeds ${plugin_action_limits_1.PLUGIN_ACTION_LIMITS.maxInputSchemaBytes / 1024} KiB`;
|
|
257
|
+
}
|
|
258
|
+
(0, action_input_schema_util_1.assertBoundedSchema)(schema);
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
return `${path}: ${(0, internal_helpers_1.castError)(error).message}`;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
172
266
|
function parsePluginManifest(rawFileContent) {
|
|
173
267
|
if (rawFileContent === null) {
|
|
174
268
|
return {
|
|
@@ -213,6 +307,14 @@ function parsePluginManifest(rawFileContent) {
|
|
|
213
307
|
.join('; '),
|
|
214
308
|
};
|
|
215
309
|
}
|
|
310
|
+
const unsupportedInput = findUnsupportedActionInput(result.data.backend);
|
|
311
|
+
if (unsupportedInput) {
|
|
312
|
+
return {
|
|
313
|
+
ok: false,
|
|
314
|
+
code: release_rejection_code_enum_1.ReleaseRejectionCode.ACTION_INPUT_UNSUPPORTED,
|
|
315
|
+
detail: unsupportedInput,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
216
318
|
return { ok: true, manifest: result.data };
|
|
217
319
|
}
|
|
218
320
|
function findIncompatibleCollectionChange(current, candidate) {
|
|
@@ -233,4 +335,12 @@ function findIncompatibleCollectionChange(current, candidate) {
|
|
|
233
335
|
}
|
|
234
336
|
return null;
|
|
235
337
|
}
|
|
338
|
+
function resolveBackendUrl(backend, deliveryUrl) {
|
|
339
|
+
return new URL(backend.url, deliveryUrl).toString();
|
|
340
|
+
}
|
|
341
|
+
function findIncompatibleActionChange(current, candidate) {
|
|
342
|
+
const next = candidate?.actions ?? {};
|
|
343
|
+
const removed = Object.keys(current?.actions ?? {}).find(name => !Object.hasOwn(next, name));
|
|
344
|
+
return removed === undefined ? null : `Action "${removed}" cannot be removed`;
|
|
345
|
+
}
|
|
236
346
|
//# sourceMappingURL=plugin-manifest.util.js.map
|