Skip to content

craft-hub / SoftwareSourceService

Class: SoftwareSourceService ​

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

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:102

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:150

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:118

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

Returns ​

Promise<object[]>


configureRefresh() ​

configureRefresh(id, refreshPolicy, revision): Promise<SoftwareSourceSnapshot>

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

Save a refresh preference independently of repository reads and cached metadata.

Parameters ​

id ​

string

refreshPolicy ​

{ mode: "manual"; } | { intervalMinutes: number; mode: "interval"; } | { mode: "daily"; time: string; timeZone: string; }

revision ​

string

Returns ​

Promise<SoftwareSourceSnapshot>


preview() ​

preview(input): Promise<SoftwareSourcePreview>

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

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

refreshPolicy? ​

{ mode: "manual"; } | { intervalMinutes: number; mode: "interval"; } | { mode: "daily"; time: string; timeZone: string; } = ...

repository? ​

string = ...

Returns ​

Promise<SoftwareSourcePreview>


refresh() ​

refresh(id): Promise<SoftwareSourceSnapshot>

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

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

Parameters ​

id ​

string

Returns ​

Promise<SoftwareSourceSnapshot>


refreshDue() ​

refreshDue(): Promise<boolean>

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

Refresh subscribed online catalogs when their saved schedule is due on a local host.

Returns ​

Promise<boolean>


remove() ​

remove(id, revision): Promise<SoftwareSourceSnapshot>

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

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:107

List cache status without reading any online or local repository.

Returns ​

Promise<SoftwareSourceSnapshot>

Released under the MIT License.