fjall 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/.bundled +3 -3
- package/bin/.metafile.json +28 -13
- package/bin/assets/generators/account/generator.js +133 -2
- package/bin/assets/generators/application/generator.js +382 -3
- package/bin/assets/generators/cdn/generator.js +436 -3
- package/bin/assets/generators/compute/generator.js +439 -1
- package/bin/assets/generators/compute/service/generator.js +338 -1
- package/bin/assets/generators/database/generator.js +439 -1
- package/bin/assets/generators/database/proxy/generator.js +338 -1
- package/bin/assets/generators/domain/generator.js +133 -2
- package/bin/assets/generators/network/generator.js +338 -1
- package/bin/assets/generators/organisation/generator.js +133 -2
- package/bin/assets/generators/shared/files/package.json +2 -2
- package/bin/assets/generators/storage/s3/generator.js +439 -1
- package/bin/assets/generators/tunnel/generator.js +338 -1
- package/bin/fjall.bundle.js +304 -304
- package/package.json +3 -3
- package/bin/assets/generators/account/generator.d.ts +0 -8
- package/bin/assets/generators/account/index.d.ts +0 -1
- package/bin/assets/generators/account/index.js +0 -1
- package/bin/assets/generators/application/generator.d.ts +0 -4
- package/bin/assets/generators/application/index.d.ts +0 -1
- package/bin/assets/generators/application/index.js +0 -1
- package/bin/assets/generators/cdn/generator.d.ts +0 -4
- package/bin/assets/generators/cdn/index.d.ts +0 -1
- package/bin/assets/generators/cdn/index.js +0 -1
- package/bin/assets/generators/compute/computeIntegrationHelpers.d.ts +0 -134
- package/bin/assets/generators/compute/computeIntegrationHelpers.js +0 -1
- package/bin/assets/generators/compute/generator.d.ts +0 -4
- package/bin/assets/generators/compute/index.d.ts +0 -1
- package/bin/assets/generators/compute/index.js +0 -1
- package/bin/assets/generators/compute/service/generator.d.ts +0 -4
- package/bin/assets/generators/compute/service/index.d.ts +0 -1
- package/bin/assets/generators/compute/service/index.js +0 -1
- package/bin/assets/generators/database/databaseIntegrationTestUtils.d.ts +0 -134
- package/bin/assets/generators/database/databaseIntegrationTestUtils.js +0 -1
- package/bin/assets/generators/database/generator.d.ts +0 -4
- package/bin/assets/generators/database/index.d.ts +0 -1
- package/bin/assets/generators/database/index.js +0 -1
- package/bin/assets/generators/database/proxy/generator.d.ts +0 -4
- package/bin/assets/generators/database/proxy/index.d.ts +0 -1
- package/bin/assets/generators/database/proxy/index.js +0 -1
- package/bin/assets/generators/domain/generator.d.ts +0 -10
- package/bin/assets/generators/domain/index.d.ts +0 -1
- package/bin/assets/generators/domain/index.js +0 -1
- package/bin/assets/generators/messaging/index.d.ts +0 -1
- package/bin/assets/generators/messaging/index.js +0 -0
- package/bin/assets/generators/network/generator.d.ts +0 -4
- package/bin/assets/generators/network/index.d.ts +0 -1
- package/bin/assets/generators/network/index.js +0 -1
- package/bin/assets/generators/organisation/generator.d.ts +0 -4
- package/bin/assets/generators/organisation/index.d.ts +0 -1
- package/bin/assets/generators/organisation/index.js +0 -1
- package/bin/assets/generators/storage/index.d.ts +0 -1
- package/bin/assets/generators/storage/index.js +0 -1
- package/bin/assets/generators/storage/s3/generator.d.ts +0 -4
- package/bin/assets/generators/tunnel/generator.d.ts +0 -4
- package/bin/assets/generators/tunnel/index.d.ts +0 -1
- package/bin/assets/generators/tunnel/index.js +0 -1
- package/bin/assets/generators/utils/ast/astCodeModification.d.ts +0 -23
- package/bin/assets/generators/utils/ast/astCodeModification.js +0 -1
- package/bin/assets/generators/utils/ast/astDomainRewriter.d.ts +0 -65
- package/bin/assets/generators/utils/ast/astDomainRewriter.js +0 -1
- package/bin/assets/generators/utils/ast/astSurgicalModification.d.ts +0 -2
- package/bin/assets/generators/utils/ast/astSurgicalModification.js +0 -1
- package/bin/assets/generators/utils/ast/index.d.ts +0 -3
- package/bin/assets/generators/utils/ast/index.js +0 -1
- package/bin/assets/generators/utils/copySharedFiles.d.ts +0 -10
- package/bin/assets/generators/utils/copySharedFiles.js +0 -1
- package/bin/assets/generators/utils/index.d.ts +0 -8
- package/bin/assets/generators/utils/index.js +0 -1
- package/bin/assets/generators/utils/integrationTestUtils.d.ts +0 -138
- package/bin/assets/generators/utils/integrationTestUtils.js +0 -4
- package/bin/assets/generators/utils/mockTree.d.ts +0 -30
- package/bin/assets/generators/utils/mockTree.js +0 -1
- package/bin/assets/generators/utils/planning/generatorHelpers.d.ts +0 -35
- package/bin/assets/generators/utils/planning/generatorHelpers.js +0 -2
- package/bin/assets/generators/utils/planning/index.d.ts +0 -1
- package/bin/assets/generators/utils/planning/index.js +0 -1
- package/bin/assets/generators/utils/prompts.d.ts +0 -4
- package/bin/assets/generators/utils/prompts.js +0 -6
- package/bin/assets/generators/utils/renderEjs.d.ts +0 -24
- package/bin/assets/generators/utils/renderEjs.js +0 -1
- package/bin/assets/generators/utils/resources/connectionHelpers.d.ts +0 -19
- package/bin/assets/generators/utils/resources/connectionHelpers.js +0 -1
- package/bin/assets/generators/utils/resources/index.d.ts +0 -4
- package/bin/assets/generators/utils/resources/index.js +0 -1
- package/bin/assets/generators/utils/resources/promptValidation.d.ts +0 -42
- package/bin/assets/generators/utils/resources/promptValidation.js +0 -1
- package/bin/assets/generators/utils/resources/resourceDetection.d.ts +0 -12
- package/bin/assets/generators/utils/resources/resourceDetection.js +0 -1
- package/bin/assets/generators/utils/resources/resourceNaming.d.ts +0 -6
- package/bin/assets/generators/utils/resources/resourceNaming.js +0 -1
- package/bin/assets/generators/utils/tree.d.ts +0 -25
- package/bin/assets/generators/utils/tree.js +0 -1
- package/bin/assets/src/util/__tests__/fjallApiClientTestHelpers.d.ts +0 -9
- package/bin/assets/src/util/__tests__/fjallApiClientTestHelpers.js +0 -1
- package/bin/assets/src/util/__tests__/outputTestHelpers.d.ts +0 -9
- package/bin/assets/src/util/__tests__/outputTestHelpers.js +0 -1
- package/bin/assets/src/util/agent/__tests__/toonTestHelpers.d.ts +0 -91
- package/bin/assets/src/util/agent/__tests__/toonTestHelpers.js +0 -1
- package/bin/assets/src/util/agent/actionRequired.d.ts +0 -60
- package/bin/assets/src/util/agent/actionRequired.js +0 -1
- package/bin/assets/src/util/agent/agentCallbacks.d.ts +0 -21
- package/bin/assets/src/util/agent/agentCallbacks.js +0 -1
- package/bin/assets/src/util/agent/agentInit.d.ts +0 -17
- package/bin/assets/src/util/agent/agentInit.js +0 -288
- package/bin/assets/src/util/agent/agentOutput.d.ts +0 -61
- package/bin/assets/src/util/agent/agentOutput.js +0 -8
- package/bin/assets/src/util/agent/budget.d.ts +0 -19
- package/bin/assets/src/util/agent/budget.js +0 -4
- package/bin/assets/src/util/agent/detectAgent.d.ts +0 -51
- package/bin/assets/src/util/agent/detectAgent.js +0 -1
- package/bin/assets/src/util/agent/errorCodeMap.d.ts +0 -16
- package/bin/assets/src/util/agent/errorCodeMap.js +0 -1
- package/bin/assets/src/util/agent/errorCodes.d.ts +0 -48
- package/bin/assets/src/util/agent/errorCodes.js +0 -1
- package/bin/assets/src/util/agent/fieldSelection.d.ts +0 -22
- package/bin/assets/src/util/agent/fieldSelection.js +0 -1
- package/bin/assets/src/util/agent/getSurface.d.ts +0 -27
- package/bin/assets/src/util/agent/getSurface.js +0 -1
- package/bin/assets/src/util/agent/index.d.ts +0 -27
- package/bin/assets/src/util/agent/index.js +0 -1
- package/bin/assets/src/util/agent/mcpProtocolEmit.d.ts +0 -31
- package/bin/assets/src/util/agent/mcpProtocolEmit.js +0 -2
- package/bin/assets/src/util/agent/schemas/appsSchemas.d.ts +0 -18
- package/bin/assets/src/util/agent/schemas/appsSchemas.js +0 -1
- package/bin/assets/src/util/agent/schemas/assetSchemas.d.ts +0 -13
- package/bin/assets/src/util/agent/schemas/assetSchemas.js +0 -1
- package/bin/assets/src/util/agent/schemas/awsSchemas.d.ts +0 -5
- package/bin/assets/src/util/agent/schemas/awsSchemas.js +0 -1
- package/bin/assets/src/util/agent/schemas/deploySchemas.d.ts +0 -8
- package/bin/assets/src/util/agent/schemas/deploySchemas.js +0 -1
- package/bin/assets/src/util/agent/schemas/index.d.ts +0 -10
- package/bin/assets/src/util/agent/schemas/index.js +0 -1
- package/bin/assets/src/util/agent/schemas/infraSchemas.d.ts +0 -45
- package/bin/assets/src/util/agent/schemas/infraSchemas.js +0 -1
- package/bin/assets/src/util/agent/schemas/secretsSchemas.d.ts +0 -13
- package/bin/assets/src/util/agent/schemas/secretsSchemas.js +0 -1
- package/bin/assets/src/util/agent/schemas/types.d.ts +0 -98
- package/bin/assets/src/util/agent/schemas/types.js +0 -0
- package/bin/assets/src/util/agent/schemas/userSchemas.d.ts +0 -21
- package/bin/assets/src/util/agent/schemas/userSchemas.js +0 -1
- package/bin/assets/src/util/agent/sessionHooks.d.ts +0 -47
- package/bin/assets/src/util/agent/sessionHooks.js +0 -6
- package/bin/assets/src/util/agent/streaming.d.ts +0 -51
- package/bin/assets/src/util/agent/streaming.js +0 -1
- package/bin/assets/src/util/agent/suggestionEntries/coreEntries.d.ts +0 -2
- package/bin/assets/src/util/agent/suggestionEntries/coreEntries.js +0 -1
- package/bin/assets/src/util/agent/suggestionEntries/identityEntries.d.ts +0 -2
- package/bin/assets/src/util/agent/suggestionEntries/identityEntries.js +0 -1
- package/bin/assets/src/util/agent/suggestionEntries/index.d.ts +0 -3
- package/bin/assets/src/util/agent/suggestionEntries/index.js +0 -1
- package/bin/assets/src/util/agent/suggestionEntries/infraEntries.d.ts +0 -2
- package/bin/assets/src/util/agent/suggestionEntries/infraEntries.js +0 -1
- package/bin/assets/src/util/agent/suggestionEntries/observabilityEntries.d.ts +0 -2
- package/bin/assets/src/util/agent/suggestionEntries/observabilityEntries.js +0 -1
- package/bin/assets/src/util/agent/suggestionEntries/secretsEntries.d.ts +0 -2
- package/bin/assets/src/util/agent/suggestionEntries/secretsEntries.js +0 -1
- package/bin/assets/src/util/agent/suggestionEntries/types.d.ts +0 -17
- package/bin/assets/src/util/agent/suggestionEntries/types.js +0 -1
- package/bin/assets/src/util/agent/suggestions.d.ts +0 -30
- package/bin/assets/src/util/agent/suggestions.js +0 -1
- package/bin/assets/src/util/agent/tokenScopes.d.ts +0 -24
- package/bin/assets/src/util/agent/tokenScopes.js +0 -1
- package/bin/assets/src/util/agent/toonFormatter.d.ts +0 -55
- package/bin/assets/src/util/agent/toonFormatter.js +0 -14
- package/bin/assets/src/util/api/Credentials.d.ts +0 -13
- package/bin/assets/src/util/api/Credentials.js +0 -1
- package/bin/assets/src/util/api/FjallApiClient.d.ts +0 -33
- package/bin/assets/src/util/api/FjallApiClient.js +0 -1
- package/bin/assets/src/util/api/FjallApiClient.types.d.ts +0 -375
- package/bin/assets/src/util/api/FjallApiClient.types.js +0 -1
- package/bin/assets/src/util/api/FjallApiClientBase.d.ts +0 -13
- package/bin/assets/src/util/api/FjallApiClientBase.js +0 -1
- package/bin/assets/src/util/api/FjallApiClientDeviceCode.d.ts +0 -13
- package/bin/assets/src/util/api/FjallApiClientDeviceCode.js +0 -1
- package/bin/assets/src/util/api/FjallApiClientErrors.d.ts +0 -5
- package/bin/assets/src/util/api/FjallApiClientErrors.js +0 -1
- package/bin/assets/src/util/api/FjallApiClientResources.d.ts +0 -45
- package/bin/assets/src/util/api/FjallApiClientResources.js +0 -1
- package/bin/assets/src/util/api/index.d.ts +0 -7
- package/bin/assets/src/util/api/index.js +0 -1
- package/bin/assets/src/util/api/resolveApiKey.d.ts +0 -1
- package/bin/assets/src/util/api/resolveApiKey.js +0 -1
- package/bin/assets/src/util/api/scaffoldNotification.d.ts +0 -2
- package/bin/assets/src/util/api/scaffoldNotification.js +0 -1
- package/bin/assets/src/util/awsCleanup.d.ts +0 -9
- package/bin/assets/src/util/awsCleanup.js +0 -1
- package/bin/assets/src/util/awsTags.d.ts +0 -19
- package/bin/assets/src/util/awsTags.js +0 -1
- package/bin/assets/src/util/buildxEventAdapter.d.ts +0 -20
- package/bin/assets/src/util/buildxEventAdapter.js +0 -1
- package/bin/assets/src/util/caseConversion.d.ts +0 -1
- package/bin/assets/src/util/caseConversion.js +0 -1
- package/bin/assets/src/util/codemod/emitCliTelemetry.d.ts +0 -32
- package/bin/assets/src/util/codemod/emitCliTelemetry.js +0 -1
- package/bin/assets/src/util/codemod/exitCodes.d.ts +0 -11
- package/bin/assets/src/util/codemod/exitCodes.js +0 -1
- package/bin/assets/src/util/codemod/index.d.ts +0 -3
- package/bin/assets/src/util/codemod/index.js +0 -1
- package/bin/assets/src/util/codemod/renderCodemod.d.ts +0 -5
- package/bin/assets/src/util/codemod/renderCodemod.js +0 -1
- package/bin/assets/src/util/codemod/stepLabels.d.ts +0 -11
- package/bin/assets/src/util/codemod/stepLabels.js +0 -1
- package/bin/assets/src/util/colourUtils.d.ts +0 -21
- package/bin/assets/src/util/colourUtils.js +0 -1
- package/bin/assets/src/util/commandErrorHandler.d.ts +0 -16
- package/bin/assets/src/util/commandErrorHandler.js +0 -1
- package/bin/assets/src/util/commandResult.d.ts +0 -63
- package/bin/assets/src/util/commandResult.js +0 -1
- package/bin/assets/src/util/concurrency.d.ts +0 -35
- package/bin/assets/src/util/concurrency.js +0 -1
- package/bin/assets/src/util/deploymentEvents.d.ts +0 -155
- package/bin/assets/src/util/deploymentEvents.js +0 -1
- package/bin/assets/src/util/diagnostics/cdkTmpdirCleanup.d.ts +0 -19
- package/bin/assets/src/util/diagnostics/cdkTmpdirCleanup.js +0 -1
- package/bin/assets/src/util/errorDisplay.d.ts +0 -4
- package/bin/assets/src/util/errorDisplay.js +0 -2
- package/bin/assets/src/util/errorUtils.d.ts +0 -1
- package/bin/assets/src/util/errorUtils.js +0 -1
- package/bin/assets/src/util/executionMode.d.ts +0 -18
- package/bin/assets/src/util/executionMode.js +0 -1
- package/bin/assets/src/util/formatDeltaValue.d.ts +0 -1
- package/bin/assets/src/util/formatDeltaValue.js +0 -1
- package/bin/assets/src/util/formatDuration.d.ts +0 -1
- package/bin/assets/src/util/formatDuration.js +0 -1
- package/bin/assets/src/util/formatRelativeTime.d.ts +0 -1
- package/bin/assets/src/util/formatRelativeTime.js +0 -1
- package/bin/assets/src/util/fuzzyMatch.d.ts +0 -38
- package/bin/assets/src/util/fuzzyMatch.js +0 -1
- package/bin/assets/src/util/gitDetection.d.ts +0 -8
- package/bin/assets/src/util/gitDetection.js +0 -1
- package/bin/assets/src/util/index.d.ts +0 -50
- package/bin/assets/src/util/index.js +0 -1
- package/bin/assets/src/util/log.d.ts +0 -29
- package/bin/assets/src/util/log.js +0 -4
- package/bin/assets/src/util/logger/CorrelatedLogger.d.ts +0 -15
- package/bin/assets/src/util/logger/CorrelatedLogger.js +0 -1
- package/bin/assets/src/util/logger/DeploymentLogger.d.ts +0 -33
- package/bin/assets/src/util/logger/DeploymentLogger.js +0 -2
- package/bin/assets/src/util/logger/FileRotator.d.ts +0 -17
- package/bin/assets/src/util/logger/FileRotator.js +0 -1
- package/bin/assets/src/util/logger/LogFileWriter.d.ts +0 -54
- package/bin/assets/src/util/logger/LogFileWriter.js +0 -4
- package/bin/assets/src/util/logger/Logger.d.ts +0 -43
- package/bin/assets/src/util/logger/Logger.js +0 -1
- package/bin/assets/src/util/logger/index.d.ts +0 -15
- package/bin/assets/src/util/logger/index.js +0 -2
- package/bin/assets/src/util/logger/logDir.d.ts +0 -5
- package/bin/assets/src/util/logger/logDir.js +0 -1
- package/bin/assets/src/util/logger/types.d.ts +0 -48
- package/bin/assets/src/util/logger/types.js +0 -1
- package/bin/assets/src/util/nonInteractive/index.d.ts +0 -3
- package/bin/assets/src/util/nonInteractive/index.js +0 -1
- package/bin/assets/src/util/nonInteractive/nonInteractiveCallbacks.d.ts +0 -18
- package/bin/assets/src/util/nonInteractive/nonInteractiveCallbacks.js +0 -1
- package/bin/assets/src/util/nonInteractive/nonInteractiveCascadeOutput.d.ts +0 -51
- package/bin/assets/src/util/nonInteractive/nonInteractiveCascadeOutput.js +0 -1
- package/bin/assets/src/util/nonInteractive/nonInteractiveLabels.d.ts +0 -23
- package/bin/assets/src/util/nonInteractive/nonInteractiveLabels.js +0 -1
- package/bin/assets/src/util/nonInteractive/nonInteractiveOutput.d.ts +0 -128
- package/bin/assets/src/util/nonInteractive/nonInteractiveOutput.js +0 -4
- package/bin/assets/src/util/nonInteractive/nonInteractiveSummaryOutput.d.ts +0 -29
- package/bin/assets/src/util/nonInteractive/nonInteractiveSummaryOutput.js +0 -3
- package/bin/assets/src/util/organisationStructure.d.ts +0 -9
- package/bin/assets/src/util/organisationStructure.js +0 -1
- package/bin/assets/src/util/parseTakeOption.d.ts +0 -1
- package/bin/assets/src/util/parseTakeOption.js +0 -1
- package/bin/assets/src/util/passwordValidation.d.ts +0 -22
- package/bin/assets/src/util/passwordValidation.js +0 -1
- package/bin/assets/src/util/pathHelpers.d.ts +0 -19
- package/bin/assets/src/util/pathHelpers.js +0 -1
- package/bin/assets/src/util/patternDetection.d.ts +0 -7
- package/bin/assets/src/util/patternDetection.js +0 -1
- package/bin/assets/src/util/promptYesNo.d.ts +0 -5
- package/bin/assets/src/util/promptYesNo.js +0 -1
- package/bin/assets/src/util/readStdin.d.ts +0 -9
- package/bin/assets/src/util/readStdin.js +0 -1
- package/bin/assets/src/util/secretsUtils.d.ts +0 -155
- package/bin/assets/src/util/secretsUtils.js +0 -3
- package/bin/assets/src/util/signalCleanup.d.ts +0 -13
- package/bin/assets/src/util/signalCleanup.js +0 -4
- package/bin/assets/src/util/stripAnsi.d.ts +0 -2
- package/bin/assets/src/util/stripAnsi.js +0 -1
- package/bin/assets/src/util/synchronizedOutput.d.ts +0 -26
- package/bin/assets/src/util/synchronizedOutput.js +0 -1
- package/bin/assets/src/util/targetDetection.d.ts +0 -27
- package/bin/assets/src/util/targetDetection.js +0 -1
- package/bin/assets/src/util/targetHelpers.d.ts +0 -20
- package/bin/assets/src/util/targetHelpers.js +0 -1
- package/bin/assets/src/util/terminalCapabilities.d.ts +0 -21
- package/bin/assets/src/util/terminalCapabilities.js +0 -1
- package/bin/assets/src/util/terminalEscapes.d.ts +0 -29
- package/bin/assets/src/util/terminalEscapes.js +0 -1
- package/bin/assets/src/util/terminalFocus.d.ts +0 -33
- package/bin/assets/src/util/terminalFocus.js +0 -1
- package/bin/assets/src/util/theme.d.ts +0 -80
- package/bin/assets/src/util/theme.js +0 -1
- package/bin/assets/src/util/truncateMiddle.d.ts +0 -9
- package/bin/assets/src/util/truncateMiddle.js +0 -1
- package/bin/assets/src/util/typeGuards.d.ts +0 -5
- package/bin/assets/src/util/typeGuards.js +0 -1
- package/bin/assets/src/util/uiRouter.d.ts +0 -13
- package/bin/assets/src/util/uiRouter.js +0 -1
- package/bin/assets/src/util/urlHelpers.d.ts +0 -4
- package/bin/assets/src/util/urlHelpers.js +0 -1
- package/bin/assets/src/util/versionDisplay.d.ts +0 -5
- package/bin/assets/src/util/versionDisplay.js +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from "@fjall/generator";
|
|
2
|
-
export * from "./ast/index.js";
|
|
3
|
-
export * from "./planning/index.js";
|
|
4
|
-
export * from "./resources/index.js";
|
|
5
|
-
export { promptForConnection, selectResources } from "./prompts.js";
|
|
6
|
-
export { renderEjsTemplates, renderEjsString, copyTemplateFile } from "./renderEjs.js";
|
|
7
|
-
export { copySharedCdkFiles } from "./copySharedFiles.js";
|
|
8
|
-
export { FileSystemTree } from "./tree.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export*from"@fjall/generator";export*from"./ast/index.js";export*from"./planning/index.js";export*from"./resources/index.js";import{promptForConnection as f,selectResources as s}from"./prompts.js";import{renderEjsTemplates as l,renderEjsString as n,copyTemplateFile as c}from"./renderEjs.js";import{copySharedCdkFiles as d}from"./copySharedFiles.js";import{FileSystemTree as a}from"./tree.js";export{a as FileSystemTree,d as copySharedCdkFiles,c as copyTemplateFile,f as promptForConnection,n as renderEjsString,l as renderEjsTemplates,s as selectResources};
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Test Utilities
|
|
3
|
-
*
|
|
4
|
-
* Shared utilities for integration tests that run CDK synth operations.
|
|
5
|
-
* Optimises test performance by using shared node_modules instead of
|
|
6
|
-
* running npm install for each test.
|
|
7
|
-
*
|
|
8
|
-
* @see aiDocs/architecture/TESTING_STRATEGY.md
|
|
9
|
-
*/
|
|
10
|
-
export declare const CLI_ROOT: string;
|
|
11
|
-
export declare const TEST_APPS_DIR: string;
|
|
12
|
-
export declare const COMPONENTS_DIR: string;
|
|
13
|
-
export declare const TEST_FIXTURES_DIR: string;
|
|
14
|
-
export declare const SHARED_NODE_MODULES: string;
|
|
15
|
-
export declare const MOCK_ACCOUNT = "123456789012";
|
|
16
|
-
export declare const MOCK_REGION = "ap-southeast-2";
|
|
17
|
-
export interface CfnResource {
|
|
18
|
-
Type: string;
|
|
19
|
-
Properties: Record<string, unknown>;
|
|
20
|
-
[key: string]: unknown;
|
|
21
|
-
}
|
|
22
|
-
export interface CfnTemplate {
|
|
23
|
-
Resources: Record<string, CfnResource>;
|
|
24
|
-
[key: string]: unknown;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* ECS Container definition structure from CloudFormation.
|
|
28
|
-
*/
|
|
29
|
-
export interface EcsContainerDefinition {
|
|
30
|
-
Name?: string;
|
|
31
|
-
Image?: string;
|
|
32
|
-
Essential?: boolean;
|
|
33
|
-
PortMappings?: Array<{
|
|
34
|
-
ContainerPort?: number;
|
|
35
|
-
Protocol?: string;
|
|
36
|
-
}>;
|
|
37
|
-
Environment?: Array<{
|
|
38
|
-
Name: string;
|
|
39
|
-
Value: string;
|
|
40
|
-
}>;
|
|
41
|
-
Secrets?: Array<{
|
|
42
|
-
Name: string;
|
|
43
|
-
ValueFrom: unknown;
|
|
44
|
-
}>;
|
|
45
|
-
Command?: string[];
|
|
46
|
-
EntryPoint?: string[];
|
|
47
|
-
[key: string]: unknown;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Common CloudFormation resource properties accessed in tests.
|
|
51
|
-
* Provides type safety for frequently accessed properties while
|
|
52
|
-
* allowing access to any other property via index signature.
|
|
53
|
-
*/
|
|
54
|
-
export interface CfnResourceProperties {
|
|
55
|
-
GroupDescription?: string;
|
|
56
|
-
SecurityGroupIngress?: Array<{
|
|
57
|
-
CidrIp?: string;
|
|
58
|
-
FromPort?: number;
|
|
59
|
-
ToPort?: number;
|
|
60
|
-
IpProtocol?: string;
|
|
61
|
-
SourceSecurityGroupId?: unknown;
|
|
62
|
-
}>;
|
|
63
|
-
Conditions?: Array<{
|
|
64
|
-
Field?: string;
|
|
65
|
-
PathPatternConfig?: {
|
|
66
|
-
Values?: string[];
|
|
67
|
-
};
|
|
68
|
-
HostHeaderConfig?: {
|
|
69
|
-
Values?: string[];
|
|
70
|
-
};
|
|
71
|
-
Values?: string[];
|
|
72
|
-
}>;
|
|
73
|
-
ContainerDefinitions?: EcsContainerDefinition[];
|
|
74
|
-
RequiresCompatibilities?: string[];
|
|
75
|
-
GenerateSecretString?: {
|
|
76
|
-
SecretStringTemplate?: string;
|
|
77
|
-
GenerateStringKey?: string;
|
|
78
|
-
ExcludeCharacters?: string;
|
|
79
|
-
};
|
|
80
|
-
[key: string]: unknown;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* A CloudFormation resource entry with typed common properties.
|
|
84
|
-
*/
|
|
85
|
-
export interface ResourceEntry {
|
|
86
|
-
logicalId: string;
|
|
87
|
-
properties: CfnResourceProperties;
|
|
88
|
-
}
|
|
89
|
-
export interface CdkSynthResult {
|
|
90
|
-
success: boolean;
|
|
91
|
-
output: string;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Run CDK synth on a test app.
|
|
95
|
-
* Uses shared node_modules when available, falls back to npm install.
|
|
96
|
-
*/
|
|
97
|
-
export declare function runCdkSynth(appName: string, options?: {
|
|
98
|
-
context?: Record<string, unknown>;
|
|
99
|
-
}): CdkSynthResult;
|
|
100
|
-
/**
|
|
101
|
-
* Patch package.json + ensure node_modules for a test app, without running
|
|
102
|
-
* `cdk synth`. Use this when a test only needs `tsc --noEmit` (or another
|
|
103
|
-
* non-synth probe) against the generated `infrastructure.ts`.
|
|
104
|
-
*/
|
|
105
|
-
export declare function prepareTestApp(appName: string): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Clean up a test app directory.
|
|
108
|
-
* Handles symlinked node_modules properly.
|
|
109
|
-
*/
|
|
110
|
-
export declare function cleanupTestApp(appName: string): void;
|
|
111
|
-
/**
|
|
112
|
-
* Read a CloudFormation template from cdk.out.
|
|
113
|
-
*
|
|
114
|
-
* Stack names use `toPascalCase(appName)` as prefix to match the transformation
|
|
115
|
-
* in `App.getApp()` (see `components/infrastructure/lib/app.ts`).
|
|
116
|
-
*/
|
|
117
|
-
export declare function readCfnTemplate(appName: string, stackSuffix: string): CfnTemplate;
|
|
118
|
-
/**
|
|
119
|
-
* Get infrastructure.ts content for a test app.
|
|
120
|
-
*/
|
|
121
|
-
export declare function getInfrastructureContent(appName: string): string;
|
|
122
|
-
/**
|
|
123
|
-
* Find resources by type in a CloudFormation template.
|
|
124
|
-
*/
|
|
125
|
-
export declare function findResourcesByType(template: CfnTemplate, resourceType: string): ResourceEntry[];
|
|
126
|
-
/**
|
|
127
|
-
* Find a security group by description substring.
|
|
128
|
-
* Commonly used to find database or ALB security groups.
|
|
129
|
-
*/
|
|
130
|
-
export declare function findSecurityGroupByDescription(securityGroups: ResourceEntry[], descriptionSubstring: string): ResourceEntry | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Extract values from ALB listener rule conditions by field type.
|
|
133
|
-
*/
|
|
134
|
-
export declare function extractConditionValues(listenerRules: ResourceEntry[], fieldType: "path-pattern" | "host-header"): string[];
|
|
135
|
-
/**
|
|
136
|
-
* Ensure components-infrastructure is built.
|
|
137
|
-
*/
|
|
138
|
-
export declare function ensureComponentsBuilt(): void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import r from"fs";import o from"path";import{execFileSync as p}from"child_process";import{toPascalCase as y}from"@fjall/util";import{normaliseError as b}from"../../src/util/errorUtils.js";const a=o.resolve(import.meta.dirname,"../.."),u=o.join(a,"fjall"),d=o.resolve(a,"../components/infrastructure"),x=o.join(a,"test-fixtures"),f=o.join(x,"node_modules"),l="123456789012",s="ap-southeast-2";function v(n,e){const t=o.join(u,n);return S(t),_(t,e?.context),m(t)?g(t):{success:!1,output:"Failed to set up node_modules"}}function O(n){const e=o.join(u,n);return S(e),m(e)}function m(n){const e=o.join(n,"node_modules");if(r.existsSync(f))try{return r.existsSync(e)&&(r.lstatSync(e).isSymbolicLink()?r.unlinkSync(e):r.rmSync(e,{recursive:!0,force:!0})),r.symlinkSync(f,e,"junction"),!0}catch(t){process.stderr.write(`integrationTestUtils: symlink to shared node_modules failed, falling back to npm install: ${t instanceof Error?t.message:String(t)}
|
|
2
|
-
`)}if(!r.existsSync(e))try{p("npm",["install"],{cwd:n,encoding:"utf-8",timeout:12e4})}catch(t){return process.stderr.write(`integrationTestUtils: npm install in ${n} failed: ${t instanceof Error?t.message:String(t)}
|
|
3
|
-
`),!1}return!0}function g(n){try{const e=o.join(n,"node_modules",".bin","cdk");return{success:!0,output:p(e,["synth"],{cwd:n,encoding:"utf-8",timeout:12e4,stdio:["pipe","pipe","pipe"],env:{...process.env,AWS_REGION:s,AWS_DEFAULT_REGION:s,CDK_DEFAULT_ACCOUNT:l,CDK_DEFAULT_REGION:s}})}}catch(e){const t=b(e),i="stdout"in t&&typeof t.stdout=="string"?t.stdout:void 0,c="stderr"in t&&typeof t.stderr=="string"?t.stderr:void 0;return{success:!1,output:i||c||t.message||"Unknown error"}}}function S(n){const e=o.join(n,"package.json"),t=JSON.parse(r.readFileSync(e,"utf-8"));t.dependencies["@fjall/components-infrastructure"]=`file:${d}`,r.writeFileSync(e,JSON.stringify(t,null,2))}function _(n,e){const t={app:"./node_modules/.bin/tsx infrastructure.ts",context:{"aws:cdk:bundling-stacks":[],[`availability-zones:account=${l}:region=${s}`]:[`${s}a`,`${s}b`,`${s}c`],[`vpc-provider:account=${l}:filter.isDefault=true:region=${s}:returnAsymmetricSubnets=true`]:{vpcId:"vpc-12345678",vpcCidrBlock:"10.0.0.0/16",availabilityZones:[`${s}a`,`${s}b`],publicSubnetIds:["subnet-pub1","subnet-pub2"],publicSubnetRouteTableIds:["rtb-pub1","rtb-pub2"],privateSubnetIds:["subnet-priv1","subnet-priv2"],privateSubnetRouteTableIds:["rtb-priv1","rtb-priv2"]},...e}};r.writeFileSync(o.join(n,"cdk.json"),JSON.stringify(t,null,2))}function h(n){const e=o.join(u,n);if(!r.existsSync(e))return;const t=o.join(e,"node_modules");r.existsSync(t)&&r.lstatSync(t).isSymbolicLink()&&r.unlinkSync(t),r.rmSync(e,{recursive:!0,force:!0})}function $(n,e){const t=o.join(u,n,"cdk.out",`${y(n)}${e}.template.json`);if(!r.existsSync(t))throw new Error(`Template not found: ${t}`);return JSON.parse(r.readFileSync(t,"utf-8"))}function I(n){const e=o.join(u,n,"infrastructure.ts");if(!r.existsSync(e))throw new Error(`Infrastructure file not found: ${e}`);return r.readFileSync(e,"utf-8")}function w(n,e){return Object.entries(n.Resources).filter(([,t])=>t.Type===e).map(([t,i])=>({logicalId:t,properties:i.Properties}))}function D(n,e){return n.find(t=>t.properties.GroupDescription?.includes(e))}function N(n,e){const t=e==="path-pattern"?"PathPatternConfig":"HostHeaderConfig";return n.flatMap(i=>i.properties.Conditions?.filter(c=>c.Field===e).flatMap(c=>c[t]?.Values??c.Values??[])).filter(i=>i!==void 0)}function R(){r.existsSync(o.join(d,"dist"))||(process.stdout.write(`Building components-infrastructure...
|
|
4
|
-
`),p("npm",["run","build"],{cwd:d,stdio:"inherit"}))}export{a as CLI_ROOT,d as COMPONENTS_DIR,l as MOCK_ACCOUNT,s as MOCK_REGION,f as SHARED_NODE_MODULES,u as TEST_APPS_DIR,x as TEST_FIXTURES_DIR,h as cleanupTestApp,R as ensureComponentsBuilt,N as extractConditionValues,w as findResourcesByType,D as findSecurityGroupByDescription,I as getInfrastructureContent,O as prepareTestApp,$ as readCfnTemplate,v as runCdkSynth};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { Tree } from "@nx/devkit";
|
|
2
|
-
/**
|
|
3
|
-
* Lightweight mock Tree implementation for generator unit tests.
|
|
4
|
-
* Use this instead of duplicating MockTree in each test file.
|
|
5
|
-
*
|
|
6
|
-
* For integration tests that need real file system behaviour, use FileSystemTree instead.
|
|
7
|
-
*/
|
|
8
|
-
export declare class MockTree {
|
|
9
|
-
private files;
|
|
10
|
-
private changes;
|
|
11
|
-
constructor(initialFiles?: Record<string, string>);
|
|
12
|
-
read(path: string): Buffer | null;
|
|
13
|
-
write(path: string, content: string): void;
|
|
14
|
-
exists(path: string): boolean;
|
|
15
|
-
getChanges(): Array<{
|
|
16
|
-
path: string;
|
|
17
|
-
content: string;
|
|
18
|
-
}>;
|
|
19
|
-
getFileContent(path: string): string | undefined;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Type helper: cast MockTree as Tree for generator functions that expect the NX Tree interface.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* const tree = new MockTree({ "apps/myapp/infrastructure/main.ts": code });
|
|
27
|
-
* const result = myGenerator(tree as unknown as Tree, options);
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export type { Tree };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class r{files=new Map;changes=[];constructor(e={}){for(const[t,s]of Object.entries(e))this.files.set(t,s)}read(e){const t=this.files.get(e);return t?Buffer.from(t):null}write(e,t){this.files.set(e,t),this.changes.push({path:e,content:t})}exists(e){return this.files.has(e)}getChanges(){return this.changes}getFileContent(e){return this.files.get(e)}}export{r as MockTree};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { type Tree } from "@nx/devkit";
|
|
2
|
-
import { type Result } from "../../../src/types/Result.js";
|
|
3
|
-
import { type ParsedInfrastructure, type ApplicationResourcePlan } from "@fjall/generator";
|
|
4
|
-
import { type z } from "zod";
|
|
5
|
-
export declare function createInfrastructureBackup(tree: Tree, infrastructurePath: string, originalContent: string): Result<void, Error>;
|
|
6
|
-
export declare function pickDefined<T extends Record<string, unknown>>(source: T, ...keys: Array<keyof T>): Partial<Pick<T, (typeof keys)[number]>>;
|
|
7
|
-
export interface ParseAndBuildResult {
|
|
8
|
-
parsed: ParsedInfrastructure;
|
|
9
|
-
plan: ApplicationResourcePlan;
|
|
10
|
-
}
|
|
11
|
-
export declare function parseAndBuildPlan(content: string, appName: string): Result<ParseAndBuildResult, Error>;
|
|
12
|
-
export declare function parseAndBuildPlanOrThrow(content: string, appName: string): ParseAndBuildResult;
|
|
13
|
-
export declare function validateGeneratorOptions<T>(schema: z.ZodType<T>, options: unknown, generatorName: string): T;
|
|
14
|
-
export declare function readInfrastructureOrThrow(tree: Tree, appName: string): {
|
|
15
|
-
path: string;
|
|
16
|
-
content: string;
|
|
17
|
-
};
|
|
18
|
-
export interface WithInfrastructurePlanContext<T> {
|
|
19
|
-
tree: Tree;
|
|
20
|
-
validated: T;
|
|
21
|
-
plan: ApplicationResourcePlan;
|
|
22
|
-
infrastructurePath: string;
|
|
23
|
-
content: string;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Orchestrates the common generator pattern: validate options, read existing
|
|
27
|
-
* infrastructure, parse into a plan, run custom logic, then write back.
|
|
28
|
-
*
|
|
29
|
-
* The callback receives the parsed plan and validated options, and must return
|
|
30
|
-
* the updated plan to be written.
|
|
31
|
-
*/
|
|
32
|
-
export declare function withInfrastructurePlan<T extends {
|
|
33
|
-
appName: string;
|
|
34
|
-
}>(tree: Tree, schema: z.ZodType<T>, options: unknown, generatorName: string, buildPlan: (ctx: WithInfrastructurePlanContext<T>) => ApplicationResourcePlan | Promise<ApplicationResourcePlan>): Promise<void>;
|
|
35
|
-
export declare function generateAndWriteInfrastructure(tree: Tree, infrastructurePath: string, originalContent: string, plan: ApplicationResourcePlan): Result<void, Error>;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import*as i from"fs";import*as w from"path";import{maskSensitiveOutput as h}from"@fjall/util";import{logger as g}from"../../../src/util/logger/index.js";import{normaliseError as d}from"../../../src/util/errorUtils.js";import{success as p,failure as a}from"../../../src/types/Result.js";import{parseInfrastructure as k,convertToResourcePlan as x,getZodErrorMessage as P,generateInfrastructureFromPlan as $}from"@fjall/generator";import{getInfrastructurePath as E}from"../../../src/util/pathHelpers.js";function I(t,o,r){const e=t.root?w.join(t.root,o):o;try{if(i.existsSync(e)){const s=`${e}.bak`,n=`${s}.tmp`;i.writeFileSync(n,r),i.renameSync(n,s)}return p(void 0)}catch(s){const n=d(s);return g.warn("Generator",`Failed to create backup of ${o}`,{error:h(n.message)}),a(n)}}function G(t,...o){const r={};for(const e of o)t[e]!==void 0&&(r[e]=t[e]);return r}function y(t,o){try{const r=k(t,{extractCustomCode:!0}),e=x(r,o,{skipValidation:!0});return r.customCodeBlocks?.length&&(e.customCodeBlocks=r.customCodeBlocks),p({parsed:r,plan:e})}catch(r){return a(d(r))}}function b(t,o){const r=y(t,o);if(!r.success)throw new Error(`Failed to parse infrastructure: ${r.error.message}`,{cause:r.error});return r.data}function B(t,o,r){const e=t.safeParse(o);if(!e.success)throw new Error(`Invalid ${r} generator options:
|
|
2
|
-
${P(e.error)}`);return e.data}function v(t,o){const r=E(o),e=t.read(r)?.toString();if(!e)throw new Error(`App '${o}' not found. Expected infrastructure.ts at: ${r}`);return{path:r,content:e}}async function j(t,o,r,e,s){const n=B(o,r,e),{path:f,content:c}=v(t,n.appName),{plan:l}=b(c,n.appName),m=await s({tree:t,validated:n,plan:l,infrastructurePath:f,content:c}),u=C(t,f,c,m);if(!u.success)throw new Error(u.error.message,{cause:u.error})}function C(t,o,r,e){const s=$(e);if(!s.success)return a(s.error);const n=I(t,o,r);return n.success?(t.write(o,s.data),p(void 0)):a(new Error(`Failed to create backup: ${n.error.message}`))}export{I as createInfrastructureBackup,C as generateAndWriteInfrastructure,y as parseAndBuildPlan,b as parseAndBuildPlanOrThrow,G as pickDefined,v as readInfrastructureOrThrow,B as validateGeneratorOptions,j as withInfrastructurePlan};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createInfrastructureBackup, pickDefined, type ParseAndBuildResult, parseAndBuildPlan, parseAndBuildPlanOrThrow, validateGeneratorOptions, readInfrastructureOrThrow, generateAndWriteInfrastructure, withInfrastructurePlan, type WithInfrastructurePlanContext } from "./generatorHelpers.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createInfrastructureBackup as a,pickDefined as t,parseAndBuildPlan as n,parseAndBuildPlanOrThrow as u,validateGeneratorOptions as d,readInfrastructureOrThrow as i,generateAndWriteInfrastructure as c,withInfrastructurePlan as s}from"./generatorHelpers.js";export{a as createInfrastructureBackup,c as generateAndWriteInfrastructure,n as parseAndBuildPlan,u as parseAndBuildPlanOrThrow,t as pickDefined,i as readInfrastructureOrThrow,d as validateGeneratorOptions,s as withInfrastructurePlan};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function promptForConnection(resourceCount: number, resourceType: string, singularMessage?: string, pluralMessage?: string): Promise<boolean>;
|
|
2
|
-
export declare function selectResources<T extends {
|
|
3
|
-
name: string;
|
|
4
|
-
}>(resources: T[], message: string, getDescription?: (r: T) => string): Promise<string[]>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import i from"prompts";async function p(e,s,o,t){const c=`Connect to existing ${s}?`,n=`Found ${e} ${s}s. Configure connections?`,a=e===1?o??c:t?.replace("{count}",String(e))??n,l=await i([{type:"confirm",name:"shouldConnect",message:a,initial:!0}]);return l?l.shouldConnect:!1}async function u(e,s,o){if(e.length===1)return process.stdout.write(`
|
|
2
|
-
Auto-selected: ${e[0].name}
|
|
3
|
-
`),[e[0].name];let t=[];for(;t.length===0;)t=(await i([{type:"multiselect",name:"selected",message:s,choices:e.map(n=>({title:n.name,value:n.name,description:o?.(n),selected:!1}))}]))?.selected||[],t.length===0&&process.stdout.write(`
|
|
4
|
-
Please select at least one resource
|
|
5
|
-
|
|
6
|
-
`);return t}export{p as promptForConnection,u as selectResources};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type Tree } from "@nx/devkit";
|
|
2
|
-
/**
|
|
3
|
-
* Renders EJS templates and generates files using Tree
|
|
4
|
-
* @param tree - Tree for file operations
|
|
5
|
-
* @param templatePath - Path to the template files
|
|
6
|
-
* @param targetPath - Target path for generated files
|
|
7
|
-
* @param substitutions - Object containing template variables
|
|
8
|
-
*/
|
|
9
|
-
export declare function renderEjsTemplates(tree: Tree, templatePath: string, targetPath: string, substitutions: Record<string, unknown>): void;
|
|
10
|
-
/**
|
|
11
|
-
* Renders a single EJS template string
|
|
12
|
-
* @param template - EJS template string
|
|
13
|
-
* @param data - Template data
|
|
14
|
-
* @returns Rendered template string
|
|
15
|
-
*/
|
|
16
|
-
export declare function renderEjsString(template: string, data: Record<string, unknown>): string;
|
|
17
|
-
/**
|
|
18
|
-
* Copies a template file with EJS substitutions
|
|
19
|
-
* @param tree - Tree for file operations
|
|
20
|
-
* @param from - Source template path
|
|
21
|
-
* @param to - Destination path
|
|
22
|
-
* @param substitutions - Template variables
|
|
23
|
-
*/
|
|
24
|
-
export declare function copyTemplateFile(tree: Tree, from: string, to: string, substitutions: Record<string, unknown>): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import S from"ejs";import r from"fs";import a from"path";function w(t,e,i,s){function n(o,u=""){const y=r.readdirSync(o);for(const d of y){const c=a.join(o,d),m=a.join(u,d),p=r.statSync(c);if(p.isDirectory())n(c,m);else if(p.isFile()){const f=r.readFileSync(c,"utf-8"),j=a.join(i,m),F=f.includes("<%")?l(f,s):f;t.write(j,F)}}}n(e)}function l(t,e){return S.render(t,e)}function D(t,e,i,s){const n=r.readFileSync(e,"utf-8"),o=l(n,s);t.write(i,o)}export{D as copyTemplateFile,l as renderEjsString,w as renderEjsTemplates};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Interactive resource connection handler (CLI-only — uses prompts).
|
|
3
|
-
* Pure connection logic (applyComputeConnections, applyServiceConnections)
|
|
4
|
-
* lives in @fjall/generator for shared use by CLI and webapp.
|
|
5
|
-
*/
|
|
6
|
-
import { type ApplicationResourcePlan, type ConnectionType } from "@fjall/generator";
|
|
7
|
-
interface ConnectionPrompts {
|
|
8
|
-
readonly singularPrompt: string;
|
|
9
|
-
readonly pluralPrompt: string;
|
|
10
|
-
}
|
|
11
|
-
interface ConnectionHandlerOptions {
|
|
12
|
-
readonly connectionConfig?: {
|
|
13
|
-
readonly connectToCompute?: string[];
|
|
14
|
-
readonly connectToServices?: string[];
|
|
15
|
-
};
|
|
16
|
-
readonly nameProvidedByFlag?: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare function handleResourceConnections(currentPlan: ApplicationResourcePlan, options: ConnectionHandlerOptions, resourceName: string, type: ConnectionType, prompts: ConnectionPrompts): Promise<void>;
|
|
19
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{applyServiceConnections as u,applyComputeConnections as s}from"@fjall/generator";import{promptForConnection as m,selectResources as f}from"../prompts.js";async function h(o,n,t,c,i){if(o.compute.length===0)return;if(n.connectionConfig){const{connectToCompute:e=[],connectToServices:r=[]}=n.connectionConfig;r.length>0&&u(o,r,t,c),e.length>0&&s(o,e,t,c);return}if(n.nameProvidedByFlag||!await m(o.compute.length,"compute resource",i.singularPrompt,i.pluralPrompt))return;const p=await f(o.compute,"Select compute resources to connect:",e=>e.type.toUpperCase());p.length>0&&s(o,p,t,c)}export{h as handleResourceConnections};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { generateUniqueResourceName, getDefaultResourceName, getUniqueDefaultResourceName, ensureUniqueResourceName } from "./resourceNaming.js";
|
|
2
|
-
export { type ComputeResource, resourceExists, assertResourceNameUnique, countResourcesOfType, detectComputeResources, databaseExists } from "./resourceDetection.js";
|
|
3
|
-
export { validateOrganisationName, validatePort, validateResourceName, validateAppName, validateInstanceType, validateLambdaMemory, validateLambdaTimeout, validateCapacity, validateDatabaseName, validateMinMaxCapacity } from "./promptValidation.js";
|
|
4
|
-
export { handleResourceConnections } from "./connectionHelpers.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{generateUniqueResourceName as t,getDefaultResourceName as o,getUniqueDefaultResourceName as r,ensureUniqueResourceName as s}from"./resourceNaming.js";import{resourceExists as u,assertResourceNameUnique as m,countResourcesOfType as c,detectComputeResources as n,databaseExists as d}from"./resourceDetection.js";import{validateOrganisationName as p,validatePort as v,validateResourceName as N,validateAppName as R,validateInstanceType as f,validateLambdaMemory as x,validateLambdaTimeout as y,validateCapacity as b,validateDatabaseName as g,validateMinMaxCapacity as q}from"./promptValidation.js";import{handleResourceConnections as U}from"./connectionHelpers.js";export{m as assertResourceNameUnique,c as countResourcesOfType,d as databaseExists,n as detectComputeResources,s as ensureUniqueResourceName,t as generateUniqueResourceName,o as getDefaultResourceName,r as getUniqueDefaultResourceName,U as handleResourceConnections,u as resourceExists,R as validateAppName,b as validateCapacity,g as validateDatabaseName,f as validateInstanceType,x as validateLambdaMemory,y as validateLambdaTimeout,q as validateMinMaxCapacity,p as validateOrganisationName,v as validatePort,N as validateResourceName};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { type Tree } from "@nx/devkit";
|
|
2
|
-
/**
|
|
3
|
-
* Validation function for organisation names
|
|
4
|
-
*/
|
|
5
|
-
export declare const validateOrganisationName: (value: string) => true | string;
|
|
6
|
-
/**
|
|
7
|
-
* Validation function for port numbers in prompts
|
|
8
|
-
*/
|
|
9
|
-
export declare const validatePort: (value: string | number) => true | string;
|
|
10
|
-
/**
|
|
11
|
-
* Validation function for resource names in prompts
|
|
12
|
-
* Checks both format and uniqueness
|
|
13
|
-
*/
|
|
14
|
-
export declare const validateResourceName: (value: string, tree: Tree, appName: string) => true | string;
|
|
15
|
-
/**
|
|
16
|
-
* Validation function for application names in prompts
|
|
17
|
-
*/
|
|
18
|
-
export declare const validateAppName: (value: string) => true | string;
|
|
19
|
-
/**
|
|
20
|
-
* Validation function for EC2 instance types in prompts
|
|
21
|
-
*/
|
|
22
|
-
export declare const validateInstanceType: (value: string) => true | string;
|
|
23
|
-
/**
|
|
24
|
-
* Validation function for Lambda memory in prompts
|
|
25
|
-
*/
|
|
26
|
-
export declare const validateLambdaMemory: (value: string | number) => true | string;
|
|
27
|
-
/**
|
|
28
|
-
* Validation function for Lambda timeout in prompts
|
|
29
|
-
*/
|
|
30
|
-
export declare const validateLambdaTimeout: (value: string | number) => true | string;
|
|
31
|
-
/**
|
|
32
|
-
* Validation function for ECS capacity settings
|
|
33
|
-
*/
|
|
34
|
-
export declare const validateCapacity: (value: string | number, min?: number, max?: number) => true | string;
|
|
35
|
-
/**
|
|
36
|
-
* Validation function for database names
|
|
37
|
-
*/
|
|
38
|
-
export declare const validateDatabaseName: (value: string) => true | string;
|
|
39
|
-
/**
|
|
40
|
-
* Validation function for ensuring min capacity is less than max capacity
|
|
41
|
-
*/
|
|
42
|
-
export declare const validateMinMaxCapacity: (minCapacity: number, maxCapacity: number) => true | string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{PortSchema as u,ResourceNameSchema as m,InstanceTypeSchema as p,AppNameSchema as f,OrganisationNameSchema as M,DatabaseNameSchema as d,getZodErrorMessage as a,MIN_LAMBDA_MEMORY as n,MAX_LAMBDA_MEMORY as o,MIN_LAMBDA_TIMEOUT as c,MAX_LAMBDA_TIMEOUT as i}from"@fjall/generator";import{resourceExists as y}from"./resourceDetection.js";const x=t=>{const e=M.safeParse(t);return e.success?!0:a(e.error)},l=t=>{const e=typeof t=="string"?parseInt(t,10):t,r=u.safeParse(e);return r.success?!0:a(r.error)},A=(t,e,r)=>{const s=m.safeParse(t);return s.success?y(e,r,t)?`Resource "${t}" already exists in this application`:!0:a(s.error)},T=t=>{const e=f.safeParse(t);return e.success?!0:a(e.error)},$=t=>{const e=p.safeParse(t);return e.success?!0:a(e.error)},h=t=>{const e=typeof t=="string"?parseInt(t,10):t;if(isNaN(e))return"Memory must be a number";if(e<n)return`Memory must be at least ${n} MB`;if(e>o)return`Memory cannot exceed ${o} MB`;if(e>128&&e%64!==0){const r=Math.floor(e/64)*64,s=Math.ceil(e/64)*64;return`Memory must be in 64 MB increments. Try ${r} or ${s}`}return!0},I=t=>{const e=typeof t=="string"?parseInt(t,10):t;return isNaN(e)?"Timeout must be a number":e<c?`Timeout must be at least ${c} seconds`:e>i?`Timeout cannot exceed ${i} seconds (15 minutes)`:!0},g=(t,e=1,r=1e3)=>{const s=typeof t=="string"?parseInt(t,10):t;return isNaN(s)?"Capacity must be a number":s<e?`Capacity must be at least ${e}`:s>r?`Capacity cannot exceed ${r}`:!0},P=t=>{const e=t?.trim()??"",r=d.safeParse(e);return r.success?!0:a(r.error)},_=(t,e)=>t>e?`Minimum capacity (${t}) cannot be greater than maximum capacity (${e})`:!0;export{T as validateAppName,g as validateCapacity,P as validateDatabaseName,$ as validateInstanceType,h as validateLambdaMemory,I as validateLambdaTimeout,_ as validateMinMaxCapacity,x as validateOrganisationName,l as validatePort,A as validateResourceName};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Tree } from "@nx/devkit";
|
|
2
|
-
export interface ComputeResource {
|
|
3
|
-
name: string;
|
|
4
|
-
type: "ecs" | "lambda" | "ec2";
|
|
5
|
-
hasConnections: boolean;
|
|
6
|
-
connectedResources: string[];
|
|
7
|
-
}
|
|
8
|
-
export declare function resourceExists(tree: Tree, appName: string, resourceName: string): boolean;
|
|
9
|
-
export declare function assertResourceNameUnique(tree: Tree, appName: string, resourceName: string): void;
|
|
10
|
-
export declare function countResourcesOfType(tree: Tree, appName: string, resourceType: "database" | "compute" | "lambda" | "ecs" | "ec2"): number;
|
|
11
|
-
export declare function detectComputeResources(tree: Tree, appName: string): ComputeResource[];
|
|
12
|
-
export declare function databaseExists(tree: Tree, appName: string, databaseName: string): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getInfrastructurePath as o}from"../../../src/util/pathHelpers.js";function l(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(t,e,r){const s=o(e),n=t.read(s)?.toString();return n?new RegExp(`["']${l(r)}["']`).test(n):!1}function y(t,e,r){const s=o(e);if(!t.read(s)?.toString())throw new Error(`Infrastructure file not found for ${e}`);if(m(t,e,r))throw new Error(`Resource name '${r}' already exists in ${e}. Please choose a different name or remove the existing resource first.`)}function P(t,e,r){const s=o(e),n=t.read(s)?.toString();if(!n)return 0;const c={database:/DatabaseFactory\.build\(/g,compute:/ComputeFactory\.build\(/g,lambda:/type:\s*["']lambda["']/g,ecs:/type:\s*["']ecs["']/g,ec2:/type:\s*["']ec2["']/g}[r];if(!c)return 0;const u=n.match(c);return u?u.length:0}function R(t,e){const r=o(e),s=t.read(r)?.toString();if(!s)return[];const n=[],a=s.matchAll(/ComputeFactory\.build\(["']([^"']+)["'],\s*\{([^}]*?)\}/gs);for(const c of a){const u=c[1],i=c[2];let f="ecs";i.includes('type: "lambda"')?f="lambda":i.includes('type: "ec2"')&&(f="ec2");const d=i.includes("connections:"),h=[];if(d){const p=i.match(/connections:\s*\[([^\]]+)\]/);if(p){const g=p[1].match(/\w+/g)??[];h.push(...g)}}n.push({name:u,type:f,hasConnections:d,connectedResources:h})}return n}function w(t,e,r){const s=o(e),n=t.read(s)?.toString();return n?new RegExp(`databaseName:\\s*["']${l(r)}["']`).test(n):!1}export{y as assertResourceNameUnique,P as countResourcesOfType,w as databaseExists,R as detectComputeResources,m as resourceExists};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { type Tree } from "@nx/devkit";
|
|
2
|
-
import { DEFAULTS } from "@fjall/generator";
|
|
3
|
-
export declare function generateUniqueResourceName(tree: Tree, appName: string, baseResourceName: string, resourceType: "database" | "compute" | "lambda" | "ecs" | "ec2"): string;
|
|
4
|
-
export declare function getDefaultResourceName(appName: string, resourceType: keyof typeof DEFAULTS.RESOURCE_SUFFIXES): string;
|
|
5
|
-
export declare function getUniqueDefaultResourceName(tree: Tree, appName: string, resourceType: keyof typeof DEFAULTS.RESOURCE_SUFFIXES): string;
|
|
6
|
-
export declare function ensureUniqueResourceName(tree: Tree, appName: string, proposedName: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{assertResourceNameUnique as $,countResourcesOfType as a,resourceExists as s}from"./resourceDetection.js";import{DEFAULTS as E}from"@fjall/generator";const i=1e3;function x(r,n,t,e){if(a(r,n,e)===0)return t;for(let u=2;u<=i;u++){const o=`${t}${u}`;try{return $(r,n,o),o}catch{}}return`${t}${i}`}function m(r,n){const t=E.RESOURCE_SUFFIXES[n];return`${r}${t}`}function T(r,n,t){const e=m(n,t);if(!s(r,n,e))return e;for(let c=2;c<=i;c++){const u=`${e}${c}`;if(!s(r,n,u))return u}return`${e}${i}`}function l(r,n,t){if(!s(r,n,t))return t;const e=t.match(/^(.+?)(\d*)$/);if(!e)return t;const c=e[1],u=e[2]?parseInt(e[2],10)+1:2;for(let o=u;o<=u+i;o++){const f=`${c}${o}`;if(!s(r,n,f))return f}return`${c}${u+i}`}export{l as ensureUniqueResourceName,x as generateUniqueResourceName,m as getDefaultResourceName,T as getUniqueDefaultResourceName};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type Tree, type FileChange } from "@nx/devkit";
|
|
2
|
-
import type { Mode } from "fs";
|
|
3
|
-
/**
|
|
4
|
-
* File system tree implementation that implements the full Nx Tree interface
|
|
5
|
-
*
|
|
6
|
-
* Provides direct filesystem operations for use in integration tests and deploy tests.
|
|
7
|
-
* Supports optional path rewriting for test isolation (e.g., redirecting fjall/ to fjall-deploy-tests/).
|
|
8
|
-
*/
|
|
9
|
-
export declare class FileSystemTree implements Tree {
|
|
10
|
-
readonly root: string;
|
|
11
|
-
private pathRewriter?;
|
|
12
|
-
private changes;
|
|
13
|
-
constructor(rootPath: string, pathRewriter?: (filePath: string) => string);
|
|
14
|
-
private resolvePath;
|
|
15
|
-
read(filePath: string): Buffer | null;
|
|
16
|
-
read(filePath: string, encoding: BufferEncoding): string | null;
|
|
17
|
-
write(filePath: string, content: string | Buffer): void;
|
|
18
|
-
exists(filePath: string): boolean;
|
|
19
|
-
delete(filePath: string): void;
|
|
20
|
-
rename(from: string, to: string): void;
|
|
21
|
-
isFile(filePath: string): boolean;
|
|
22
|
-
children(dirPath: string): string[];
|
|
23
|
-
listChanges(): FileChange[];
|
|
24
|
-
changePermissions(filePath: string, mode: Mode): void;
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{existsSync as s,readFileSync as h,writeFileSync as c,mkdirSync as o,rmSync as l,renameSync as u,statSync as f,readdirSync as m,chmodSync as P}from"fs";import{join as v,dirname as a}from"path";class S{root;pathRewriter;changes=new Map;constructor(t,e){this.root=t,this.pathRewriter=e}resolvePath(t){const e=this.pathRewriter?this.pathRewriter(t):t;return v(this.root,e)}read(t,e){const r=this.resolvePath(t);return s(r)?e?h(r,e):h(r):null}write(t,e){const r=this.resolvePath(t),i=a(r);s(i)||o(i,{recursive:!0});const n=s(r);c(r,e),this.changes.set(t,{path:t,type:n?"UPDATE":"CREATE",content:Buffer.isBuffer(e)?e:Buffer.from(e)})}exists(t){return s(this.resolvePath(t))}delete(t){const e=this.resolvePath(t);s(e)&&(l(e,{recursive:!0,force:!0}),this.changes.set(t,{path:t,type:"DELETE",content:null}))}rename(t,e){const r=this.resolvePath(t),i=this.resolvePath(e);if(!s(r))return;const n=a(i);s(n)||o(n,{recursive:!0}),u(r,i)}isFile(t){const e=this.resolvePath(t);return s(e)?f(e).isFile():!1}children(t){const e=this.resolvePath(t);if(!s(e))return[];try{return m(e)}catch{return[]}}listChanges(){return Array.from(this.changes.values())}changePermissions(t,e){const r=this.resolvePath(t);s(r)&&P(r,e)}}export{S as FileSystemTree};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared test constants and helpers for FjallApiClient test files.
|
|
3
|
-
*
|
|
4
|
-
* vi.mock() calls must remain in each test file (Vitest hoisting),
|
|
5
|
-
* but these constants and factory functions can be shared.
|
|
6
|
-
*/
|
|
7
|
-
export declare const TEST_API_KEY = "fj_test_key_abc123";
|
|
8
|
-
export declare const TEST_BASE_URL = "https://test.fjall.io";
|
|
9
|
-
export declare function createClient(FjallApiClientClass: new (apiKey: string, baseUrl: string) => unknown, apiKey?: string, baseUrl?: string): unknown;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const o="fj_test_key_abc123",_="https://test.fjall.io";function r(t,e=o,n=_){return new t(e,n)}export{o as TEST_API_KEY,_ as TEST_BASE_URL,r as createClient};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { vi } from "vitest";
|
|
2
|
-
export declare function rawLines(): string[];
|
|
3
|
-
export declare function plainLines(): string[];
|
|
4
|
-
export declare function getWriteSpy(): ReturnType<typeof vi.spyOn>;
|
|
5
|
-
/**
|
|
6
|
-
* Registers beforeEach/afterEach hooks that spy on process.stdout.write.
|
|
7
|
-
* Call once at the top of your describe block or test file.
|
|
8
|
-
*/
|
|
9
|
-
export declare function installStdoutSpy(): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{vi as e,beforeEach as n,afterEach as o}from"vitest";import i from"strip-ansi";let t;function p(){return t.mock.calls.map(r=>String(r[0]).replace(/\n$/,""))}function m(){return p().map(r=>i(r))}function s(){return t}function u(){n(()=>{t=e.spyOn(process.stdout,"write").mockImplementation(()=>!0)}),o(()=>{t.mockRestore()})}export{s as getWriteSpy,u as installStdoutSpy,m as plainLines,p as rawLines};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TOON capture spy for AXI agent-mode tests.
|
|
3
|
-
*
|
|
4
|
-
* Mirrors `installStdoutSpy` from `outputTestHelpers.ts` but accumulates
|
|
5
|
-
* writes into a buffer, splits on the `---` block separator, and parses
|
|
6
|
-
* each block as TOON via `@toon-format/toon`.
|
|
7
|
-
*
|
|
8
|
-
* The helper handles:
|
|
9
|
-
*
|
|
10
|
-
* 1. Multiple blocks flushed in a single `write()` call
|
|
11
|
-
* 2. A single block spanning multiple `write()` calls
|
|
12
|
-
* 3. Malformed TOON blocks (recorded as `malformed` events, never thrown)
|
|
13
|
-
*
|
|
14
|
-
* Tests that assert on the final block without a trailing `---` separator
|
|
15
|
-
* must call `capture.flush()` before querying, otherwise the lazy parser
|
|
16
|
-
* will still include the tail — parsing happens across the entire buffer
|
|
17
|
-
* regardless, but `flush()` is retained as an explicit no-op sync point
|
|
18
|
-
* for readability and future-proofing.
|
|
19
|
-
*/
|
|
20
|
-
import { vi } from "vitest";
|
|
21
|
-
export type CapturedEventType = "data" | "error" | "action_required" | "step" | "progress" | "malformed";
|
|
22
|
-
export interface CapturedToonEvent {
|
|
23
|
-
readonly type: CapturedEventType;
|
|
24
|
-
readonly block: string;
|
|
25
|
-
readonly parsed: unknown;
|
|
26
|
-
readonly timestamp: number;
|
|
27
|
-
readonly error?: string;
|
|
28
|
-
}
|
|
29
|
-
export interface ToonCapture {
|
|
30
|
-
events: () => readonly CapturedToonEvent[];
|
|
31
|
-
rawBuffer: () => string;
|
|
32
|
-
parsed: () => readonly CapturedToonEvent[];
|
|
33
|
-
malformed: () => readonly CapturedToonEvent[];
|
|
34
|
-
ofType: (type: CapturedEventType) => readonly CapturedToonEvent[];
|
|
35
|
-
last: () => CapturedToonEvent | undefined;
|
|
36
|
-
flush: () => void;
|
|
37
|
-
clear: () => void;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Matches a line containing only the block separator with optional
|
|
41
|
-
* surrounding whitespace. Multiline mode so `^` and `$` match line boundaries.
|
|
42
|
-
*/
|
|
43
|
-
declare const BLOCK_SEPARATOR_RE: RegExp;
|
|
44
|
-
/**
|
|
45
|
-
* Matches a trailing `help[N]:` section at the end of a TOON block.
|
|
46
|
-
*
|
|
47
|
-
* `renderHelp()` produces `help[N]:\n line1\n line2` which is NOT valid
|
|
48
|
-
* TOON — the decoder interprets `help[N]:` as a typed array header and fails
|
|
49
|
-
* to parse the indented text lines. We strip this section before decoding
|
|
50
|
-
* and preserve it as metadata on the event.
|
|
51
|
-
*/
|
|
52
|
-
declare const HELP_BLOCK_RE: RegExp;
|
|
53
|
-
/**
|
|
54
|
-
* Installs beforeEach/afterEach hooks that spy on `process.stdout.write`,
|
|
55
|
-
* accumulating every chunk into an in-memory buffer. Returns a handle
|
|
56
|
-
* whose query methods parse the buffer lazily (only when called).
|
|
57
|
-
*
|
|
58
|
-
* Call once at the top of a describe block or test file, exactly like
|
|
59
|
-
* `installStdoutSpy()`.
|
|
60
|
-
*/
|
|
61
|
-
export declare function installToonCapture(): ToonCapture;
|
|
62
|
-
/**
|
|
63
|
-
* Asserts the capture contains at least one valid TOON block and zero
|
|
64
|
-
* malformed blocks.
|
|
65
|
-
*/
|
|
66
|
-
export declare function assertValidToon(capture: ToonCapture): void;
|
|
67
|
-
/**
|
|
68
|
-
* Asserts the last captured block exists and has the expected type.
|
|
69
|
-
* Consolidates the common guard pattern across TOON snapshot tests.
|
|
70
|
-
*/
|
|
71
|
-
export declare function assertLastBlockType(capture: ToonCapture, expectedType: CapturedEventType): void;
|
|
72
|
-
/**
|
|
73
|
-
* Creates a mock OutputWriter with vi.fn() methods. Use in tests that
|
|
74
|
-
* pass a writer directly to handler functions (e.g. secrets set/delete).
|
|
75
|
-
*/
|
|
76
|
-
export declare function createMockWriter(): Record<string, ReturnType<typeof vi.fn>>;
|
|
77
|
-
/**
|
|
78
|
-
* Returns a mock configuration for `nonInteractiveOutput.js`. Use inside
|
|
79
|
-
* `vi.mock()` factory calls to avoid duplicating the OutputWriter stub.
|
|
80
|
-
*/
|
|
81
|
-
export declare function createOutputWriterMock(): Record<string, unknown>;
|
|
82
|
-
/**
|
|
83
|
-
* Returns a mock configuration for `logger/index.js`. Use inside
|
|
84
|
-
* `vi.mock()` factory calls to avoid duplicating the logger stub.
|
|
85
|
-
*/
|
|
86
|
-
export declare function createLoggerMock(): Record<string, unknown>;
|
|
87
|
-
/**
|
|
88
|
-
* Returns a standard mock theme with consistent colour values.
|
|
89
|
-
*/
|
|
90
|
-
export declare function createThemeMock(): Record<string, unknown>;
|
|
91
|
-
export { BLOCK_SEPARATOR_RE, HELP_BLOCK_RE };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{afterEach as y,beforeEach as g,expect as c,vi as r}from"vitest";import{decode as h}from"@toon-format/toon";import{BLOCK_SEPARATOR as E}from"../toonFormatter.js";let p,s="",n=[],i=!1;const m=new RegExp(`^\\s*${E.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`,"m"),d=/\nhelp\[\d+\]:(?:\n {2}[^\n]*)*\s*$/;function k(e){if(typeof e!="object"||e===null||Array.isArray(e))return"data";const t=e;if("error"in t&&"code"in t)return"error";if("action"in t&&"userActionRequired"in t)return"action_required";for(const o of Object.keys(t))if(o.includes(".step"))return"step";for(const o of Object.keys(t))if(o.endsWith(".progress"))return"progress";return"data"}function a(){if(!i)return;n=[];const e=s.split(m);for(const t of e){const o=t.trim();if(o.length===0)continue;const u=o.replace(d,"").trim();if(u.length===0)continue;const l=Date.now();try{const f=h(u);n.push({type:k(f),block:o,parsed:f,timestamp:l})}catch(f){n.push({type:"malformed",block:o,parsed:void 0,timestamp:l,error:f instanceof Error?f.message:String(f)})}}i=!1}function B(){return g(()=>{s="",n=[],i=!1,p=r.spyOn(process.stdout,"write").mockImplementation((e=>{const t=typeof e=="string"?e:Buffer.from(e).toString("utf8");return s+=t,i=!0,!0}))}),y(()=>{p?.mockRestore(),p=void 0,s="",n=[],i=!1}),{events:()=>(a(),n),rawBuffer:()=>s,parsed:()=>(a(),n.filter(e=>e.type!=="malformed")),malformed:()=>(a(),n.filter(e=>e.type==="malformed")),ofType:e=>(a(),n.filter(t=>t.type===e)),last:()=>(a(),n.length===0?void 0:n[n.length-1]),flush:()=>{a()},clear:()=>{s="",n=[],i=!1}}}function T(e){c(e.malformed()).toHaveLength(0);const t=e.parsed();c(t.length).toBeGreaterThan(0)}function S(e,t){T(e);const o=e.last();c(o).toBeDefined(),c(o?.type).toBe(t)}function b(){return{line:r.fn(),indent:r.fn(),stepStart:r.fn(),stepComplete:r.fn(),summary:r.fn(),dockerProgress:r.fn()}}function A(){return{OutputWriter:class{stepStart=r.fn();stepComplete=r.fn();indent=r.fn();line=r.fn();summary=r.fn();dockerProgress=r.fn()},STEP_STATUS:{COMPLETED:"completed",ERROR:"error"}}}function L(){return{logger:{debug:r.fn(),info:r.fn(),warn:r.fn(),error:r.fn()}}}function w(){return{theme:{colours:{primary:"#6366f1",completed:"#00ff00",error:"#ff0000",warning:"#ffaa00",dim:"#888888"}}}}export{m as BLOCK_SEPARATOR_RE,d as HELP_BLOCK_RE,S as assertLastBlockType,T as assertValidToon,L as createLoggerMock,b as createMockWriter,A as createOutputWriterMock,w as createThemeMock,B as installToonCapture};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action-required payload factories for common CLI gates. Each factory
|
|
3
|
-
* returns a structured ActionRequired object that the agent can parse
|
|
4
|
-
* to determine whether it can resolve the gate itself (add a flag,
|
|
5
|
-
* run a command) or must escalate to a human.
|
|
6
|
-
*/
|
|
7
|
-
import type { ActionRequired } from "./schemas/types.js";
|
|
8
|
-
/**
|
|
9
|
-
* Emitted when a command would destroy infrastructure and the user has
|
|
10
|
-
* not passed `--skip-confirmation` or `--yes`.
|
|
11
|
-
*
|
|
12
|
-
* The agent can resolve this autonomously by re-running with the flag.
|
|
13
|
-
*/
|
|
14
|
-
export declare function destructiveGate(command: string, target: string): ActionRequired;
|
|
15
|
-
/**
|
|
16
|
-
* Emitted when a required flag is missing from the invocation.
|
|
17
|
-
*
|
|
18
|
-
* The agent can resolve this by adding the missing flag.
|
|
19
|
-
*/
|
|
20
|
-
export declare function missingFlagGate(command: string, flag: string, description: string): ActionRequired;
|
|
21
|
-
/**
|
|
22
|
-
* Emitted when the user is not authenticated.
|
|
23
|
-
*
|
|
24
|
-
* If an API key is available the agent can resolve this by setting
|
|
25
|
-
* FJALL_API_KEY; otherwise a human must complete interactive login.
|
|
26
|
-
*/
|
|
27
|
-
export declare function authRequiredGate(command: string, options?: {
|
|
28
|
-
apiKeyAvailable?: boolean;
|
|
29
|
-
}): ActionRequired;
|
|
30
|
-
/**
|
|
31
|
-
* Emitted when SSO login is required. Always requires human
|
|
32
|
-
* intervention to complete the browser-based flow.
|
|
33
|
-
*/
|
|
34
|
-
export declare function ssoGate(url: string): ActionRequired;
|
|
35
|
-
/**
|
|
36
|
-
* Emitted when no AWS account is connected to the organisation.
|
|
37
|
-
*
|
|
38
|
-
* The agent can resolve this by running `fjall connect`.
|
|
39
|
-
*/
|
|
40
|
-
export declare function awsAccountGate(command: string): ActionRequired;
|
|
41
|
-
export interface DriftConflictDelta {
|
|
42
|
-
readonly property: string;
|
|
43
|
-
readonly theirs: unknown;
|
|
44
|
-
readonly ours: unknown;
|
|
45
|
-
readonly verdict: "clean" | "no-op" | "compatible" | "conflict";
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Emitted when a codemod operation encounters a drift conflict — the
|
|
49
|
-
* user's infrastructure file has manual edits that conflict with the
|
|
50
|
-
* requested operation.
|
|
51
|
-
*
|
|
52
|
-
* The agent can resolve this by re-running with `--force` (overwrite)
|
|
53
|
-
* or by skipping the operation. Merge requires LLM fallback eligibility.
|
|
54
|
-
*/
|
|
55
|
-
export declare function driftConflictGate(params: {
|
|
56
|
-
resourceType: string;
|
|
57
|
-
resourceName: string;
|
|
58
|
-
deltas: readonly DriftConflictDelta[];
|
|
59
|
-
allowMerge: boolean;
|
|
60
|
-
}): ActionRequired;
|