Skip to content

API guide ​

Part of Build an integration: shared APIs and infrastructure for adapter authors. For application usage, choose a library.

For exact parameter/return types and all exports, use the generated TypeScript reference. The guide below explains how to choose an entry point.

Contracts: portline-abstract ​

ExportPurpose
ConnectionProfile / ConnectionDefinitionNormalized saved metadata and supported/unsupported connection kinds
SourceReference / ProfileStorageStable source identity and native storage provenance
ProfileSource / ProfileSourceDiscoverySynchronous or asynchronous reads and explicit discovery results
CredentialReference / CredentialProvider / CredentialResultSource-owned, lazy credential lookup
ProfileWriter / ProfileWritePlan / ProfileWriteInspectionPreview/apply contract and availability state
ProfileConnectorFactory / connector provider contractsSource-independent connector construction without a storage-only restriction

Core: portline-core ​

ExportBehavior
ProfileCatalog(source, profiles)In-memory normalized source with list/get/search and uniqueness validation
searchProfiles / getProfileByPath / buildProfileTreeGeneric metadata queries using an explicit adapter
CredentialResolverRegister credential providers by source and resolve without caching secrets
ProfileConnectorRegistryRegister typed providers by protocol and retain provider-specific options/results
assertProfileWriteAllowedRefuse mismatched revision/source and unsafe or unknown write availability
planProfileSync(source, writer, mappings)Select profiles and their connection dependencies, then call writer.plan

Native infrastructure: portline-platform ​

ExportBehavior
NativeProfileSourceCatalog plus opt-in raw native settings and explicit secret loader
fileSource / registrySource / selectSource / requireSourceConstruct or select source provenance without hiding ambiguity
discoverNativeSourcesShared registry/portable candidate discovery with injectable readers
windowsRegistry / windowsProcessesWindows inspection helpers
NativeProfileWriterSanitized intent, native projection, guarded inspection and commit lifecycle
NativeWriteOptions / NativeWritePreview / ProfileMutationTyped writer policies, saved previews and explicit mutation kinds
RegistryWriteError / RegistryWriteModeStructured refusal/recovery details and transactional/guarded policy

Application writer factories supply the selected application and source. inspect reports revision and availability; plan/planChanges produce previews; importPlan reconstructs a saved preview; apply rechecks guards. backupPaths exposes retained recovery files.

Native storage/image/backend contracts are also exported for trusted host integrations. Backend injection is not a CLI force option and does not make arbitrary native writes safe.

CLI infrastructure: portline-cli ​

createProfileCli builds an embeddable command runner. Its run(args) resolves an exit code rather than terminating the host. It supplies list, search, get and source, table/JSON presentation, password masking and extension hooks.

createNormalizedCliSource adapts a normalized source for presentation. parseProfileArgs handles declared common/source options. createProfileWriteCommands adds write, sync, apply and write-status using a host-provided writer and a fixed allowlist of source adapters.

See building a CLI and the writing guide.

Shared execution: portline-dockline ​

ExportBehavior
createDocklineBridge(options?) / DocklineBridgeShared normalized FTP/SFTP/SSH execution with source, credential and trust services
toConfig(input, options?)Resolve file configuration, including a bound SFTP trust policy, without loading a protocol client
toSshConfig(input, options?)Resolve scalar SSH settings; saved pin-set/callback services are retained by withSsh
createFileAdapter(input, options?)Load the selected file client and return its disconnected adapter
withFiles(input, callback, options?)Run a callback within a Dockline file session and close it on completion/failure
withSsh(input, callback, options?)Run a callback within an SSH session with exec, shell and asUser
ExecutionOptions / DocklineBridgeOptionsConnection selection, runtime authentication/trust and supported transport controls
ProfileExecutionError / BridgeErrorCodeSelection, unsupported metadata, missing credentials/trust/client and invalid-profile errors
TrustChallenge / TrustProvider / PasswordChallengeExplicit application callbacks; no automatic persistence
SshConfig / SshSession / SshExecOptions / SshExecResultPublic structural SSH configuration, scoped command API and results

All five methods are asynchronous. A string input uses the configured source's exact-path get; a direct ConnectionProfile needs no source when runtime credentials or a credential provider are supplied. Protocol clients are optional peers. The execution guide documents complete signatures, precedence, client installation, TLS, cancellation and every bridge error code. Generic factory/registry contracts do not replace this concrete shared bridge.