Skip to content

Commit 0076c14

Browse files
committed
make it public
1 parent dc47c00 commit 0076c14

File tree

5 files changed

+37
-30
lines changed

5 files changed

+37
-30
lines changed

Sources/PackageCollections/PackageCollections+Configuration.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
// TODO: how do we read default config values? ENV variables? user settings?
1212
extension PackageCollections {
13-
struct Configuration {
13+
public struct Configuration {
1414
// TODO: add configuration like mx size of feed, retries, etc
15+
16+
public init() {}
1517
}
1618
}

Sources/PackageCollections/PackageCollections+Storage.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@
1111
import TSCBasic
1212

1313
extension PackageCollections {
14-
struct Storage: Closable {
14+
public struct Storage: Closable {
1515
let collectionsProfiles: PackageCollectionsProfileStorage
1616
let collections: PackageCollectionsStorage
17+
18+
public init(collectionsProfiles: PackageCollectionsProfileStorage, collections: PackageCollectionsStorage) {
19+
self.collectionsProfiles = collectionsProfiles
20+
self.collections = collections
21+
}
1722
}
1823
}
1924

2025
extension PackageCollections.Storage {
21-
func close() throws {
26+
public func close() throws {
2227
var errors = [Error]()
2328

2429
let tryClose = { (item: Any) in

Sources/PackageCollections/PackageCollections.swift

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import PackageModel
1212
import TSCBasic
1313

1414
// TODO: is there a better name? this conflicts with the module name which is okay in this case but not ideal in Swift
15-
internal struct PackageCollections: PackageCollectionsProtocol {
15+
public struct PackageCollections: PackageCollectionsProtocol {
1616
private let configuration: Configuration
1717
private let storage: Storage
1818
private let providers: [PackageCollectionsModel.CollectionSourceType: PackageCollectionProvider]
@@ -23,13 +23,13 @@ internal struct PackageCollections: PackageCollectionsProtocol {
2323
self.providers = providers
2424
}
2525

26-
func listProfiles(callback: @escaping (Result<[PackageCollectionsModel.Profile], Error>) -> Void) {
26+
public func listProfiles(callback: @escaping (Result<[PackageCollectionsModel.Profile], Error>) -> Void) {
2727
self.storage.collectionsProfiles.listProfiles(callback: callback)
2828
}
2929

30-
func listCollections(identifiers: Set<PackageCollectionsModel.CollectionIdentifier>? = nil,
31-
in profile: PackageCollectionsModel.Profile? = nil,
32-
callback: @escaping (Result<[PackageCollectionsModel.Collection], Error>) -> Void) {
30+
public func listCollections(identifiers: Set<PackageCollectionsModel.CollectionIdentifier>? = nil,
31+
in profile: PackageCollectionsModel.Profile? = nil,
32+
callback: @escaping (Result<[PackageCollectionsModel.Collection], Error>) -> Void) {
3333
let profile = profile ?? .default
3434

3535
self.storage.collectionsProfiles.listSources(in: profile) { result in
@@ -60,7 +60,7 @@ internal struct PackageCollections: PackageCollectionsProtocol {
6060
}
6161
}
6262

63-
func findPackages(
63+
public func findPackages(
6464
_ query: String,
6565
collections: Set<PackageCollectionsModel.CollectionIdentifier>? = nil,
6666
profile: PackageCollectionsModel.Profile? = nil,
@@ -82,8 +82,8 @@ internal struct PackageCollections: PackageCollectionsProtocol {
8282
}
8383
}
8484

85-
func refreshCollections(in profile: PackageCollectionsModel.Profile? = nil,
86-
callback: @escaping (Result<[PackageCollectionsModel.CollectionSource], Error>) -> Void) {
85+
public func refreshCollections(in profile: PackageCollectionsModel.Profile? = nil,
86+
callback: @escaping (Result<[PackageCollectionsModel.CollectionSource], Error>) -> Void) {
8787
let profile = profile ?? .default
8888

8989
self.storage.collectionsProfiles.listSources(in: profile) { result in
@@ -109,10 +109,10 @@ internal struct PackageCollections: PackageCollectionsProtocol {
109109
}
110110
}
111111

112-
func addCollection(_ source: PackageCollectionsModel.CollectionSource,
113-
order: Int? = nil,
114-
to profile: PackageCollectionsModel.Profile? = nil,
115-
callback: @escaping (Result<PackageCollectionsModel.Collection, Error>) -> Void) {
112+
public func addCollection(_ source: PackageCollectionsModel.CollectionSource,
113+
order: Int? = nil,
114+
to profile: PackageCollectionsModel.Profile? = nil,
115+
callback: @escaping (Result<PackageCollectionsModel.Collection, Error>) -> Void) {
116116
let profile = profile ?? .default
117117

118118
if let errors = source.validate() {
@@ -131,9 +131,9 @@ internal struct PackageCollections: PackageCollectionsProtocol {
131131
}
132132
}
133133

134-
func removeCollection(_ source: PackageCollectionsModel.CollectionSource,
135-
from profile: PackageCollectionsModel.Profile? = nil,
136-
callback: @escaping (Result<Void, Error>) -> Void) {
134+
public func removeCollection(_ source: PackageCollectionsModel.CollectionSource,
135+
from profile: PackageCollectionsModel.Profile? = nil,
136+
callback: @escaping (Result<Void, Error>) -> Void) {
137137
let profile = profile ?? .default
138138

139139
self.storage.collectionsProfiles.remove(source: source, from: profile) { result in
@@ -159,9 +159,9 @@ internal struct PackageCollections: PackageCollectionsProtocol {
159159
}
160160
}
161161

162-
func moveCollection(_ source: PackageCollectionsModel.CollectionSource,
163-
to order: Int, in profile: PackageCollectionsModel.Profile? = nil,
164-
callback: @escaping (Result<Void, Error>) -> Void) {
162+
public func moveCollection(_ source: PackageCollectionsModel.CollectionSource,
163+
to order: Int, in profile: PackageCollectionsModel.Profile? = nil,
164+
callback: @escaping (Result<Void, Error>) -> Void) {
165165
let profile = profile ?? .default
166166

167167
self.storage.collectionsProfiles.move(source: source, to: order, in: profile, callback: callback)
@@ -170,8 +170,8 @@ internal struct PackageCollections: PackageCollectionsProtocol {
170170
// Returns information about a package collection.
171171
// The collection is not required to be in the configured list.
172172
// If not found locally (storage), the collection will be fetched from the source.
173-
func getCollection(_ source: PackageCollectionsModel.CollectionSource,
174-
callback: @escaping (Result<PackageCollectionsModel.Collection, Error>) -> Void) {
173+
public func getCollection(_ source: PackageCollectionsModel.CollectionSource,
174+
callback: @escaping (Result<PackageCollectionsModel.Collection, Error>) -> Void) {
175175
if let errors = source.validate() {
176176
return callback(.failure(MultipleErrors(errors)))
177177
}
@@ -189,7 +189,7 @@ internal struct PackageCollections: PackageCollectionsProtocol {
189189
}
190190
}
191191

192-
func listTargets(
192+
public func listTargets(
193193
collections: Set<PackageCollectionsModel.CollectionIdentifier>? = nil,
194194
in profile: PackageCollectionsModel.Profile? = nil,
195195
callback: @escaping (Result<PackageCollectionsModel.TargetListResult, Error>) -> Void
@@ -205,7 +205,7 @@ internal struct PackageCollections: PackageCollectionsProtocol {
205205
}
206206
}
207207

208-
func findTargets(
208+
public func findTargets(
209209
_ query: String,
210210
searchType: PackageCollectionsModel.TargetSearchType? = nil,
211211
collections: Set<PackageCollectionsModel.CollectionIdentifier>? = nil,
@@ -230,9 +230,9 @@ internal struct PackageCollections: PackageCollectionsProtocol {
230230
}
231231

232232
// FIXME:
233-
func getPackageMetadata(_ reference: PackageReference,
234-
profile: PackageCollectionsModel.Profile? = nil,
235-
callback: @escaping (Result<PackageCollectionsModel.PackageMetadata, Error>) -> Void) {
233+
public func getPackageMetadata(_ reference: PackageReference,
234+
profile: PackageCollectionsModel.Profile? = nil,
235+
callback: @escaping (Result<PackageCollectionsModel.PackageMetadata, Error>) -> Void) {
236236
fatalError("not implemented")
237237
}
238238

Sources/PackageCollections/Storage/PackageCollectionsProfileStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import TSCBasic
1818

1919
// MARK: - PackageCollectionsProfileStorage
2020

21-
protocol PackageCollectionsProfileStorage {
21+
public protocol PackageCollectionsProfileStorage {
2222
/// Lists all configured profiles.
2323
///
2424
/// - Parameters:

Sources/PackageCollections/Storage/PackageCollectionsStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import TSCUtility
1919

2020
// MARK: - PackageCollectionsStorage
2121

22-
protocol PackageCollectionsStorage {
22+
public protocol PackageCollectionsStorage {
2323
/// Writes `PackageCollection` to storage.
2424
///
2525
/// - Parameters:

0 commit comments

Comments
 (0)