@wildo-ai/wildo-cli 1.1.13 → 1.1.14
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/commands/build/approve.command.d.ts +4 -0
- package/dist/src/commands/build/approve.command.d.ts.map +1 -1
- package/dist/src/commands/build/approve.command.js +14 -3
- package/dist/src/commands/build/approve.command.js.map +1 -1
- package/dist/src/commands/build/close.command.d.ts +4 -0
- package/dist/src/commands/build/close.command.d.ts.map +1 -1
- package/dist/src/commands/build/close.command.js +17 -3
- package/dist/src/commands/build/close.command.js.map +1 -1
- package/dist/src/commands/config/sync.command.d.ts.map +1 -1
- package/dist/src/commands/config/sync.command.js +21 -1
- package/dist/src/commands/config/sync.command.js.map +1 -1
- package/dist/src/commands/creation/feed.command.d.ts.map +1 -1
- package/dist/src/commands/creation/feed.command.js +6 -3
- package/dist/src/commands/creation/feed.command.js.map +1 -1
- package/dist/src/commands/fwk/publish-all.command.d.ts +13 -0
- package/dist/src/commands/fwk/publish-all.command.d.ts.map +1 -1
- package/dist/src/commands/fwk/publish-all.command.js +57 -3
- package/dist/src/commands/fwk/publish-all.command.js.map +1 -1
- package/dist/src/commands/fwk/publish-docker.command.d.ts.map +1 -1
- package/dist/src/commands/fwk/publish-docker.command.js +16 -1
- package/dist/src/commands/fwk/publish-docker.command.js.map +1 -1
- package/dist/src/commands/fwk/registry-host.command.d.ts +19 -1
- package/dist/src/commands/fwk/registry-host.command.d.ts.map +1 -1
- package/dist/src/commands/fwk/registry-host.command.js +78 -3
- package/dist/src/commands/fwk/registry-host.command.js.map +1 -1
- package/dist/src/commands/init.command.d.ts +14 -0
- package/dist/src/commands/init.command.d.ts.map +1 -1
- package/dist/src/commands/init.command.js +29 -3
- package/dist/src/commands/init.command.js.map +1 -1
- package/dist/src/commands/registry/repair-lockfile.command.d.ts.map +1 -1
- package/dist/src/commands/registry/repair-lockfile.command.js +1 -0
- package/dist/src/commands/registry/repair-lockfile.command.js.map +1 -1
- package/dist/src/commands/registry/update.command.d.ts.map +1 -1
- package/dist/src/commands/registry/update.command.js +1 -0
- package/dist/src/commands/registry/update.command.js.map +1 -1
- package/dist/src/commands/seal/verify.command.d.ts +18 -0
- package/dist/src/commands/seal/verify.command.d.ts.map +1 -1
- package/dist/src/commands/seal/verify.command.js +62 -1
- package/dist/src/commands/seal/verify.command.js.map +1 -1
- package/dist/src/services/application/provider-runtime-sync.service.d.ts.map +1 -1
- package/dist/src/services/application/provider-runtime-sync.service.js +26 -1
- package/dist/src/services/application/provider-runtime-sync.service.js.map +1 -1
- package/dist/src/services/application/saas-skeleton.service.d.ts.map +1 -1
- package/dist/src/services/application/saas-skeleton.service.js +24 -2
- package/dist/src/services/application/saas-skeleton.service.js.map +1 -1
- package/dist/src/services/companion/build-console.service.d.ts +39 -2
- package/dist/src/services/companion/build-console.service.d.ts.map +1 -1
- package/dist/src/services/companion/build-console.service.js +54 -4
- package/dist/src/services/companion/build-console.service.js.map +1 -1
- package/dist/src/services/companion/creation-console.service.d.ts +6 -1
- package/dist/src/services/companion/creation-console.service.d.ts.map +1 -1
- package/dist/src/services/companion/creation-console.service.js +14 -2
- package/dist/src/services/companion/creation-console.service.js.map +1 -1
- package/dist/src/services/companion/creation-drive.service.d.ts.map +1 -1
- package/dist/src/services/companion/creation-drive.service.js +5 -2
- package/dist/src/services/companion/creation-drive.service.js.map +1 -1
- package/dist/src/services/credentials/composed-provider-catalogue.d.ts.map +1 -1
- package/dist/src/services/credentials/composed-provider-catalogue.js +14 -2
- package/dist/src/services/credentials/composed-provider-catalogue.js.map +1 -1
- package/dist/src/services/credentials/secret-requirements.service.d.ts +2 -1
- package/dist/src/services/credentials/secret-requirements.service.d.ts.map +1 -1
- package/dist/src/services/credentials/secret-requirements.service.js +17 -1
- package/dist/src/services/credentials/secret-requirements.service.js.map +1 -1
- package/dist/src/services/deployment/application-runtime-environment.d.ts.map +1 -1
- package/dist/src/services/deployment/application-runtime-environment.js +3 -13
- package/dist/src/services/deployment/application-runtime-environment.js.map +1 -1
- package/dist/src/services/deployment/docker/docker-compose-generator.service.d.ts.map +1 -1
- package/dist/src/services/deployment/docker/docker-compose-generator.service.js +8 -2
- package/dist/src/services/deployment/docker/docker-compose-generator.service.js.map +1 -1
- package/dist/src/services/deployment/host-toolchain-readiness.service.d.ts +1 -1
- package/dist/src/services/deployment/host-toolchain-readiness.service.js +1 -1
- package/dist/src/services/deployment/host-toolchain-readiness.service.js.map +1 -1
- package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.d.ts.map +1 -1
- package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.js +3 -1
- package/dist/src/services/deployment/k8s/k8s-manifest-generator.service.js.map +1 -1
- package/dist/src/services/deployment/local-precondition-checks.service.d.ts.map +1 -1
- package/dist/src/services/deployment/local-precondition-checks.service.js +4 -2
- package/dist/src/services/deployment/local-precondition-checks.service.js.map +1 -1
- package/dist/src/services/environment/env-configuration-generator.service.d.ts.map +1 -1
- package/dist/src/services/environment/env-configuration-generator.service.js +8 -3
- package/dist/src/services/environment/env-configuration-generator.service.js.map +1 -1
- package/dist/src/services/environment/environment-service-profile.utils.d.ts +8 -1
- package/dist/src/services/environment/environment-service-profile.utils.d.ts.map +1 -1
- package/dist/src/services/environment/environment-service-profile.utils.js +14 -1
- package/dist/src/services/environment/environment-service-profile.utils.js.map +1 -1
- package/dist/src/services/framework/framework-docker-publish.service.d.ts +89 -0
- package/dist/src/services/framework/framework-docker-publish.service.d.ts.map +1 -1
- package/dist/src/services/framework/framework-docker-publish.service.js +180 -18
- package/dist/src/services/framework/framework-docker-publish.service.js.map +1 -1
- package/dist/src/services/framework/github-actions-annotation.d.ts +19 -0
- package/dist/src/services/framework/github-actions-annotation.d.ts.map +1 -0
- package/dist/src/services/framework/github-actions-annotation.js +25 -0
- package/dist/src/services/framework/github-actions-annotation.js.map +1 -0
- package/dist/src/services/framework/registry-host/registry-host-upgrade.d.ts +43 -0
- package/dist/src/services/framework/registry-host/registry-host-upgrade.d.ts.map +1 -0
- package/dist/src/services/framework/registry-host/registry-host-upgrade.js +117 -0
- package/dist/src/services/framework/registry-host/registry-host-upgrade.js.map +1 -0
- package/dist/src/services/framework/registry-host/registry-host.service.d.ts +1 -1
- package/dist/src/services/framework/registry-host/registry-host.service.d.ts.map +1 -1
- package/dist/src/services/framework/registry-host/registry-host.service.js +2 -0
- package/dist/src/services/framework/registry-host/registry-host.service.js.map +1 -1
- package/dist/src/services/registry/installed-file-state.utils.d.ts +8 -0
- package/dist/src/services/registry/installed-file-state.utils.d.ts.map +1 -1
- package/dist/src/services/registry/installed-file-state.utils.js +9 -1
- package/dist/src/services/registry/installed-file-state.utils.js.map +1 -1
- package/dist/src/services/registry/module-install.service.d.ts.map +1 -1
- package/dist/src/services/registry/module-install.service.js +1 -0
- package/dist/src/services/registry/module-install.service.js.map +1 -1
- package/dist/src/services/registry/provider-module-scaffold.service.d.ts.map +1 -1
- package/dist/src/services/registry/provider-module-scaffold.service.js +4 -0
- package/dist/src/services/registry/provider-module-scaffold.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/framework-root-package.json +3 -3
- package/package.json +22 -22
- package/scripts/app-dependency-alignment/propagated-engine-overrides.json +1 -1
- package/templates/infra/docker-compose/docker-compose.wildo-platform.yml.hbs +17 -2
- package/templates/infra/registry-host/docker-compose.yml +9 -2
- package/templates/infra/registry-host/upgrade-image.sh +108 -0
- package/templates/saas/i18n/email/resources/dataSubjectRequests/create.users-custom_ready/labels.fr.ts +22 -0
- package/templates/saas/i18n/email/resources/dataSubjectRequests/create.users-custom_received/labels.fr.ts +23 -0
- package/templates/saas/i18n/email/resources/dataSubjectRequests/update.users-custom_extended/labels.fr.ts +23 -0
- package/templates/saas/i18n/email/resources/organizationSsoConfig/repairUnreadableConfiguration.organization-users/labels.fr.ts +23 -0
- package/templates/saas/i18n/engine/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.ts +28 -0
- package/templates/saas/i18n/engine/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.ts +28 -0
- package/templates/saas/i18n/engine/components/LOW_LEVEL_AI_APPROVAL.en.ts +2 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_AI_APPROVAL.fr.ts +2 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.ts +6 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.ts +6 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_APPROVAL_SEAL.en.ts +40 -0
- package/templates/saas/i18n/engine/components/LOW_LEVEL_APPROVAL_SEAL.fr.ts +40 -0
- package/templates/saas/i18n/engine/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.ts +2 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.ts +2 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_FORM_FIELD_STRING.en.ts +2 -1
- package/templates/saas/i18n/engine/components/LOW_LEVEL_FORM_FIELD_STRING.fr.ts +2 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.ts +2 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.ts +2 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_TERMS.en.ts +3 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_TERMS.fr.ts +3 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_USER_AUTH.en.ts +2 -1
- package/templates/saas/i18n/engine/components/PUBLIC_LAYOUTS_USER_AUTH.fr.ts +2 -1
- package/templates/saas/i18n/engine/components/RESOURCES_LAYOUTS_FILTERS.en.ts +3 -1
- package/templates/saas/i18n/engine/components/RESOURCES_LAYOUTS_FILTERS.fr.ts +4 -2
- package/templates/saas/i18n/engine/components/RESOURCES_LAYOUTS_LIST.en.ts +18 -1
- package/templates/saas/i18n/engine/components/RESOURCES_LAYOUTS_LIST.fr.ts +18 -1
- package/templates/saas/i18n/engine/resources/actorSystemExecutions.en.ts +10 -82
- package/templates/saas/i18n/engine/resources/actorSystemExecutions.fr.ts +0 -72
- package/templates/saas/i18n/engine/resources/actorTasks.en.ts +0 -33
- package/templates/saas/i18n/engine/resources/actorTasks.fr.ts +0 -33
- package/templates/saas/i18n/engine/resources/agentBehaviorReports.en.ts +0 -108
- package/templates/saas/i18n/engine/resources/agentBehaviorReports.fr.ts +0 -108
- package/templates/saas/i18n/engine/resources/agentOperationRecords.en.ts +8 -24
- package/templates/saas/i18n/engine/resources/agentOperationRecords.fr.ts +10 -26
- package/templates/saas/i18n/engine/resources/agentWorkCaptureSettings.en.ts +0 -12
- package/templates/saas/i18n/engine/resources/agentWorkCaptureSettings.fr.ts +0 -12
- package/templates/saas/i18n/engine/resources/anonymous_users.en.ts +8 -74
- package/templates/saas/i18n/engine/resources/anonymous_users.fr.ts +0 -66
- package/templates/saas/i18n/engine/resources/applicationA2aPushDeliveryLog.en.ts +3 -21
- package/templates/saas/i18n/engine/resources/applicationA2aPushDeliveryLog.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/applicationA2aTokenBudgetState.en.ts +3 -33
- package/templates/saas/i18n/engine/resources/applicationA2aTokenBudgetState.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/applicationAccessGrants.en.ts +13 -55
- package/templates/saas/i18n/engine/resources/applicationAccessGrants.fr.ts +0 -42
- package/templates/saas/i18n/engine/resources/applicationAgentPolicies.en.ts +8 -24
- package/templates/saas/i18n/engine/resources/applicationAgentPolicies.fr.ts +8 -24
- package/templates/saas/i18n/engine/resources/applicationAgentWorkDecisionContents.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/applicationAgentWorkDecisionContents.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/applicationAgentWorkDecisions.en.ts +13 -43
- package/templates/saas/i18n/engine/resources/applicationAgentWorkDecisions.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/applicationApiKeys.en.ts +2 -70
- package/templates/saas/i18n/engine/resources/applicationApiKeys.fr.ts +2 -70
- package/templates/saas/i18n/engine/resources/applicationAuditLogs.en.ts +41 -94
- package/templates/saas/i18n/engine/resources/applicationAuditLogs.fr.ts +41 -94
- package/templates/saas/i18n/engine/resources/applicationDataKeys.en.ts +2 -22
- package/templates/saas/i18n/engine/resources/applicationDataKeys.fr.ts +2 -22
- package/templates/saas/i18n/engine/resources/applicationFeatures.en.ts +0 -24
- package/templates/saas/i18n/engine/resources/applicationFeatures.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/applicationFlowActorExecutions.en.ts +25 -160
- package/templates/saas/i18n/engine/resources/applicationFlowActorExecutions.fr.ts +25 -160
- package/templates/saas/i18n/engine/resources/applicationFlowActorTasks.en.ts +6 -28
- package/templates/saas/i18n/engine/resources/applicationFlowActorTasks.fr.ts +8 -30
- package/templates/saas/i18n/engine/resources/applicationInboundDeliveries.en.ts +92 -23
- package/templates/saas/i18n/engine/resources/applicationInboundDeliveries.fr.ts +95 -26
- package/templates/saas/i18n/engine/resources/applicationM2mWebhookDeliveryLog.en.ts +1 -25
- package/templates/saas/i18n/engine/resources/applicationM2mWebhookDeliveryLog.fr.ts +4 -28
- package/templates/saas/i18n/engine/resources/applicationMetadata.en.ts +0 -18
- package/templates/saas/i18n/engine/resources/applicationMetadata.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/applicationOAuthClients.en.ts +2 -58
- package/templates/saas/i18n/engine/resources/applicationOAuthClients.fr.ts +2 -58
- package/templates/saas/i18n/engine/resources/applicationProviderCredentials.en.ts +168 -0
- package/templates/saas/i18n/engine/resources/applicationProviderCredentials.fr.ts +168 -0
- package/templates/saas/i18n/engine/resources/applicationScimProvisioningConfig.en.ts +0 -30
- package/templates/saas/i18n/engine/resources/applicationScimProvisioningConfig.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/applicationSiemDeliveryDlq.en.ts +3 -42
- package/templates/saas/i18n/engine/resources/applicationSiemDeliveryDlq.fr.ts +5 -44
- package/templates/saas/i18n/engine/resources/applicationSiemDeliveryOutbox.en.ts +3 -30
- package/templates/saas/i18n/engine/resources/applicationSiemDeliveryOutbox.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/applicationSiemExportConfig.en.ts +0 -24
- package/templates/saas/i18n/engine/resources/applicationSiemExportConfig.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/applicationSsoConfig.en.ts +113 -61
- package/templates/saas/i18n/engine/resources/applicationSsoConfig.fr.ts +113 -61
- package/templates/saas/i18n/engine/resources/applicationSsoConnections.en.ts +0 -138
- package/templates/saas/i18n/engine/resources/applicationSsoConnections.fr.ts +0 -138
- package/templates/saas/i18n/engine/resources/applicationVersions.en.ts +3 -27
- package/templates/saas/i18n/engine/resources/applicationVersions.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/applicationWebhookConfig.en.ts +5 -54
- package/templates/saas/i18n/engine/resources/applicationWebhookConfig.fr.ts +5 -54
- package/templates/saas/i18n/engine/resources/applications.en.ts +39 -2177
- package/templates/saas/i18n/engine/resources/applications.fr.ts +39 -2177
- package/templates/saas/i18n/engine/resources/approvalSeals.en.ts +38 -31
- package/templates/saas/i18n/engine/resources/approvalSeals.fr.ts +38 -31
- package/templates/saas/i18n/engine/resources/auditLogs.en.ts +78 -111
- package/templates/saas/i18n/engine/resources/auditLogs.fr.ts +78 -111
- package/templates/saas/i18n/engine/resources/billingEffectOutbox.en.ts +2 -4
- package/templates/saas/i18n/engine/resources/billingEffectOutbox.fr.ts +2 -4
- package/templates/saas/i18n/engine/resources/billingSubscriptionMutationIntents.en.ts +8 -6
- package/templates/saas/i18n/engine/resources/billingSubscriptionMutationIntents.fr.ts +8 -6
- package/templates/saas/i18n/engine/resources/chatConversations.en.ts +0 -18
- package/templates/saas/i18n/engine/resources/chatConversations.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/chatIdentityLinks.en.ts +0 -44
- package/templates/saas/i18n/engine/resources/chatIdentityLinks.fr.ts +0 -44
- package/templates/saas/i18n/engine/resources/consumableTokens.en.ts +4 -43
- package/templates/saas/i18n/engine/resources/consumableTokens.fr.ts +4 -43
- package/templates/saas/i18n/engine/resources/conversationMessages.en.ts +16 -27
- package/templates/saas/i18n/engine/resources/conversationMessages.fr.ts +16 -27
- package/templates/saas/i18n/engine/resources/conversationReplyTokens.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/conversationReplyTokens.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/conversationThreads.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/conversationThreads.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/dataSeedRuns.en.ts +22 -17
- package/templates/saas/i18n/engine/resources/dataSeedRuns.fr.ts +22 -17
- package/templates/saas/i18n/engine/resources/dataSubjectRequests.en.ts +410 -0
- package/templates/saas/i18n/engine/resources/dataSubjectRequests.fr.ts +410 -0
- package/templates/saas/i18n/engine/resources/etlPipelineStates.en.ts +128 -146
- package/templates/saas/i18n/engine/resources/etlPipelineStates.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/evaluationDatasetExports.en.ts +13 -43
- package/templates/saas/i18n/engine/resources/evaluationDatasetExports.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/evaluationExportAuthorizations.en.ts +0 -12
- package/templates/saas/i18n/engine/resources/evaluationExportAuthorizations.fr.ts +0 -12
- package/templates/saas/i18n/engine/resources/externalDataErasureSuppressions.en.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalDataErasureSuppressions.fr.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalDataOutboundChanges.en.ts +24 -45
- package/templates/saas/i18n/engine/resources/externalDataOutboundChanges.fr.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalDataPendingReferences.en.ts +0 -24
- package/templates/saas/i18n/engine/resources/externalDataPendingReferences.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/externalDataPipelineMembershipKeys.en.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalDataPipelineMembershipKeys.fr.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalDataPipelineMemberships.en.ts +8 -14
- package/templates/saas/i18n/engine/resources/externalDataPipelineMemberships.fr.ts +0 -6
- package/templates/saas/i18n/engine/resources/externalDataPipelineRequestedKeys.en.ts +0 -24
- package/templates/saas/i18n/engine/resources/externalDataPipelineRequestedKeys.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/externalDataPipelineRunRecords.en.ts +150 -174
- package/templates/saas/i18n/engine/resources/externalDataPipelineRunRecords.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/externalDataRemoteVersions.en.ts +12 -33
- package/templates/saas/i18n/engine/resources/externalDataRemoteVersions.fr.ts +0 -21
- package/templates/saas/i18n/engine/resources/externalEffectReservations.en.ts +147 -0
- package/templates/saas/i18n/engine/resources/externalEffectReservations.fr.ts +147 -0
- package/templates/saas/i18n/engine/resources/files.en.ts +0 -39
- package/templates/saas/i18n/engine/resources/files.fr.ts +0 -39
- package/templates/saas/i18n/engine/resources/humanDecisionNoticeStays.en.ts +0 -18
- package/templates/saas/i18n/engine/resources/humanDecisionNoticeStays.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/idempotentRequestOutcomes.en.ts +115 -0
- package/templates/saas/i18n/engine/resources/idempotentRequestOutcomes.fr.ts +115 -0
- package/templates/saas/i18n/engine/resources/inboundAddressTombstones.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/inboundAddressTombstones.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/inboundContacts.en.ts +3 -30
- package/templates/saas/i18n/engine/resources/inboundContacts.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/inboundEmails.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/inboundEmails.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/jobExecutions.en.ts +11 -25
- package/templates/saas/i18n/engine/resources/jobExecutions.fr.ts +11 -25
- package/templates/saas/i18n/engine/resources/jobPayloadStorage.en.ts +3 -30
- package/templates/saas/i18n/engine/resources/jobPayloadStorage.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/legalHolds.en.ts +0 -88
- package/templates/saas/i18n/engine/resources/legalHolds.fr.ts +0 -88
- package/templates/saas/i18n/engine/resources/modelCallAttributions.en.ts +16 -40
- package/templates/saas/i18n/engine/resources/modelCallAttributions.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/modelCostPeriodAggregates.en.ts +13 -37
- package/templates/saas/i18n/engine/resources/modelCostPeriodAggregates.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/oauthConsentGrants.en.ts +10 -40
- package/templates/saas/i18n/engine/resources/oauthConsentGrants.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/operationApprovalRequests.en.ts +120 -60
- package/templates/saas/i18n/engine/resources/operationApprovalRequests.fr.ts +120 -60
- package/templates/saas/i18n/engine/resources/organizationA2aPushDeliveryLog.en.ts +3 -21
- package/templates/saas/i18n/engine/resources/organizationA2aPushDeliveryLog.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/organizationA2aTokenBudgetState.en.ts +3 -33
- package/templates/saas/i18n/engine/resources/organizationA2aTokenBudgetState.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/organizationAgentPolicies.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationAgentPolicies.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationAgentWorkDecisionContents.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationAgentWorkDecisionContents.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationAgentWorkDecisions.en.ts +13 -43
- package/templates/saas/i18n/engine/resources/organizationAgentWorkDecisions.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/organizationApiKeys.en.ts +2 -79
- package/templates/saas/i18n/engine/resources/organizationApiKeys.fr.ts +2 -79
- package/templates/saas/i18n/engine/resources/organizationBillingAccounts.en.ts +0 -549
- package/templates/saas/i18n/engine/resources/organizationBillingAccounts.fr.ts +0 -549
- package/templates/saas/i18n/engine/resources/organizationChatSettings.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationChatSettings.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationCreditPools.en.ts +13 -18
- package/templates/saas/i18n/engine/resources/organizationCreditPools.fr.ts +13 -18
- package/templates/saas/i18n/engine/resources/organizationCustomDomains.en.ts +195 -0
- package/templates/saas/i18n/engine/resources/organizationCustomDomains.fr.ts +195 -0
- package/templates/saas/i18n/engine/resources/organizationDashboardLayouts.en.ts +153 -0
- package/templates/saas/i18n/engine/resources/organizationDashboardLayouts.fr.ts +153 -0
- package/templates/saas/i18n/engine/resources/organizationEmailDomains.en.ts +0 -39
- package/templates/saas/i18n/engine/resources/organizationEmailDomains.fr.ts +0 -39
- package/templates/saas/i18n/engine/resources/organizationFeatures.en.ts +0 -34
- package/templates/saas/i18n/engine/resources/organizationFeatures.fr.ts +0 -34
- package/templates/saas/i18n/engine/resources/organizationFlowActorExecutions.en.ts +25 -160
- package/templates/saas/i18n/engine/resources/organizationFlowActorExecutions.fr.ts +25 -160
- package/templates/saas/i18n/engine/resources/organizationFlowActorTasks.en.ts +6 -28
- package/templates/saas/i18n/engine/resources/organizationFlowActorTasks.fr.ts +8 -30
- package/templates/saas/i18n/engine/resources/organizationGuidanceState.en.ts +3 -18
- package/templates/saas/i18n/engine/resources/organizationGuidanceState.fr.ts +0 -15
- package/templates/saas/i18n/engine/resources/organizationInboundDeliveries.en.ts +95 -26
- package/templates/saas/i18n/engine/resources/organizationInboundDeliveries.fr.ts +95 -26
- package/templates/saas/i18n/engine/resources/organizationInvoiceRefs.en.ts +14 -45
- package/templates/saas/i18n/engine/resources/organizationInvoiceRefs.fr.ts +14 -45
- package/templates/saas/i18n/engine/resources/organizationLifecycleState.en.ts +1 -17
- package/templates/saas/i18n/engine/resources/organizationLifecycleState.fr.ts +1 -17
- package/templates/saas/i18n/engine/resources/organizationM2mWebhookDeliveryLog.en.ts +2 -26
- package/templates/saas/i18n/engine/resources/organizationM2mWebhookDeliveryLog.fr.ts +4 -28
- package/templates/saas/i18n/engine/resources/organizationMembers.en.ts +2 -95
- package/templates/saas/i18n/engine/resources/organizationMembers.fr.ts +2 -95
- package/templates/saas/i18n/engine/resources/organizationModelUsageCeilingState.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationModelUsageCeilingState.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationNotificationBadges.en.ts +3 -36
- package/templates/saas/i18n/engine/resources/organizationNotificationBadges.fr.ts +0 -33
- package/templates/saas/i18n/engine/resources/organizationNotifications.en.ts +0 -12
- package/templates/saas/i18n/engine/resources/organizationNotifications.fr.ts +0 -12
- package/templates/saas/i18n/engine/resources/organizationOAuthClients.en.ts +2 -67
- package/templates/saas/i18n/engine/resources/organizationOAuthClients.fr.ts +2 -67
- package/templates/saas/i18n/engine/resources/organizationOnboardingOperations.en.ts +0 -9
- package/templates/saas/i18n/engine/resources/organizationOnboardingOperations.fr.ts +0 -9
- package/templates/saas/i18n/engine/resources/organizationPersonTokenCeilingState.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationPersonTokenCeilingState.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationPreferences.en.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationPreferences.fr.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationProfiles.en.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationProfiles.fr.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationProgressionState.en.ts +1 -17
- package/templates/saas/i18n/engine/resources/organizationProgressionState.fr.ts +1 -17
- package/templates/saas/i18n/engine/resources/organizationProviderCredentials.en.ts +0 -58
- package/templates/saas/i18n/engine/resources/organizationProviderCredentials.fr.ts +0 -58
- package/templates/saas/i18n/engine/resources/organizationRelationships.en.ts +0 -128
- package/templates/saas/i18n/engine/resources/organizationRelationships.fr.ts +0 -128
- package/templates/saas/i18n/engine/resources/organizationRepresentations.en.ts +0 -83
- package/templates/saas/i18n/engine/resources/organizationRepresentations.fr.ts +0 -83
- package/templates/saas/i18n/engine/resources/organizationScimProvisioningConfig.en.ts +0 -43
- package/templates/saas/i18n/engine/resources/organizationScimProvisioningConfig.fr.ts +0 -43
- package/templates/saas/i18n/engine/resources/organizationScimTokens.en.ts +5 -76
- package/templates/saas/i18n/engine/resources/organizationScimTokens.fr.ts +5 -76
- package/templates/saas/i18n/engine/resources/organizationSiemDeliveryDlq.en.ts +4 -43
- package/templates/saas/i18n/engine/resources/organizationSiemDeliveryDlq.fr.ts +6 -45
- package/templates/saas/i18n/engine/resources/organizationSiemDeliveryOutbox.en.ts +3 -30
- package/templates/saas/i18n/engine/resources/organizationSiemDeliveryOutbox.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/organizationSiemExportConfig.en.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationSiemExportConfig.fr.ts +0 -37
- package/templates/saas/i18n/engine/resources/organizationSsoConfig.en.ts +113 -74
- package/templates/saas/i18n/engine/resources/organizationSsoConfig.fr.ts +113 -74
- package/templates/saas/i18n/engine/resources/organizationSsoConnections.en.ts +0 -148
- package/templates/saas/i18n/engine/resources/organizationSsoConnections.fr.ts +0 -148
- package/templates/saas/i18n/engine/resources/organizationSubscriptions.en.ts +40 -78
- package/templates/saas/i18n/engine/resources/organizationSubscriptions.fr.ts +42 -80
- package/templates/saas/i18n/engine/resources/organizationUnitMembers.en.ts +2 -50
- package/templates/saas/i18n/engine/resources/organizationUnitMembers.fr.ts +2 -50
- package/templates/saas/i18n/engine/resources/organizationUnits.en.ts +0 -49
- package/templates/saas/i18n/engine/resources/organizationUnits.fr.ts +0 -49
- package/templates/saas/i18n/engine/resources/organizationUsageRecords.en.ts +13 -37
- package/templates/saas/i18n/engine/resources/organizationUsageRecords.fr.ts +13 -37
- package/templates/saas/i18n/engine/resources/organizationWebhookConfig.en.ts +5 -67
- package/templates/saas/i18n/engine/resources/organizationWebhookConfig.fr.ts +5 -67
- package/templates/saas/i18n/engine/resources/organizations.en.ts +34 -637
- package/templates/saas/i18n/engine/resources/organizations.fr.ts +32 -635
- package/templates/saas/i18n/engine/resources/platformAccessGrants.en.ts +0 -91
- package/templates/saas/i18n/engine/resources/platformAccessGrants.fr.ts +0 -91
- package/templates/saas/i18n/engine/resources/postCommitEffectOutbox.en.ts +0 -24
- package/templates/saas/i18n/engine/resources/postCommitEffectOutbox.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/prices.en.ts +47 -108
- package/templates/saas/i18n/engine/resources/prices.fr.ts +48 -109
- package/templates/saas/i18n/engine/resources/products.en.ts +24 -68
- package/templates/saas/i18n/engine/resources/products.fr.ts +24 -68
- package/templates/saas/i18n/engine/resources/professionalQualifications.en.ts +0 -87
- package/templates/saas/i18n/engine/resources/professionalQualifications.fr.ts +0 -87
- package/templates/saas/i18n/engine/resources/promotions.en.ts +4 -56
- package/templates/saas/i18n/engine/resources/promotions.fr.ts +6 -58
- package/templates/saas/i18n/engine/resources/providerCallRecords.en.ts +77 -101
- package/templates/saas/i18n/engine/resources/providerCallRecords.fr.ts +0 -24
- package/templates/saas/i18n/engine/resources/publishedVerificationKeys.en.ts +2 -25
- package/templates/saas/i18n/engine/resources/publishedVerificationKeys.fr.ts +2 -25
- package/templates/saas/i18n/engine/resources/referrals.en.ts +21 -18
- package/templates/saas/i18n/engine/resources/referrals.fr.ts +21 -18
- package/templates/saas/i18n/engine/resources/relationshipCapabilityGrants.en.ts +0 -80
- package/templates/saas/i18n/engine/resources/relationshipCapabilityGrants.fr.ts +0 -80
- package/templates/saas/i18n/engine/resources/relationshipInvitations.en.ts +0 -89
- package/templates/saas/i18n/engine/resources/relationshipInvitations.fr.ts +0 -89
- package/templates/saas/i18n/engine/resources/relationshipMailboxes.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/relationshipMailboxes.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/representativeAssignments.en.ts +108 -112
- package/templates/saas/i18n/engine/resources/representativeAssignments.fr.ts +108 -112
- package/templates/saas/i18n/engine/resources/retentionEnforcementRecords.en.ts +8 -21
- package/templates/saas/i18n/engine/resources/retentionEnforcementRecords.fr.ts +8 -21
- package/templates/saas/i18n/engine/resources/signatureRequestSigners.en.ts +141 -0
- package/templates/saas/i18n/engine/resources/signatureRequestSigners.fr.ts +141 -0
- package/templates/saas/i18n/engine/resources/signatureRequests.en.ts +205 -0
- package/templates/saas/i18n/engine/resources/signatureRequests.fr.ts +205 -0
- package/templates/saas/i18n/engine/resources/smsNumberAssignments.en.ts +101 -0
- package/templates/saas/i18n/engine/resources/smsNumberAssignments.fr.ts +101 -0
- package/templates/saas/i18n/engine/resources/smsOptOuts.en.ts +166 -0
- package/templates/saas/i18n/engine/resources/smsOptOuts.fr.ts +166 -0
- package/templates/saas/i18n/engine/resources/smsProviderEvents.en.ts +195 -0
- package/templates/saas/i18n/engine/resources/smsProviderEvents.fr.ts +195 -0
- package/templates/saas/i18n/engine/resources/ssoDomainReservations.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/ssoDomainReservations.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/systemOfRecordPartitionAssignments.en.ts +3 -39
- package/templates/saas/i18n/engine/resources/systemOfRecordPartitionAssignments.fr.ts +0 -36
- package/templates/saas/i18n/engine/resources/systemOfRecordWriteAdmissions.en.ts +0 -3
- package/templates/saas/i18n/engine/resources/systemOfRecordWriteAdmissions.fr.ts +0 -3
- package/templates/saas/i18n/engine/resources/transactionalCommitReceipts.en.ts +0 -6
- package/templates/saas/i18n/engine/resources/transactionalCommitReceipts.fr.ts +0 -6
- package/templates/saas/i18n/engine/resources/userA2aPushDeliveryLog.en.ts +3 -21
- package/templates/saas/i18n/engine/resources/userA2aPushDeliveryLog.fr.ts +0 -18
- package/templates/saas/i18n/engine/resources/userA2aTokenBudgetState.en.ts +3 -33
- package/templates/saas/i18n/engine/resources/userA2aTokenBudgetState.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/userAgentWorkDecisionContents.en.ts +0 -27
- package/templates/saas/i18n/engine/resources/userAgentWorkDecisionContents.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/userAgentWorkDecisions.en.ts +13 -43
- package/templates/saas/i18n/engine/resources/userAgentWorkDecisions.fr.ts +0 -30
- package/templates/saas/i18n/engine/resources/userCredentials.en.ts +3 -87
- package/templates/saas/i18n/engine/resources/userCredentials.fr.ts +0 -84
- package/templates/saas/i18n/engine/resources/userFeatures.en.ts +0 -12
- package/templates/saas/i18n/engine/resources/userFeatures.fr.ts +0 -12
- package/templates/saas/i18n/engine/resources/userFlowActorExecutions.en.ts +25 -160
- package/templates/saas/i18n/engine/resources/userFlowActorExecutions.fr.ts +25 -160
- package/templates/saas/i18n/engine/resources/userFlowActorTasks.en.ts +6 -28
- package/templates/saas/i18n/engine/resources/userFlowActorTasks.fr.ts +8 -30
- package/templates/saas/i18n/engine/resources/userGovernedDocumentAcceptances.en.ts +13 -18
- package/templates/saas/i18n/engine/resources/userGovernedDocumentAcceptances.fr.ts +13 -18
- package/templates/saas/i18n/engine/resources/userGuidanceState.en.ts +3 -18
- package/templates/saas/i18n/engine/resources/userGuidanceState.fr.ts +0 -15
- package/templates/saas/i18n/engine/resources/userIdentityLinks.en.ts +13 -40
- package/templates/saas/i18n/engine/resources/userIdentityLinks.fr.ts +0 -27
- package/templates/saas/i18n/engine/resources/userLifecycleState.en.ts +0 -15
- package/templates/saas/i18n/engine/resources/userLifecycleState.fr.ts +0 -15
- package/templates/saas/i18n/engine/resources/userNotificationBadges.en.ts +3 -36
- package/templates/saas/i18n/engine/resources/userNotificationBadges.fr.ts +0 -33
- package/templates/saas/i18n/engine/resources/userPreferences.en.ts +8 -60
- package/templates/saas/i18n/engine/resources/userPreferences.fr.ts +8 -60
- package/templates/saas/i18n/engine/resources/userProfiles.en.ts +5 -56
- package/templates/saas/i18n/engine/resources/userProfiles.fr.ts +0 -51
- package/templates/saas/i18n/engine/resources/userProgressionState.en.ts +1 -17
- package/templates/saas/i18n/engine/resources/userProgressionState.fr.ts +1 -17
- package/templates/saas/i18n/engine/resources/userProviderCredentials.en.ts +0 -52
- package/templates/saas/i18n/engine/resources/userProviderCredentials.fr.ts +0 -52
- package/templates/saas/i18n/engine/resources/userSelfPreferences.en.ts +8 -56
- package/templates/saas/i18n/engine/resources/userSelfPreferences.fr.ts +8 -56
- package/templates/saas/i18n/engine/resources/userSelfProfiles.en.ts +5 -61
- package/templates/saas/i18n/engine/resources/userSelfProfiles.fr.ts +0 -56
- package/templates/saas/i18n/engine/resources/user_self.en.ts +37 -214
- package/templates/saas/i18n/engine/resources/user_self.fr.ts +37 -214
- package/templates/saas/i18n/engine/resources/users.en.ts +53 -180
- package/templates/saas/i18n/engine/resources/users.fr.ts +53 -180
- package/templates/saas/scenarios/add-technical-doc/files/technical-doc/Dockerfile +4 -1
- package/templates/saas/scenarios/add-technical-doc/files/technical-doc/src/plugins/api-reference-pages.ts +9 -1
- package/templates/saas/scenarios/add-website/files/website/Dockerfile +4 -1
- package/templates/saas/scenarios/add-website/files/website/astro.config.ts.hbs +4 -0
- package/templates/saas/scenarios/add-website/files/website/package.json.hbs +1 -1
- package/templates/saas/scenarios/add-worker-node/files/workers/__workerDir__/Dockerfile.hbs +3 -1
- package/templates/saas/skeleton/backend-api/Dockerfile +5 -2
- package/templates/saas/skeleton/frontend/Dockerfile +4 -1
- package/templates/saas/skeleton/frontend/vite-engine-dependency-prebundle.ts +10 -1
- package/templates/saas/skeleton/frontend/vite.config.ts.hbs +14 -3
- package/wildo-framework.info.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-install.service.js","sourceRoot":"","sources":["../../../../src/services/registry/module-install.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,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: the pipeline `wildo registry add` runs, as a service, so the\n * one other door that installs a module — `wildo init --blueprint`, for the modules a blueprint REFERENCES (#2879) —\n * runs exactly the same steps and writes exactly the same lockfile entry.\n *\n * Two halves, because they have different preconditions:\n *\n * - `acquireModuleForInstall` RESOLVES a spec to one version and fetches its bytes: from the framework checkout for a\n * `wildo/...` spec inside a checkout (#2015), from the registry otherwise, integrity-checked against the digest the\n * registry resolved. It needs only a command context and a registry; nothing is written into the application.\n * - `installAcquiredModule` writes it: stage, check the staged manifest against the request and the host's\n * requirements, fan the files out inside the manifest's boundaries without silently replacing an application file\n * (#2016), register the module in the host's registries (#1755), and record the lockfile entry — all under the\n * workspace mutation lock, rolled back if the lockfile write fails.\n *\n * What stays with each caller is what differs between them: `registry add` runs `pnpm install` and the provider sync\n * right after, while `wildo init` installs before its own `pnpm install` and leaves the sync to `wildo config sync`.\n */\n\nimport { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\nimport { RegistryLockfileService, RegistryServerClient } from '@wildo-ai/wildo-module-client';\nimport { DEFAULT_REGISTRY_ID, ModuleDistribution, ModuleKind, type RegistryModulesLockEntry } from '@wildo-ai/platform-config-lib';\nimport type { CommandContext } from '~wildo-cli/kernel/types';\nimport { ErrorUtils } from '~wildo-cli/infrastructure/errors/error.utils';\nimport { RegistryCredentialsService } from './registry-credentials.service';\nimport {\n assertModuleEntryUnchangedUnderLock,\n resolveRegistryUrlForCommand,\n withRegistryWorkspaceMutationLock,\n type ParsedModuleSpec,\n} from './registry-command.utils';\nimport { fanOutToSaasSource, readStagedManifest, rollbackFanOut, validatedStagedAppFiles } from './boundary-fanout.utils';\nimport { nextInstalledFileHashes, planProtectedWrite, registryForceBackupDirectory } from './installed-file-state.utils';\nimport { findResourceConfigurationFiles } from './migration-obligation.utils';\nimport { deriveProviderRegistration, registerModuleForInstall, rollbackInstallRegistration } from './module-registration.service';\nimport { reportRegistrationOutcome } from './provider-wiring.service';\nimport { moduleArtifactPaths } from './module-artifact-files.utils';\nimport { localCheckoutRootFor, resolveLocalCheckoutModule } from './local-checkout-module-source.service';\nimport {\n describeAcquisition,\n lockEntryProvenance,\n moduleRequirementsOriginOf,\n stageModuleAcquisition,\n type ModuleAcquisition,\n} from './module-acquisition.utils';\nimport { checkModuleRequirements } from './module-requirements.service';\nimport { assertStagedManifestMatchesRequest } from './artifact-trust.utils';\n\n/** The operator log an install writes to. */\nexport type ModuleInstallLog = CommandContext['log'];\n\n/** A resolved, fetched module version, ready to install, and the registry credential that fetched it (if any). */\nexport interface AcquiredModule {\n readonly parsed: ParsedModuleSpec;\n readonly acquisition: ModuleAcquisition;\n /** The registry URL whose stored credential was used, so the caller can mark it used once the install succeeds. */\n readonly credentialUrl?: string;\n}\n\n/**\n * Resolve `parsed` to one version and fetch it. Inside a framework checkout, a `wildo/...` spec with no registry flag\n * is served by the checkout itself (#2015); anything else comes from the registry `registryFlag` resolves to.\n */\nexport async function acquireModuleForInstall(\n ctx: CommandContext,\n parsed: ParsedModuleSpec,\n /** `saasRoot` is the application whose registry configuration applies; absent before one exists (`wildo init`). */\n input: { readonly registryFlag?: string | undefined; readonly saasRoot?: string | undefined; readonly label: string },\n): Promise<AcquiredModule> {\n const localCheckoutRoot = localCheckoutRootFor(ctx, { domain: parsed.domain, ...(input.registryFlag === undefined ? {} : { registryFlag: input.registryFlag }) });\n if (localCheckoutRoot !== undefined) {\n const local = await resolveLocalCheckoutModule({ frameworkRoot: localCheckoutRoot, domain: parsed.domain, moduleId: parsed.moduleId, range: parsed.range });\n return { parsed, acquisition: { distribution: ModuleDistribution.LOCAL_CHECKOUT, version: local.version, local } };\n }\n const resolved = await resolveRegistryUrlForCommand(ctx, { ...(input.registryFlag === undefined ? {} : { flag: input.registryFlag }), ...(input.saasRoot === undefined ? {} : { saasRoot: input.saasRoot }) });\n ctx.log.info(`[${input.label}] resolving ${parsed.moduleId}@${parsed.range} on ${resolved.url} (${resolved.source})`);\n const credential = await RegistryCredentialsService.get(resolved.url);\n const clientOptions = { baseUrl: resolved.url, authToken: credential?.rawToken };\n // Resolve the range to one exact version and its digest.\n const { version, artifactDigest, yanked } = await RegistryServerClient.resolve(clientOptions, {\n domain: parsed.domain,\n moduleId: parsed.moduleId,\n range: parsed.range,\n });\n if (yanked) {\n // Only an exact pin reaches a yanked release (#1758); install it, but say so.\n ctx.log.warn(` ${parsed.moduleId}@${version} is YANKED (${yanked.yankedAt}${yanked.reason ? `: ${yanked.reason}` : ''}). Installing the pinned release; pick a live one with a range.`);\n }\n // Download the bytes, verified against the resolved digest (KD-9: a mismatch throws).\n const { bytes } = await RegistryServerClient.download(clientOptions, {\n domain: parsed.domain,\n moduleId: parsed.moduleId,\n version,\n expectedDigest: artifactDigest,\n });\n ctx.log.info(` downloaded → ${bytes.byteLength} bytes`);\n return {\n parsed,\n acquisition: {\n distribution: ModuleDistribution.REGISTRY,\n version,\n artifactDigest,\n bytes,\n registry: { url: resolved.url, id: resolved.id ?? DEFAULT_REGISTRY_ID },\n },\n ...(credential ? { credentialUrl: resolved.url } : {}),\n };\n}\n\n/** What an install did that its caller acts on afterwards. */\nexport interface ModuleInstallOutcome {\n readonly version: string;\n /** A provider module was installed: its packages must be installed before anything discovers them. */\n readonly changedProvider: boolean;\n /** The provider ships skills (#2026). */\n readonly carriesSkills: boolean;\n /** The install-script names this install newly allowed (#2801), rebuilt after `pnpm install`. */\n readonly allowedInstallScripts: readonly string[];\n /** The module's resource configuration files, for the migration obligation (#1757). */\n readonly resourceConfigurationFiles: readonly string[];\n /** The lockfile entry written. */\n readonly entry: RegistryModulesLockEntry;\n}\n\n/**\n * Install an acquired module into `saasRoot`, under the workspace mutation lock. Refuses a module that is already\n * installed (it moves only through `update`) and a blueprint (#2861). Throws, having rolled the files and the\n * registration back, when the lockfile cannot be written.\n */\nexport async function installAcquiredModule(input: {\n readonly saasRoot: string;\n readonly frameworkRoot: string | null;\n readonly acquired: AcquiredModule;\n /** Overwrite application files no module installed, keeping a backup (`wildo registry add --force`). */\n readonly force: boolean;\n readonly log: ModuleInstallLog;\n}): Promise<ModuleInstallOutcome> {\n const { saasRoot, acquired, log } = input;\n const { parsed, acquisition } = acquired;\n const version = acquisition.version;\n log.info(` resolved → ${describeAcquisition(parsed.moduleId, acquisition)}`);\n let outcome: ModuleInstallOutcome | undefined;\n await withRegistryWorkspaceMutationLock(saasRoot, async () => {\n // Decided before the lock (\"not installed\"); re-confirmed under it.\n await assertModuleEntryUnchangedUnderLock(saasRoot, parsed.moduleId, undefined);\n // Stage the version where the fan-out reads it (the extracted artifact, or the checkout copy).\n const paths = moduleArtifactPaths(saasRoot, parsed.domain, parsed.moduleId, version);\n const stagedCount = await stageModuleAcquisition(acquisition, paths, saasRoot);\n log.success(` staged ${stagedCount} file(s) → ${path.relative(saasRoot, paths.extractDir)}/`);\n\n // The staged manifest is the source of truth for the boundary allow-list (KD-12).\n const stagedManifest = await readStagedManifest(paths.extractDir);\n assertStagedManifestMatchesRequest(stagedManifest, { moduleId: parsed.moduleId, version });\n // #2861: a blueprint is applied by `wildo init --blueprint`, never installed into an existing application. Its\n // staged copy can never become an install, so it does not stay in the application's generated tree.\n if (stagedManifest.kind === ModuleKind.BLUEPRINT) {\n await fs.rm(paths.extractDir, { recursive: true, force: true });\n await fs.rm(paths.zip, { force: true });\n throw new Error(`${stagedManifest.id} is a blueprint: it starts a new application with \\`wildo init --blueprint\\` and is never installed into an existing one.`);\n }\n for (const notice of await checkModuleRequirements(saasRoot, stagedManifest, moduleRequirementsOriginOf(acquisition))) log.warn(notice);\n // #2014: a provider module is wired into THIS application's own runtimes. Derived before a single file is\n // written, so a refusal (no backend service to own a backend facet) leaves the application untouched.\n const providerRegistration = stagedManifest.kind === ModuleKind.PROVIDER ? await deriveProviderRegistration(saasRoot, stagedManifest) : undefined;\n // M9 backup dir: sibling to `extractDir` so the fan-out walker doesn't traverse it. Cleaned up after a\n // successful fan-out.\n await fs.rm(paths.backupDir, { recursive: true, force: true });\n // #2016: never silently replace a file the application authored itself.\n const writePlan = await planProtectedWrite({\n saasRoot,\n moduleId: parsed.moduleId,\n stagedPaths: await validatedStagedAppFiles({ saasRoot, extractDir: paths.extractDir, manifest: stagedManifest }),\n force: input.force,\n restoreMissing: false,\n backupDirectory: registryForceBackupDirectory(saasRoot, parsed.moduleId),\n findOtherOwners: (candidates) => RegistryLockfileService.findFileOwners({ saasRoot, paths: candidates, excludeModuleId: parsed.moduleId }),\n });\n for (const forced of writePlan.forced) log.warn(` overwrote ${forced.path} (--force); the application's version is at ${path.relative(saasRoot, forced.backup)}`);\n const fanOut = await fanOutToSaasSource({\n saasRoot,\n extractDir: paths.extractDir,\n manifest: stagedManifest,\n moduleId: parsed.moduleId,\n backupDir: paths.backupDir,\n skipPaths: writePlan.skip,\n });\n log.success(` wrote ${fanOut.writtenFiles.length} app source file(s) per manifest.boundaries`);\n for (const warning of fanOut.overlapWarnings) {\n log.warn(` [overlap] \"${warning.path}\" was also claimed by \"${warning.otherModuleId}\" — overwritten by ${parsed.moduleId}.`);\n }\n\n // #1755: register the module in the host's registries (or mark why it is not).\n const registrationOutcome = registerModuleForInstall(saasRoot, input.frameworkRoot, stagedManifest, undefined, providerRegistration);\n reportRegistrationOutcome(log, registrationOutcome, saasRoot);\n\n // The lockfile entry; `files[]` records the application paths so `remove` can clean them up symmetrically. If its\n // write fails after the fan-out succeeded, the application source is rolled back so a half-applied install does\n // not leak into the repository.\n const entry: RegistryModulesLockEntry = {\n moduleId: parsed.moduleId,\n ...lockEntryProvenance(acquisition),\n domain: parsed.domain,\n version,\n requestedRange: parsed.range,\n installedAt: new Date().toISOString(),\n files: fanOut.ownedFiles,\n installedFileHashes: await nextInstalledFileHashes({ saasRoot, ownedFiles: fanOut.ownedFiles, skipped: writePlan.skip }),\n source: 'install',\n ...(registrationOutcome.registration ? { registration: registrationOutcome.registration } : {}),\n };\n try {\n await RegistryLockfileService.upsertEntry(saasRoot, entry);\n } catch (lockErr) {\n log.error(` lockfile write failed — rolling back ${fanOut.writtenFiles.length} fan-out file(s).`);\n // `rollbackFanOut` swallows per-file errors itself; this guard stays for a future change that lets them out.\n try {\n rollbackInstallRegistration(saasRoot, registrationOutcome.snapshots);\n await rollbackFanOut({ saasRoot, result: fanOut });\n } catch (rbErr) {\n log.error(` rollback failed: ${ErrorUtils.extractErrorMessage(rbErr)} — SaaS source may be in a partially-applied state.`);\n }\n // Drop the artifact dir and backup so the install can be retried cleanly. Each cleanup is best-effort: a cleanup\n // failure must never mask the lockfile error that is being surfaced.\n await fs.rm(paths.extractDir, { recursive: true, force: true }).catch(() => {});\n await fs.rm(paths.backupDir, { recursive: true, force: true }).catch(() => {});\n await fs.rm(paths.zip, { force: true }).catch(() => {});\n throw lockErr;\n }\n // Successful install: the backup is no longer needed once the lockfile records the new entry.\n await fs.rm(paths.backupDir, { recursive: true, force: true }).catch(() => {});\n log.success(' lockfile updated');\n if (registrationOutcome.registration) {\n log.success(` registered in the application's module registries (${registrationOutcome.registration.moduleId})`);\n }\n outcome = {\n version,\n changedProvider: providerRegistration !== undefined,\n carriesSkills: (stagedManifest.provider?.skills?.length ?? 0) > 0,\n allowedInstallScripts: registrationOutcome.allowedInstallScripts,\n resourceConfigurationFiles: await findResourceConfigurationFiles(saasRoot, fanOut.writtenFiles),\n entry,\n };\n });\n if (outcome === undefined) throw new Error(`The install of ${parsed.moduleId} finished without an outcome.`);\n return outcome;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"module-install.service.js","sourceRoot":"","sources":["../../../../src/services/registry/module-install.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,UAAU,EAAiC,MAAM,+BAA+B,CAAC;AAEnI,OAAO,EAAE,UAAU,E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C,CAAC;YAC/E,MAAM,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACxD,MAAM,OAAO,CAAC;QAChB,CAAC;QACD,8FAA8F;QAC9F,MAAM,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC/E,GAAG,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAClC,IAAI,mBAAmB,CAAC,YAAY,EAAE,CAAC;YACrC,GAAG,CAAC,OAAO,CAAC,wDAAwD,mBAAmB,CAAC,YAAY,CAAC,QAAQ,GAAG,CAAC,CAAC;QACpH,CAAC;QACD,OAAO,GAAG;YACR,OAAO;YACP,eAAe,EAAE,oBAAoB,KAAK,SAAS;YACnD,aAAa,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC;YACjE,qBAAqB,EAAE,mBAAmB,CAAC,qBAAqB;YAChE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC;YAC/F,KAAK;SACN,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,CAAC,QAAQ,+BAA+B,CAAC,CAAC;IAC7G,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/**\n * Installing a registry module into an application: the pipeline `wildo registry add` runs, as a service, so the\n * one other door that installs a module — `wildo init --blueprint`, for the modules a blueprint REFERENCES (#2879) —\n * runs exactly the same steps and writes exactly the same lockfile entry.\n *\n * Two halves, because they have different preconditions:\n *\n * - `acquireModuleForInstall` RESOLVES a spec to one version and fetches its bytes: from the framework checkout for a\n * `wildo/...` spec inside a checkout (#2015), from the registry otherwise, integrity-checked against the digest the\n * registry resolved. It needs only a command context and a registry; nothing is written into the application.\n * - `installAcquiredModule` writes it: stage, check the staged manifest against the request and the host's\n * requirements, fan the files out inside the manifest's boundaries without silently replacing an application file\n * (#2016), register the module in the host's registries (#1755), and record the lockfile entry — all under the\n * workspace mutation lock, rolled back if the lockfile write fails.\n *\n * What stays with each caller is what differs between them: `registry add` runs `pnpm install` and the provider sync\n * right after, while `wildo init` installs before its own `pnpm install` and leaves the sync to `wildo config sync`.\n */\n\nimport { promises as fs } from 'node:fs';\nimport * as path from 'node:path';\nimport { RegistryLockfileService, RegistryServerClient } from '@wildo-ai/wildo-module-client';\nimport { DEFAULT_REGISTRY_ID, ModuleDistribution, ModuleKind, type RegistryModulesLockEntry } from '@wildo-ai/platform-config-lib';\nimport type { CommandContext } from '~wildo-cli/kernel/types';\nimport { ErrorUtils } from '~wildo-cli/infrastructure/errors/error.utils';\nimport { RegistryCredentialsService } from './registry-credentials.service';\nimport {\n assertModuleEntryUnchangedUnderLock,\n resolveRegistryUrlForCommand,\n withRegistryWorkspaceMutationLock,\n type ParsedModuleSpec,\n} from './registry-command.utils';\nimport { fanOutToSaasSource, readStagedManifest, rollbackFanOut, validatedStagedAppFiles } from './boundary-fanout.utils';\nimport { nextInstalledFileHashes, planProtectedWrite, registryForceBackupDirectory } from './installed-file-state.utils';\nimport { findResourceConfigurationFiles } from './migration-obligation.utils';\nimport { deriveProviderRegistration, registerModuleForInstall, rollbackInstallRegistration } from './module-registration.service';\nimport { reportRegistrationOutcome } from './provider-wiring.service';\nimport { moduleArtifactPaths } from './module-artifact-files.utils';\nimport { localCheckoutRootFor, resolveLocalCheckoutModule } from './local-checkout-module-source.service';\nimport {\n describeAcquisition,\n lockEntryProvenance,\n moduleRequirementsOriginOf,\n stageModuleAcquisition,\n type ModuleAcquisition,\n} from './module-acquisition.utils';\nimport { checkModuleRequirements } from './module-requirements.service';\nimport { assertStagedManifestMatchesRequest } from './artifact-trust.utils';\n\n/** The operator log an install writes to. */\nexport type ModuleInstallLog = CommandContext['log'];\n\n/** A resolved, fetched module version, ready to install, and the registry credential that fetched it (if any). */\nexport interface AcquiredModule {\n readonly parsed: ParsedModuleSpec;\n readonly acquisition: ModuleAcquisition;\n /** The registry URL whose stored credential was used, so the caller can mark it used once the install succeeds. */\n readonly credentialUrl?: string;\n}\n\n/**\n * Resolve `parsed` to one version and fetch it. Inside a framework checkout, a `wildo/...` spec with no registry flag\n * is served by the checkout itself (#2015); anything else comes from the registry `registryFlag` resolves to.\n */\nexport async function acquireModuleForInstall(\n ctx: CommandContext,\n parsed: ParsedModuleSpec,\n /** `saasRoot` is the application whose registry configuration applies; absent before one exists (`wildo init`). */\n input: { readonly registryFlag?: string | undefined; readonly saasRoot?: string | undefined; readonly label: string },\n): Promise<AcquiredModule> {\n const localCheckoutRoot = localCheckoutRootFor(ctx, { domain: parsed.domain, ...(input.registryFlag === undefined ? {} : { registryFlag: input.registryFlag }) });\n if (localCheckoutRoot !== undefined) {\n const local = await resolveLocalCheckoutModule({ frameworkRoot: localCheckoutRoot, domain: parsed.domain, moduleId: parsed.moduleId, range: parsed.range });\n return { parsed, acquisition: { distribution: ModuleDistribution.LOCAL_CHECKOUT, version: local.version, local } };\n }\n const resolved = await resolveRegistryUrlForCommand(ctx, { ...(input.registryFlag === undefined ? {} : { flag: input.registryFlag }), ...(input.saasRoot === undefined ? {} : { saasRoot: input.saasRoot }) });\n ctx.log.info(`[${input.label}] resolving ${parsed.moduleId}@${parsed.range} on ${resolved.url} (${resolved.source})`);\n const credential = await RegistryCredentialsService.get(resolved.url);\n const clientOptions = { baseUrl: resolved.url, authToken: credential?.rawToken };\n // Resolve the range to one exact version and its digest.\n const { version, artifactDigest, yanked } = await RegistryServerClient.resolve(clientOptions, {\n domain: parsed.domain,\n moduleId: parsed.moduleId,\n range: parsed.range,\n });\n if (yanked) {\n // Only an exact pin reaches a yanked release (#1758); install it, but say so.\n ctx.log.warn(` ${parsed.moduleId}@${version} is YANKED (${yanked.yankedAt}${yanked.reason ? `: ${yanked.reason}` : ''}). Installing the pinned release; pick a live one with a range.`);\n }\n // Download the bytes, verified against the resolved digest (KD-9: a mismatch throws).\n const { bytes } = await RegistryServerClient.download(clientOptions, {\n domain: parsed.domain,\n moduleId: parsed.moduleId,\n version,\n expectedDigest: artifactDigest,\n });\n ctx.log.info(` downloaded → ${bytes.byteLength} bytes`);\n return {\n parsed,\n acquisition: {\n distribution: ModuleDistribution.REGISTRY,\n version,\n artifactDigest,\n bytes,\n registry: { url: resolved.url, id: resolved.id ?? DEFAULT_REGISTRY_ID },\n },\n ...(credential ? { credentialUrl: resolved.url } : {}),\n };\n}\n\n/** What an install did that its caller acts on afterwards. */\nexport interface ModuleInstallOutcome {\n readonly version: string;\n /** A provider module was installed: its packages must be installed before anything discovers them. */\n readonly changedProvider: boolean;\n /** The provider ships skills (#2026). */\n readonly carriesSkills: boolean;\n /** The install-script names this install newly allowed (#2801), rebuilt after `pnpm install`. */\n readonly allowedInstallScripts: readonly string[];\n /** The module's resource configuration files, for the migration obligation (#1757). */\n readonly resourceConfigurationFiles: readonly string[];\n /** The lockfile entry written. */\n readonly entry: RegistryModulesLockEntry;\n}\n\n/**\n * Install an acquired module into `saasRoot`, under the workspace mutation lock. Refuses a module that is already\n * installed (it moves only through `update`) and a blueprint (#2861). Throws, having rolled the files and the\n * registration back, when the lockfile cannot be written.\n */\nexport async function installAcquiredModule(input: {\n readonly saasRoot: string;\n readonly frameworkRoot: string | null;\n readonly acquired: AcquiredModule;\n /** Overwrite application files no module installed, keeping a backup (`wildo registry add --force`). */\n readonly force: boolean;\n readonly log: ModuleInstallLog;\n}): Promise<ModuleInstallOutcome> {\n const { saasRoot, acquired, log } = input;\n const { parsed, acquisition } = acquired;\n const version = acquisition.version;\n log.info(` resolved → ${describeAcquisition(parsed.moduleId, acquisition)}`);\n let outcome: ModuleInstallOutcome | undefined;\n await withRegistryWorkspaceMutationLock(saasRoot, async () => {\n // Decided before the lock (\"not installed\"); re-confirmed under it.\n await assertModuleEntryUnchangedUnderLock(saasRoot, parsed.moduleId, undefined);\n // Stage the version where the fan-out reads it (the extracted artifact, or the checkout copy).\n const paths = moduleArtifactPaths(saasRoot, parsed.domain, parsed.moduleId, version);\n const stagedCount = await stageModuleAcquisition(acquisition, paths, saasRoot);\n log.success(` staged ${stagedCount} file(s) → ${path.relative(saasRoot, paths.extractDir)}/`);\n\n // The staged manifest is the source of truth for the boundary allow-list (KD-12).\n const stagedManifest = await readStagedManifest(paths.extractDir);\n assertStagedManifestMatchesRequest(stagedManifest, { moduleId: parsed.moduleId, version });\n // #2861: a blueprint is applied by `wildo init --blueprint`, never installed into an existing application. Its\n // staged copy can never become an install, so it does not stay in the application's generated tree.\n if (stagedManifest.kind === ModuleKind.BLUEPRINT) {\n await fs.rm(paths.extractDir, { recursive: true, force: true });\n await fs.rm(paths.zip, { force: true });\n throw new Error(`${stagedManifest.id} is a blueprint: it starts a new application with \\`wildo init --blueprint\\` and is never installed into an existing one.`);\n }\n for (const notice of await checkModuleRequirements(saasRoot, stagedManifest, moduleRequirementsOriginOf(acquisition))) log.warn(notice);\n // #2014: a provider module is wired into THIS application's own runtimes. Derived before a single file is\n // written, so a refusal (no backend service to own a backend facet) leaves the application untouched.\n const providerRegistration = stagedManifest.kind === ModuleKind.PROVIDER ? await deriveProviderRegistration(saasRoot, stagedManifest) : undefined;\n // M9 backup dir: sibling to `extractDir` so the fan-out walker doesn't traverse it. Cleaned up after a\n // successful fan-out.\n await fs.rm(paths.backupDir, { recursive: true, force: true });\n // #2016: never silently replace a file the application authored itself.\n const writePlan = await planProtectedWrite({\n saasRoot,\n extractDir: paths.extractDir,\n moduleId: parsed.moduleId,\n stagedPaths: await validatedStagedAppFiles({ saasRoot, extractDir: paths.extractDir, manifest: stagedManifest }),\n force: input.force,\n restoreMissing: false,\n backupDirectory: registryForceBackupDirectory(saasRoot, parsed.moduleId),\n findOtherOwners: (candidates) => RegistryLockfileService.findFileOwners({ saasRoot, paths: candidates, excludeModuleId: parsed.moduleId }),\n });\n for (const forced of writePlan.forced) log.warn(` overwrote ${forced.path} (--force); the application's version is at ${path.relative(saasRoot, forced.backup)}`);\n const fanOut = await fanOutToSaasSource({\n saasRoot,\n extractDir: paths.extractDir,\n manifest: stagedManifest,\n moduleId: parsed.moduleId,\n backupDir: paths.backupDir,\n skipPaths: writePlan.skip,\n });\n log.success(` wrote ${fanOut.writtenFiles.length} app source file(s) per manifest.boundaries`);\n for (const warning of fanOut.overlapWarnings) {\n log.warn(` [overlap] \"${warning.path}\" was also claimed by \"${warning.otherModuleId}\" — overwritten by ${parsed.moduleId}.`);\n }\n\n // #1755: register the module in the host's registries (or mark why it is not).\n const registrationOutcome = registerModuleForInstall(saasRoot, input.frameworkRoot, stagedManifest, undefined, providerRegistration);\n reportRegistrationOutcome(log, registrationOutcome, saasRoot);\n\n // The lockfile entry; `files[]` records the application paths so `remove` can clean them up symmetrically. If its\n // write fails after the fan-out succeeded, the application source is rolled back so a half-applied install does\n // not leak into the repository.\n const entry: RegistryModulesLockEntry = {\n moduleId: parsed.moduleId,\n ...lockEntryProvenance(acquisition),\n domain: parsed.domain,\n version,\n requestedRange: parsed.range,\n installedAt: new Date().toISOString(),\n files: fanOut.ownedFiles,\n installedFileHashes: await nextInstalledFileHashes({ saasRoot, ownedFiles: fanOut.ownedFiles, skipped: writePlan.skip }),\n source: 'install',\n ...(registrationOutcome.registration ? { registration: registrationOutcome.registration } : {}),\n };\n try {\n await RegistryLockfileService.upsertEntry(saasRoot, entry);\n } catch (lockErr) {\n log.error(` lockfile write failed — rolling back ${fanOut.writtenFiles.length} fan-out file(s).`);\n // `rollbackFanOut` swallows per-file errors itself; this guard stays for a future change that lets them out.\n try {\n rollbackInstallRegistration(saasRoot, registrationOutcome.snapshots);\n await rollbackFanOut({ saasRoot, result: fanOut });\n } catch (rbErr) {\n log.error(` rollback failed: ${ErrorUtils.extractErrorMessage(rbErr)} — SaaS source may be in a partially-applied state.`);\n }\n // Drop the artifact dir and backup so the install can be retried cleanly. Each cleanup is best-effort: a cleanup\n // failure must never mask the lockfile error that is being surfaced.\n await fs.rm(paths.extractDir, { recursive: true, force: true }).catch(() => {});\n await fs.rm(paths.backupDir, { recursive: true, force: true }).catch(() => {});\n await fs.rm(paths.zip, { force: true }).catch(() => {});\n throw lockErr;\n }\n // Successful install: the backup is no longer needed once the lockfile records the new entry.\n await fs.rm(paths.backupDir, { recursive: true, force: true }).catch(() => {});\n log.success(' lockfile updated');\n if (registrationOutcome.registration) {\n log.success(` registered in the application's module registries (${registrationOutcome.registration.moduleId})`);\n }\n outcome = {\n version,\n changedProvider: providerRegistration !== undefined,\n carriesSkills: (stagedManifest.provider?.skills?.length ?? 0) > 0,\n allowedInstallScripts: registrationOutcome.allowedInstallScripts,\n resourceConfigurationFiles: await findResourceConfigurationFiles(saasRoot, fanOut.writtenFiles),\n entry,\n };\n });\n if (outcome === undefined) throw new Error(`The install of ${parsed.moduleId} finished without an outcome.`);\n return outcome;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-module-scaffold.service.d.ts","sourceRoot":"","sources":["../../../../src/services/registry/provider-module-scaffold.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAA2C,6BAA6B,EAAE,KAAK,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAGvJ,OAAO,EAQL,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACxB,MAAM,mEAAmE,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AAEvE,uDAAuD;AACvD,oBAAY,oBAAoB;IAC9B,mEAAmE;IACnE,OAAO,YAAY;IACnB,+EAA+E;IAC/E,MAAM,WAAW;CAClB;AAED,MAAM,WA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ACH,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,iBAAiB,CAAC,CAAC;CAC7E;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,UAAU,GAAG,eAAe,EAAE,CA8I5H;
|
|
1
|
+
{"version":3,"file":"provider-module-scaffold.service.d.ts","sourceRoot":"","sources":["../../../../src/services/registry/provider-module-scaffold.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAA2C,6BAA6B,EAAE,KAAK,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAGvJ,OAAO,EAQL,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACxB,MAAM,mEAAmE,CAAC;AAE3E;;;GAGG;AACH,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AAEvE,uDAAuD;AACvD,oBAAY,oBAAoB;IAC9B,mEAAmE;IACnE,OAAO,YAAY;IACnB,+EAA+E;IAC/E,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,sGAAsG;IACtG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,uGAAuG;IACvG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,+FAA+F;IAC/F,QAAQ,CAAC,YAAY,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,0BAA0B,CAAC;QAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,GAAG,iBAAi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AAE,CAAC,CAWhM;AAED,iHAAiH;AACjH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,qBAAqB,CA8D1F"}
|
|
@@ -509,6 +509,7 @@ function renderCompanionExports(input) {
|
|
|
509
509
|
* \`wildo registry add\` rewrites to the installing application's scope.
|
|
510
510
|
*/
|
|
511
511
|
import { describeProviderConnectionParameterNames, describeProviderVendorRegistrationSteps } from '@wildo-ai/external-connectors-models';
|
|
512
|
+
import { describeProviderProtocolSecretSlots } from '@wildo-ai/saas-models';
|
|
512
513
|
import type { ProviderCompanionContribution, RuntimeOwnerCompanionExports } from '@wildo-ai/saas-models';
|
|
513
514
|
import { ${name} } from './backend.exports.js';
|
|
514
515
|
|
|
@@ -529,6 +530,9 @@ export const providerContributions: ProviderCompanionContribution[] = [
|
|
|
529
530
|
engineCapabilities: [],
|
|
530
531
|
providerCapabilities: [],
|
|
531
532
|
protocols: module.protocols.map((binding) => binding.protocol),
|
|
533
|
+
// Which arm reads which secret (#2054), so \`wildo secrets\` attributes a slot only to a runtime whose scope enables an
|
|
534
|
+
// arm reading it (#3837).
|
|
535
|
+
protocolSecretSlots: describeProviderProtocolSecretSlots(module.secretsContract, module.protocols),
|
|
532
536
|
secretsContractShape: Object.entries(module.secretsContract)
|
|
533
537
|
.map(([slug, entry]) => ({ slug, envVarName: entry.envVarName, required: entry.required, description: entry.description }))
|
|
534
538
|
.sort((a, b) => a.slug.localeCompare(b.slug)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-module-scaffold.service.js","sourceRoot":"","sources":["../../../../src/services/registry/provider-module-scaffold.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,uCAAuC,EAAE,6BAA6B,EAA2B,MAAM,sCAAsC,CAAC;AACvJ,OAAO,EAAE,uCAAuC,EAAE,MAAM,uDAAuD,CAAC;AAChH,OAAO,EAAE,Y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CAAC","sourcesContent":["/**\n * A new provider module, written so it passes every mechanical check before any vendor knowledge is added (#2513).\n *\n * Until this, each module in `providers-registry/` was assembled by copying the previous one (asana, microsoft-teams\n * and azure-document-intelligence are about 600 lines each), and a module learned what the checks require by failing\n * them. Vendors now go through a production line twenty at a time (epic #2518), so the starting point has to be a\n * command, and the shape it writes has to be the one the checks enforce.\n *\n * ## What it writes\n *\n * The seven files every module has: `wildo.module.json`, the backend facet's `package.json` and `tsconfig.json`,\n * `backend.exports.ts`, `companion-exports.ts`, `operations.ts`, and the provider's skill. Two shapes:\n *\n * - **A provider of its own** (tier CATALOGUE): its identity, its REST contract (base URL, the credential slot, and\n * an OAuth2 block when the vendor uses one), its secrets contract, and a compliance profile stating plainly that\n * the vendor's legal facts are not researched yet (`UNDETERMINED`, #1744), so nothing reads as established.\n * - **An augmentation** of an engine provider (`--augments microsoft`, #2022): operations only, which run on the\n * base's connection, base URL and credential. The caller supplies the base's contract facts (`augmentsBase`).\n *\n * A module that fills an engine capability (tier EXTENSION) is not scaffolded yet: each capability has its own contract\n * arm (email, SMS, document extraction), and the scaffold gains each one when a vendor for it enters the line.\n *\n * ## Seeding operations from the vendor's description\n *\n * Given the vendor's OpenAPI description and the operations to start from, the scaffold writes those operations\n * from the description itself, relative to the base URL they will be sent under (the module's own, or the base's):\n * the server on that URL's host, the path with the base URL's path removed, query, header and path parameters with\n * their required flags (leaving out the headers the specification says to ignore and any parameter the contract\n * already sends), a JSON body whose fields are the described body's (inside its envelope when the described body is a\n * single wrapping object, as Asana's `data` is), and an input schema typed from the described primitives. So the\n * OpenAPI conformance check (#2028) passes on what was seeded, by construction.\n *\n * What the scaffold cannot model it refuses rather than drops: a body that is not a JSON object, a description on\n * another host, a path outside the base URL's, two seeds with one id, one name in two parameter locations. Those\n * operations are written by hand.\n *\n * ## What stays with the author\n *\n * Every decision about the vendor is marked where it is made. The ones a published module must not ship without\n * (what the module is for, its skill's trigger phrases, an operation's purpose the description does not give) carry\n * {@link PROVIDER_SCAFFOLD_PLACEHOLDER}, which publish refuses. The rest is marked in prose: which connections the\n * vendor admits, the input schemas' finer constraints, the compliance facts.\n */\nimport { describeProviderRestOperationHostDefect, ProviderRestParameterLocation, type ProviderRestOAuth2 } from '@wildo-ai/external-connectors-models';\nimport { providerOperationPathTemplateIsRelative } from '@wildo-ai/external-connectors-private/backend-runtime';\nimport { ProviderTier } from '@wildo-ai/saas-models';\nimport {\n appendUrlPath,\n contractSuppliedParameters,\n githubRawUrlBranch,\n OPENAPI_IGNORED_HEADER_PARAMETERS,\n serverReachesHost,\n urlHost,\n urlPath,\n type ContractSuppliedParameters,\n type OpenApiDescription,\n} from '~wildo-cli/services/registry/provider-openapi-conformance.service';\n\n/**\n * The marker a scaffold leaves where the author owes a sentence. Publish refuses a module that still carries one\n * (`providerModuleStructureRefusals`), so an unfinished module cannot ship its placeholder text into applications.\n */\nexport const PROVIDER_SCAFFOLD_PLACEHOLDER = 'TODO(provider-scaffold)';\n\n/** How the vendor authenticates the module's calls. */\nexport enum ProviderScaffoldAuth {\n /** A key or token pasted once: an application-owned connection. */\n API_KEY = 'api-key',\n /** An OAuth2 authorization-code grant: a person connects their own account. */\n OAUTH2 = 'oauth2',\n}\n\nexport interface ProviderScaffoldInput {\n /** The provider ref: one kebab-case segment, the module's directory and its package name's suffix. */\n readonly ref: string;\n /** The vendor identity, kebab-case like a ref. */\n readonly vendor: string;\n /** The vendor's display name, for prose (`Asana`). */\n readonly displayName: string;\n /** When set, the module is an augmentation of this engine provider and owns no contract of its own. */\n readonly augments?: string;\n /** For an augmentation: the base's REST base URL and what its contract sends on every call. */\n readonly augmentsBase?: { readonly baseUrl: string; readonly supplied: ContractSuppliedParameters; readonly oauth2?: Pick<ProviderRestOAuth2, 'audiences' | 'primaryAudience'> };\n readonly auth: ProviderScaffoldAuth;\n /** The REST base URL of a provider of its own. Seeded paths are written relative to it. */\n readonly baseUrl?: string;\n readonly apiKeyHeader?: string;\n readonly apiKeyPrefix?: string;\n readonly oauth2?: { readonly authorizeUrl: string; readonly tokenUrl: string; readonly scopes: readonly string[] };\n /** The engine version a new module starts from: its manifest's `engine.framework` is `^<this>`, verified at publish. */\n readonly engineVersion: string;\n readonly openApi?: { readonly url: string; readonly document: OpenApiDescription; readonly seed: readonly string[] };\n}\n\n/** The scaffold's output: file contents by path relative to the module directory. */\nexport type ProviderScaffoldFiles = ReadonlyMap<string, string>;\n\nconst MODULE_ID_PATTERN = /^[a-z][a-z0-9-]*$/;\nconst OPENAPI_METHODS = ['get', 'put', 'post', 'delete', 'patch'] as const;\nconst IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\n\n/** The parameter locations a description uses, mapped to the contract's vocabulary. */\nconst DESCRIBED_PARAMETER_LOCATIONS: Readonly<Record<string, ProviderRestParameterLocation>> = {\n path: ProviderRestParameterLocation.PATH,\n query: ProviderRestParameterLocation.QUERY,\n header: ProviderRestParameterLocation.HEADER,\n};\n\n/** `ASANA`, `MICROSOFT_TEAMS`: the prefix of every environment variable the module declares. */\nfunction envPrefix(ref: string): string {\n return ref.toUpperCase().replace(/-/g, '_');\n}\n\n/** `asana` → `Asana`, `microsoft-teams` → `MicrosoftTeams`: the stem of the module's exported names. */\nfunction pascal(ref: string): string {\n return ref.split('-').map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('');\n}\n\n/** A string literal for generated TypeScript: every character escaped, so no vendor text can break the file. */\nconst quote = (value: string) => JSON.stringify(value);\n\n/** An object key for generated TypeScript: bare when it is an identifier, quoted otherwise (`'conversations.list'`). */\nconst objectKey = (value: string) => (IDENTIFIER.test(value) ? value : quote(value));\n\n/** Text for a generated comment: one line, and never the sequence that would end the comment. */\nconst commentText = (value: string) => value.replace(/\\*\\//g, '* /').replace(/\\s+/g, ' ').trim();\n\n/** `getTasksForProject` → `get_tasks_for_project`: an operation id in the alphabet the checks admit (`[A-Za-z0-9_.-]`). */\nexport function operationIdFrom(openApiOperationId: string): string {\n return openApiOperationId\n .replace(/([a-z0-9])([A-Z])/g, '$1_$2')\n .replace(/[^A-Za-z0-9_.-]+/g, '_')\n .replace(/^_+|_+$/g, '')\n .toLowerCase();\n}\n\ninterface SeededParameter {\n readonly name: string;\n readonly in: ProviderRestParameterLocation;\n readonly required: boolean;\n readonly zod: string;\n readonly description?: string;\n}\n\ninterface SeededOperation {\n readonly operationId: string;\n readonly openApiOperationId: string;\n readonly method: string;\n readonly pathTemplate: string;\n /** The operation's own host, when the description serves it on another host of the base's token audience (#2546). */\n readonly host?: string;\n readonly summary?: string;\n readonly parameters: readonly SeededParameter[];\n readonly body?: { readonly envelope?: string; readonly fields: ReadonlyArray<{ name: string; required: boolean; zod: string; description?: string }> };\n}\n\ntype Schema = { $ref?: string; type?: string; description?: string; readOnly?: boolean; properties?: Record<string, Schema>; required?: string[]; allOf?: Schema[]; items?: Schema };\n\n/** A local `$ref`, followed to a fixed depth; anything it cannot follow answers undefined. */\nfunction deref<T extends { $ref?: string }>(document: OpenApiDescription, value: T | undefined, depth = 0): T | undefined {\n if (value?.$ref === undefined) return value;\n if (depth > 8 || !value.$ref.startsWith('#/')) return undefined;\n let target: unknown = document;\n for (const segment of value.$ref.slice(2).split('/')) target = (target as Record<string, unknown> | undefined)?.[segment.replace(/~1/g, '/').replace(/~0/g, '~')];\n return deref(document, target as T | undefined, depth + 1);\n}\n\n/** A described schema's properties and required list, `allOf` merged; undefined when it is not an object with properties. */\nfunction objectOf(document: OpenApiDescription, schema: Schema | undefined, depth = 0): { properties: Record<string, Schema>; required: Set<string> } | undefined {\n const resolved = deref(document, schema);\n if (resolved === undefined || depth > 8) return undefined;\n const properties: Record<string, Schema> = { ...(resolved.properties ?? {}) };\n const required = new Set(resolved.required ?? []);\n for (const member of resolved.allOf ?? []) {\n const inner = objectOf(document, member, depth + 1);\n if (inner === undefined) continue;\n Object.assign(properties, inner.properties);\n for (const name of inner.required) required.add(name);\n }\n return Object.keys(properties).length === 0 ? undefined : { properties, required };\n}\n\n/** The Zod expression for a described primitive; anything richer is left for the author as `z.unknown()`. */\nfunction zodFor(document: OpenApiDescription, schema: Schema | undefined): string {\n switch (deref(document, schema)?.type) {\n case 'string': return 'z.string()';\n case 'integer':\n case 'number': return 'z.number()';\n case 'boolean': return 'z.boolean()';\n case 'array': return 'z.array(z.unknown())';\n case 'object': return 'z.looseObject({})';\n default: return 'z.unknown()';\n }\n}\n\n/** The first line of a described text, for a `.describe()` or a summary. */\nconst firstLine = (text: string | undefined) => (text ? text.split('\\n')[0]!.trim() || undefined : undefined);\n\n/** Where the seeded operations will be sent: the base URL they are relative to, and what its contract sends itself. */\nexport interface SeedTarget {\n readonly baseUrl: string;\n readonly supplied: ContractSuppliedParameters;\n /**\n * The operations augment a base provider. The engine admits an augmentation's operation only as a `/…` path below\n * the base (`providerOperationPathTemplateIsRelative`), so one at the base path itself cannot be seeded for it.\n */\n readonly augmentation?: boolean;\n /**\n * The base's token audiences, when it declares them (#2546). A description served on ANOTHER host that the base URL's\n * own audience admits (Gmail's `gmail.googleapis.com` on google-drive's `www.googleapis.com`) is seeded with that host\n * on each operation, as the runtime sends it; a description on any other host is still refused.\n */\n readonly oauth2?: Pick<ProviderRestOAuth2, 'audiences' | 'primaryAudience'>;\n}\n\n/**\n * The described operations a seed names, by OpenAPI `operationId` or by `METHOD /path` as the description writes it,\n * written relative to `target.baseUrl`. Throws naming every seed that matches nothing, and every operation it cannot\n * model, so the scaffold never writes fewer, or different, operations than were asked for.\n */\nexport function seedOperations(document: OpenApiDescription, seeds: readonly string[], target: SeedTarget): SeededOperation[] {\n // The runtime appends a template after everything that follows the host, so a base URL carrying a query, a fragment\n // or a backslash could only send its operations somewhere other than the path it names.\n if (/[?#\\\\]/.test(target.baseUrl.replace(/^[a-z][a-z0-9+.-]*:\\/\\//i, ''))) {\n throw new Error(`The base URL ${target.baseUrl} carries a query, a fragment or a backslash; an operation's path would be appended after it. Use a plain base URL.`);\n }\n const baseHost = urlHost(target.baseUrl);\n const servers = (document.servers ?? []).map((server) => server.url).filter((url): url is string => typeof url === 'string');\n // Every server on the base URL's host may be dialled, as the conformance check reads them; an operation is seeded\n // under the first of them whose path its described path falls under.\n let serverPaths = servers.length === 0 ? [''] : servers.filter((url) => serverReachesHost(urlHost(url), baseHost)).map(urlPath);\n // The prefix the runtime puts before every template: the base URL's path without its trailing slash.\n let basePrefix = appendUrlPath(urlPath(target.baseUrl), '');\n let operationHost: string | undefined;\n if (serverPaths.length === 0 && target.oauth2 !== undefined) {\n // Another host of the base URL's own token audience: the operation names it, and its path is the server's path plus\n // the described path, with no base prefix (the runtime sends it to `https://<host><path>`).\n const onAudience = servers.filter((url) => {\n const host = urlHost(url);\n return /^https:\\/\\//i.test(url) && host !== undefined && describeProviderRestOperationHostDefect(host, { baseUrl: target.baseUrl, oauth2: target.oauth2! }) === undefined;\n });\n const hosts = [...new Set(onAudience.map((url) => urlHost(url)!))];\n if (hosts.length > 1) {\n throw new Error(`The description's servers are on ${hosts.join(' and ')}; an operation names one host, so seed from a description with one server.`);\n }\n if (hosts.length === 1) {\n operationHost = hosts[0];\n serverPaths = onAudience.map(urlPath);\n basePrefix = '';\n }\n }\n if (serverPaths.length === 0) {\n throw new Error(`The description's servers (${servers.join(', ')}) are not on ${baseHost ?? target.baseUrl}, the host these operations are sent to${target.oauth2 === undefined ? '' : ', nor on another host its token is valid on'}; it describes another API.`);\n }\n const suppliedHeaders = new Set(target.supplied.headers.map((name) => name.toLowerCase()));\n const suppliedQuery = new Set(target.supplied.query);\n\n const found: SeededOperation[] = [];\n const unmatched = new Set(seeds);\n for (const [path, rawItem] of Object.entries(document.paths ?? {})) {\n const item = rawItem as Record<string, unknown>;\n for (const method of OPENAPI_METHODS) {\n const operation = item[method] as { operationId?: string; summary?: string; parameters?: unknown[]; requestBody?: { $ref?: string; content?: Record<string, { schema?: Schema }> } } | undefined;\n if (operation === undefined) continue;\n const keys = [operation.operationId, `${method.toUpperCase()} ${path}`].filter((key): key is string => key !== undefined);\n const seed = keys.find((key) => unmatched.has(key));\n if (seed === undefined) continue;\n unmatched.delete(seed);\n\n // OpenAPI's join and the runtime's are the same append (`appendUrlPath`), so the template is what remains of the\n // described full path once the base's prefix is taken off: a trailing slash and a root `/` survive, and an\n // operation at the base path itself is the empty template the runtime appends as nothing.\n const fullPath = serverPaths.map((serverPath) => appendUrlPath(serverPath, path))\n .find((candidate) => candidate === basePrefix || candidate.startsWith(`${basePrefix}/`));\n if (fullPath === undefined) {\n throw new Error(`${seed}: ${serverPaths.map((serverPath) => appendUrlPath(serverPath, path)).join(' or ')} is not under ${basePrefix || '/'}, the base URL's path; the operation would be sent somewhere else.`);\n }\n const pathTemplate = fullPath.slice(basePrefix.length);\n // The engine's own rule for an augmentation's operation, so the scaffold never writes one a host would refuse.\n if (target.augmentation === true && !providerOperationPathTemplateIsRelative(pathTemplate)) {\n throw new Error(`${seed}: '${pathTemplate}' (from ${fullPath}) is not a plain '/…' path below the base, which an augmentation's operation must be, so a host would refuse it; write it on a provider of its own.`);\n }\n\n const byKey = new Map<string, SeededParameter>();\n for (const raw of [...((item.parameters as unknown[] | undefined) ?? []), ...(operation.parameters ?? [])]) {\n const parameter = deref(document, raw as { $ref?: string; name?: string; in?: string; required?: boolean; description?: string; schema?: Schema });\n const location = parameter?.in === undefined ? undefined : DESCRIBED_PARAMETER_LOCATIONS[parameter.in];\n if (parameter?.name === undefined || location === undefined) continue;\n // The transport sets these, and the contract sends its own credential and default headers on every call.\n if (location === ProviderRestParameterLocation.HEADER && (OPENAPI_IGNORED_HEADER_PARAMETERS.has(parameter.name.toLowerCase()) || suppliedHeaders.has(parameter.name.toLowerCase()))) continue;\n if (location === ProviderRestParameterLocation.QUERY && suppliedQuery.has(parameter.name)) continue;\n const description = firstLine(parameter.description);\n byKey.set(`${location} ${parameter.name}`, {\n name: parameter.name,\n in: location,\n required: location === ProviderRestParameterLocation.PATH || parameter.required === true,\n zod: zodFor(document, parameter.schema),\n ...(description === undefined ? {} : { description }),\n });\n }\n const parameters = [...byKey.values()];\n const sharedName = parameters.find((parameter, index) => parameters.findIndex((other) => other.name === parameter.name) !== index);\n if (sharedName !== undefined) {\n throw new Error(`${seed}: \"${sharedName.name}\" is a parameter in two locations, so one input cannot feed both; write this operation by hand.`);\n }\n\n let body: SeededOperation['body'];\n if (operation.requestBody !== undefined) {\n const content = deref(document, operation.requestBody)?.content;\n const jsonType = Object.keys(content ?? {}).find((type) => type === 'application/json' || type.endsWith('+json'));\n let described = jsonType === undefined ? undefined : objectOf(document, content![jsonType]?.schema);\n if (described === undefined) {\n throw new Error(`${seed}: its body (${Object.keys(content ?? {}).join(', ') || 'unreadable'}) is not a JSON object the scaffold can model; write this operation by hand.`);\n }\n let envelope: string | undefined;\n // A body that is one wrapping object (Asana's `data`) is sent through the contract's `envelope`, so the input\n // a person fills in stays flat.\n const names = Object.keys(described.properties);\n if (names.length === 1) {\n const inner = objectOf(document, described.properties[names[0]!]);\n if (inner !== undefined) {\n envelope = names[0];\n described = inner;\n }\n }\n const object = described;\n body = {\n ...(envelope === undefined ? {} : { envelope }),\n // A `readOnly` property is one the vendor answers with and does not take, so it is no field a person fills in.\n // OpenAPI 3.0.3 says it \"MAY be sent as part of a response but SHOULD NOT be sent as part of the request\".\n // spec-cite: OpenAPI Specification 3.0.3, Schema Object, fixed field `readOnly`.\n fields: Object.entries(object.properties).filter(([, schema]) => deref(document, schema)?.readOnly !== true).map(([name, schema]) => {\n const description = firstLine(deref(document, schema)?.description);\n return { name, required: object.required.has(name), zod: zodFor(document, schema), ...(description === undefined ? {} : { description }) };\n }),\n };\n }\n const collision = body?.fields.find((field) => parameters.some((parameter) => parameter.name === field.name));\n if (collision !== undefined) {\n throw new Error(`${seed}: body field \"${collision.name}\" has the name of a parameter, so one input cannot feed both; write this operation by hand.`);\n }\n const operationId = operationIdFrom(operation.operationId ?? `${method}_${path}`);\n if (found.some((other) => other.operationId === operationId)) {\n throw new Error(`${seed}: its operation id would be \"${operationId}\", which another seed already has; seed one of them and write the other by hand.`);\n }\n const summary = firstLine(operation.summary);\n found.push({\n operationId,\n openApiOperationId: seed,\n method: method.toUpperCase(),\n pathTemplate,\n ...(operationHost === undefined ? {} : { host: operationHost }),\n ...(summary === undefined ? {} : { summary }),\n parameters,\n ...(body === undefined ? {} : { body }),\n });\n }\n }\n if (unmatched.size > 0) {\n throw new Error(`No described operation matches ${[...unmatched].map((seed) => `\"${seed}\"`).join(', ')}: seed by the description's operationId or by \"METHOD /path\" as it writes the path.`);\n }\n return found;\n}\n\n/** The contract enum member a seeded parameter location is written as. */\nconst LOCATION_MEMBER: Readonly<Record<ProviderRestParameterLocation, string>> = {\n [ProviderRestParameterLocation.PATH]: 'PATH',\n [ProviderRestParameterLocation.QUERY]: 'QUERY',\n [ProviderRestParameterLocation.HEADER]: 'HEADER',\n};\n\n/** One seeded operation as `ProviderRestOperation` source. */\nfunction renderOperation(operation: SeededOperation): string {\n const read = operation.method === 'GET';\n const fieldLine = (name: string, zod: string, required: boolean, description?: string) =>\n ` ${objectKey(name)}: ${zod}${description ? `.describe(${quote(description)})` : ''}${required ? '' : '.optional()'},`;\n const inputLines = [\n ...operation.parameters.map((parameter) => fieldLine(parameter.name, parameter.zod, parameter.required, parameter.description)),\n ...(operation.body?.fields ?? []).map((field) => fieldLine(field.name, field.zod, field.required, field.description)),\n ];\n return [\n ` ${objectKey(operation.operationId)}: {`,\n ` operationId: ${quote(operation.operationId)},`,\n ` domain: 'default',`,\n ` method: API_HttpMethod.${operation.method},`,\n ` pathTemplate: ${quote(operation.pathTemplate)},`,\n ...(operation.host === undefined ? [] : [` host: ${quote(operation.host)},`]),\n ` classification: ExternalOperation_Classification.${read ? 'READ' : 'WRITE'},`,\n ` summary: ${quote(operation.summary ?? `${PROVIDER_SCAFFOLD_PLACEHOLDER}: what this operation is for.`)},`,\n ` parameters: [`,\n ...operation.parameters.map((parameter) =>\n ` { name: ${quote(parameter.name)}, in: ProviderRestParameterLocation.${LOCATION_MEMBER[parameter.in]}${parameter.required && parameter.in !== ProviderRestParameterLocation.PATH ? ', required: true' : ''} },`),\n ` ],`,\n ...(operation.body === undefined\n ? []\n : [` requestBody: { encoding: ProviderRestRequestBodyEncoding.JSON${operation.body.envelope ? `, envelope: ${quote(operation.body.envelope)}` : ''} },`]),\n ` inputSchema: z.looseObject({`,\n ...inputLines.map((line) => ` ${line}`),\n ` }),`,\n ` },`,\n ].join('\\n');\n}\n\nfunction renderOperations(input: ProviderScaffoldInput, operations: readonly SeededOperation[]): string {\n // Only what the seeded operations use: an unused import is noise an author would have to work out is safe to remove.\n const modelImports = operations.length === 0\n ? []\n : [\n 'API_HttpMethod',\n 'ExternalOperation_Classification',\n ...(operations.some((operation) => operation.parameters.length > 0) ? ['ProviderRestParameterLocation'] : []),\n ...(operations.some((operation) => operation.body !== undefined) ? ['ProviderRestRequestBodyEncoding'] : []),\n ];\n const imports = [\n ...(operations.length === 0 ? [] : [\"import { z } from 'zod';\", '']),\n `import { ${[...modelImports, 'type ProviderRestOperationCatalogue'].join(', ')} } from '@wildo-ai/external-connectors-models';`,\n '',\n ].join('\\n');\n const seededFrom = input.openApi === undefined\n ? ' * No operation yet. Seed them from the vendor\\'s description (`wildo providers new --openapi <url> --seed <operationId>`), or write\\n * each one here, choosing 10 to 20 by the use case they serve rather than everything the vendor publishes.'\n : ` * Seeded from ${commentText(input.openApi.url)}:\\n${operations.map((operation) => ` * - \\`${commentText(operation.operationId)}\\` ← ${commentText(operation.openApiOperationId)}`).join('\\n')}\\n *\\n * Each one is what the description says. Refine its input schema (formats, enums, which fields a person fills in) and\\n * keep it conformant: publish checks every operation against the description pinned in wildo.module.json.`;\n return `/**\n * ${commentText(input.displayName)}'s operations: the catalogue this provider executes.\n *\n${seededFrom}\n *\n * This file is the application's own once installed: edit it like any other source. \\`wildo registry update\\` keeps a\n * file you changed and says so.\n */\n\n${imports}\nexport const catalogue: ProviderRestOperationCatalogue = {\n domains: ['default'],\n operations: {\n${operations.map(renderOperation).join('\\n')}\n },\n};\n`;\n}\n\nfunction renderProviderExports(input: ProviderScaffoldInput): string {\n const name = `${pascal(input.ref)}BackendProvider`;\n const prefix = envPrefix(input.ref);\n const oauth2 = input.auth === ProviderScaffoldAuth.OAUTH2 ? input.oauth2 : undefined;\n const connections = oauth2 === undefined\n ? [\n ' // A pasted key is the application\\'s own account. Admit more only once the vendor\\'s model is known (#1047).',\n ' { ownerScope: ExternalProvider_Connection_OwnerScope.APPLICATION, delegation: ExternalProvider_Connection_DelegationMode.SERVICE },',\n ]\n : [\n ' // Decide which accounts this vendor\\'s calls may spend: these are the three asana admits (#333).',\n ' { ownerScope: ExternalProvider_Connection_OwnerScope.APPLICATION, delegation: ExternalProvider_Connection_DelegationMode.SERVICE },',\n ' { ownerScope: ExternalProvider_Connection_OwnerScope.ORGANIZATION, delegation: ExternalProvider_Connection_DelegationMode.USER },',\n ' { ownerScope: ExternalProvider_Connection_OwnerScope.USER, delegation: ExternalProvider_Connection_DelegationMode.SERVICE },',\n ];\n const tokenVar = `${prefix}_${oauth2 === undefined ? 'API_KEY' : 'ACCESS_TOKEN'}`;\n const secrets = [\n ...(oauth2 === undefined ? [] : [\n ` clientId: { envVarName: ${quote(`${prefix}_CLIENT_ID`)}, required: true, description: ${quote(`OAuth2 client id for the application's ${input.displayName} registration.`)} },`,\n ` clientSecret: { envVarName: ${quote(`${prefix}_CLIENT_SECRET`)}, required: true, description: ${quote(`OAuth2 client secret for the application's ${input.displayName} registration.`)} },`,\n ]),\n oauth2 === undefined\n ? ` apiKey: { envVarName: ${quote(tokenVar)}, required: true, description: ${quote(`API key for ${input.displayName}.`)} },`\n : ` accessToken: { envVarName: ${quote(tokenVar)}, required: false, description: ${quote(`Access token for ${input.displayName}. Minted by the OAuth2 exchange, not authored.`)} },`,\n ];\n return `/**\n * ${commentText(input.displayName)}, as a provider an application owns.\n *\n * Scaffolded by \\`wildo providers new\\` (#2513). What is still to decide is marked where it is decided: the connections\n * the vendor admits, and its compliance facts, which stay UNDETERMINED until researched with a source and a date.\n *\n * \\`packageName\\` is this package's own name; \\`wildo registry add\\` rewrites it to the installing application's scope.\n */\n\nimport {\n ExternalProvider_Connection_DelegationMode,\n ExternalProvider_Connection_OwnerScope,\n ProviderProtocolRuntimeKind,\n} from '@wildo-ai/external-connectors-models';\nimport { defineProviderMetadata, ProviderComplianceDetermination, ProviderOriginKind, ProviderTier } from '@wildo-ai/saas-models';\nimport type { BackendProviderModule, BackendProviderRegistryFragment, ProviderRef } from '@wildo-ai/external-connectors-private/backend';\n\nexport const ${name}: BackendProviderModule = {\n metadata: defineProviderMetadata({\n ref: ${quote(input.ref)},\n packageName: ${quote(`@wildo-ai/provider-${input.ref}`)},\n tier: ProviderTier.CATALOGUE,\n vendor: ${quote(input.vendor)},\n origin: { kind: ProviderOriginKind.APPLICATION },\n }),\n complianceProfile: {\n determination: ProviderComplianceDetermination.UNDETERMINED,\n reason: ${quote(`${input.displayName}'s legal facts are not researched yet: they are recorded with a source and a date before the module is proven.`)},\n },\n providerCapabilities: [],\n admissibleConnections: [\n${connections.join('\\n')}\n ],\n secretsContract: {\n${secrets.join('\\n')}\n },\n protocols: [\n {\n // The MEMBER NAME, not the enum value: \\`composeBackendProviders\\` indexes the enum BY this string.\n protocol: 'REST_API',\n runtimeContract: {\n kind: ProviderProtocolRuntimeKind.REST,\n baseUrl: ${quote(input.baseUrl ?? '')},\n${oauth2 === undefined ? '' : ` oauth2: {\n authorizeUrl: ${quote(oauth2.authorizeUrl)},\n tokenUrl: ${quote(oauth2.tokenUrl)},\n scopes: ${JSON.stringify(oauth2.scopes)},\n clientIdSecretRef: ${quote(`${prefix}_CLIENT_ID`)},\n clientSecretSecretRef: ${quote(`${prefix}_CLIENT_SECRET`)},\n },\n`} apiKey: { secretRef: ${quote(tokenVar)}, headerName: ${quote(input.apiKeyHeader ?? 'Authorization')}, prefix: ${quote(input.apiKeyPrefix ?? 'Bearer ')} },\n operations: async () => (await import('./operations.js')).catalogue,\n },\n },\n ],\n};\n\n/** The conventional export a host loads a provider package by. */\nexport const backendProviderFragment: BackendProviderRegistryFragment = {\n modules: new Map([[${name}.metadata.ref as ProviderRef, ${name}]]),\n};\n`;\n}\n\nfunction renderAugmentationExports(input: ProviderScaffoldInput, operations: readonly SeededOperation[]): string {\n const ids = operations.map((operation) => operation.operationId).sort();\n return `/**\n * ${commentText(input.displayName)}: operations added to the engine's \\`${input.augments}\\` provider (#2022).\n *\n * Scaffolded by \\`wildo providers new --augments ${input.augments}\\` (#2513). An augmentation owns nothing but operations:\n * they run on the base's connection, base URL and credential, and an application opts in under\n * \\`providers.augmentations.${input.augments}\\`.\n */\n\nimport type { ProviderAugmentation } from '@wildo-ai/external-connectors-private/backend-runtime';\nimport { ProviderOriginKind, ProviderTier } from '@wildo-ai/saas-models';\n\n/** The engine provider these operations are added to. */\nexport const AUGMENTED_PROVIDER_REF = ${quote(input.augments!)};\n\n/** Every operation id this adds, stated statically because the catalogue is lazy. Sorted, unique, non-empty. */\nconst OPERATION_IDS = ${JSON.stringify(ids)};\n\n/**\n * A plain value, typed through a TYPE import: \\`defineProviderAugmentation\\`'s package is not one a provider module may\n * load at boot (\\`check:provider-module-eager-graph\\`). Publish and every host check it through \\`readProviderAugmentations\\`.\n */\nconst augmentation: ProviderAugmentation = {\n augments: AUGMENTED_PROVIDER_REF,\n metadata: { packageName: ${quote(`@wildo-ai/provider-${input.ref}`)}, tier: ProviderTier.CATALOGUE, origin: { kind: ProviderOriginKind.APPLICATION } },\n operationIds: OPERATION_IDS,\n operations: async (domain) => (domain === undefined || domain === 'default' ? (await import('./operations.js')).catalogue : { domains: [], operations: {} }),\n reason: ${quote(`Adds ${input.displayName} operations to ${input.augments}.`)},\n};\n\nexport const providerAugmentations = new Map([[AUGMENTED_PROVIDER_REF, augmentation]]);\n`;\n}\n\nfunction renderAugmentationCompanionExports(input: ProviderScaffoldInput): string {\n return `/**\n * What discovery reads about this augmentation without executing an operation (#1672, #2022). A separate record from a\n * provider contribution: an augmentation owns no ref, secrets or connection. Every field is derived from the\n * augmentation; the one literal is \\`runtimeImportPath\\`, which \\`wildo registry add\\` rewrites.\n */\nimport type { ProviderAugmentationContribution, RuntimeOwnerCompanionExports } from '@wildo-ai/saas-models';\nimport { AUGMENTED_PROVIDER_REF, providerAugmentations as augmentationsByBase } from './backend.exports.js';\n\nconst augmentation = augmentationsByBase.get(AUGMENTED_PROVIDER_REF)!;\n\nexport const providerAugmentations: ProviderAugmentationContribution[] = [\n {\n augments: augmentation.augments,\n packageName: augmentation.metadata.packageName,\n tier: augmentation.metadata.tier,\n origin: augmentation.metadata.origin,\n runtimeImportPath: ${quote(`@wildo-ai/provider-${input.ref}/backend`)},\n operationIds: [...augmentation.operationIds],\n requiredScopes: [...(augmentation.requiredScopes ?? [])],\n },\n];\n\nconst companionExports: RuntimeOwnerCompanionExports = { providerAugmentations };\n\nexport default companionExports;\n`;\n}\n\nfunction renderCompanionExports(input: ProviderScaffoldInput): string {\n const name = `${pascal(input.ref)}BackendProvider`;\n return `/**\n * What discovery reads about ${commentText(input.displayName)} without executing an operation. Every field is derived from the\n * module, so the declaration cannot drift from what the runtime loads; the one literal is \\`runtimeImportPath\\`, which\n * \\`wildo registry add\\` rewrites to the installing application's scope.\n */\nimport { describeProviderConnectionParameterNames, describeProviderVendorRegistrationSteps } from '@wildo-ai/external-connectors-models';\nimport type { ProviderCompanionContribution, RuntimeOwnerCompanionExports } from '@wildo-ai/saas-models';\nimport { ${name} } from './backend.exports.js';\n\nconst module = ${name};\n\n/** What the connect form asks a person for (which tenant, which subdomain), so the labelling pipeline plans its words. */\nconst connectionParameterNames = describeProviderConnectionParameterNames(module.protocols);\n\n/** The vendor registration's steps, once the module declares one, so the labelling pipeline plans their words (#3252). */\nconst vendorRegistrationSteps = describeProviderVendorRegistrationSteps(module.vendorRegistration);\n\nexport const providerContributions: ProviderCompanionContribution[] = [\n {\n ref: module.metadata.ref,\n identity: { packageName: module.metadata.packageName, tier: module.metadata.tier, vendor: module.metadata.vendor, origin: module.metadata.origin },\n runtimeImportPath: ${quote(`@wildo-ai/provider-${input.ref}/backend`)},\n runtimeTargets: [{ kind: 'backend' }],\n engineCapabilities: [],\n providerCapabilities: [],\n protocols: module.protocols.map((binding) => binding.protocol),\n secretsContractShape: Object.entries(module.secretsContract)\n .map(([slug, entry]) => ({ slug, envVarName: entry.envVarName, required: entry.required, description: entry.description }))\n .sort((a, b) => a.slug.localeCompare(b.slug)),\n ...(connectionParameterNames === undefined ? {} : { connectionParameterNames }),\n ...(vendorRegistrationSteps === undefined ? {} : { vendorRegistrationSteps }),\n ...(module.complianceProfile === undefined ? {} : { complianceProfile: module.complianceProfile }),\n },\n];\n\nconst companionExports: RuntimeOwnerCompanionExports = { providerContributions };\n\nexport default companionExports;\n`;\n}\n\nfunction renderSkill(input: ProviderScaffoldInput, operations: readonly SeededOperation[]): string {\n const how = input.augments === undefined\n ? `a REST provider addressed by the ref \\`${input.ref}\\``\n : `operations added to the engine's \\`${input.augments}\\` provider, running on its connection`;\n // YAML double-quoted scalars accept JSON string syntax, so a display name holding `: ` or quotes cannot break the frontmatter.\n const description = quote(`Use when the application calls ${input.displayName} through the installed ${input.ref} provider. ${PROVIDER_SCAFFOLD_PLACEHOLDER}: the phrases a developer would say, quoted.`);\n return `---\nname: provider-${input.ref}\ndescription: ${description}\n---\n\n# ${commentText(input.displayName)} (registry provider)\n\nThis provider is the application's own copy of ${commentText(input.displayName)}: ${how}.\n\n## App Paths\n\n| What | Where |\n|---|---|\n| The installed package | \\`providers/${input.ref}/backend/\\` (\\`@<app-scope>/provider-${input.ref}\\`) |\n| The operations, editable | \\`providers/${input.ref}/backend/src/operations.ts\\` |\n| The provider declaration | \\`wildo.saas.config.ts\\` → ${input.augments === undefined ? `\\`providers.scopes.backend.providers.${input.ref}\\` (\\`protocols: ['REST_API']\\`)` : `\\`providers.augmentations.${input.augments}\\``} |\n\n## Operations\n\n${operations.length === 0 ? 'None yet.' : operations.map((operation) => `- \\`${operation.operationId}\\` — ${commentText(operation.summary ?? `${PROVIDER_SCAFFOLD_PLACEHOLDER}: what it is for`)}`).join('\\n')}\n\n## Verification\n\n- \\`wildo providers show ${input.augments ?? input.ref}\\` lists the operations above.\n`;\n}\n\nfunction renderPackageJson(input: ProviderScaffoldInput): string {\n const exportsMap: Record<string, Record<string, string>> = {\n './backend': { source: './src/backend.exports.ts', types: './dist/backend.exports.d.ts', import: './dist/backend.exports.js', default: './dist/backend.exports.js' },\n './companion': { source: './src/companion-exports.ts', types: './dist/companion-exports.d.ts', import: './dist/companion-exports.js', default: './dist/companion-exports.js' },\n };\n return `${JSON.stringify({\n name: `@wildo-ai/provider-${input.ref}`,\n version: '1.0.0',\n description: `${input.displayName} provider, backend facet. Installed into an application with \\`wildo registry add wildo/providers/${input.ref}\\`.`,\n license: 'UNLICENSED',\n private: true,\n type: 'module',\n exports: exportsMap,\n scripts: { build: 'tsc -p tsconfig.json', dev: 'tsc -p tsconfig.json --watch --preserveWatchOutput' },\n dependencies: { '@wildo-ai/external-connectors-models': '*', '@wildo-ai/external-connectors-private': '*', '@wildo-ai/saas-models': '*', zod: '*' },\n devDependencies: { typescript: '*' },\n }, null, 2)}\\n`;\n}\n\nconst TSCONFIG = `${JSON.stringify({\n '//': 'Self-contained on purpose: the same file builds this facet in the framework checkout and in every application it is installed into, so it extends nothing either place may lack.',\n compilerOptions: {\n target: 'ES2022', lib: ['ES2022'], module: 'preserve', moduleResolution: 'bundler', strict: true, isolatedModules: true, esModuleInterop: true,\n skipLibCheck: true, forceConsistentCasingInFileNames: true, noEmitOnError: true, declaration: true, rootDir: 'src', outDir: 'dist',\n },\n include: ['src/**/*'],\n exclude: ['node_modules', 'dist'],\n}, null, 2)}\\n`;\n\n/**\n * The REST contract facts of the engine provider an augmentation adds to: the base URL its operations are sent under,\n * and what that contract sends on every call. Read from the engine's own module, so the seeded paths are relative to\n * the URL the runtime really dials.\n */\nexport async function engineBaseContract(baseRef: string): Promise<{ baseUrl: string; supplied: ContractSuppliedParameters; oauth2?: Pick<ProviderRestOAuth2, 'audiences' | 'primaryAudience'> }> {\n const { ENGINE_BACKEND_PROVIDER_LOADERS } = await import('@wildo-ai/external-connectors-private/backend-runtime');\n const { ProviderProtocolRuntimeKind } = await import('@wildo-ai/external-connectors-models');\n const load = [...ENGINE_BACKEND_PROVIDER_LOADERS.entries()].find(([ref]) => ref === baseRef)?.[1];\n if (load === undefined) throw new Error(`\"${baseRef}\" is not a provider the engine ships; an augmentation is scaffolded against an engine provider.`);\n const contract = (await load()).protocols.find((binding) => binding.runtimeContract.kind === ProviderProtocolRuntimeKind.REST)?.runtimeContract;\n const baseUrl = (contract as { baseUrl?: unknown } | undefined)?.baseUrl;\n if (typeof baseUrl !== 'string') throw new Error(`\"${baseRef}\" declares no REST base URL, so its operations have nothing to be relative to.`);\n // The token audiences (#2546): which other hosts an operation of this base may name, Gmail's on google-drive.\n const oauth2 = (contract as { oauth2?: Pick<ProviderRestOAuth2, 'audiences' | 'primaryAudience'> } | undefined)?.oauth2;\n return { baseUrl, supplied: contractSuppliedParameters(contract), ...(oauth2?.audiences === undefined ? {} : { oauth2: { audiences: oauth2.audiences, primaryAudience: oauth2.primaryAudience } }) };\n}\n\n/** Every file of a new module, by path relative to its directory. Pure: the command writes what this returns. */\nexport function scaffoldProviderModule(input: ProviderScaffoldInput): ProviderScaffoldFiles {\n for (const [label, value] of [['provider ref', input.ref], ['vendor', input.vendor], ...(input.augments === undefined ? [] : [['augmented provider', input.augments]])] as const) {\n if (!MODULE_ID_PATTERN.test(value)) throw new Error(`\"${value}\" is not a ${label}: one kebab-case segment, starting with a letter.`);\n }\n if (input.augments !== undefined && input.augmentsBase === undefined) {\n throw new Error(`An augmentation is written against its base's contract, and \"${input.augments}\"'s was not supplied.`);\n }\n if (input.augments === undefined && (input.baseUrl === undefined || !/^https:\\/\\//.test(input.baseUrl))) {\n throw new Error('A provider of its own needs its REST base URL (https).');\n }\n if (input.baseUrl !== undefined && /[?#\\\\]/.test(input.baseUrl.replace(/^https:\\/\\//, ''))) {\n throw new Error(`The base URL ${input.baseUrl} carries a query, a fragment or a backslash; every operation's path would be appended after it. Use a plain base URL.`);\n }\n if (input.auth === ProviderScaffoldAuth.OAUTH2 && input.augments === undefined && input.oauth2 === undefined) {\n throw new Error('An OAuth2 provider needs its authorize URL, token URL and scopes.');\n }\n if (input.openApi !== undefined) {\n // The same two refusals publish makes, before seeding: what publish would refuse is not a starting point.\n const version = input.openApi.document.openapi;\n if (version === undefined || !String(version).startsWith('3.')) {\n throw new Error(`${input.openApi.url} is ${input.openApi.document.swagger !== undefined ? `Swagger ${input.openApi.document.swagger}` : 'not an OpenAPI 3 document'}; seed from the vendor's OpenAPI 3 description.`);\n }\n const branch = githubRawUrlBranch(input.openApi.url);\n if (branch !== undefined) throw new Error(`${input.openApi.url} reads the branch \"${branch}\", which moves; pin it to a commit.`);\n }\n const target: SeedTarget = input.augmentsBase !== undefined ? { ...input.augmentsBase, augmentation: true } : { baseUrl: input.baseUrl!, supplied: { headers: [input.apiKeyHeader ?? 'Authorization'], query: [] } };\n const operations = input.openApi === undefined ? [] : seedOperations(input.openApi.document, input.openApi.seed, target);\n if (input.augments !== undefined && operations.length === 0) {\n throw new Error('An augmentation adds operations and nothing else, so it starts from at least one: seed it from the vendor\\'s description.');\n }\n const revision = input.openApi?.document.info?.version;\n if (input.openApi !== undefined && revision === undefined) {\n throw new Error(`${input.openApi.url} states no info.version, so the module cannot pin the revision it is checked against.`);\n }\n const manifest = {\n id: `providers/${input.ref}`,\n version: '1.0.0',\n kind: 'provider',\n description: `${input.displayName}: ${PROVIDER_SCAFFOLD_PLACEHOLDER}: what an application uses it for.`,\n boundaries: { providers: [`providers/${input.ref}`] },\n engine: { framework: `^${input.engineVersion}` },\n provider: {\n ref: input.ref,\n tier: ProviderTier.CATALOGUE,\n vendor: input.vendor,\n providerCapabilities: [],\n facets: { backend: {} },\n maturity: 'adopted',\n ...(input.openApi === undefined ? {} : { openApi: { url: input.openApi.url, revision: String(revision) } }),\n ...(input.augments === undefined ? {} : { augments: input.augments }),\n skills: [`provider-${input.ref}`],\n },\n };\n return new Map<string, string>([\n ['wildo.module.json', `${JSON.stringify(manifest, null, 2)}\\n`],\n ['backend/package.json', renderPackageJson(input)],\n ['backend/tsconfig.json', TSCONFIG],\n ['backend/src/operations.ts', renderOperations(input, operations)],\n ['backend/src/backend.exports.ts', input.augments === undefined ? renderProviderExports(input) : renderAugmentationExports(input, operations)],\n ['backend/src/companion-exports.ts', input.augments === undefined ? renderCompanionExports(input) : renderAugmentationCompanionExports(input)],\n [`skills/provider-${input.ref}/SKILL.md`, renderSkill(input, operations)],\n ]);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"provider-module-scaffold.service.js","sourceRoot":"","sources":["../../../../src/services/registry/provider-module-scaffold.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,uCAAuC,EAAE,6BAA6B,EAA2B,MAAM,sCAAsC,CAAC;AACvJ,OAAO,EAAE,uCAAuC,EAAE,MAAM,uDAAuD,CAAC;AAChH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,kBAAkB,EAClB,iCAAiC,EACjC,iBAAiB,EACjB,OAAO,EACP,OAAO,GAGR,MAAM,mEAAmE,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,yBAAyB,CAAC;AAEvE,uDAAuD;AACvD,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,mEAAmE;IACnE,2CAAmB,CAAA;IACnB,+EAA+E;IAC/E,yCAAiB,CAAA;AACnB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B;AA2BD,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAC9C,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAC3E,MAAM,UAAU,GAAG,4BAA4B,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AAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QAC/D,CAAC,sBAAsB,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAClD,CAAC,uBAAuB,EAAE,QAAQ,CAAC;QACnC,CAAC,2BAA2B,EAAE,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAClE,CAAC,gCAAgC,EAAE,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC9I,CAAC,kCAAkC,EAAE,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,kCAAkC,CAAC,KAAK,CAAC,CAAC;QAC9I,CAAC,mBAAmB,KAAK,CAAC,GAAG,WAAW,EAAE,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;KAC1E,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * A new provider module, written so it passes every mechanical check before any vendor knowledge is added (#2513).\n *\n * Until this, each module in `providers-registry/` was assembled by copying the previous one (asana, microsoft-teams\n * and azure-document-intelligence are about 600 lines each), and a module learned what the checks require by failing\n * them. Vendors now go through a production line twenty at a time (epic #2518), so the starting point has to be a\n * command, and the shape it writes has to be the one the checks enforce.\n *\n * ## What it writes\n *\n * The seven files every module has: `wildo.module.json`, the backend facet's `package.json` and `tsconfig.json`,\n * `backend.exports.ts`, `companion-exports.ts`, `operations.ts`, and the provider's skill. Two shapes:\n *\n * - **A provider of its own** (tier CATALOGUE): its identity, its REST contract (base URL, the credential slot, and\n * an OAuth2 block when the vendor uses one), its secrets contract, and a compliance profile stating plainly that\n * the vendor's legal facts are not researched yet (`UNDETERMINED`, #1744), so nothing reads as established.\n * - **An augmentation** of an engine provider (`--augments microsoft`, #2022): operations only, which run on the\n * base's connection, base URL and credential. The caller supplies the base's contract facts (`augmentsBase`).\n *\n * A module that fills an engine capability (tier EXTENSION) is not scaffolded yet: each capability has its own contract\n * arm (email, SMS, document extraction), and the scaffold gains each one when a vendor for it enters the line.\n *\n * ## Seeding operations from the vendor's description\n *\n * Given the vendor's OpenAPI description and the operations to start from, the scaffold writes those operations\n * from the description itself, relative to the base URL they will be sent under (the module's own, or the base's):\n * the server on that URL's host, the path with the base URL's path removed, query, header and path parameters with\n * their required flags (leaving out the headers the specification says to ignore and any parameter the contract\n * already sends), a JSON body whose fields are the described body's (inside its envelope when the described body is a\n * single wrapping object, as Asana's `data` is), and an input schema typed from the described primitives. So the\n * OpenAPI conformance check (#2028) passes on what was seeded, by construction.\n *\n * What the scaffold cannot model it refuses rather than drops: a body that is not a JSON object, a description on\n * another host, a path outside the base URL's, two seeds with one id, one name in two parameter locations. Those\n * operations are written by hand.\n *\n * ## What stays with the author\n *\n * Every decision about the vendor is marked where it is made. The ones a published module must not ship without\n * (what the module is for, its skill's trigger phrases, an operation's purpose the description does not give) carry\n * {@link PROVIDER_SCAFFOLD_PLACEHOLDER}, which publish refuses. The rest is marked in prose: which connections the\n * vendor admits, the input schemas' finer constraints, the compliance facts.\n */\nimport { describeProviderRestOperationHostDefect, ProviderRestParameterLocation, type ProviderRestOAuth2 } from '@wildo-ai/external-connectors-models';\nimport { providerOperationPathTemplateIsRelative } from '@wildo-ai/external-connectors-private/backend-runtime';\nimport { ProviderTier } from '@wildo-ai/saas-models';\nimport {\n appendUrlPath,\n contractSuppliedParameters,\n githubRawUrlBranch,\n OPENAPI_IGNORED_HEADER_PARAMETERS,\n serverReachesHost,\n urlHost,\n urlPath,\n type ContractSuppliedParameters,\n type OpenApiDescription,\n} from '~wildo-cli/services/registry/provider-openapi-conformance.service';\n\n/**\n * The marker a scaffold leaves where the author owes a sentence. Publish refuses a module that still carries one\n * (`providerModuleStructureRefusals`), so an unfinished module cannot ship its placeholder text into applications.\n */\nexport const PROVIDER_SCAFFOLD_PLACEHOLDER = 'TODO(provider-scaffold)';\n\n/** How the vendor authenticates the module's calls. */\nexport enum ProviderScaffoldAuth {\n /** A key or token pasted once: an application-owned connection. */\n API_KEY = 'api-key',\n /** An OAuth2 authorization-code grant: a person connects their own account. */\n OAUTH2 = 'oauth2',\n}\n\nexport interface ProviderScaffoldInput {\n /** The provider ref: one kebab-case segment, the module's directory and its package name's suffix. */\n readonly ref: string;\n /** The vendor identity, kebab-case like a ref. */\n readonly vendor: string;\n /** The vendor's display name, for prose (`Asana`). */\n readonly displayName: string;\n /** When set, the module is an augmentation of this engine provider and owns no contract of its own. */\n readonly augments?: string;\n /** For an augmentation: the base's REST base URL and what its contract sends on every call. */\n readonly augmentsBase?: { readonly baseUrl: string; readonly supplied: ContractSuppliedParameters; readonly oauth2?: Pick<ProviderRestOAuth2, 'audiences' | 'primaryAudience'> };\n readonly auth: ProviderScaffoldAuth;\n /** The REST base URL of a provider of its own. Seeded paths are written relative to it. */\n readonly baseUrl?: string;\n readonly apiKeyHeader?: string;\n readonly apiKeyPrefix?: string;\n readonly oauth2?: { readonly authorizeUrl: string; readonly tokenUrl: string; readonly scopes: readonly string[] };\n /** The engine version a new module starts from: its manifest's `engine.framework` is `^<this>`, verified at publish. */\n readonly engineVersion: string;\n readonly openApi?: { readonly url: string; readonly document: OpenApiDescription; readonly seed: readonly string[] };\n}\n\n/** The scaffold's output: file contents by path relative to the module directory. */\nexport type ProviderScaffoldFiles = ReadonlyMap<string, string>;\n\nconst MODULE_ID_PATTERN = /^[a-z][a-z0-9-]*$/;\nconst OPENAPI_METHODS = ['get', 'put', 'post', 'delete', 'patch'] as const;\nconst IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;\n\n/** The parameter locations a description uses, mapped to the contract's vocabulary. */\nconst DESCRIBED_PARAMETER_LOCATIONS: Readonly<Record<string, ProviderRestParameterLocation>> = {\n path: ProviderRestParameterLocation.PATH,\n query: ProviderRestParameterLocation.QUERY,\n header: ProviderRestParameterLocation.HEADER,\n};\n\n/** `ASANA`, `MICROSOFT_TEAMS`: the prefix of every environment variable the module declares. */\nfunction envPrefix(ref: string): string {\n return ref.toUpperCase().replace(/-/g, '_');\n}\n\n/** `asana` → `Asana`, `microsoft-teams` → `MicrosoftTeams`: the stem of the module's exported names. */\nfunction pascal(ref: string): string {\n return ref.split('-').map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join('');\n}\n\n/** A string literal for generated TypeScript: every character escaped, so no vendor text can break the file. */\nconst quote = (value: string) => JSON.stringify(value);\n\n/** An object key for generated TypeScript: bare when it is an identifier, quoted otherwise (`'conversations.list'`). */\nconst objectKey = (value: string) => (IDENTIFIER.test(value) ? value : quote(value));\n\n/** Text for a generated comment: one line, and never the sequence that would end the comment. */\nconst commentText = (value: string) => value.replace(/\\*\\//g, '* /').replace(/\\s+/g, ' ').trim();\n\n/** `getTasksForProject` → `get_tasks_for_project`: an operation id in the alphabet the checks admit (`[A-Za-z0-9_.-]`). */\nexport function operationIdFrom(openApiOperationId: string): string {\n return openApiOperationId\n .replace(/([a-z0-9])([A-Z])/g, '$1_$2')\n .replace(/[^A-Za-z0-9_.-]+/g, '_')\n .replace(/^_+|_+$/g, '')\n .toLowerCase();\n}\n\ninterface SeededParameter {\n readonly name: string;\n readonly in: ProviderRestParameterLocation;\n readonly required: boolean;\n readonly zod: string;\n readonly description?: string;\n}\n\ninterface SeededOperation {\n readonly operationId: string;\n readonly openApiOperationId: string;\n readonly method: string;\n readonly pathTemplate: string;\n /** The operation's own host, when the description serves it on another host of the base's token audience (#2546). */\n readonly host?: string;\n readonly summary?: string;\n readonly parameters: readonly SeededParameter[];\n readonly body?: { readonly envelope?: string; readonly fields: ReadonlyArray<{ name: string; required: boolean; zod: string; description?: string }> };\n}\n\ntype Schema = { $ref?: string; type?: string; description?: string; readOnly?: boolean; properties?: Record<string, Schema>; required?: string[]; allOf?: Schema[]; items?: Schema };\n\n/** A local `$ref`, followed to a fixed depth; anything it cannot follow answers undefined. */\nfunction deref<T extends { $ref?: string }>(document: OpenApiDescription, value: T | undefined, depth = 0): T | undefined {\n if (value?.$ref === undefined) return value;\n if (depth > 8 || !value.$ref.startsWith('#/')) return undefined;\n let target: unknown = document;\n for (const segment of value.$ref.slice(2).split('/')) target = (target as Record<string, unknown> | undefined)?.[segment.replace(/~1/g, '/').replace(/~0/g, '~')];\n return deref(document, target as T | undefined, depth + 1);\n}\n\n/** A described schema's properties and required list, `allOf` merged; undefined when it is not an object with properties. */\nfunction objectOf(document: OpenApiDescription, schema: Schema | undefined, depth = 0): { properties: Record<string, Schema>; required: Set<string> } | undefined {\n const resolved = deref(document, schema);\n if (resolved === undefined || depth > 8) return undefined;\n const properties: Record<string, Schema> = { ...(resolved.properties ?? {}) };\n const required = new Set(resolved.required ?? []);\n for (const member of resolved.allOf ?? []) {\n const inner = objectOf(document, member, depth + 1);\n if (inner === undefined) continue;\n Object.assign(properties, inner.properties);\n for (const name of inner.required) required.add(name);\n }\n return Object.keys(properties).length === 0 ? undefined : { properties, required };\n}\n\n/** The Zod expression for a described primitive; anything richer is left for the author as `z.unknown()`. */\nfunction zodFor(document: OpenApiDescription, schema: Schema | undefined): string {\n switch (deref(document, schema)?.type) {\n case 'string': return 'z.string()';\n case 'integer':\n case 'number': return 'z.number()';\n case 'boolean': return 'z.boolean()';\n case 'array': return 'z.array(z.unknown())';\n case 'object': return 'z.looseObject({})';\n default: return 'z.unknown()';\n }\n}\n\n/** The first line of a described text, for a `.describe()` or a summary. */\nconst firstLine = (text: string | undefined) => (text ? text.split('\\n')[0]!.trim() || undefined : undefined);\n\n/** Where the seeded operations will be sent: the base URL they are relative to, and what its contract sends itself. */\nexport interface SeedTarget {\n readonly baseUrl: string;\n readonly supplied: ContractSuppliedParameters;\n /**\n * The operations augment a base provider. The engine admits an augmentation's operation only as a `/…` path below\n * the base (`providerOperationPathTemplateIsRelative`), so one at the base path itself cannot be seeded for it.\n */\n readonly augmentation?: boolean;\n /**\n * The base's token audiences, when it declares them (#2546). A description served on ANOTHER host that the base URL's\n * own audience admits (Gmail's `gmail.googleapis.com` on google-drive's `www.googleapis.com`) is seeded with that host\n * on each operation, as the runtime sends it; a description on any other host is still refused.\n */\n readonly oauth2?: Pick<ProviderRestOAuth2, 'audiences' | 'primaryAudience'>;\n}\n\n/**\n * The described operations a seed names, by OpenAPI `operationId` or by `METHOD /path` as the description writes it,\n * written relative to `target.baseUrl`. Throws naming every seed that matches nothing, and every operation it cannot\n * model, so the scaffold never writes fewer, or different, operations than were asked for.\n */\nexport function seedOperations(document: OpenApiDescription, seeds: readonly string[], target: SeedTarget): SeededOperation[] {\n // The runtime appends a template after everything that follows the host, so a base URL carrying a query, a fragment\n // or a backslash could only send its operations somewhere other than the path it names.\n if (/[?#\\\\]/.test(target.baseUrl.replace(/^[a-z][a-z0-9+.-]*:\\/\\//i, ''))) {\n throw new Error(`The base URL ${target.baseUrl} carries a query, a fragment or a backslash; an operation's path would be appended after it. Use a plain base URL.`);\n }\n const baseHost = urlHost(target.baseUrl);\n const servers = (document.servers ?? []).map((server) => server.url).filter((url): url is string => typeof url === 'string');\n // Every server on the base URL's host may be dialled, as the conformance check reads them; an operation is seeded\n // under the first of them whose path its described path falls under.\n let serverPaths = servers.length === 0 ? [''] : servers.filter((url) => serverReachesHost(urlHost(url), baseHost)).map(urlPath);\n // The prefix the runtime puts before every template: the base URL's path without its trailing slash.\n let basePrefix = appendUrlPath(urlPath(target.baseUrl), '');\n let operationHost: string | undefined;\n if (serverPaths.length === 0 && target.oauth2 !== undefined) {\n // Another host of the base URL's own token audience: the operation names it, and its path is the server's path plus\n // the described path, with no base prefix (the runtime sends it to `https://<host><path>`).\n const onAudience = servers.filter((url) => {\n const host = urlHost(url);\n return /^https:\\/\\//i.test(url) && host !== undefined && describeProviderRestOperationHostDefect(host, { baseUrl: target.baseUrl, oauth2: target.oauth2! }) === undefined;\n });\n const hosts = [...new Set(onAudience.map((url) => urlHost(url)!))];\n if (hosts.length > 1) {\n throw new Error(`The description's servers are on ${hosts.join(' and ')}; an operation names one host, so seed from a description with one server.`);\n }\n if (hosts.length === 1) {\n operationHost = hosts[0];\n serverPaths = onAudience.map(urlPath);\n basePrefix = '';\n }\n }\n if (serverPaths.length === 0) {\n throw new Error(`The description's servers (${servers.join(', ')}) are not on ${baseHost ?? target.baseUrl}, the host these operations are sent to${target.oauth2 === undefined ? '' : ', nor on another host its token is valid on'}; it describes another API.`);\n }\n const suppliedHeaders = new Set(target.supplied.headers.map((name) => name.toLowerCase()));\n const suppliedQuery = new Set(target.supplied.query);\n\n const found: SeededOperation[] = [];\n const unmatched = new Set(seeds);\n for (const [path, rawItem] of Object.entries(document.paths ?? {})) {\n const item = rawItem as Record<string, unknown>;\n for (const method of OPENAPI_METHODS) {\n const operation = item[method] as { operationId?: string; summary?: string; parameters?: unknown[]; requestBody?: { $ref?: string; content?: Record<string, { schema?: Schema }> } } | undefined;\n if (operation === undefined) continue;\n const keys = [operation.operationId, `${method.toUpperCase()} ${path}`].filter((key): key is string => key !== undefined);\n const seed = keys.find((key) => unmatched.has(key));\n if (seed === undefined) continue;\n unmatched.delete(seed);\n\n // OpenAPI's join and the runtime's are the same append (`appendUrlPath`), so the template is what remains of the\n // described full path once the base's prefix is taken off: a trailing slash and a root `/` survive, and an\n // operation at the base path itself is the empty template the runtime appends as nothing.\n const fullPath = serverPaths.map((serverPath) => appendUrlPath(serverPath, path))\n .find((candidate) => candidate === basePrefix || candidate.startsWith(`${basePrefix}/`));\n if (fullPath === undefined) {\n throw new Error(`${seed}: ${serverPaths.map((serverPath) => appendUrlPath(serverPath, path)).join(' or ')} is not under ${basePrefix || '/'}, the base URL's path; the operation would be sent somewhere else.`);\n }\n const pathTemplate = fullPath.slice(basePrefix.length);\n // The engine's own rule for an augmentation's operation, so the scaffold never writes one a host would refuse.\n if (target.augmentation === true && !providerOperationPathTemplateIsRelative(pathTemplate)) {\n throw new Error(`${seed}: '${pathTemplate}' (from ${fullPath}) is not a plain '/…' path below the base, which an augmentation's operation must be, so a host would refuse it; write it on a provider of its own.`);\n }\n\n const byKey = new Map<string, SeededParameter>();\n for (const raw of [...((item.parameters as unknown[] | undefined) ?? []), ...(operation.parameters ?? [])]) {\n const parameter = deref(document, raw as { $ref?: string; name?: string; in?: string; required?: boolean; description?: string; schema?: Schema });\n const location = parameter?.in === undefined ? undefined : DESCRIBED_PARAMETER_LOCATIONS[parameter.in];\n if (parameter?.name === undefined || location === undefined) continue;\n // The transport sets these, and the contract sends its own credential and default headers on every call.\n if (location === ProviderRestParameterLocation.HEADER && (OPENAPI_IGNORED_HEADER_PARAMETERS.has(parameter.name.toLowerCase()) || suppliedHeaders.has(parameter.name.toLowerCase()))) continue;\n if (location === ProviderRestParameterLocation.QUERY && suppliedQuery.has(parameter.name)) continue;\n const description = firstLine(parameter.description);\n byKey.set(`${location} ${parameter.name}`, {\n name: parameter.name,\n in: location,\n required: location === ProviderRestParameterLocation.PATH || parameter.required === true,\n zod: zodFor(document, parameter.schema),\n ...(description === undefined ? {} : { description }),\n });\n }\n const parameters = [...byKey.values()];\n const sharedName = parameters.find((parameter, index) => parameters.findIndex((other) => other.name === parameter.name) !== index);\n if (sharedName !== undefined) {\n throw new Error(`${seed}: \"${sharedName.name}\" is a parameter in two locations, so one input cannot feed both; write this operation by hand.`);\n }\n\n let body: SeededOperation['body'];\n if (operation.requestBody !== undefined) {\n const content = deref(document, operation.requestBody)?.content;\n const jsonType = Object.keys(content ?? {}).find((type) => type === 'application/json' || type.endsWith('+json'));\n let described = jsonType === undefined ? undefined : objectOf(document, content![jsonType]?.schema);\n if (described === undefined) {\n throw new Error(`${seed}: its body (${Object.keys(content ?? {}).join(', ') || 'unreadable'}) is not a JSON object the scaffold can model; write this operation by hand.`);\n }\n let envelope: string | undefined;\n // A body that is one wrapping object (Asana's `data`) is sent through the contract's `envelope`, so the input\n // a person fills in stays flat.\n const names = Object.keys(described.properties);\n if (names.length === 1) {\n const inner = objectOf(document, described.properties[names[0]!]);\n if (inner !== undefined) {\n envelope = names[0];\n described = inner;\n }\n }\n const object = described;\n body = {\n ...(envelope === undefined ? {} : { envelope }),\n // A `readOnly` property is one the vendor answers with and does not take, so it is no field a person fills in.\n // OpenAPI 3.0.3 says it \"MAY be sent as part of a response but SHOULD NOT be sent as part of the request\".\n // spec-cite: OpenAPI Specification 3.0.3, Schema Object, fixed field `readOnly`.\n fields: Object.entries(object.properties).filter(([, schema]) => deref(document, schema)?.readOnly !== true).map(([name, schema]) => {\n const description = firstLine(deref(document, schema)?.description);\n return { name, required: object.required.has(name), zod: zodFor(document, schema), ...(description === undefined ? {} : { description }) };\n }),\n };\n }\n const collision = body?.fields.find((field) => parameters.some((parameter) => parameter.name === field.name));\n if (collision !== undefined) {\n throw new Error(`${seed}: body field \"${collision.name}\" has the name of a parameter, so one input cannot feed both; write this operation by hand.`);\n }\n const operationId = operationIdFrom(operation.operationId ?? `${method}_${path}`);\n if (found.some((other) => other.operationId === operationId)) {\n throw new Error(`${seed}: its operation id would be \"${operationId}\", which another seed already has; seed one of them and write the other by hand.`);\n }\n const summary = firstLine(operation.summary);\n found.push({\n operationId,\n openApiOperationId: seed,\n method: method.toUpperCase(),\n pathTemplate,\n ...(operationHost === undefined ? {} : { host: operationHost }),\n ...(summary === undefined ? {} : { summary }),\n parameters,\n ...(body === undefined ? {} : { body }),\n });\n }\n }\n if (unmatched.size > 0) {\n throw new Error(`No described operation matches ${[...unmatched].map((seed) => `\"${seed}\"`).join(', ')}: seed by the description's operationId or by \"METHOD /path\" as it writes the path.`);\n }\n return found;\n}\n\n/** The contract enum member a seeded parameter location is written as. */\nconst LOCATION_MEMBER: Readonly<Record<ProviderRestParameterLocation, string>> = {\n [ProviderRestParameterLocation.PATH]: 'PATH',\n [ProviderRestParameterLocation.QUERY]: 'QUERY',\n [ProviderRestParameterLocation.HEADER]: 'HEADER',\n};\n\n/** One seeded operation as `ProviderRestOperation` source. */\nfunction renderOperation(operation: SeededOperation): string {\n const read = operation.method === 'GET';\n const fieldLine = (name: string, zod: string, required: boolean, description?: string) =>\n ` ${objectKey(name)}: ${zod}${description ? `.describe(${quote(description)})` : ''}${required ? '' : '.optional()'},`;\n const inputLines = [\n ...operation.parameters.map((parameter) => fieldLine(parameter.name, parameter.zod, parameter.required, parameter.description)),\n ...(operation.body?.fields ?? []).map((field) => fieldLine(field.name, field.zod, field.required, field.description)),\n ];\n return [\n ` ${objectKey(operation.operationId)}: {`,\n ` operationId: ${quote(operation.operationId)},`,\n ` domain: 'default',`,\n ` method: API_HttpMethod.${operation.method},`,\n ` pathTemplate: ${quote(operation.pathTemplate)},`,\n ...(operation.host === undefined ? [] : [` host: ${quote(operation.host)},`]),\n ` classification: ExternalOperation_Classification.${read ? 'READ' : 'WRITE'},`,\n ` summary: ${quote(operation.summary ?? `${PROVIDER_SCAFFOLD_PLACEHOLDER}: what this operation is for.`)},`,\n ` parameters: [`,\n ...operation.parameters.map((parameter) =>\n ` { name: ${quote(parameter.name)}, in: ProviderRestParameterLocation.${LOCATION_MEMBER[parameter.in]}${parameter.required && parameter.in !== ProviderRestParameterLocation.PATH ? ', required: true' : ''} },`),\n ` ],`,\n ...(operation.body === undefined\n ? []\n : [` requestBody: { encoding: ProviderRestRequestBodyEncoding.JSON${operation.body.envelope ? `, envelope: ${quote(operation.body.envelope)}` : ''} },`]),\n ` inputSchema: z.looseObject({`,\n ...inputLines.map((line) => ` ${line}`),\n ` }),`,\n ` },`,\n ].join('\\n');\n}\n\nfunction renderOperations(input: ProviderScaffoldInput, operations: readonly SeededOperation[]): string {\n // Only what the seeded operations use: an unused import is noise an author would have to work out is safe to remove.\n const modelImports = operations.length === 0\n ? []\n : [\n 'API_HttpMethod',\n 'ExternalOperation_Classification',\n ...(operations.some((operation) => operation.parameters.length > 0) ? ['ProviderRestParameterLocation'] : []),\n ...(operations.some((operation) => operation.body !== undefined) ? ['ProviderRestRequestBodyEncoding'] : []),\n ];\n const imports = [\n ...(operations.length === 0 ? [] : [\"import { z } from 'zod';\", '']),\n `import { ${[...modelImports, 'type ProviderRestOperationCatalogue'].join(', ')} } from '@wildo-ai/external-connectors-models';`,\n '',\n ].join('\\n');\n const seededFrom = input.openApi === undefined\n ? ' * No operation yet. Seed them from the vendor\\'s description (`wildo providers new --openapi <url> --seed <operationId>`), or write\\n * each one here, choosing 10 to 20 by the use case they serve rather than everything the vendor publishes.'\n : ` * Seeded from ${commentText(input.openApi.url)}:\\n${operations.map((operation) => ` * - \\`${commentText(operation.operationId)}\\` ← ${commentText(operation.openApiOperationId)}`).join('\\n')}\\n *\\n * Each one is what the description says. Refine its input schema (formats, enums, which fields a person fills in) and\\n * keep it conformant: publish checks every operation against the description pinned in wildo.module.json.`;\n return `/**\n * ${commentText(input.displayName)}'s operations: the catalogue this provider executes.\n *\n${seededFrom}\n *\n * This file is the application's own once installed: edit it like any other source. \\`wildo registry update\\` keeps a\n * file you changed and says so.\n */\n\n${imports}\nexport const catalogue: ProviderRestOperationCatalogue = {\n domains: ['default'],\n operations: {\n${operations.map(renderOperation).join('\\n')}\n },\n};\n`;\n}\n\nfunction renderProviderExports(input: ProviderScaffoldInput): string {\n const name = `${pascal(input.ref)}BackendProvider`;\n const prefix = envPrefix(input.ref);\n const oauth2 = input.auth === ProviderScaffoldAuth.OAUTH2 ? input.oauth2 : undefined;\n const connections = oauth2 === undefined\n ? [\n ' // A pasted key is the application\\'s own account. Admit more only once the vendor\\'s model is known (#1047).',\n ' { ownerScope: ExternalProvider_Connection_OwnerScope.APPLICATION, delegation: ExternalProvider_Connection_DelegationMode.SERVICE },',\n ]\n : [\n ' // Decide which accounts this vendor\\'s calls may spend: these are the three asana admits (#333).',\n ' { ownerScope: ExternalProvider_Connection_OwnerScope.APPLICATION, delegation: ExternalProvider_Connection_DelegationMode.SERVICE },',\n ' { ownerScope: ExternalProvider_Connection_OwnerScope.ORGANIZATION, delegation: ExternalProvider_Connection_DelegationMode.USER },',\n ' { ownerScope: ExternalProvider_Connection_OwnerScope.USER, delegation: ExternalProvider_Connection_DelegationMode.SERVICE },',\n ];\n const tokenVar = `${prefix}_${oauth2 === undefined ? 'API_KEY' : 'ACCESS_TOKEN'}`;\n const secrets = [\n ...(oauth2 === undefined ? [] : [\n ` clientId: { envVarName: ${quote(`${prefix}_CLIENT_ID`)}, required: true, description: ${quote(`OAuth2 client id for the application's ${input.displayName} registration.`)} },`,\n ` clientSecret: { envVarName: ${quote(`${prefix}_CLIENT_SECRET`)}, required: true, description: ${quote(`OAuth2 client secret for the application's ${input.displayName} registration.`)} },`,\n ]),\n oauth2 === undefined\n ? ` apiKey: { envVarName: ${quote(tokenVar)}, required: true, description: ${quote(`API key for ${input.displayName}.`)} },`\n : ` accessToken: { envVarName: ${quote(tokenVar)}, required: false, description: ${quote(`Access token for ${input.displayName}. Minted by the OAuth2 exchange, not authored.`)} },`,\n ];\n return `/**\n * ${commentText(input.displayName)}, as a provider an application owns.\n *\n * Scaffolded by \\`wildo providers new\\` (#2513). What is still to decide is marked where it is decided: the connections\n * the vendor admits, and its compliance facts, which stay UNDETERMINED until researched with a source and a date.\n *\n * \\`packageName\\` is this package's own name; \\`wildo registry add\\` rewrites it to the installing application's scope.\n */\n\nimport {\n ExternalProvider_Connection_DelegationMode,\n ExternalProvider_Connection_OwnerScope,\n ProviderProtocolRuntimeKind,\n} from '@wildo-ai/external-connectors-models';\nimport { defineProviderMetadata, ProviderComplianceDetermination, ProviderOriginKind, ProviderTier } from '@wildo-ai/saas-models';\nimport type { BackendProviderModule, BackendProviderRegistryFragment, ProviderRef } from '@wildo-ai/external-connectors-private/backend';\n\nexport const ${name}: BackendProviderModule = {\n metadata: defineProviderMetadata({\n ref: ${quote(input.ref)},\n packageName: ${quote(`@wildo-ai/provider-${input.ref}`)},\n tier: ProviderTier.CATALOGUE,\n vendor: ${quote(input.vendor)},\n origin: { kind: ProviderOriginKind.APPLICATION },\n }),\n complianceProfile: {\n determination: ProviderComplianceDetermination.UNDETERMINED,\n reason: ${quote(`${input.displayName}'s legal facts are not researched yet: they are recorded with a source and a date before the module is proven.`)},\n },\n providerCapabilities: [],\n admissibleConnections: [\n${connections.join('\\n')}\n ],\n secretsContract: {\n${secrets.join('\\n')}\n },\n protocols: [\n {\n // The MEMBER NAME, not the enum value: \\`composeBackendProviders\\` indexes the enum BY this string.\n protocol: 'REST_API',\n runtimeContract: {\n kind: ProviderProtocolRuntimeKind.REST,\n baseUrl: ${quote(input.baseUrl ?? '')},\n${oauth2 === undefined ? '' : ` oauth2: {\n authorizeUrl: ${quote(oauth2.authorizeUrl)},\n tokenUrl: ${quote(oauth2.tokenUrl)},\n scopes: ${JSON.stringify(oauth2.scopes)},\n clientIdSecretRef: ${quote(`${prefix}_CLIENT_ID`)},\n clientSecretSecretRef: ${quote(`${prefix}_CLIENT_SECRET`)},\n },\n`} apiKey: { secretRef: ${quote(tokenVar)}, headerName: ${quote(input.apiKeyHeader ?? 'Authorization')}, prefix: ${quote(input.apiKeyPrefix ?? 'Bearer ')} },\n operations: async () => (await import('./operations.js')).catalogue,\n },\n },\n ],\n};\n\n/** The conventional export a host loads a provider package by. */\nexport const backendProviderFragment: BackendProviderRegistryFragment = {\n modules: new Map([[${name}.metadata.ref as ProviderRef, ${name}]]),\n};\n`;\n}\n\nfunction renderAugmentationExports(input: ProviderScaffoldInput, operations: readonly SeededOperation[]): string {\n const ids = operations.map((operation) => operation.operationId).sort();\n return `/**\n * ${commentText(input.displayName)}: operations added to the engine's \\`${input.augments}\\` provider (#2022).\n *\n * Scaffolded by \\`wildo providers new --augments ${input.augments}\\` (#2513). An augmentation owns nothing but operations:\n * they run on the base's connection, base URL and credential, and an application opts in under\n * \\`providers.augmentations.${input.augments}\\`.\n */\n\nimport type { ProviderAugmentation } from '@wildo-ai/external-connectors-private/backend-runtime';\nimport { ProviderOriginKind, ProviderTier } from '@wildo-ai/saas-models';\n\n/** The engine provider these operations are added to. */\nexport const AUGMENTED_PROVIDER_REF = ${quote(input.augments!)};\n\n/** Every operation id this adds, stated statically because the catalogue is lazy. Sorted, unique, non-empty. */\nconst OPERATION_IDS = ${JSON.stringify(ids)};\n\n/**\n * A plain value, typed through a TYPE import: \\`defineProviderAugmentation\\`'s package is not one a provider module may\n * load at boot (\\`check:provider-module-eager-graph\\`). Publish and every host check it through \\`readProviderAugmentations\\`.\n */\nconst augmentation: ProviderAugmentation = {\n augments: AUGMENTED_PROVIDER_REF,\n metadata: { packageName: ${quote(`@wildo-ai/provider-${input.ref}`)}, tier: ProviderTier.CATALOGUE, origin: { kind: ProviderOriginKind.APPLICATION } },\n operationIds: OPERATION_IDS,\n operations: async (domain) => (domain === undefined || domain === 'default' ? (await import('./operations.js')).catalogue : { domains: [], operations: {} }),\n reason: ${quote(`Adds ${input.displayName} operations to ${input.augments}.`)},\n};\n\nexport const providerAugmentations = new Map([[AUGMENTED_PROVIDER_REF, augmentation]]);\n`;\n}\n\nfunction renderAugmentationCompanionExports(input: ProviderScaffoldInput): string {\n return `/**\n * What discovery reads about this augmentation without executing an operation (#1672, #2022). A separate record from a\n * provider contribution: an augmentation owns no ref, secrets or connection. Every field is derived from the\n * augmentation; the one literal is \\`runtimeImportPath\\`, which \\`wildo registry add\\` rewrites.\n */\nimport type { ProviderAugmentationContribution, RuntimeOwnerCompanionExports } from '@wildo-ai/saas-models';\nimport { AUGMENTED_PROVIDER_REF, providerAugmentations as augmentationsByBase } from './backend.exports.js';\n\nconst augmentation = augmentationsByBase.get(AUGMENTED_PROVIDER_REF)!;\n\nexport const providerAugmentations: ProviderAugmentationContribution[] = [\n {\n augments: augmentation.augments,\n packageName: augmentation.metadata.packageName,\n tier: augmentation.metadata.tier,\n origin: augmentation.metadata.origin,\n runtimeImportPath: ${quote(`@wildo-ai/provider-${input.ref}/backend`)},\n operationIds: [...augmentation.operationIds],\n requiredScopes: [...(augmentation.requiredScopes ?? [])],\n },\n];\n\nconst companionExports: RuntimeOwnerCompanionExports = { providerAugmentations };\n\nexport default companionExports;\n`;\n}\n\nfunction renderCompanionExports(input: ProviderScaffoldInput): string {\n const name = `${pascal(input.ref)}BackendProvider`;\n return `/**\n * What discovery reads about ${commentText(input.displayName)} without executing an operation. Every field is derived from the\n * module, so the declaration cannot drift from what the runtime loads; the one literal is \\`runtimeImportPath\\`, which\n * \\`wildo registry add\\` rewrites to the installing application's scope.\n */\nimport { describeProviderConnectionParameterNames, describeProviderVendorRegistrationSteps } from '@wildo-ai/external-connectors-models';\nimport { describeProviderProtocolSecretSlots } from '@wildo-ai/saas-models';\nimport type { ProviderCompanionContribution, RuntimeOwnerCompanionExports } from '@wildo-ai/saas-models';\nimport { ${name} } from './backend.exports.js';\n\nconst module = ${name};\n\n/** What the connect form asks a person for (which tenant, which subdomain), so the labelling pipeline plans its words. */\nconst connectionParameterNames = describeProviderConnectionParameterNames(module.protocols);\n\n/** The vendor registration's steps, once the module declares one, so the labelling pipeline plans their words (#3252). */\nconst vendorRegistrationSteps = describeProviderVendorRegistrationSteps(module.vendorRegistration);\n\nexport const providerContributions: ProviderCompanionContribution[] = [\n {\n ref: module.metadata.ref,\n identity: { packageName: module.metadata.packageName, tier: module.metadata.tier, vendor: module.metadata.vendor, origin: module.metadata.origin },\n runtimeImportPath: ${quote(`@wildo-ai/provider-${input.ref}/backend`)},\n runtimeTargets: [{ kind: 'backend' }],\n engineCapabilities: [],\n providerCapabilities: [],\n protocols: module.protocols.map((binding) => binding.protocol),\n // Which arm reads which secret (#2054), so \\`wildo secrets\\` attributes a slot only to a runtime whose scope enables an\n // arm reading it (#3837).\n protocolSecretSlots: describeProviderProtocolSecretSlots(module.secretsContract, module.protocols),\n secretsContractShape: Object.entries(module.secretsContract)\n .map(([slug, entry]) => ({ slug, envVarName: entry.envVarName, required: entry.required, description: entry.description }))\n .sort((a, b) => a.slug.localeCompare(b.slug)),\n ...(connectionParameterNames === undefined ? {} : { connectionParameterNames }),\n ...(vendorRegistrationSteps === undefined ? {} : { vendorRegistrationSteps }),\n ...(module.complianceProfile === undefined ? {} : { complianceProfile: module.complianceProfile }),\n },\n];\n\nconst companionExports: RuntimeOwnerCompanionExports = { providerContributions };\n\nexport default companionExports;\n`;\n}\n\nfunction renderSkill(input: ProviderScaffoldInput, operations: readonly SeededOperation[]): string {\n const how = input.augments === undefined\n ? `a REST provider addressed by the ref \\`${input.ref}\\``\n : `operations added to the engine's \\`${input.augments}\\` provider, running on its connection`;\n // YAML double-quoted scalars accept JSON string syntax, so a display name holding `: ` or quotes cannot break the frontmatter.\n const description = quote(`Use when the application calls ${input.displayName} through the installed ${input.ref} provider. ${PROVIDER_SCAFFOLD_PLACEHOLDER}: the phrases a developer would say, quoted.`);\n return `---\nname: provider-${input.ref}\ndescription: ${description}\n---\n\n# ${commentText(input.displayName)} (registry provider)\n\nThis provider is the application's own copy of ${commentText(input.displayName)}: ${how}.\n\n## App Paths\n\n| What | Where |\n|---|---|\n| The installed package | \\`providers/${input.ref}/backend/\\` (\\`@<app-scope>/provider-${input.ref}\\`) |\n| The operations, editable | \\`providers/${input.ref}/backend/src/operations.ts\\` |\n| The provider declaration | \\`wildo.saas.config.ts\\` → ${input.augments === undefined ? `\\`providers.scopes.backend.providers.${input.ref}\\` (\\`protocols: ['REST_API']\\`)` : `\\`providers.augmentations.${input.augments}\\``} |\n\n## Operations\n\n${operations.length === 0 ? 'None yet.' : operations.map((operation) => `- \\`${operation.operationId}\\` — ${commentText(operation.summary ?? `${PROVIDER_SCAFFOLD_PLACEHOLDER}: what it is for`)}`).join('\\n')}\n\n## Verification\n\n- \\`wildo providers show ${input.augments ?? input.ref}\\` lists the operations above.\n`;\n}\n\nfunction renderPackageJson(input: ProviderScaffoldInput): string {\n const exportsMap: Record<string, Record<string, string>> = {\n './backend': { source: './src/backend.exports.ts', types: './dist/backend.exports.d.ts', import: './dist/backend.exports.js', default: './dist/backend.exports.js' },\n './companion': { source: './src/companion-exports.ts', types: './dist/companion-exports.d.ts', import: './dist/companion-exports.js', default: './dist/companion-exports.js' },\n };\n return `${JSON.stringify({\n name: `@wildo-ai/provider-${input.ref}`,\n version: '1.0.0',\n description: `${input.displayName} provider, backend facet. Installed into an application with \\`wildo registry add wildo/providers/${input.ref}\\`.`,\n license: 'UNLICENSED',\n private: true,\n type: 'module',\n exports: exportsMap,\n scripts: { build: 'tsc -p tsconfig.json', dev: 'tsc -p tsconfig.json --watch --preserveWatchOutput' },\n dependencies: { '@wildo-ai/external-connectors-models': '*', '@wildo-ai/external-connectors-private': '*', '@wildo-ai/saas-models': '*', zod: '*' },\n devDependencies: { typescript: '*' },\n }, null, 2)}\\n`;\n}\n\nconst TSCONFIG = `${JSON.stringify({\n '//': 'Self-contained on purpose: the same file builds this facet in the framework checkout and in every application it is installed into, so it extends nothing either place may lack.',\n compilerOptions: {\n target: 'ES2022', lib: ['ES2022'], module: 'preserve', moduleResolution: 'bundler', strict: true, isolatedModules: true, esModuleInterop: true,\n skipLibCheck: true, forceConsistentCasingInFileNames: true, noEmitOnError: true, declaration: true, rootDir: 'src', outDir: 'dist',\n },\n include: ['src/**/*'],\n exclude: ['node_modules', 'dist'],\n}, null, 2)}\\n`;\n\n/**\n * The REST contract facts of the engine provider an augmentation adds to: the base URL its operations are sent under,\n * and what that contract sends on every call. Read from the engine's own module, so the seeded paths are relative to\n * the URL the runtime really dials.\n */\nexport async function engineBaseContract(baseRef: string): Promise<{ baseUrl: string; supplied: ContractSuppliedParameters; oauth2?: Pick<ProviderRestOAuth2, 'audiences' | 'primaryAudience'> }> {\n const { ENGINE_BACKEND_PROVIDER_LOADERS } = await import('@wildo-ai/external-connectors-private/backend-runtime');\n const { ProviderProtocolRuntimeKind } = await import('@wildo-ai/external-connectors-models');\n const load = [...ENGINE_BACKEND_PROVIDER_LOADERS.entries()].find(([ref]) => ref === baseRef)?.[1];\n if (load === undefined) throw new Error(`\"${baseRef}\" is not a provider the engine ships; an augmentation is scaffolded against an engine provider.`);\n const contract = (await load()).protocols.find((binding) => binding.runtimeContract.kind === ProviderProtocolRuntimeKind.REST)?.runtimeContract;\n const baseUrl = (contract as { baseUrl?: unknown } | undefined)?.baseUrl;\n if (typeof baseUrl !== 'string') throw new Error(`\"${baseRef}\" declares no REST base URL, so its operations have nothing to be relative to.`);\n // The token audiences (#2546): which other hosts an operation of this base may name, Gmail's on google-drive.\n const oauth2 = (contract as { oauth2?: Pick<ProviderRestOAuth2, 'audiences' | 'primaryAudience'> } | undefined)?.oauth2;\n return { baseUrl, supplied: contractSuppliedParameters(contract), ...(oauth2?.audiences === undefined ? {} : { oauth2: { audiences: oauth2.audiences, primaryAudience: oauth2.primaryAudience } }) };\n}\n\n/** Every file of a new module, by path relative to its directory. Pure: the command writes what this returns. */\nexport function scaffoldProviderModule(input: ProviderScaffoldInput): ProviderScaffoldFiles {\n for (const [label, value] of [['provider ref', input.ref], ['vendor', input.vendor], ...(input.augments === undefined ? [] : [['augmented provider', input.augments]])] as const) {\n if (!MODULE_ID_PATTERN.test(value)) throw new Error(`\"${value}\" is not a ${label}: one kebab-case segment, starting with a letter.`);\n }\n if (input.augments !== undefined && input.augmentsBase === undefined) {\n throw new Error(`An augmentation is written against its base's contract, and \"${input.augments}\"'s was not supplied.`);\n }\n if (input.augments === undefined && (input.baseUrl === undefined || !/^https:\\/\\//.test(input.baseUrl))) {\n throw new Error('A provider of its own needs its REST base URL (https).');\n }\n if (input.baseUrl !== undefined && /[?#\\\\]/.test(input.baseUrl.replace(/^https:\\/\\//, ''))) {\n throw new Error(`The base URL ${input.baseUrl} carries a query, a fragment or a backslash; every operation's path would be appended after it. Use a plain base URL.`);\n }\n if (input.auth === ProviderScaffoldAuth.OAUTH2 && input.augments === undefined && input.oauth2 === undefined) {\n throw new Error('An OAuth2 provider needs its authorize URL, token URL and scopes.');\n }\n if (input.openApi !== undefined) {\n // The same two refusals publish makes, before seeding: what publish would refuse is not a starting point.\n const version = input.openApi.document.openapi;\n if (version === undefined || !String(version).startsWith('3.')) {\n throw new Error(`${input.openApi.url} is ${input.openApi.document.swagger !== undefined ? `Swagger ${input.openApi.document.swagger}` : 'not an OpenAPI 3 document'}; seed from the vendor's OpenAPI 3 description.`);\n }\n const branch = githubRawUrlBranch(input.openApi.url);\n if (branch !== undefined) throw new Error(`${input.openApi.url} reads the branch \"${branch}\", which moves; pin it to a commit.`);\n }\n const target: SeedTarget = input.augmentsBase !== undefined ? { ...input.augmentsBase, augmentation: true } : { baseUrl: input.baseUrl!, supplied: { headers: [input.apiKeyHeader ?? 'Authorization'], query: [] } };\n const operations = input.openApi === undefined ? [] : seedOperations(input.openApi.document, input.openApi.seed, target);\n if (input.augments !== undefined && operations.length === 0) {\n throw new Error('An augmentation adds operations and nothing else, so it starts from at least one: seed it from the vendor\\'s description.');\n }\n const revision = input.openApi?.document.info?.version;\n if (input.openApi !== undefined && revision === undefined) {\n throw new Error(`${input.openApi.url} states no info.version, so the module cannot pin the revision it is checked against.`);\n }\n const manifest = {\n id: `providers/${input.ref}`,\n version: '1.0.0',\n kind: 'provider',\n description: `${input.displayName}: ${PROVIDER_SCAFFOLD_PLACEHOLDER}: what an application uses it for.`,\n boundaries: { providers: [`providers/${input.ref}`] },\n engine: { framework: `^${input.engineVersion}` },\n provider: {\n ref: input.ref,\n tier: ProviderTier.CATALOGUE,\n vendor: input.vendor,\n providerCapabilities: [],\n facets: { backend: {} },\n maturity: 'adopted',\n ...(input.openApi === undefined ? {} : { openApi: { url: input.openApi.url, revision: String(revision) } }),\n ...(input.augments === undefined ? {} : { augments: input.augments }),\n skills: [`provider-${input.ref}`],\n },\n };\n return new Map<string, string>([\n ['wildo.module.json', `${JSON.stringify(manifest, null, 2)}\\n`],\n ['backend/package.json', renderPackageJson(input)],\n ['backend/tsconfig.json', TSCONFIG],\n ['backend/src/operations.ts', renderOperations(input, operations)],\n ['backend/src/backend.exports.ts', input.augments === undefined ? renderProviderExports(input) : renderAugmentationExports(input, operations)],\n ['backend/src/companion-exports.ts', input.augments === undefined ? renderCompanionExports(input) : renderAugmentationCompanionExports(input)],\n [`skills/provider-${input.ref}/SKILL.md`, renderSkill(input, operations)],\n ]);\n}\n"]}
|