Skip to content

craft-hub / SoftwareSourceService

Class: SoftwareSourceService ​

Defined in: packages/craft-hub/src/software-sources.ts:89

Preview, bind and refresh repository catalogs while retaining the last valid snapshot.

Constructors ​

Constructor ​

new SoftwareSourceService(dataDir, localAvailable?, reader?): SoftwareSourceService

Defined in: packages/craft-hub/src/software-sources.ts:94

Parameters ​

dataDir ​

string

localAvailable? ​

boolean = true

reader? ​

SoftwareRepositoryReader = ...

Returns ​

SoftwareSourceService

Methods ​

apply() ​

apply(previewId): Promise<SoftwareSourceSnapshot>

Defined in: packages/craft-hub/src/software-sources.ts:142

Apply exactly the reviewed snapshot if the saved source set has not changed.

Parameters ​

previewId ​

string

Returns ​

Promise<SoftwareSourceSnapshot>


catalogs() ​

catalogs(): Promise<object[]>

Defined in: packages/craft-hub/src/software-sources.ts:110

Read cached catalogs for browsing; no source refresh or command execution is implicit.

Returns ​

Promise<object[]>


preview() ​

preview(input): Promise<SoftwareSourcePreview>

Defined in: packages/craft-hub/src/software-sources.ts:121

Read and validate a proposed source, preserving its other binding when editing.

Parameters ​

input ​
branch? ​

string = ...

catalogPath? ​

string = ...

id? ​

string = ...

localPath? ​

string = ...

mode ​

"local" | "remote" = modeSchema

repository? ​

string = ...

Returns ​

Promise<SoftwareSourcePreview>


refresh() ​

refresh(id): Promise<SoftwareSourceSnapshot>

Defined in: packages/craft-hub/src/software-sources.ts:157

Refresh the selected binding; failures retain the last known catalog and its provenance.

Parameters ​

id ​

string

Returns ​

Promise<SoftwareSourceSnapshot>


remove() ​

remove(id, revision): Promise<SoftwareSourceSnapshot>

Defined in: packages/craft-hub/src/software-sources.ts:179

Unsubscribe without touching checkouts, favorites, plugins or the bundled catalog.

Parameters ​

id ​

string

revision ​

string

Returns ​

Promise<SoftwareSourceSnapshot>


snapshot() ​

snapshot(): Promise<SoftwareSourceSnapshot>

Defined in: packages/craft-hub/src/software-sources.ts:99

List cache status without reading any online or local repository.

Returns ​

Promise<SoftwareSourceSnapshot>

Released under the MIT License.