diff --git a/.claude/skills/app-implement-feature/SKILL.md b/.claude/skills/app-implement-feature/SKILL.md index c71d1acb..1cbd8223 100644 --- a/.claude/skills/app-implement-feature/SKILL.md +++ b/.claude/skills/app-implement-feature/SKILL.md @@ -1,12 +1,12 @@ --- name: app-implement-feature description: | - Guide for implementing features following architecture-first design, TDD, rich domain models, and Swift 6.2 patterns. Use this skill when: + Guide for implementing features in a Swift app laid out by concept, not by layer: each concept folder holds its public face (rich values, @Mockable roles named for what they are), its implementations in Internal/, and the bare outside call in Internal/System/; no Domain/ or Infrastructure/ folders. Covers placing the change in docs/CANONICAL_MODEL.md, Chicago-school TDD and Swift 6.2 patterns. Use this skill when: (1) Adding new functionality to a Swift app (2) Creating domain models that follow user's mental model (3) Building SwiftUI views that consume domain models directly (4) User asks "how do I implement X" or "add feature Y" - (5) Implementing any feature that spans Domain, Infrastructure, and App layers + (5) Implementing any feature that spans a concept folder, its Internal/ implementations, and the App --- # Implement Feature @@ -17,69 +17,73 @@ Implement features using architecture-first design, TDD, rich domain models, and ``` ┌─────────────────────────────────────────────────────────────┐ -│ 1. ARCHITECTURE DESIGN (Required - User Approval Needed) │ +│ 0. DESIGN (no approval gate — design, then build) │ ├─────────────────────────────────────────────────────────────┤ -│ • Analyze requirements │ -│ • Create component diagram │ -│ • Show data flow and interactions │ -│ • Present to user for review │ -│ • Wait for approval before proceeding │ +│ • Place it in the canonical model (docs/CANONICAL_MODEL.md) │ +│ • Name every type for what it is in the domain │ +│ • Diagram: public face · Internal/ · Internal/System/ │ +│ • Show the design and the files to touch, then go on │ └─────────────────────────────────────────────────────────────┘ │ - ▼ (User Approves) + ▼ ┌─────────────────────────────────────────────────────────────┐ -│ 2. TDD IMPLEMENTATION │ +│ 1-3. TDD IMPLEMENTATION │ ├─────────────────────────────────────────────────────────────┤ -│ • Domain model tests → Domain models │ -│ • Infrastructure tests → Implementations │ -│ • Integration and views │ +│ • Public face: value types, @Mockable roles (/) │ +│ • Implementations (/Internal/) │ +│ • Bare outside call (/Internal/System/, ≤100 LOC) │ +│ • The way in: App wiring and views │ └─────────────────────────────────────────────────────────────┘ ``` -## Phase 0: Architecture Design (MANDATORY) +## Phase 0: Design -Before writing any code, create an architecture diagram and get user approval. +Design before writing code, show it, then build it test-first. Don't stop to +ask for approval; the user interrupts if the design is wrong. Ask only when a +decision is genuinely theirs (a concept that fits no folder, a changed law). -### Step 1: Analyze Requirements +### Step 1: Place it in the canonical model -Identify: -- What new models/types are needed -- Which existing components will be modified -- Data flow between components -- External dependencies (APIs, databases, CLI tools) +`docs/CANONICAL_MODEL.md` is the single map of the domain: the tree of +concepts, the words (ubiquitous language), every law with its **one owner**, +and the folder each concept lives in. Read it, then answer: + +| Question | If yes | +|---|---| +| Which concept owns the question it answers? | its type goes in `Sources//`, its implementation in that concept's `Internal/`. A concept that fits no folder is a missing word — ask before inventing a folder | +| Which node is told? | a new verb lands on one node of the tree; `App/` only parses, calls and renders | +| Does it add or change a law? | it gets **one** owner — the type that holds the data. Grep for the rule first: if it is already written, that is the owner, or the duplicate to remove | +| Does it need the outside world? | a `@Mockable` role in the public face, named for the role ([Naming](#4-name-every-abstraction-for-its-role)), implemented in `Internal/` | +| Does what differs between cases become a branch? | make it data: a table, a value, a registration — not an `if` | + +When the doc doesn't cover the change, write it into `CANONICAL_MODEL.md` +first (tree lines, a law with its owner, a word in the glossary). That diff +is part of the design. If the project has no `CANONICAL_MODEL.md` yet, start +one with just the concepts this feature touches. Code that disagrees with the +doc is behind; don't bend the design to it. + +Then ask the five questions of every type the change touches — would the user +say it, does it decide about itself, can you see every state, is it as small as +it can be, is what differs data — and check each concept it touches → +[domain-shape.md](references/domain-shape.md). ### Step 2: Create Architecture Diagram -Use ASCII diagram showing all components and their interactions: +Use an ASCII diagram showing the concept folder, what sits in its public face, +what sits in `Internal/`, and the one bare call in `Internal/System/`: ``` -┌─────────────────────────────────────────────────────────────────────┐ -│ ARCHITECTURE │ -├─────────────────────────────────────────────────────────────────────┤ -│ │ -│ ┌─────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ -│ │ External │ │ Infrastructure │ │ Domain │ │ -│ └─────────────┘ └──────────────────┘ └──────────────────┘ │ -│ │ -│ ┌─────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ -│ │ API/DB │────▶│ Repository/ │────▶│ DomainModel │ │ -│ │ (external) │ │ Client │ │ (rich behavior) │ │ -│ └─────────────┘ └──────────────────┘ └──────────────────┘ │ -│ │ │ │ -│ │ ▼ │ -│ │ ┌──────────────────┐ │ -│ │ │ DomainService │ │ -│ └─────────────▶│ (actor) │ │ -│ └──────────────────┘ │ -│ │ │ -│ ▼ │ -│ ┌──────────────────────────────────┐ │ -│ │ App Layer │ │ -│ │ ┌────────────────────────────┐ │ │ -│ │ │ SwiftUI Views │ │ │ -│ │ └────────────────────────────┘ │ │ -│ └──────────────────────────────────┘ │ -└─────────────────────────────────────────────────────────────────────┘ +Sources/Orders/ Orders/Internal/ Orders/Internal/System/ +┌──────────────────┐ ┌──────────────────────┐ any ┌────────────────────────┐ +│ Order, OrderItem │ │ APIOrderRepository │ HTTP │ URLSessionHTTP │ +│ (values + rules) │ ◀──────── │ (request, decode, │ ───────▶ │ (≤100 lines: only the │ +│ OrderRepository │ implements│ map DTO → Order, │ │ URLSession call) │ +│ (@Mockable role) │ │ error mapping) │ ◀─ Mock └────────────────────────┘ +│ OrderBook (actor)│ └──────────────────────┘ HTTP +└──────────────────┘ in tests + ▲ + │ imports the public face only +Sources/App/ SwiftUI views + entry point (wires Internal/ implementations in) ``` ### Step 3: Document Component Interactions @@ -91,21 +95,17 @@ List each component with: - **Dependencies**: What it needs ``` -| Component | Purpose | Inputs | Outputs | Dependencies | -|-----------------|----------------------|----------------|----------------|----------------| -| UserRepository | Fetch user data | userId | User | NetworkClient | -| OrderService | Manage order logic | Order, User | OrderResult | UserRepository | +| Component | Purpose | Inputs | Outputs | Dependencies | +|------------|-----------------------|--------------|--------------|--------------| +| UserRepository | Find and save users | UserId | User | HTTP | +| OrderBook | Keep orders current | Order, User | Order | OrderRepository | ``` -### Step 4: Present for User Approval - -**IMPORTANT**: Always ask user to review the architecture before implementing. +### Step 4: Show the design, then build -Use AskUserQuestion tool with options: -- "Approve - proceed with implementation" -- "Modify - I have feedback on the design" - -Do NOT proceed to Phase 1 until user explicitly approves. +Present the `CANONICAL_MODEL.md` diff (if any), the diagram and a "files to +touch" list ([template](references/architecture-diagrams.md#design-presentation-template)), +then go straight to Phase 1. No approval question. --- @@ -168,29 +168,79 @@ struct OrderRow: View { ```swift @Mockable public protocol OrderRepository: Sendable { + func all() async throws -> [Order] func fetch(id: OrderId) async throws -> Order func save(_ order: Order) async throws } @Mockable -public protocol NetworkClient: Sendable { +public protocol HTTP: Sendable { func request(_ endpoint: Endpoint) async throws -> T } ``` +### 4. Name every abstraction for its role + +Every `@Mockable` protocol, actor and adapter is named **for what it is in the +domain**, never for its architectural pattern: + +- **Never `XxxService`, `XxxManager`, `XxxPort`, `XxxHelper`.** If you reach for + one, the abstraction isn't named yet — keep going until the noun describes + what the thing *is* (`OrderBook`, `Checkout`, `HTTP`, `Subprocess`). If no + noun comes, the abstraction probably shouldn't exist yet. +- **`XxxRepository` is for CRUD only** — `OrderRepository`, `UserRepository`: + load / save / delete an aggregate by identity. Anything that does more than + CRUD — a workflow (sign in, submit for review, boot), an adapter, an event + source, a process — gets a role noun (`Checkout`, `SignIn`, `Subprocess`). +- **Implementations are named for how they do it**: `APIOrderRepository`, + `SQLiteOrderRepository`, `URLSessionHTTP`, `InMemoryOrderRepository` — each plays the role it + is named after. +- **Tests are named for the outcome**, in the user's words: + `` `should show the new status after an update` ``, never the method or + mechanism (`returns`, `calls`, `fetches`). + ## Architecture -| Layer | Location | Purpose | -|-------|----------|---------| -| **Domain** | `Sources/Domain/` | Rich models, protocols, actors (single source of truth) | -| **Infrastructure** | `Sources/Infrastructure/` | Repositories, clients, adapters | -| **App** | `Sources/App/` | SwiftUI views consuming domain directly (no ViewModel) | +**No `Domain/` folder, no `Infrastructure/` folder.** Code is grouped by the +concept it is about, not by the layer it sits in. Every folder has the same +shape: + +``` +Sources/ +├── / # shared kernel: ids, errors, small values — imports nothing of ours +├── Orders/ # one folder per concept (nest sub-concepts: Orders/Items/) +│ ├── Order.swift # PUBLIC FACE — values with behaviour, +│ ├── OrderStatus.swift # @Mockable roles, actors; what other folders may use +│ ├── OrderRepository.swift # (CRUD for Order: load / save / delete by id) +│ └── Internal/ # IMPLEMENTATIONS — adapters that play the roles, +│ ├── APIOrderRepository.swift# DTOs, mappers, wire formats; decisions, unit-tested +│ ├── OrderDTO.swift +│ └── System/ # THE BARE OUTSIDE CALL — URLSession, a DB driver, +│ └── URLSessionHTTP.swift # Process, a private symbol; ≤100 lines, no decisions +└── App/ # THE WAY IN — SwiftUI views (no ViewModel), entry point, wiring +Tests/Tests/ # mirrors Sources/ folder for folder +├── Orders/OrderTests.swift +└── Orders/Internal/APIOrderRepositoryTests.swift +``` + +| Part | Location | Holds | Tested how | +|------|----------|-------|------------| +| **Public face** | `Sources//` | rich value types, `@Mockable` role protocols, actors — the single source of truth | 100%, state-based | +| **Implementations** | `Sources//Internal/` | the adapters that play the roles, DTOs, mappers — every decision about the outside | ≥90%, via the collaborator's `MockXxx` | +| **Bare outside call** | `Sources//Internal/System/` | the irreducible call (`URLSession`, `Process`, `dlopen`, a socket), ≤100 lines | integration-only; the only code coverage leaves out | +| **The way in** | `Sources/App/` (or `Commands/`, `Server/`) | views, entry point, registration — parse, call, render; no rules | views are thin; wiring by a smoke test | + +**Rules:** +- **Imports flow inward**: `App → → `. A concept never imports another concept's `Internal/`; it may use another concept's public face only. +- **`Internal/` is a fence, not just a folder**: nothing outside the concept names a type in its `Internal/`, except the composition root in `App/` that wires an implementation into a role. Prefer `internal` access; make an `Internal/` type `public` only when the concept is its own module and `App/` must construct it. +- **Split adapters that wrap I/O**: the decisions (request building, decoding, mapping, retries, error mapping) live in `Internal/` and are tested through a small `@Mockable` collaborator (`HTTP`, `Subprocess`); only the call itself goes in `Internal/System/`. If a `System/` file grows a decision, move the decision up. +- **A concept that fits no folder is a missing word** — ask before inventing a folder. **Key patterns:** -- **Repository Pattern** - Abstract data access behind protocols +- **Repository for CRUD only** - Aggregate load / save / delete behind `XxxRepository` in the public face; a workflow (sign in, submit, boot) takes a role noun - **Protocol-Based DI** - `@Mockable` for testing - **Chicago School TDD** - Test state, not interactions -- **No ViewModel layer** - Views consume domain directly +- **No ViewModel layer** - Views consume the public face directly ## TDD Workflow (Chicago School) @@ -200,93 +250,130 @@ We follow **Chicago school TDD** (state-based testing): - Mocks stub dependencies to return data, not to verify calls - Design emerges from tests (emergent design) -### Phase 1: Domain Model Tests +### Phase 1: Public Face Tests (`Tests/...//`) -Test state and computed properties: +Test the values and actors in the concept folder through their state and +computed properties: ```swift @Suite struct OrderTests { - @Test func `order computes total from items`() { - // Given + @Test func `should total an order from its items`() { let order = Order(items: [ OrderItem(price: 10, quantity: 2), OrderItem(price: 5, quantity: 1) ], status: .pending) - // When/Then #expect(order.totalAmount == 25) } - @Test func `pending order can be cancelled`() { - // Given - let order = Order(items: [], status: .pending) + @Test func `should let a pending order be cancelled`() { + #expect(Order(items: [], status: .pending).canBeCancelled == true) + } - // When/Then - #expect(order.canBeCancelled == true) + @Test func `should refuse to cancel an order once shipped`() { + #expect(Order(items: [], status: .shipped).canBeCancelled == false) } +} +``` - @Test func `shipped order cannot be cancelled`() { - // Given - let order = Order(items: [], status: .shipped) +An actor in the public face is tested against a stubbed role: - // When/Then - #expect(order.canBeCancelled == false) +```swift +@Suite +struct OrderBookTests { + @Test func `should give back the order it was asked for`() async throws { + let orders = MockOrderRepository() + given(orders).fetch(id: any()).willReturn(Order(items: [], status: .pending)) + + let book = OrderBook(orders: orders) + + #expect(try await book.getOrder(OrderId("123")).status == .pending) } } ``` -### Phase 2: Infrastructure Tests +### Phase 2: Implementation Tests (`Tests/...//Internal/`) -Stub dependencies to return data, assert on resulting state: +An adapter in `Internal/` holds every decision about the outside world +(request, decode, map, error mapping). Test it through its collaborator's +mock (`MockHTTP`) and assert on the domain value it produces: ```swift @Suite -struct OrderServiceTests { - @Test func `service returns order on success`() async throws { - // Given - stub dependency to return data (not verify calls) - let mockRepo = MockOrderRepository() - let expectedOrder = Order(items: [], status: .pending) - given(mockRepo).fetch(id: any()).willReturn(expectedOrder) +struct APIOrderRepositoryTests { + @Test func `should load an order when the API answers`() async throws { + let http = MockHTTP() + given(http).request(any()).willReturn( + OrderDTO(id: "123", status: "pending", items: []) + ) + + let order = try await APIOrderRepository(http: http).fetch(id: OrderId("123")) + + #expect(order.id.value == "123") + #expect(order.status == .pending) + } - let service = OrderService(repository: mockRepo) + @Test func `should fail when the network is down`() async { + let http = MockHTTP() + given(http).request(any()).willThrow(NetworkError.connectionFailed) - // When - let result = try await service.getOrder(id: "123") + await #expect(throws: OrdersError.networkError) { + try await APIOrderRepository(http: http).fetch(id: OrderId("123")) + } + } +} +``` - // Then - verify returned state, not interactions - #expect(result.status == .pending) +The bare call in `Internal/System/` (`URLSessionHTTP`) is the collaborator's +real implementation. It has no decisions to unit-test; prove it once against +the real thing, tagged so the normal loop can skip it, with a time limit: + +```swift +@Suite(.tags(.system)) +struct URLSessionHTTPTests { + @Test(.timeLimit(.minutes(1))) + func `should reach a live server`() async throws { + let status: HealthDTO = try await URLSessionHTTP().request(.health) + #expect(status.ok == true) } } ``` +If you can't drive the adapter through a `MockXxx`, it isn't split +correctly: move the decision out of `System/` and back into `Internal/`. + ### Phase 3: Integration -Wire up in app entry point and create views. +Wire the `Internal/` implementations into their roles at the app entry point (the only place outside the concept that names them), and create views that consume the public face. ## References - [Architecture diagram patterns](references/architecture-diagrams.md) - ASCII diagram examples - [Swift 6.2 @Observable patterns](references/swift-observable.md) +- [Think the domain first](references/domain-shape.md) - five questions, check by concept - [Rich domain model patterns](references/domain-models.md) - [TDD test patterns](references/tdd-patterns.md) ## Checklist -### Architecture Design (Phase 0) -- [ ] Analyze requirements and identify components -- [ ] Create ASCII architecture diagram with component interactions -- [ ] Document component table (purpose, inputs, outputs, dependencies) -- [ ] **Get user approval before proceeding** +### Design (Phase 0) +- [ ] Place the change in `docs/CANONICAL_MODEL.md` (concept, owner of every law it adds); update the doc first if it doesn't cover it +- [ ] Ask the five questions of every type touched ([domain-shape](references/domain-shape.md)) +- [ ] Name every new type for its domain role — no `Service` / `Manager` / `Port` suffixes; `Repository` only for CRUD +- [ ] Create ASCII diagram: public face · `Internal/` · `Internal/System/` +- [ ] Show the design and files to touch, then proceed (no approval question) ### Implementation (Phases 1-3) - Chicago School TDD - [ ] Write failing test asserting expected STATE (Red) - [ ] Write minimal code to pass the test (Green) - [ ] Refactor while keeping tests green -- [ ] Define domain models in `Sources/Domain/` with behavior +- [ ] Define the public face in `Sources//` (values with behavior, `@Mockable` roles) - [ ] Test state changes and return values (not interactions) - [ ] Define protocols with `@Mockable` for external dependencies - [ ] Stub mocks to return data, assert on resulting state -- [ ] Implement infrastructure in `Sources/Infrastructure/` -- [ ] Create views consuming domain models directly +- [ ] Implement adapters in `Sources//Internal/`; bare outside call only in `Internal/System/` (≤100 lines) +- [ ] Tests mirror `Sources/` folder for folder (`Tests/Tests//Internal/…`) +- [ ] No new `Domain/` or `Infrastructure/` folder; nothing outside the concept (except the App wiring) names an `Internal/` type +- [ ] Create views consuming the public face directly - [ ] Run `swift test` to verify all tests pass diff --git a/.claude/skills/app-implement-feature/references/architecture-diagrams.md b/.claude/skills/app-implement-feature/references/architecture-diagrams.md index df6e118a..1d587883 100644 --- a/.claude/skills/app-implement-feature/references/architecture-diagrams.md +++ b/.claude/skills/app-implement-feature/references/architecture-diagrams.md @@ -4,41 +4,40 @@ ASCII diagrams for documenting feature architecture before implementation. ## Table of Contents -- [Layered Architecture](#layered-architecture) +- [Concept Folder Layout](#concept-folder-layout) - [Data Flow Diagrams](#data-flow-diagrams) - [Sequence Diagrams](#sequence-diagrams) - [Component Interaction Tables](#component-interaction-tables) --- -## Layered Architecture +## Concept Folder Layout -### Three-Layer Pattern (Standard) +No `Domain/` or `Infrastructure/` layer folders: each concept folder carries +its public face at the top, its implementations in `Internal/`, and the bare +outside call in `Internal/System/`. + +### One Concept (Standard) ``` ┌─────────────────────────────────────────────────────────────────────┐ │ FEATURE: [Feature Name] │ ├─────────────────────────────────────────────────────────────────────┤ │ │ -│ EXTERNAL INFRASTRUCTURE DOMAIN │ -│ ┌─────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ -│ │ [Source] │──────▶│ [Repository/ │────▶│ [Model] │ │ -│ │ (API/DB) │ │ Client] │ │ (value types) │ │ -│ └─────────────┘ └─────────────────┘ └─────────────────┘ │ -│ │ │ -│ ▼ │ -│ ┌─────────────────┐ │ -│ │ [Service] │ │ -│ │ (actor) │ │ -│ └─────────────────┘ │ -│ │ │ -│ ▼ │ -│ ┌───────────────────────────────────────┐ │ -│ │ APP LAYER │ │ -│ │ ┌─────────────────────────────────┐ │ │ -│ │ │ [Views/Registration] │ │ │ -│ │ └─────────────────────────────────┘ │ │ -│ └───────────────────────────────────────┘ │ +│ Sources/[Concept]/ [Concept]/Internal/ Internal/System/ │ +│ ┌─────────────────┐ ┌─────────────────┐ ┌───────────────┐ │ +│ │ [Model] │◀──────│ [Adapter] │──▶│ [Bare call] │──▶ API/DB +│ │ (value types) │ impl. │ (decode, map, │ │ (≤100 lines, │ │ +│ │ [Role] │ │ decisions) │ │ no decisions)│ │ +│ │ (@Mockable) │ └─────────────────┘ └───────────────┘ │ +│ │ [Actor] │ │ +│ └─────────────────┘ │ +│ ▲ public face only │ +│ ┌───────────────────────────────────────┐ │ +│ │ Sources/App/ │ │ +│ │ [Views] · [Entry point: wires │ │ +│ │ Internal/ adapters in] │ │ +│ └───────────────────────────────────────┘ │ └─────────────────────────────────────────────────────────────────────┘ ``` @@ -48,65 +47,50 @@ ASCII diagrams for documenting feature architecture before implementation. ┌─────────────────────────────────────────────────────────────────────────┐ │ Swift App System │ ├─────────────────────────────────────────────────────────────────────────┤ -│ │ -│ ┌────────────────────────────────────────────────────────────────────┐ │ -│ │ Domain Layer │ │ -│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────────┐ │ │ -│ │ │ Order │ │ User │ │ OrderManager (actor) │ │ │ -│ │ │ OrderStatus │ │ Product │ │ CartService │ │ │ -│ │ └──────────────┘ └──────────────┘ └──────────────────────────┘ │ │ -│ └────────────────────────────────────────────────────────────────────┘ │ -│ ▲ │ -│ │ implements │ -│ ┌────────────────────────────────────────────────────────────────────┐ │ -│ │ Infrastructure Layer │ │ -│ │ ┌────────────────────────────────────────────────────────────┐ │ │ -│ │ │ Repositories │ │ │ -│ │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │ │ │ -│ │ │ │ Order │ │ User │ │ Product │ │ [NewRepo] │ │ │ │ -│ │ │ │ Repo │ │ Repo │ │ Repo │ │ │ │ │ │ -│ │ │ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │ │ │ -│ │ └────────────────────────────────────────────────────────────┘ │ │ -│ │ │ │ -│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────────┐ │ │ -│ │ │ NetworkClient│ │ DatabaseClient│ │ NotificationService │ │ │ -│ │ └──────────────┘ └──────────────┘ └──────────────────────────┘ │ │ -│ └────────────────────────────────────────────────────────────────────┘ │ -│ ▲ │ -│ │ uses │ -│ ┌────────────────────────────────────────────────────────────────────┐ │ -│ │ App Layer │ │ -│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────────┐ │ │ -│ │ │ AppState │ │ Views │ │ App Entry Point │ │ │ -│ │ │ (@Observable)│ │ │ │ (registration) │ │ │ -│ │ └──────────────┘ └──────────────┘ └──────────────────────────┘ │ │ -│ └────────────────────────────────────────────────────────────────────┘ │ +│ Sources/App/ views (@Observable state) · entry point/wiring │ +│ │ imports public faces │ +│ ▼ │ +│ ┌──────────────────────┐ ┌──────────────────────┐ ┌──────────────────┐ │ +│ │ Orders/ │ │ Users/ │ │ [NewConcept]/ │ │ +│ │ Order, OrderStatus │ │ User │ │ [Model] │ │ +│ │ OrderRepository │ │ UserRepository │ │ [Role] │ │ +│ │ OrderBook (actor) │ │ │ │ │ │ +│ │ Internal/ │ │ Internal/ │ │ Internal/ │ │ +│ │ APIOrderRepository │ │ APIUserRepository │ │ [Adapter] │ │ +│ │ OrderDTO │ │ System/ │ │ System/ │ │ +│ └──────────────────────┘ └──────────────────────┘ └──────────────────┘ │ +│ │ every concept may use │ +│ ▼ │ +│ Sources/Core/ ids · errors · HTTP role │ +│ Internal/System/ URLSessionHTTP (the one network call) │ └─────────────────────────────────────────────────────────────────────────┘ ``` +Concepts never reach into each other's `Internal/`. + --- ## Data Flow Diagrams -### Repository Data Flow +### Collection Data Flow (OrderRepository → APIOrderRepository) ``` ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌───────────┐ -│ API/DB │────▶│ Repository│────▶│ Mapper │────▶│ Domain │ +│ API/DB │────▶│ APIOrderRepository │────▶│ Mapper │────▶│ Domain │ │ Response │ │ Fetch │ │ Logic │ │ Model │ └───────────┘ └───────────┘ └───────────┘ └───────────┘ Raw Fetch Parse Domain Data Data Data Model ``` -### Service Orchestration Flow +### Actor Orchestration Flow ``` ┌─────────────────────────────────────────────────────────────────────┐ -│ SERVICE FLOW │ +│ ACTOR FLOW │ ├─────────────────────────────────────────────────────────────────────┤ │ │ -│ View ──▶ Service (actor) ──▶ Repository.fetch() ──▶ API/DB │ +│ View ──▶ OrderBook (actor) ──▶ OrderRepository.fetch() ──▶ API/DB │ │ │ │ │ │ │ ▼ │ │ │ ┌─────────────────┐ │ @@ -135,7 +119,7 @@ ASCII diagrams for documenting feature architecture before implementation. ``` ┌─────────┐ ┌───────────┐ ┌─────────────┐ ┌──────────────┐ -│ Repo │────▶│ Try Fetch │────▶│ Success │────▶│ Return Data │ +│ OrderRepository │────▶│ Try Fetch │────▶│ Success │────▶│ Return Data │ └─────────┘ └───────────┘ └─────────────┘ └──────────────┘ │ ▼ (failure) @@ -146,7 +130,7 @@ ASCII diagrams for documenting feature architecture before implementation. │ ▼ ┌─────────────────┐ - │ Service handles │ + │ Actor handles │ │ or propagates │ └─────────────────┘ ``` @@ -158,7 +142,7 @@ ASCII diagrams for documenting feature architecture before implementation. ### User Action Flow ``` -User View Service Repository API +User View OrderBook OrderRepository API │ │ │ │ │ │──tap()──────▶│ │ │ │ │ │──action()────▶│ │ │ @@ -176,7 +160,7 @@ User View Service Repository API ### State Change Notification ``` -Repository Service @Observable View +OrderRepository OrderBook @Observable View │ │ │ │ │──model─────────▶│ │ │ │ │──update()────▶│ │ @@ -195,46 +179,52 @@ Repository Service @Observable View ### Standard Table Format ``` -| Component | Purpose | Inputs | Outputs | Dependencies | -|------------------|-------------------------|------------------|-----------------|-------------------| -| OrderRepository | Fetches orders from API | OrderId | Order | NetworkClient | -| OrderManager | Manages order lifecycle | Order, Status | Updated Order | OrderRepository | -| OrderMapper | Converts DTO to domain | OrderDTO | Order | None | +| Component | Purpose | Inputs | Outputs | Dependencies | +|--------------|----------------------------|----------------|----------------|--------------| +| OrderRepository | The collection of orders | OrderId | Order | - | +| APIOrderRepository | Plays OrderRepository over the API | OrderId | Order | HTTP | +| OrderBook | Keeps orders current | Order, Status | Updated Order | OrderRepository | +| OrderMapper | Converts DTO to an Order | OrderDTO | Order | None | ``` ### Extended Table (for complex features) ``` -| Component | Layer | Protocol | Creates/Modifies | Test File | -|------------------|----------------|--------------------|---------------------|--------------------------------| -| APIOrderRepo | Infrastructure | OrderRepository | Creates | APIOrderRepositoryTests.swift | -| OrderMapper | Infrastructure | - | Creates | OrderMapperTests.swift | -| OrderManager | Domain | - | Manages | OrderManagerTests.swift | -| OrderListView | App | - | Displays | - | +| Component | Place | Protocol | Creates/Modifies | Test File | +|-----------------|------------------------|----------|------------------|-------------------------| +| APIOrderRepository | Orders/Internal/ | OrderRepository | Creates | APIOrderRepositoryTests.swift | +| OrderMapper | Orders/Internal/ | - | Creates | OrderMapperTests.swift | +| URLSessionHTTP | Core/Internal/System/ | HTTP | Creates | (integration only) | +| OrderBook | Orders/ (public face) | - | Manages | OrderBookTests.swift | +| OrderListView | App/ | - | Displays | - | ``` ### Files to Create/Modify Table ``` -| File Path | Action | Description | -|-------------------------------------------------|----------|--------------------------------------| -| Sources/Infrastructure/API/OrderRepository.swift | Create | Implements OrderRepository protocol | -| Sources/Domain/Services/OrderManager.swift | Create | Actor managing order state | -| Tests/InfrastructureTests/OrderRepositoryTests.swift | Create | Repository behavior tests | -| Sources/App/Views/OrderListView.swift | Create | SwiftUI view for orders | -| Sources/App/App.swift | Modify | Register dependencies | +| File Path | Action | Description | +|------------------------------------------------------|--------|---------------------------------| +| docs/CANONICAL_MODEL.md | Modify | Orders in the tree, laws, words | +| Sources/Orders/OrderRepository.swift | Create | @Mockable collection (face) | +| Sources/Orders/OrderBook.swift | Create | Actor keeping orders current | +| Sources/Orders/Internal/APIOrderRepository.swift | Create | Plays OrderRepository over the API | +| Tests/AppTests/Orders/OrderBookTests.swift | Create | Actor behavior tests | +| Tests/AppTests/Orders/Internal/APIOrderRepositoryTests.swift | Create | Adapter behavior tests | +| Sources/App/Views/OrderListView.swift | Create | SwiftUI view for orders | +| Sources/App/App.swift | Modify | Wire APIOrderRepository into OrderRepository | ``` --- -## Approval Prompt Template +## Design Presentation Template -After presenting the architecture, ask for user approval: +Show the design, then start Phase 1 — no approval question: ``` -## Architecture Review +## Design: [Feature Name] -I've designed the architecture for [Feature Name]: +### Canonical model +[diff to docs/CANONICAL_MODEL.md, or "already covered by §"] [Diagram Here] @@ -246,12 +236,9 @@ I've designed the architecture for [Feature Name]: ### Files to Create/Modify -- `Sources/.../NewFile.swift` - [Description] -- `Tests/.../NewTests.swift` - [Description] +- `Sources//NewType.swift` - [Description] +- `Sources//Internal/NewAdapter.swift` - [Description] +- `Tests/Tests//NewTypeTests.swift` - [Description] -**Ready to proceed with TDD implementation?** +Starting with the first failing test: `should [when ]`. ``` - -Use AskUserQuestion with: -- "Approve - proceed with implementation" -- "Modify - I have feedback on the design" diff --git a/.claude/skills/app-implement-feature/references/domain-models.md b/.claude/skills/app-implement-feature/references/domain-models.md index e3a9e16c..3e1985f9 100644 --- a/.claude/skills/app-implement-feature/references/domain-models.md +++ b/.claude/skills/app-implement-feature/references/domain-models.md @@ -87,14 +87,13 @@ public protocol PaymentProcessor: Sendable { func refund(transactionId: String, amount: Decimal) async throws -> RefundResult } +// CRUD for an aggregate: XxxRepository. Anything more than CRUD takes a role noun. @Mockable -public protocol Repository: Sendable { - associatedtype Entity - associatedtype ID - - func findById(_ id: ID) async throws -> Entity? - func save(_ entity: Entity) async throws - func delete(_ id: ID) async throws +public protocol OrderRepository: Sendable { + func all() async throws -> [Order] + func fetch(id: OrderId) async throws -> Order + func save(_ order: Order) async throws + func delete(id: OrderId) async throws } ``` @@ -196,30 +195,36 @@ public enum OrderStatus: Int, Comparable, Sendable, CaseIterable { ## Actors for Thread Safety -Use actors for stateful domain services: +Use actors for stateful domain objects (named for what they are, never `XxxManager`): ```swift -public actor OrderManager { - private let repository: any OrderRepository +public actor OrderBook { + private let orders: any OrderRepository private var cachedOrders: [OrderId: Order] = [:] - public init(repository: any OrderRepository) { - self.repository = repository + public init(orders: any OrderRepository) { + self.orders = orders } public func getOrder(_ id: OrderId) async throws -> Order { if let cached = cachedOrders[id] { return cached } - let order = try await repository.fetch(id: id) + let order = try await orders.fetch(id: id) cachedOrders[id] = order return order } + public func all() async throws -> [Order] { + let all = try await orders.all() + for order in all { cachedOrders[order.id] = order } + return all + } + public func updateStatus(_ id: OrderId, to status: OrderStatus) async throws { var order = try await getOrder(id) order = order.withStatus(status) - try await repository.save(order) + try await orders.save(order) cachedOrders[id] = order } diff --git a/.claude/skills/app-implement-feature/references/domain-shape.md b/.claude/skills/app-implement-feature/references/domain-shape.md new file mode 100644 index 00000000..5c18a77d --- /dev/null +++ b/.claude/skills/app-implement-feature/references/domain-shape.md @@ -0,0 +1,64 @@ +# Think the domain first + +Before any change, a fix too, ask how the domain should be, not only where the +line fits. The aim is a domain that is **easy to understand**: someone new +reads a type's surface and can explain it in the user's words. Borrow from DDD +only what serves that; no pattern is added for its own sake. + +The tree, the words, every law and its owner are in `docs/CANONICAL_MODEL.md`; +the Swift patterns in [domain-models.md](domain-models.md). + +## Five questions, of every type the change touches + +**1. Would the user say it?** +Names come from what the user sees (the screens, the CLI, the API), never the +mechanism. If the facts need a concept the code doesn't have, it is hiding as +an optional or a flag. *"Cancellable" is a word users meet; `statusCode < 3` +is not.* + +**2. Does the thing decide about itself?** +A rule lives on the thing it is about; callers tell it, they don't read its +state and decide. *Three views writing `order.status == .pending || +order.status == .processing` means the rule is `Order.canBeCancelled`, and +callers ask for it.* + +**3. Can you see every state?** +Each state a user can meet is a case with its data; one value never means two +things. *A payment that timed out may have gone through: it is `unconfirmed`, +not `failed`. A missing answer is a case (`unknown`), not a thrown error.* + +**4. Is it as small as it can be?** +A value when it is data with rules; an actor or class only when it changes +over time; a `@Mockable` protocol only at the outside world (a network, a +database, a process), named for its role. No type, layer or flag the change +doesn't need — but never drop a rule the domain keeps. + +**5. Is what differs between cases data?** +A table, a value, a registration — never `if kind == "premium"` or a subclass +per variant. *A shipping rule per country is a lookup in `ShippingRates`, not +a `switch` in the checkout view.* + +## Check by concept + +The five questions look at one type. To find what is wrong across the domain, +check each **concept folder** as a whole. Each row names a smell you can grep +for. + +| # | Ask | The smell | +|---|---|---| +| 1 | **Does anything cross the fence?** Only a public face or an id may | another concept's `Internal/` type used here; `App/` building an adapter it should only wire | +| 2 | **Does every word mean one thing here?** | one name for two facts | +| 3 | **Does every law have one owner?** | the same rule written twice, drifting; a caller reading state to decide | +| 4 | **Is the business above, and the technique below?** | a request, SQL or JSON assembled in the public face or in `App/`; a domain decision in `Internal/System/` | +| 5 | **Does a new case add data, not an edit?** | a `switch` on a variant name; one type changing for several reasons | +| 6 | **Does the question have a home?** | a rule that lives only in a doc, a view, or a comment | + +A finding goes in `CANONICAL_MODEL.md`: as a fix when a law already says what +is right, or as an open question when the design must decide first. + +## Keep it in scope + +- Fix what these questions find **in the types the change touches**, test + first. Record the rest in `CANONICAL_MODEL.md` for its own change. +- A new aggregate, a moved law or a changed owner is a design change: write it + into `CANONICAL_MODEL.md` first, as part of the Phase 0 design. diff --git a/.claude/skills/app-implement-feature/references/swift-observable.md b/.claude/skills/app-implement-feature/references/swift-observable.md index 32f52f8a..66251fa1 100644 --- a/.claude/skills/app-implement-feature/references/swift-observable.md +++ b/.claude/skills/app-implement-feature/references/swift-observable.md @@ -178,10 +178,10 @@ final class OrderState: @unchecked Sendable { private(set) var orders: [Order] = [] private(set) var isLoading: Bool = false - private let manager: OrderManager // Actor + private let book: OrderBook // Actor - init(manager: OrderManager) { - self.manager = manager + init(book: OrderBook) { + self.book = book } @MainActor @@ -190,7 +190,7 @@ final class OrderState: @unchecked Sendable { defer { isLoading = false } do { - orders = try await manager.fetchAll() + orders = try await book.all() } catch { // Handle error } @@ -199,10 +199,10 @@ final class OrderState: @unchecked Sendable { @MainActor func updateStatus(_ orderId: OrderId, to status: OrderStatus) async { do { - try await manager.updateStatus(orderId, to: status) + try await book.updateStatus(orderId, to: status) // Refresh the specific order if let index = orders.firstIndex(where: { $0.id == orderId }) { - orders[index] = try await manager.fetch(orderId) + orders[index] = try await book.getOrder(orderId) } } catch { // Handle error diff --git a/.claude/skills/app-implement-feature/references/tdd-patterns.md b/.claude/skills/app-implement-feature/references/tdd-patterns.md index a0cc1421..79628092 100644 --- a/.claude/skills/app-implement-feature/references/tdd-patterns.md +++ b/.claude/skills/app-implement-feature/references/tdd-patterns.md @@ -17,11 +17,11 @@ Use `@Test` and `@Suite` instead of XCTest: ```swift import Testing import Foundation -@testable import Domain +@testable import App // the module that holds Sources/Orders/ @Suite struct OrderTests { - @Test func `order at pending status can be cancelled`() { + @Test func `should let a pending order be cancelled`() { let order = Order(items: [], status: .pending) #expect(order.canBeCancelled == true) } @@ -31,7 +31,7 @@ struct OrderTests { ## Given-When-Then Structure ```swift -@Test func `order computes total from items`() { +@Test func `should total an order from its items`() { // Given let order = Order(items: [ OrderItem(price: 10, quantity: 2), @@ -55,12 +55,13 @@ import Mockable @Mockable public protocol OrderRepository: Sendable { + func all() async throws -> [Order] func fetch(id: OrderId) async throws -> Order func save(_ order: Order) async throws } @Mockable -public protocol NetworkClient: Sendable { +public protocol HTTP: Sendable { func request(_ endpoint: Endpoint) async throws -> T } ``` @@ -71,26 +72,26 @@ public protocol NetworkClient: Sendable { import Mockable @Suite -struct OrderServiceTests { - @Test func `service returns order on fetch`() async throws { +struct OrderBookTests { + @Test func `should give back the order it was asked for`() async throws { // Given - STUB dependencies to return data - let mockRepo = MockOrderRepository() + let mockOrders = MockOrderRepository() let expectedOrder = Order( id: OrderId("123"), items: [OrderItem(price: 10, quantity: 1)], status: .pending ) - given(mockRepo).fetch(id: any()).willReturn(expectedOrder) + given(mockOrders).fetch(id: any()).willReturn(expectedOrder) - let service = OrderService(repository: mockRepo) + let book = OrderBook(orders: mockOrders) // When - let result = try await service.getOrder(id: "123") + let result = try await book.getOrder(OrderId("123")) // Then - verify STATE, not that methods were called #expect(result.status == .pending) #expect(result.totalAmount == 10) - // AVOID: verify(mockRepo).fetch(id: any()).called(1) // London school - don't do this + // AVOID: verify(mockOrders).fetch(id: any()).called(1) // London school - don't do this } } ``` @@ -104,7 +105,7 @@ Test state and computed properties: ```swift @Suite struct MoneyTests { - @Test func `money adds correctly with same currency`() { + @Test func `should add two amounts in the same currency`() { let money1 = Money(amount: 10, currency: .usd) let money2 = Money(amount: 5, currency: .usd) @@ -114,7 +115,7 @@ struct MoneyTests { #expect(result.currency == .usd) } - @Test func `money formats with currency symbol`() { + @Test func `should show an amount with its currency symbol`() { let money = Money(amount: 99.99, currency: .usd) #expect(money.formatted == "$99.99") @@ -123,15 +124,15 @@ struct MoneyTests { @Suite struct OrderStatusTests { - @Test func `pending status needs attention`() { + @Test func `should need attention while pending`() { #expect(OrderStatus.pending.needsAttention == true) } - @Test func `delivered status is terminal`() { + @Test func `should be final once delivered`() { #expect(OrderStatus.delivered.isTerminal == true) } - @Test func `shipped status does not need attention`() { + @Test func `should not need attention once shipped`() { #expect(OrderStatus.shipped.needsAttention == false) } } @@ -140,31 +141,31 @@ struct OrderStatusTests { ## Async Test Patterns ```swift -@Test func `repository returns order on success`() async throws { +@Test func `should load an order when the API answers`() async throws { // Given - let mockClient = MockNetworkClient() - given(mockClient).request(any()).willReturn( + let mockHTTP = MockHTTP() + given(mockHTTP).request(any()).willReturn( OrderDTO(id: "123", status: "pending", items: []) ) - let repository = APIOrderRepository(client: mockClient) + let orders = APIOrderRepository(http: mockHTTP) // When - let order = try await repository.fetch(id: OrderId("123")) + let order = try await orders.fetch(id: OrderId("123")) // Then #expect(order.id.value == "123") #expect(order.status == .pending) } -@Test func `repository throws when network fails`() async { +@Test func `should fail when the network is down`() async { // Given - let mockClient = MockNetworkClient() - given(mockClient).request(any()).willThrow(NetworkError.connectionFailed) - let repository = APIOrderRepository(client: mockClient) + let mockHTTP = MockHTTP() + given(mockHTTP).request(any()).willThrow(NetworkError.connectionFailed) + let orders = APIOrderRepository(http: mockHTTP) // When/Then - await #expect(throws: RepositoryError.networkError) { - try await repository.fetch(id: OrderId("123")) + await #expect(throws: OrdersError.networkError) { + try await orders.fetch(id: OrderId("123")) } } ``` @@ -173,35 +174,35 @@ struct OrderStatusTests { ```swift @Suite -struct OrderManagerTests { - @Test func `manager caches fetched orders`() async throws { +struct OrderBookTests { + @Test func `should serve an order again without refetching it`() async throws { // Given - let mockRepo = MockOrderRepository() + let mockOrders = MockOrderRepository() let order = Order(id: OrderId("123"), items: [], status: .pending) - given(mockRepo).fetch(id: any()).willReturn(order) + given(mockOrders).fetch(id: any()).willReturn(order) - let manager = OrderManager(repository: mockRepo) + let book = OrderBook(orders: mockOrders) // When - fetch twice - let first = try await manager.getOrder(OrderId("123")) - let second = try await manager.getOrder(OrderId("123")) + let first = try await book.getOrder(OrderId("123")) + let second = try await book.getOrder(OrderId("123")) // Then - both return same order (cached) #expect(first.id == second.id) } - @Test func `manager updates order status`() async throws { + @Test func `should show the new status after an update`() async throws { // Given - let mockRepo = MockOrderRepository() + let mockOrders = MockOrderRepository() var order = Order(id: OrderId("123"), items: [], status: .pending) - given(mockRepo).fetch(id: any()).willReturn(order) - given(mockRepo).save(any()).willReturn(()) + given(mockOrders).fetch(id: any()).willReturn(order) + given(mockOrders).save(any()).willReturn(()) - let manager = OrderManager(repository: mockRepo) + let book = OrderBook(orders: mockOrders) // When - try await manager.updateStatus(OrderId("123"), to: .processing) - let updated = try await manager.getOrder(OrderId("123")) + try await book.updateStatus(OrderId("123"), to: .processing) + let updated = try await book.getOrder(OrderId("123")) // Then - verify state changed #expect(updated.status == .processing) @@ -212,20 +213,23 @@ struct OrderManagerTests { ## Test Organization ``` -Tests/ -├── DomainTests/ -│ ├── Models/ -│ │ ├── OrderTests.swift # Domain model behavior -│ │ ├── MoneyTests.swift # Value object behavior -│ │ └── OrderStatusTests.swift # Enum behavior -│ └── Services/ -│ └── OrderManagerTests.swift # Actor behavior -└── InfrastructureTests/ - └── Repositories/ - ├── APIOrderRepositoryTests.swift # Repository behavior - └── OrderParsingTests.swift # Parsing logic +Tests/AppTests/ # mirrors Sources/ folder for folder +├── Core/ +│ └── MoneyTests.swift # Value object behavior +└── Orders/ + ├── OrderTests.swift # Public face: model behavior + ├── OrderStatusTests.swift # Enum behavior + ├── OrderBookTests.swift # Actor behavior + └── Internal/ + ├── APIOrderRepositoryTests.swift # Adapter behavior via MockHTTP + ├── OrderParsingTests.swift # Parsing logic + └── System/ + └── URLSessionHTTPTests.swift # Integration only (real call, time-limited) ``` +A test lives at the same path as the source it covers. `Internal/System/` is +the only folder coverage leaves out; everything else is unit-tested. + ## Running Tests ```bash @@ -233,7 +237,7 @@ Tests/ swift test # Run specific test suite -swift test --filter DomainTests +swift test --filter OrderTests # Run specific test swift test --filter "OrderTests/order computes total from items" @@ -246,7 +250,7 @@ swift test --filter "OrderTests/order computes total from items" | Test Type | What to Assert | |---------------------|---------------------------------------------------| | Domain models | Computed properties, state after mutations | -| Services/Repos | Return values, thrown errors, resulting state | +| Actors/collections | Return values, thrown errors, resulting state | | Actors | State after operations complete | ### What NOT to Test diff --git a/.claude/skills/asc-app-clips b/.claude/skills/asc-app-clips new file mode 120000 index 00000000..b8092f7f --- /dev/null +++ b/.claude/skills/asc-app-clips @@ -0,0 +1 @@ +../../.agents/skills/asc-app-clips \ No newline at end of file diff --git a/.claude/skills/asc-app-infos b/.claude/skills/asc-app-infos new file mode 120000 index 00000000..50c0202f --- /dev/null +++ b/.claude/skills/asc-app-infos @@ -0,0 +1 @@ +../../.agents/skills/asc-app-infos \ No newline at end of file diff --git a/.claude/skills/asc-app-previews b/.claude/skills/asc-app-previews new file mode 120000 index 00000000..05f53a73 --- /dev/null +++ b/.claude/skills/asc-app-previews @@ -0,0 +1 @@ +../../.agents/skills/asc-app-previews \ No newline at end of file diff --git a/.claude/skills/asc-app-shots b/.claude/skills/asc-app-shots new file mode 120000 index 00000000..6dec088e --- /dev/null +++ b/.claude/skills/asc-app-shots @@ -0,0 +1 @@ +../../.agents/skills/asc-app-shots \ No newline at end of file diff --git a/.claude/skills/asc-app-shots-prompt b/.claude/skills/asc-app-shots-prompt new file mode 120000 index 00000000..9ea2aeda --- /dev/null +++ b/.claude/skills/asc-app-shots-prompt @@ -0,0 +1 @@ +../../.agents/skills/asc-app-shots-prompt \ No newline at end of file diff --git a/.claude/skills/asc-app-wall b/.claude/skills/asc-app-wall new file mode 120000 index 00000000..94d66c4a --- /dev/null +++ b/.claude/skills/asc-app-wall @@ -0,0 +1 @@ +../../.agents/skills/asc-app-wall \ No newline at end of file diff --git a/.claude/skills/asc-appstore-release b/.claude/skills/asc-appstore-release new file mode 120000 index 00000000..7fe8c116 --- /dev/null +++ b/.claude/skills/asc-appstore-release @@ -0,0 +1 @@ +../../.agents/skills/asc-appstore-release \ No newline at end of file diff --git a/.claude/skills/asc-auth b/.claude/skills/asc-auth new file mode 120000 index 00000000..10ae2781 --- /dev/null +++ b/.claude/skills/asc-auth @@ -0,0 +1 @@ +../../.agents/skills/asc-auth \ No newline at end of file diff --git a/.claude/skills/asc-availability b/.claude/skills/asc-availability new file mode 120000 index 00000000..d1602a7b --- /dev/null +++ b/.claude/skills/asc-availability @@ -0,0 +1 @@ +../../.agents/skills/asc-availability \ No newline at end of file diff --git a/.claude/skills/asc-beta-review b/.claude/skills/asc-beta-review new file mode 120000 index 00000000..98fe7dca --- /dev/null +++ b/.claude/skills/asc-beta-review @@ -0,0 +1 @@ +../../.agents/skills/asc-beta-review \ No newline at end of file diff --git a/.claude/skills/asc-builds-archive b/.claude/skills/asc-builds-archive new file mode 120000 index 00000000..5cf4ac2b --- /dev/null +++ b/.claude/skills/asc-builds-archive @@ -0,0 +1 @@ +../../.agents/skills/asc-builds-archive \ No newline at end of file diff --git a/.claude/skills/asc-builds-upload b/.claude/skills/asc-builds-upload new file mode 120000 index 00000000..0f1ecaf6 --- /dev/null +++ b/.claude/skills/asc-builds-upload @@ -0,0 +1 @@ +../../.agents/skills/asc-builds-upload \ No newline at end of file diff --git a/.claude/skills/asc-check-readiness b/.claude/skills/asc-check-readiness new file mode 120000 index 00000000..65754e95 --- /dev/null +++ b/.claude/skills/asc-check-readiness @@ -0,0 +1 @@ +../../.agents/skills/asc-check-readiness \ No newline at end of file diff --git a/.claude/skills/asc-cli b/.claude/skills/asc-cli new file mode 120000 index 00000000..ea4035a9 --- /dev/null +++ b/.claude/skills/asc-cli @@ -0,0 +1 @@ +../../.agents/skills/asc-cli \ No newline at end of file diff --git a/.claude/skills/asc-code-signing b/.claude/skills/asc-code-signing new file mode 120000 index 00000000..8e543601 --- /dev/null +++ b/.claude/skills/asc-code-signing @@ -0,0 +1 @@ +../../.agents/skills/asc-code-signing \ No newline at end of file diff --git a/.claude/skills/asc-customer-reviews b/.claude/skills/asc-customer-reviews new file mode 120000 index 00000000..6fa98c3e --- /dev/null +++ b/.claude/skills/asc-customer-reviews @@ -0,0 +1 @@ +../../.agents/skills/asc-customer-reviews \ No newline at end of file diff --git a/.claude/skills/asc-experiments b/.claude/skills/asc-experiments new file mode 120000 index 00000000..b502c9fb --- /dev/null +++ b/.claude/skills/asc-experiments @@ -0,0 +1 @@ +../../.agents/skills/asc-experiments \ No newline at end of file diff --git a/.claude/skills/asc-game-center b/.claude/skills/asc-game-center new file mode 120000 index 00000000..a55810dd --- /dev/null +++ b/.claude/skills/asc-game-center @@ -0,0 +1 @@ +../../.agents/skills/asc-game-center \ No newline at end of file diff --git a/.claude/skills/asc-iap b/.claude/skills/asc-iap new file mode 120000 index 00000000..7d1dc92a --- /dev/null +++ b/.claude/skills/asc-iap @@ -0,0 +1 @@ +../../.agents/skills/asc-iap \ No newline at end of file diff --git a/.claude/skills/asc-init b/.claude/skills/asc-init new file mode 120000 index 00000000..066d5b2f --- /dev/null +++ b/.claude/skills/asc-init @@ -0,0 +1 @@ +../../.agents/skills/asc-init \ No newline at end of file diff --git a/.claude/skills/asc-iris b/.claude/skills/asc-iris new file mode 120000 index 00000000..9f5bbf5a --- /dev/null +++ b/.claude/skills/asc-iris @@ -0,0 +1 @@ +../../.agents/skills/asc-iris \ No newline at end of file diff --git a/.claude/skills/asc-new-app-release b/.claude/skills/asc-new-app-release new file mode 120000 index 00000000..5d17156a --- /dev/null +++ b/.claude/skills/asc-new-app-release @@ -0,0 +1 @@ +../../.agents/skills/asc-new-app-release \ No newline at end of file diff --git a/.claude/skills/asc-performance b/.claude/skills/asc-performance new file mode 120000 index 00000000..abf1b15e --- /dev/null +++ b/.claude/skills/asc-performance @@ -0,0 +1 @@ +../../.agents/skills/asc-performance \ No newline at end of file diff --git a/.claude/skills/asc-plugin-release b/.claude/skills/asc-plugin-release new file mode 120000 index 00000000..c5dd9c55 --- /dev/null +++ b/.claude/skills/asc-plugin-release @@ -0,0 +1 @@ +../../.agents/skills/asc-plugin-release \ No newline at end of file diff --git a/.claude/skills/asc-plugins b/.claude/skills/asc-plugins new file mode 120000 index 00000000..5baecbec --- /dev/null +++ b/.claude/skills/asc-plugins @@ -0,0 +1 @@ +../../.agents/skills/asc-plugins \ No newline at end of file diff --git a/.claude/skills/asc-promoted-purchases b/.claude/skills/asc-promoted-purchases new file mode 120000 index 00000000..ce8e659f --- /dev/null +++ b/.claude/skills/asc-promoted-purchases @@ -0,0 +1 @@ +../../.agents/skills/asc-promoted-purchases \ No newline at end of file diff --git a/.claude/skills/asc-release-workflow b/.claude/skills/asc-release-workflow new file mode 120000 index 00000000..b7535d88 --- /dev/null +++ b/.claude/skills/asc-release-workflow @@ -0,0 +1 @@ +../../.agents/skills/asc-release-workflow \ No newline at end of file diff --git a/.claude/skills/asc-reports b/.claude/skills/asc-reports new file mode 120000 index 00000000..a95a3c6c --- /dev/null +++ b/.claude/skills/asc-reports @@ -0,0 +1 @@ +../../.agents/skills/asc-reports \ No newline at end of file diff --git a/.claude/skills/asc-review-detail b/.claude/skills/asc-review-detail new file mode 120000 index 00000000..14025a71 --- /dev/null +++ b/.claude/skills/asc-review-detail @@ -0,0 +1 @@ +../../.agents/skills/asc-review-detail \ No newline at end of file diff --git a/.claude/skills/asc-skills b/.claude/skills/asc-skills new file mode 120000 index 00000000..46647347 --- /dev/null +++ b/.claude/skills/asc-skills @@ -0,0 +1 @@ +../../.agents/skills/asc-skills \ No newline at end of file diff --git a/.claude/skills/asc-subscriptions b/.claude/skills/asc-subscriptions new file mode 120000 index 00000000..129b8882 --- /dev/null +++ b/.claude/skills/asc-subscriptions @@ -0,0 +1 @@ +../../.agents/skills/asc-subscriptions \ No newline at end of file diff --git a/.claude/skills/asc-testflight b/.claude/skills/asc-testflight new file mode 120000 index 00000000..129e66bb --- /dev/null +++ b/.claude/skills/asc-testflight @@ -0,0 +1 @@ +../../.agents/skills/asc-testflight \ No newline at end of file diff --git a/.claude/skills/asc-users b/.claude/skills/asc-users new file mode 120000 index 00000000..74fcc92d --- /dev/null +++ b/.claude/skills/asc-users @@ -0,0 +1 @@ +../../.agents/skills/asc-users \ No newline at end of file diff --git a/.claude/skills/asc-xcode-cloud b/.claude/skills/asc-xcode-cloud new file mode 120000 index 00000000..9ac94057 --- /dev/null +++ b/.claude/skills/asc-xcode-cloud @@ -0,0 +1 @@ +../../.agents/skills/asc-xcode-cloud \ No newline at end of file diff --git a/.claude/skills/fix-bug/SKILL.md b/.claude/skills/fix-bug/SKILL.md index 43233a0b..4cff1b8e 100644 --- a/.claude/skills/fix-bug/SKILL.md +++ b/.claude/skills/fix-bug/SKILL.md @@ -28,10 +28,10 @@ Fix the bug where the rule lives, not at a call site that happens to show it: | Symptom | Owner | Test lives in | |---|---|---| -| Wrong `isLive` / `isEditable` / `isPending` | the state enum in `Sources/Domain/…` | `Tests/DomainTests/…` | -| Missing or wrong next command / `_links` | the model's `structuredAffordances` (CLI and REST both derive from it) | `Tests/DomainTests/…` | -| Field `null`, wrong value, missing parent ID | the `SDK*Repository` mapper in `Sources/Infrastructure/…` | `Tests/InfrastructureTests/…` | -| A value App Store Connect sends shows as `null` | a domain enum missing a case the SDK has (mapped via `init(rawValue:)` → `nil`) | Domain + Infrastructure | +| Wrong `isLive` / `isEditable` / `isPending` | the state enum in `Sources/ASCKit//` | `Tests/ASCKitTests//` | +| Missing or wrong next command / `_links` | the model's `structuredAffordances` (CLI and REST both derive from it) | `Tests/ASCKitTests//` | +| Field `null`, wrong value, missing parent ID | the `SDK*Repository` mapper in `Sources/ASCKit//Internal/` | `Tests/ASCKitTests//Internal/` | +| A value App Store Connect sends shows as `null` | a domain enum missing a case the SDK has (mapped via `init(rawValue:)` → `nil`) | the concept's face + its `Internal/` mapper | | Wrong flag parsing, table, or JSON shape | the command in `Sources/ASCCommand/Commands/…` | `Tests/ASCCommandTests/…` | | CLI right but REST wrong (or the reverse) | the controller in `Commands/Web/Controllers/` — CLI and REST should share one path; make them | `Tests/ASCCommandTests/…` | diff --git a/.claude/skills/implement-feature/SKILL.md b/.claude/skills/implement-feature/SKILL.md index b75c5fea..c62313e4 100644 --- a/.claude/skills/implement-feature/SKILL.md +++ b/.claude/skills/implement-feature/SKILL.md @@ -6,7 +6,7 @@ description: | (2) Creating domain models that follow user's mental model (3) Building new CLI commands that consume domain repositories (4) User asks "how do I implement X" or "add feature Y" - (5) Implementing any feature that spans Domain, Infrastructure, and ASCCommand layers + (5) Implementing any feature that spans a concept folder in ASCKit (its public face and Internal/) and ASCCommand --- # Implement Feature in asc-swift @@ -24,10 +24,10 @@ Implement features using architecture-first design, TDD, rich domain models, and 2. TDD IMPLEMENTATION (Always write tests FIRST) • NEVER write implementation code without a failing test • Think from user's mental model — test cases describe what the user expects, not internals - • Write domain tests first → then infrastructure tests → then command tests + • Write public-face tests first → then Internal/ adapter tests → then command tests • Each test must FAIL (red) before writing implementation - • Domain tests → Domain value types + AffordanceProviding + @Mockable protocol - • Infrastructure: SDK adapter injecting parent IDs, composing multi-call flows + • Public face (ASCKit//) → value types + AffordanceProviding + @Mockable protocol + • Internal/ (ASCKit//Internal/): SDK adapter injecting parent IDs, composing multi-call flows • Command: formatAgentItems → {"data":[{...,"affordances":{...}}]} 3. REST EXPOSURE (no feature is done until reachable via REST) @@ -110,6 +110,8 @@ See [command-affordances.md](references/command-affordances.md) for: ### 4. Repository protocol — primitives only, but allow composition in adapters +`XxxRepository` is for CRUD over an aggregate only — a state change like `submit` is an update. A protocol that runs something outside asc-cli (sign in, boot, install, download) takes a role noun instead: `IrisSignIn`, `Simulators`, `Reports`. A workflow over aggregates (find the draft, add the item, submit) is a domain operation on the model, built from repository primitives — `version.submitForReview(to:)`, `SubmissionPlan.submit(repo:)` — never a repository method. + ```swift @Mockable public protocol MyRepository: Sendable { @@ -151,7 +153,7 @@ The REST controller calls the same `execute(repo:affordanceMode: .rest)` — no When ASC paginates a relationship or splits a single user-visible resource across endpoints, compose them inside the SDK adapter. **Apple's parent-endpoint `include=foo` truncates the relationship to ~10 entries** — for full lists, hit the dedicated relationship endpoint with explicit `limit`. The iOS SDK does this for `fetchAvailability`, `fetchPriceSchedule`, `fetchEqualizations`, and others. ```swift -public func getAvailability(iapId: String) async throws -> Domain.InAppPurchaseAvailability { +public func getAvailability(iapId: String) async throws -> ASCKit.InAppPurchaseAvailability { // Two parallel calls — `include=availableTerritories` truncates to ~10. async let availResponse = client.request( APIEndpoint.v2.inAppPurchases.id(iapId).inAppPurchaseAvailability.get(parameters: .init()) @@ -163,8 +165,8 @@ public func getAvailability(iapId: String) async throws -> Domain.InAppPurchaseA ) let (avail, terr) = try await (availResponse, terrResponse) - let territories = terr.data.map { Domain.Territory(id: $0.id, currency: $0.attributes?.currency) } - return Domain.InAppPurchaseAvailability( + let territories = terr.data.map { ASCKit.Territory(id: $0.id, currency: $0.attributes?.currency) } + return ASCKit.InAppPurchaseAvailability( id: avail.data.id, iapId: iapId, isAvailableInNewTerritories: avail.data.attributes?.isAvailableInNewTerritories ?? false, territories: territories @@ -183,12 +185,12 @@ public func getAvailability(iapId: String) async throws -> Domain.InAppPurchaseA See [tdd-patterns.md](references/tdd-patterns.md) for complete patterns including: - `MockRepositoryFactory` (always use, never construct models inline) - Affordance tests -- Infrastructure parent-ID injection tests +- `Internal/` adapter parent-ID injection tests - `@Mockable` / `given().willReturn()` usage Name each test `should [when ]`, in the words of the person, agent or REST client who sees the result — never a method, type or mechanism verb → [Naming tests](references/tdd-patterns.md#naming-tests). -### Phase 1: Domain +### Phase 1: Public face (`ASCKit//`) ```swift @Test func `should belong to the parent it was listed under`() { @@ -210,7 +212,7 @@ Name each test `should [when ]`, in the words of the person Both `affordances` and `apiLinks` derive from the same `structuredAffordances` — testing each catches both the CLI and REST surfaces in one set of assertions. -### Phase 2: Infrastructure +### Phase 2: Adapter (`ASCKit//Internal/`) ```swift @Test func `should tie each model to the parent it was listed under`() async throws { @@ -337,7 +339,7 @@ Per CLAUDE.md, **a feature is not complete until it is reachable via REST.** Ste } ``` -6. **Advertise the resource** from `APIRoot.structuredAffordances` (`Sources/Domain/Shared/APIRoot.swift`) when it is a new top-level resource, so `GET /api/v1` lists it. +6. **Advertise the resource** from `APIRoot.structuredAffordances` (`Sources/ASCKit/Shared/APIRoot.swift`) when it is a new top-level resource, so `GET /api/v1` lists it. 7. Add a REST test in `Tests/ASCCommandTests/Commands/Web/RESTRoutesTests.swift` that calls `execute(repo:affordanceMode: .rest)` and asserts `_links` + the resolved REST path. @@ -345,7 +347,7 @@ Per CLAUDE.md, **a feature is not complete until it is reachable via REST.** Ste **REST rules:** - CLI flag and REST query-param names match: `--expired-only` ↔ `?expired-only=true`, both calling the same repository method. -- Helpers in `RESTRoutes.swift`: `restFormat(items)` (REST twin of `formatAgentItems(…, affordanceMode: .rest)`) and `jsonError(message, status:)` (from `Infrastructure/Web/ASCWebServer.swift`). +- Helpers in `RESTRoutes.swift`: `restFormat(items)` (REST twin of `formatAgentItems(…, affordanceMode: .rest)`) and `jsonError(message, status:)` (from `ASCKit/Web/ASCWebServer.swift`). - `RESTPathResolver` maps affordance actions to HTTP: `list`/`get` → GET, `create`/`add` → POST to the parent's collection, `update` → PATCH, `delete`/`remove` → DELETE, anything else (e.g. `submit`) → POST `…/{id}/{action}`. - Controllers are structs with dependencies injected at init; repositories are constructed once in `RESTRoutes.configure`, never per request. @@ -396,22 +398,22 @@ Docs follow `docs/documentation-design/README.md`: each fact has one home, and n - [ ] Files table filled - [ ] **User approval received** -### Phase 1: Domain +### Phase 1: Public face - [ ] `XModel.swift` — `struct` + `Sendable` + `Equatable` + `Identifiable` + `Codable` -- [ ] Carries `parentId` (ASC API omits parent IDs from response — Infrastructure injects them) +- [ ] Carries `parentId` (ASC API omits parent IDs from response — the `Internal/` mapper injects them) - [ ] `Presentable` conformance (`tableHeaders`, `tableRow`) - [ ] `AffordanceProviding` via `structuredAffordances` (NOT raw `affordances`) - [ ] State enum with semantic booleans (`isLive`, `isEditable`, `isPendingReview`, etc.) - [ ] `XRepository.swift` — `@Mockable` protocol with primitive methods only - [ ] `make*` factory added to `MockRepositoryFactory.swift` -- [ ] Domain tests: model fields, semantic booleans, affordances, **and `apiLinks`** for the new keys +- [ ] Public-face tests: model fields, semantic booleans, affordances, **and `apiLinks`** for the new keys -### Phase 2: Infrastructure +### Phase 2: Adapter (`Internal/`) - [ ] `SDKXRepository.swift` — implements protocol, injects parent IDs in mappers - [ ] Multi-call composition where needed (relationships paginate at ~10 — use dedicated endpoints with `limit:`) - [ ] Factory registered in `ClientFactory.swift` - [ ] `_xRoutes` registered AND touched in `RESTPathResolver.ensureInitialized()` -- [ ] Infrastructure tests cover: parent ID injection, multi-call composition, >10-entry regression +- [ ] `Internal/` adapter tests cover: parent ID injection, multi-call composition, >10-entry regression ### Phase 3: Command - [ ] `XCommand.swift` + subcommands using `formatAgentItems` diff --git a/.claude/skills/implement-feature/references/architecture-diagrams.md b/.claude/skills/implement-feature/references/architecture-diagrams.md index 1f011a63..9a292fed 100644 --- a/.claude/skills/implement-feature/references/architecture-diagrams.md +++ b/.claude/skills/implement-feature/references/architecture-diagrams.md @@ -45,18 +45,18 @@ ## Full System Overview ``` -Domain Layer +ASCKit// (public face) App AppStoreVersion AppStoreVersionLocalization AppRepository (+ affordances) AppScreenshotSet BuildRepository AppStoreVersionState AppScreenshot TestFlight repos ScreenshotRepository AffordanceProviding -Infrastructure Layer (implements Domain protocols) +ASCKit//Internal/ (implements the face's protocols) SDKAppRepository SDKBuildRepository SDKTestFlightRepository SDKScreenshotRepository ClientFactory EnvironmentAuthProvider -ASCCommand Layer +ASCCommand (the way in) asc apps list → formatAgentItems → {"data":[{...,"affordances":{...}}]} asc versions list → formatAgentItems asc version-localizations list → formatAgentItems @@ -111,7 +111,7 @@ AsyncParsableCommand.run() ├─ ClientProvider.makeXRepository() │ │ │ ▼ - │ OpenAPI call → map SDK types → Domain structs (with parentId injected) + │ OpenAPI call → map SDK types → ASCKit structs (with parentId injected) │ ├─ OutputFormatter.formatAgentItems(items, ...) │ │ @@ -141,17 +141,17 @@ AsyncParsableCommand.run() | File | Action | Notes | |-------------------------------------------------------------|----------|----------------------------------------------| -| `Sources/Domain/X/XModel.swift` | Create | Struct + AffordanceProviding | -| `Sources/Domain/X/XRepository.swift` | Create | @Mockable protocol | -| `Sources/Infrastructure/X/SDKXRepository.swift` | Create | Implements XRepository, injects parent IDs | -| `Sources/Infrastructure/Client/ClientFactory.swift` | Modify | Add `makeXRepository()` factory | +| `Sources/ASCKit/X/XModel.swift` | Create | Struct + AffordanceProviding | +| `Sources/ASCKit/X/XRepository.swift` | Create | @Mockable protocol | +| `Sources/ASCKit/X/Internal/SDKXRepository.swift` | Create | Implements XRepository, injects parent IDs | +| `Sources/ASCKit/Shared/Internal/ClientFactory.swift` | Modify | Add `makeXRepository()` factory | | `Sources/ASCCommand/Commands/X/XCommand.swift` | Create | AsyncParsableCommand group + List subcommand | | `Sources/ASCCommand/ASC.swift` | Modify | Add XCommand to subcommands | | `Sources/ASCCommand/ClientProvider.swift` | Modify | Add `makeXRepository()` static factory | -| `Tests/DomainTests/X/XModelTests.swift` | Create | State, computed props, Codable | -| `Tests/DomainTests/X/XRepositoryTests.swift` | Create | Mock-based repository tests | -| `Tests/DomainTests/Apps/AffordancesTests.swift` | Modify | Add affordance tests for new model | -| `Tests/DomainTests/TestHelpers/MockRepositoryFactory.swift`| Modify | Add `makeX(...)` factory method | +| `Tests/ASCKitTests/X/XModelTests.swift` | Create | State, computed props, Codable | +| `Tests/ASCKitTests/X/XRepositoryTests.swift` | Create | Mock-based repository tests | +| `Tests/ASCKitTests/Apps/AffordancesTests.swift` | Modify | Add affordance tests for new model | +| `Tests/ASCKitTests/TestHelpers/MockRepositoryFactory.swift`| Modify | Add `makeX(...)` factory method | --- @@ -170,7 +170,7 @@ AsyncParsableCommand.run() ### Files -- `Sources/Domain/X/XModel.swift` — ... +- `Sources/ASCKit/X/XModel.swift` — ... - ... **Proceed with TDD implementation?** diff --git a/.claude/skills/implement-feature/references/command-affordances.md b/.claude/skills/implement-feature/references/command-affordances.md index 28f8102b..d9397fcd 100644 --- a/.claude/skills/implement-feature/references/command-affordances.md +++ b/.claude/skills/implement-feature/references/command-affordances.md @@ -5,7 +5,7 @@ The CLI equivalent of REST HATEOAS. Every JSON response embeds ready-to-run CLI ## Protocol ```swift -// Sources/Domain/Shared/AffordanceProviding.swift +// Sources/ASCKit/Shared/AffordanceProviding.swift public protocol AffordanceProviding { var affordances: [String: String] { get } } @@ -88,7 +88,7 @@ let output = try formatter.formatItems(versions, ...) ## Tests -Add affordance tests in `Tests/DomainTests/Apps/AffordancesTests.swift`: +Add affordance tests in `Tests/ASCKitTests/Apps/AffordancesTests.swift`: ```swift @Test func `app affordances include listVersions command`() { diff --git a/.claude/skills/implement-feature/references/domain-models.md b/.claude/skills/implement-feature/references/domain-models.md index 2e06dd2d..9df20579 100644 --- a/.claude/skills/implement-feature/references/domain-models.md +++ b/.claude/skills/implement-feature/references/domain-models.md @@ -24,12 +24,12 @@ Required conformances: The ASC API never includes parent IDs in response bodies. The infrastructure mapper must inject them: ```swift -// Infrastructure: inject parentId from the request parameter +// Internal/ mapper: inject parentId from the request parameter private func mapLocalization( _ sdk: AppStoreVersionLocalization, versionId: String // ← comes from the request, not the response -) -> Domain.AppStoreVersionLocalization { - Domain.AppStoreVersionLocalization( +) -> ASCKit.AppStoreVersionLocalization { + ASCKit.AppStoreVersionLocalization( id: sdk.id, versionId: versionId, // ← injected locale: sdk.attributes?.locale ?? "" @@ -123,7 +123,7 @@ Method naming convention: `list` prefix (not `fetch`). All tests use `MockRepositoryFactory` with sensible defaults — never construct models inline: ```swift -// Tests/DomainTests/TestHelpers/MockRepositoryFactory.swift +// Tests/ASCKitTests/TestHelpers/MockRepositoryFactory.swift enum MockRepositoryFactory { static func makeVersion( id: String = "v1", @@ -147,24 +147,24 @@ let loc = MockRepositoryFactory.makeLocalization(versionId: "v-99") Add new `make*` methods to `MockRepositoryFactory` whenever you add a new domain model. -## Infrastructure Mapper Pattern +## `Internal/` Mapper Pattern Use private mapper functions (not static factory methods on the domain type): ```swift -// In OpenAPIXxxRepository.swift (Infrastructure layer) +// In OpenAPIXxxRepository.swift (in the concept's Internal/) private func mapVersion( _ sdkVersion: AppStoreConnect_Swift_SDK.AppStoreVersion, appId: String -) -> Domain.AppStoreVersion { - let state = Domain.AppStoreVersionState( +) -> ASCKit.AppStoreVersion { + let state = ASCKit.AppStoreVersionState( rawValue: sdkVersion.attributes?.appStoreState?.rawValue ?? "" ) ?? .prepareForSubmission - return Domain.AppStoreVersion( + return ASCKit.AppStoreVersion( id: sdkVersion.id, appId: appId, versionString: sdkVersion.attributes?.versionString ?? "", - platform: Domain.AppStorePlatform(rawValue: sdkVersion.attributes?.platform?.rawValue ?? "") ?? .iOS, + platform: ASCKit.AppStorePlatform(rawValue: sdkVersion.attributes?.platform?.rawValue ?? "") ?? .iOS, state: state, createdDate: sdkVersion.attributes?.createdDate ) @@ -264,7 +264,7 @@ The mock ignores the URL value — no real filesystem needed. `MockRepositoryFac ## What NOT to Put in Domain Models -- No `import AppStoreConnect_Swift_SDK` (Infrastructure concern) +- No `import AppStoreConnect_Swift_SDK` (an `Internal/` concern) - No CLI output formatting (ASCCommand concern) - No network code or `URLSession` - No SwiftUI or `@Observable` (this is a CLI, not a GUI app) diff --git a/.claude/skills/implement-feature/references/swift-concurrency.md b/.claude/skills/implement-feature/references/swift-concurrency.md index db497ce3..1078f0d6 100644 --- a/.claude/skills/implement-feature/references/swift-concurrency.md +++ b/.claude/skills/implement-feature/references/swift-concurrency.md @@ -60,9 +60,9 @@ struct AppsList: AsyncParsableCommand { } ``` -## Stateless Infrastructure Types +## Stateless `Internal/` Types -Infrastructure types that don't hold mutable state use `struct`: +`Internal/` types that don't hold mutable state use `struct`: ```swift // Stateless — reads environment at call time, no stored mutable state @@ -129,7 +129,7 @@ func run() async throws { - [ ] Domain models are `struct` + `Sendable` (not `class`) - [ ] Repository protocols conform to `Sendable` -- [ ] Infrastructure structs are stateless or explicitly `Sendable` +- [ ] `Internal/` structs are stateless or explicitly `Sendable` - [ ] Commands use `AsyncParsableCommand` for async entry points - [ ] No `@unchecked Sendable` unless absolutely necessary with documented reason - [ ] All `async throws` propagate errors rather than swallowing them \ No newline at end of file diff --git a/.claude/skills/implement-feature/references/swift-observable.md b/.claude/skills/implement-feature/references/swift-observable.md index ad6b5d17..a665a05c 100644 --- a/.claude/skills/implement-feature/references/swift-observable.md +++ b/.claude/skills/implement-feature/references/swift-observable.md @@ -4,7 +4,7 @@ - All domain models: `Sendable` (struct is implicitly Sendable when all stored props are Sendable) - Repository protocols: `: Sendable` (required for `@Mockable` compatibility) -- Infrastructure repos: `@unchecked Sendable` (hold `APIProvider` which is a reference type) +- `Internal/` repos: `@unchecked Sendable` (hold `APIProvider` which is a reference type) - Commands: `AsyncParsableCommand` with `async throws func run()` ## Domain Models (Pure Structs) @@ -31,7 +31,7 @@ public protocol AppRepository: Sendable { } ``` -## Infrastructure (APIProvider wrapper) +## `Internal/` adapters (APIProvider wrapper) ```swift // @unchecked Sendable because APIProvider is a reference type diff --git a/.claude/skills/implement-feature/references/tdd-patterns.md b/.claude/skills/implement-feature/references/tdd-patterns.md index e073cb39..b4344351 100644 --- a/.claude/skills/implement-feature/references/tdd-patterns.md +++ b/.claude/skills/implement-feature/references/tdd-patterns.md @@ -92,7 +92,7 @@ Use `@Test` and `@Suite` with backtick test names: ```swift import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppStoreVersionTests { @@ -114,7 +114,7 @@ struct AppStoreVersionTests { Never construct domain models inline in tests. Use the shared factory: ```swift -// Tests/DomainTests/TestHelpers/MockRepositoryFactory.swift +// Tests/ASCKitTests/TestHelpers/MockRepositoryFactory.swift // All params have sensible defaults MockRepositoryFactory.makeVersion(id: "v1", appId: "app-1", state: .readyForSale) @@ -128,7 +128,7 @@ Add a new `make*` method when adding a new domain model. ## Affordance Tests -Add to `Tests/DomainTests/Apps/AffordancesTests.swift` (or a domain-specific file): +Add to `Tests/ASCKitTests/Apps/AffordancesTests.swift` (or a domain-specific file): ```swift @Test func `should point to the model's children and siblings`() { @@ -174,7 +174,7 @@ struct VersionsListTests { } ``` -## Infrastructure Adapter Tests +## `Internal/` Adapter Tests Stub the SDK response with `StubAPIClient`, read through the real `SDK*Repository`, assert the domain value: @@ -225,25 +225,18 @@ struct AppStoreVersionStateTests { ``` Tests/ -├── DomainTests/ +├── ASCKitTests/ ← mirrors Sources/ASCKit/ │ ├── Apps/ │ │ ├── AppTests.swift │ │ ├── AppStoreVersionTests.swift -│ │ ├── AppStoreVersionStateTests.swift -│ │ ├── AppRepositoryTests.swift -│ │ └── AffordancesTests.swift ← all affordance tests -│ ├── Screenshots/ -│ │ ├── AppStoreVersionLocalizationTests.swift -│ │ ├── AppScreenshotSetTests.swift -│ │ ├── AppScreenshotTests.swift -│ │ └── ScreenshotRepositoryTests.swift -│ ├── Builds/ +│ │ ├── AffordancesTests.swift ← all affordance tests +│ │ ├── Internal/ ← adapter tests (parent-ID injection, mapping) +│ │ └── Versions/Localizations/ScreenshotSets/… │ ├── Auth/ +│ │ └── Internal/ │ ├── Shared/ │ └── TestHelpers/ -│ └── MockRepositoryFactory.swift ← shared factory -├── InfrastructureTests/ -│ └── Auth/ +│ └── MockRepositoryFactory.swift ← shared factory └── ASCCommandTests/ └── OutputFormatterTests.swift ``` @@ -252,7 +245,7 @@ Tests/ ```bash swift test # All tests -swift test --filter DomainTests # Domain only +swift test --filter ASCKitTests # ASCKit only swift test --filter "AppStoreVersionTests" # One suite ``` diff --git a/.claude/skills/improvement/SKILL.md b/.claude/skills/improvement/SKILL.md index 0941d706..25c223d5 100644 --- a/.claude/skills/improvement/SKILL.md +++ b/.claude/skills/improvement/SKILL.md @@ -102,7 +102,7 @@ Use `formatter.formatAgentItems()` (not `formatItems`) for commands that should **Test approach**: `OutputFormatterTests` with known domain model inputs; affordance tests in `AffordancesTests.swift` -### 3. Infrastructure Improvements +### 3. Adapter (`Internal/`) Improvements Enhance OpenAPI adapters or error handling: @@ -163,15 +163,15 @@ swift test # Must remain all green | Layer | Location | Improvement Examples | |-------|----------|---------------------| -| **Domain** | `Sources/Domain/` | New computed properties, convenience methods, better enums | -| **Infrastructure** | `Sources/Infrastructure/` | Better error mapping, additional field mapping | +| **Public face** | `Sources/ASCKit//` | New computed properties, convenience methods, better enums | +| **Implementations** | `Sources/ASCKit//Internal/` | Better error mapping, additional field mapping | | **ASCCommand** | `Sources/ASCCommand/` | Output formatting, command options, TUI enhancements | ## Guidelines ### Do - Keep changes focused and minimal -- Put the rule on the type that owns it — a state enum's semantic boolean, a model's `structuredAffordances`, the Infrastructure mapper — not in a command or controller +- Put the rule on the type that owns it — a state enum's semantic boolean, a model's `structuredAffordances`, the `Internal/` mapper — not in a command or controller - Maintain existing behavior - Add tests for new behavior - Follow existing code patterns diff --git a/CHANGELOG.md b/CHANGELOG.md index db3612b2..3098f591 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- `asc versions submit` and `POST /api/v1/versions/:id/submit` refuse a version that can't be edited (e.g. Ready for Sale) before calling Apple, saying which states can go to review. +- **Breaking (library):** one `ASCKit` module (`import ASCKit`); 7 non-CRUD repositories take role names (`IrisAuthRepository` → `IrisSignIn`, …); `SubmissionRepository.submitVersion` → `AppStoreVersion.submitForReview(to:)`. → [design](docs/features/concept-folders/design.md) + +### Fixed +- Command Center's Submit for Review no longer reports success when `versions submit` fails; it says the submission didn't go and points to the command log. + --- ## [0.18.9] - 2026-11-08 diff --git a/CLAUDE.md b/CLAUDE.md index 7c0b80cd..bb50b780 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -25,7 +25,7 @@ Chicago School — state-based, not interaction-based: tests verify what domain - Assert exact output values (`"READY_FOR_SALE"`, `"expired": true`), never "is non-empty" or "doesn't throw". Command tests assert the full JSON string. - Implement just enough to pass — no extra fields, no speculative branches. - Difficult to test = design problem. Never modify a test to make it pass; if it fails unexpectedly, the spec was wrong. -- `@Testing` (not XCTest); `@Mockable` protocols with `given().willReturn()`; shared test data in `Tests/DomainTests/TestHelpers/MockRepositoryFactory.swift`. +- `@Testing` (not XCTest); `@Mockable` protocols with `given().willReturn()`; shared test data in `Tests/ASCKitTests/TestHelpers/MockRepositoryFactory.swift`. ## Commands @@ -41,20 +41,23 @@ make check-docs # broken links, doc size budgets ## Architecture -Three strict layers, dependencies pointing one way: `ASCCommand → Infrastructure → Domain`. +Concept folders, not layers. Imports point one way: `ASCCommand → ASCKit`. ``` Sources/ -├── Domain/ # Pure value types, @Mockable protocols — zero I/O -├── Infrastructure/ # Implements Domain protocols via appstoreconnect-swift-sdk -└── ASCCommand/ # CLI entry (ASC.swift), output formatting, REST server (Commands/Web/), TUI +├── ASCKit// # public face: models, state enums, affordances, @Mockable repositories — zero I/O +│ └── Internal/ # implementations: SDK adapters, DTO mapping, file storage +│ └── System/ # only the bare outside call (SDK request, URLSession, WebKit), ≤100 lines +├── ASCCommand/ # the way in: CLI entry (ASC.swift), output formatting, REST commands, TUI +└── ASCPlugin/ # the plugin SDK third parties link ``` -Domain folders mirror the App Store Connect resource hierarchy (`Domain/Apps/Versions/Localizations/…`); Infrastructure and `Tests/` mirror Domain exactly. Look at the tree rather than a list here. +Concept folders mirror the App Store Connect resource hierarchy (`ASCKit/Apps/Versions/Localizations/…`); `Tests/ASCKitTests/` mirrors `Sources/ASCKit/` folder for folder. A concept never reaches into another concept's `Internal/`; only `ASCCommand/ClientProvider.swift` names `Internal/` types. Look at the tree rather than a list here. Why: [concept-folders design](docs/features/concept-folders/design.md). **Rules every change follows:** -- Domain models are `public struct` + `Sendable` + `Equatable` + `Codable`; the JSON encoding is the public schema. Optional text fields use `encodeIfPresent` so nil is omitted. -- Every model carries its **parent ID** (`AppStoreVersion.appId`, `AppScreenshot.setId`). The API doesn't return parent IDs, so Infrastructure mappers inject them from the request. +- Models are `public struct` + `Sendable` + `Equatable` + `Codable`; the JSON encoding is the public schema. Optional text fields use `encodeIfPresent` so nil is omitted. +- **`XxxRepository` is for CRUD only** (list / get / create / update / delete an aggregate; a state change like `submit` is an update). A protocol that runs something outside asc-cli — sign in, boot, install, download — takes a role noun (`IrisSignIn`, `Simulators`, `Reports`). A workflow *over* aggregates (find the draft, add the item, submit) is a method on the model, not a repository method: `version.submitForReview(to:)`. Never `XxxService` / `XxxManager`. +- Every model carries its **parent ID** (`AppStoreVersion.appId`, `AppScreenshot.setId`). The API doesn't return parent IDs, so the `Internal/` mappers inject them from the request. - State enums expose **semantic booleans** (`isLive`, `isEditable`, `isPending`) for agent decisions. - **CAEOAS:** every model provides `structuredAffordances` — ready-to-run next commands, state-aware (e.g. `submitForReview` only when `isEditable`). The CLI `affordances` and REST `_links` both derive from it. - **CLI and REST ship together:** a command that returns data is also exposed by `asc web-server`. A feature isn't done until it is reachable over REST. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80d47a1b..573b6914 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,15 +17,17 @@ swift build -c release && cp .build/release/asc /usr/local/bin/ # install from ## How the code is organised -Three layers, dependencies pointing one way: `ASCCommand → Infrastructure → Domain`. +Concept folders, not layers. Imports point one way: `ASCCommand → ASCKit`. ``` Sources/ -├── Domain/ # Pure value types, @Mockable protocols — zero I/O -├── Infrastructure/ # SDK adapters (appstoreconnect-swift-sdk), parent ID injection -└── ASCCommand/ # CLI commands, REST server, output formatting, TUI +├── ASCKit// # public face: models, @Mockable repositories — zero I/O +│ └── Internal/ # SDK adapters (appstoreconnect-swift-sdk), parent ID injection +└── ASCCommand/ # CLI commands, REST server, output formatting, TUI ``` +`Tests/ASCKitTests/` mirrors `Sources/ASCKit/`. The layout's rules: [concept-folders design](docs/features/concept-folders/design.md). + Why it's built this way (CAEOAS, rich domain models, parent IDs): [docs/design.md](docs/design.md). ## Rules diff --git a/Package.swift b/Package.swift index 0790a827..95be80c9 100644 --- a/Package.swift +++ b/Package.swift @@ -6,7 +6,7 @@ let package = Package( platforms: [.macOS(.v14)], products: [ .executable(name: "asc", targets: ["ASCCommand"]), - .library(name: "ASCKit", targets: ["Domain", "Infrastructure"]), + .library(name: "ASCKit", targets: ["ASCKit"]), .library(name: "ASCPlugin", targets: ["ASCPlugin"]), ], dependencies: [ @@ -30,32 +30,25 @@ let package = Package( ] ), .target( - name: "Domain", + name: "ASCKit", dependencies: [ + "ASCPlugin", .product(name: "Mockable", package: "Mockable"), .product(name: "Mustache", package: "swift-mustache"), - ], - resources: [.copy("Screenshots/Gallery/Resources")], - swiftSettings: [.define("MOCKING")] - ), - .target( - name: "Infrastructure", - dependencies: [ - "Domain", - "ASCPlugin", .product(name: "AppStoreConnect-Swift-SDK", package: "appstoreconnect-swift-sdk"), .product(name: "SweetCookieKit", package: "sweetcookiekit"), .product(name: "Hummingbird", package: "hummingbird"), .product(name: "HummingbirdTLS", package: "hummingbird"), .product(name: "HummingbirdWebSocket", package: "hummingbird-websocket"), .product(name: "SRP", package: "swift-srp"), - ] + ], + resources: [.copy("Screenshots/Gallery/Resources")], + swiftSettings: [.define("MOCKING")] ), .executableTarget( name: "ASCCommand", dependencies: [ - "Domain", - "Infrastructure", + "ASCKit", "ASCPlugin", .product(name: "ArgumentParser", package: "swift-argument-parser"), .product(name: "TauTUI", package: "TauTUI"), @@ -63,18 +56,9 @@ let package = Package( resources: [.copy("Resources/mockups")] ), .testTarget( - name: "DomainTests", - dependencies: [ - "Domain", - .product(name: "Mockable", package: "Mockable"), - ], - swiftSettings: [.define("MOCKING")] - ), - .testTarget( - name: "InfrastructureTests", + name: "ASCKitTests", dependencies: [ - "Infrastructure", - "Domain", + "ASCKit", .product(name: "Mockable", package: "Mockable"), ], swiftSettings: [.define("MOCKING")] @@ -83,7 +67,7 @@ let package = Package( name: "ASCCommandTests", dependencies: [ "ASCCommand", - "Domain", + "ASCKit", .product(name: "Mockable", package: "Mockable"), .product(name: "HummingbirdTesting", package: "hummingbird"), .product(name: "HummingbirdWebSocket", package: "hummingbird-websocket"), diff --git a/Sources/ASCCommand/ClientProvider.swift b/Sources/ASCCommand/ClientProvider.swift index 2c3b2997..c590291f 100644 --- a/Sources/ASCCommand/ClientProvider.swift +++ b/Sources/ASCCommand/ClientProvider.swift @@ -1,6 +1,5 @@ -import Domain +import ASCKit import Foundation -import Infrastructure struct ClientProvider { static func makeAppRepository() throws -> any AppRepository { @@ -291,16 +290,16 @@ struct ClientProvider { // MARK: - Simulators - static func makeSimulatorRepository() -> any SimulatorRepository { - ClientFactory().makeSimulatorRepository() + static func makeSimulators() -> any Simulators { + ClientFactory().makeSimulators() } // SimulatorInteractionRepository moved to ASCPro (pro feature) // MARK: - Skills - static func makeSkillRepository() -> any SkillRepository { - ClientFactory().makeSkillRepository() + static func makeSkills() -> any Skills { + ClientFactory().makeSkills() } static func makeSkillConfigStorage() -> any SkillConfigStorage { @@ -309,8 +308,8 @@ struct ClientProvider { // MARK: - Plugins - static func makePluginRepository() -> any PluginRepository { - ClientFactory().makePluginRepository() + static func makePlugins() -> any Plugins { + ClientFactory().makePlugins() } static func makeTemplateRepository() -> AggregateTemplateRepository { @@ -321,8 +320,24 @@ struct ClientProvider { AggregateGalleryTemplateRepository.shared } - static func makeThemeRepository() -> AggregateThemeRepository { - AggregateThemeRepository.shared + static func makeThemes() -> AggregateThemes { + AggregateThemes.shared + } + + static func makeAuthStorage() -> any AuthStorage { + FileAuthStorage() + } + + static func makeEnvironmentAuthProvider() -> any AuthProvider { + EnvironmentAuthProvider() + } + + static func makeXcodeBuildRunner() -> any XcodeBuildRunner { + ProcessXcodeBuildRunner() + } + + static func makeProjectConfigStorage() -> any ProjectConfigStorage { + FileProjectConfigStorage() } static func makeHTMLRenderer() -> any HTMLRenderer { @@ -333,8 +348,8 @@ struct ClientProvider { FileAppShotsConfigStorage() } - static func makeAppWallRepository(token: String) -> any AppWallRepository { - GitHubAppWallRepository(token: token) + static func makeAppWall(token: String) -> any AppWall { + GitHubAppWall(token: token) } static func makeUserRepository() throws -> any UserRepository { @@ -379,10 +394,10 @@ struct ClientProvider { return try factory.makeAppClipRepository(authProvider: authProvider) } - static func makeReportRepository() throws -> any ReportRepository { + static func makeReports() throws -> any Reports { let authProvider = CompositeAuthProvider() let factory = ClientFactory() - return try factory.makeReportRepository(authProvider: authProvider) + return try factory.makeReports(authProvider: authProvider) } static func makeAnalyticsReportRepository() throws -> any AnalyticsReportRepository { @@ -433,8 +448,8 @@ struct ClientProvider { ClientFactory().makeIrisCookieProvider() } - static func makeIrisAuthRepository() -> any IrisAuthRepository { - IrisAuthSDKRepository() + static func makeIrisSignIn() -> any IrisSignIn { + IrisSDKSignIn() } static func makeIrisSessionRepository() -> any IrisSessionRepository { diff --git a/Sources/ASCCommand/Commands/AgeRating/AgeRatingCommand.swift b/Sources/ASCCommand/Commands/AgeRating/AgeRatingCommand.swift index 789815de..0df6b8df 100644 --- a/Sources/ASCCommand/Commands/AgeRating/AgeRatingCommand.swift +++ b/Sources/ASCCommand/Commands/AgeRating/AgeRatingCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AgeRatingCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsDelete.swift b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsDelete.swift index 3d284224..47bd8902 100644 --- a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsDelete.swift +++ b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AnalyticsReportsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsInstancesList.swift b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsInstancesList.swift index 08811a45..739b134c 100644 --- a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsInstancesList.swift +++ b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsInstancesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AnalyticsReportsInstancesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsList.swift b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsList.swift index 62b07944..3ff56f2f 100644 --- a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsList.swift +++ b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AnalyticsReportsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsReportsList.swift b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsReportsList.swift index f6109eb6..ca83d0a5 100644 --- a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsReportsList.swift +++ b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsReportsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AnalyticsReportsReportsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsRequest.swift b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsRequest.swift index ecd695e4..67e1c51a 100644 --- a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsRequest.swift +++ b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsRequest.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AnalyticsReportsRequest: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsSegmentsList.swift b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsSegmentsList.swift index c2c8729b..a1c0e4e3 100644 --- a/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsSegmentsList.swift +++ b/Sources/ASCCommand/Commands/AnalyticsReports/AnalyticsReportsSegmentsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AnalyticsReportsSegmentsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppCategories/AppCategoriesCommand.swift b/Sources/ASCCommand/Commands/AppCategories/AppCategoriesCommand.swift index e2c753ff..a875cc4a 100644 --- a/Sources/ASCCommand/Commands/AppCategories/AppCategoriesCommand.swift +++ b/Sources/ASCCommand/Commands/AppCategories/AppCategoriesCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppCategoriesCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsCreate.swift b/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsCreate.swift index cae35429..4ab8aa6d 100644 --- a/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsCreate.swift +++ b/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppClipExperienceLocalizationsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsDelete.swift b/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsDelete.swift index 92bad6b7..8fc3c857 100644 --- a/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsDelete.swift +++ b/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppClipExperienceLocalizationsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsList.swift b/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsList.swift index 11c99bdd..fbfcff2a 100644 --- a/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsList.swift +++ b/Sources/ASCCommand/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppClipExperienceLocalizationsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesCreate.swift b/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesCreate.swift index 011e4719..3d26ae73 100644 --- a/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesCreate.swift +++ b/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppClipExperiencesCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesDelete.swift b/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesDelete.swift index e2cf8ebc..560d53fb 100644 --- a/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesDelete.swift +++ b/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppClipExperiencesDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesList.swift b/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesList.swift index e711340d..eb376219 100644 --- a/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesList.swift +++ b/Sources/ASCCommand/Commands/AppClipExperiences/AppClipExperiencesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppClipExperiencesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppClips/AppClipsList.swift b/Sources/ASCCommand/Commands/AppClips/AppClipsList.swift index f3555bbc..53e1fe3d 100644 --- a/Sources/ASCCommand/Commands/AppClips/AppClipsList.swift +++ b/Sources/ASCCommand/Commands/AppClips/AppClipsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppClipsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppInfoLocalizations/AppInfoLocalizationsCommand.swift b/Sources/ASCCommand/Commands/AppInfoLocalizations/AppInfoLocalizationsCommand.swift index 29fa4736..ec37c8b0 100644 --- a/Sources/ASCCommand/Commands/AppInfoLocalizations/AppInfoLocalizationsCommand.swift +++ b/Sources/ASCCommand/Commands/AppInfoLocalizations/AppInfoLocalizationsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppInfoLocalizationsCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppInfos/AppInfosCommand.swift b/Sources/ASCCommand/Commands/AppInfos/AppInfosCommand.swift index 47505863..f9344c8b 100644 --- a/Sources/ASCCommand/Commands/AppInfos/AppInfosCommand.swift +++ b/Sources/ASCCommand/Commands/AppInfos/AppInfosCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppInfosCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppPreviewSets/AppPreviewSetsCommand.swift b/Sources/ASCCommand/Commands/AppPreviewSets/AppPreviewSetsCommand.swift index ce1a22cf..bffbc7b1 100644 --- a/Sources/ASCCommand/Commands/AppPreviewSets/AppPreviewSetsCommand.swift +++ b/Sources/ASCCommand/Commands/AppPreviewSets/AppPreviewSetsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct AppPreviewSetsCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/AppPreviews/AppPreviewsCommand.swift b/Sources/ASCCommand/Commands/AppPreviews/AppPreviewsCommand.swift index c47f3190..27368ba8 100644 --- a/Sources/ASCCommand/Commands/AppPreviews/AppPreviewsCommand.swift +++ b/Sources/ASCCommand/Commands/AppPreviews/AppPreviewsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct AppPreviewsCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/AppShots/AppShotsCommand.swift b/Sources/ASCCommand/Commands/AppShots/AppShotsCommand.swift index a54cb38e..bcbe9cd4 100644 --- a/Sources/ASCCommand/Commands/AppShots/AppShotsCommand.swift +++ b/Sources/ASCCommand/Commands/AppShots/AppShotsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppShotsCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppShots/AppShotsConfig.swift b/Sources/ASCCommand/Commands/AppShots/AppShotsConfig.swift index 8841ed63..ceac50cf 100644 --- a/Sources/ASCCommand/Commands/AppShots/AppShotsConfig.swift +++ b/Sources/ASCCommand/Commands/AppShots/AppShotsConfig.swift @@ -1,7 +1,6 @@ import ArgumentParser -import Domain +import ASCKit import Foundation -import Infrastructure struct AppShotsConfig: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -18,7 +17,7 @@ struct AppShotsConfig: AsyncParsableCommand { var remove: Bool = false func run() async throws { - let storage = FileAppShotsConfigStorage() + let storage = ClientProvider.makeAppShotsConfigStorage() print(try await execute(storage: storage)) } @@ -29,7 +28,7 @@ struct AppShotsConfig: AsyncParsableCommand { } if let key = geminiApiKey, !key.isEmpty { - let config = Domain.AppShotsConfig(geminiApiKey: key) + let config = ASCKit.AppShotsConfig(geminiApiKey: key) try storage.save(config) let masked = String(key.prefix(8)) + "..." + String(key.suffix(4)) return "Gemini API key saved to ~/.asc/app-shots-config.json (\(masked))" diff --git a/Sources/ASCCommand/Commands/AppShots/AppShotsExport.swift b/Sources/ASCCommand/Commands/AppShots/AppShotsExport.swift index eb414916..71bc8b3d 100644 --- a/Sources/ASCCommand/Commands/AppShots/AppShotsExport.swift +++ b/Sources/ASCCommand/Commands/AppShots/AppShotsExport.swift @@ -1,7 +1,6 @@ import ArgumentParser -import Domain +import ASCKit import Foundation -import Infrastructure struct AppShotsExport: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppShots/AppShotsGalleryTemplates.swift b/Sources/ASCCommand/Commands/AppShots/AppShotsGalleryTemplates.swift index 3c7012ff..d205b177 100644 --- a/Sources/ASCCommand/Commands/AppShots/AppShotsGalleryTemplates.swift +++ b/Sources/ASCCommand/Commands/AppShots/AppShotsGalleryTemplates.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct AppShotsGalleryTemplatesCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/AppShots/AppShotsGenerate.swift b/Sources/ASCCommand/Commands/AppShots/AppShotsGenerate.swift index 9c9116db..e187050b 100644 --- a/Sources/ASCCommand/Commands/AppShots/AppShotsGenerate.swift +++ b/Sources/ASCCommand/Commands/AppShots/AppShotsGenerate.swift @@ -1,7 +1,6 @@ import ArgumentParser -import Domain +import ASCKit import Foundation -import Infrastructure struct AppShotsGenerate: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -33,7 +32,7 @@ struct AppShotsGenerate: AsyncParsableCommand { var prompt: String? func run() async throws { - let configStorage = FileAppShotsConfigStorage() + let configStorage = ClientProvider.makeAppShotsConfigStorage() let apiKey = try resolveGeminiApiKey(geminiApiKey, configStorage: configStorage) let path = try await Self.run( file: file, apiKey: apiKey, model: model, diff --git a/Sources/ASCCommand/Commands/AppShots/AppShotsTemplates.swift b/Sources/ASCCommand/Commands/AppShots/AppShotsTemplates.swift index 85ab8ae6..a2d88d38 100644 --- a/Sources/ASCCommand/Commands/AppShots/AppShotsTemplates.swift +++ b/Sources/ASCCommand/Commands/AppShots/AppShotsTemplates.swift @@ -1,7 +1,6 @@ import ArgumentParser -import Domain +import ASCKit import Foundation -import Infrastructure struct AppShotsTemplatesCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AppShots/AppShotsThemes.swift b/Sources/ASCCommand/Commands/AppShots/AppShotsThemes.swift index 2783f83c..a5644026 100644 --- a/Sources/ASCCommand/Commands/AppShots/AppShotsThemes.swift +++ b/Sources/ASCCommand/Commands/AppShots/AppShotsThemes.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct AppShotsThemesCommand: AsyncParsableCommand { @@ -27,11 +27,11 @@ struct AppShotsThemesList: AsyncParsableCommand { @OptionGroup var globals: GlobalOptions func run() async throws { - let repo = ClientProvider.makeThemeRepository() + let repo = ClientProvider.makeThemes() print(try await execute(repo: repo)) } - func execute(repo: any ThemeRepository, affordanceMode: AffordanceMode = .cli) async throws -> String { + func execute(repo: any Themes, affordanceMode: AffordanceMode = .cli) async throws -> String { let themes = try await repo.listThemes() let formatter = OutputFormatter(format: globals.outputFormat, pretty: globals.pretty) return try formatter.formatAgentItems( @@ -60,11 +60,11 @@ struct AppShotsThemesGet: AsyncParsableCommand { var context: Bool = false func run() async throws { - let repo = ClientProvider.makeThemeRepository() + let repo = ClientProvider.makeThemes() print(try await execute(repo: repo)) } - func execute(repo: any ThemeRepository) async throws -> String { + func execute(repo: any Themes) async throws -> String { guard let theme = try await repo.getTheme(id: id) else { throw ValidationError("Theme '\(id)' not found. Run `asc app-shots themes list` to see available themes.") } @@ -96,11 +96,11 @@ struct AppShotsThemesDesign: AsyncParsableCommand { var id: String func run() async throws { - let repo = ClientProvider.makeThemeRepository() + let repo = ClientProvider.makeThemes() print(try await execute(themeRepo: repo)) } - func execute(themeRepo: any ThemeRepository) async throws -> String { + func execute(themeRepo: any Themes) async throws -> String { let design = try await themeRepo.design(themeId: id) let encoder = JSONEncoder() encoder.outputFormatting = [.prettyPrinted, .sortedKeys] @@ -236,7 +236,7 @@ struct AppShotsThemesApply: AsyncParsableCommand { var imageOutput: String? func run() async throws { - let themeRepo = ClientProvider.makeThemeRepository() + let themeRepo = ClientProvider.makeThemes() let templateRepo = ClientProvider.makeTemplateRepository() if preview == .image { let renderer = ClientProvider.makeHTMLRenderer() @@ -246,7 +246,7 @@ struct AppShotsThemesApply: AsyncParsableCommand { } } - func execute(themeRepo: any ThemeRepository, templateRepo: any TemplateRepository, renderer: (any HTMLRenderer)? = nil) async throws -> String { + func execute(themeRepo: any Themes, templateRepo: any TemplateRepository, renderer: (any HTMLRenderer)? = nil) async throws -> String { guard let tmpl = try await templateRepo.getTemplate(id: template) else { throw ValidationError("Template '\(template)' not found. Run `asc app-shots templates list` to see available templates.") } diff --git a/Sources/ASCCommand/Commands/AppShots/AppShotsUtils.swift b/Sources/ASCCommand/Commands/AppShots/AppShotsUtils.swift index 09c3ec10..6022c195 100644 --- a/Sources/ASCCommand/Commands/AppShots/AppShotsUtils.swift +++ b/Sources/ASCCommand/Commands/AppShots/AppShotsUtils.swift @@ -1,6 +1,6 @@ import ArgumentParser import CoreGraphics -import Domain +import ASCKit import Foundation import ImageIO diff --git a/Sources/ASCCommand/Commands/AppWall/AppWallSubmit.swift b/Sources/ASCCommand/Commands/AppWall/AppWallSubmit.swift index 85598ceb..9029f17c 100644 --- a/Sources/ASCCommand/Commands/AppWall/AppWallSubmit.swift +++ b/Sources/ASCCommand/Commands/AppWall/AppWallSubmit.swift @@ -1,7 +1,6 @@ import ArgumentParser -import Domain +import ASCKit import Foundation -import Infrastructure struct AppWallSubmit: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -34,11 +33,11 @@ struct AppWallSubmit: AsyncParsableCommand { func run() async throws { let token = try resolveGitHubToken() - let repo = ClientProvider.makeAppWallRepository(token: token) + let repo = ClientProvider.makeAppWall(token: token) print(try await execute(repo: repo)) } - func execute(repo: any AppWallRepository) async throws -> String { + func execute(repo: any AppWall) async throws -> String { let appIdURLs = appId.map { "https://apps.apple.com/app/id\($0)" } let allApps = appIdURLs + app let wallApp = AppWallApp( diff --git a/Sources/ASCCommand/Commands/Apps/AppsList.swift b/Sources/ASCCommand/Commands/Apps/AppsList.swift index cf6f5ac9..712607d3 100644 --- a/Sources/ASCCommand/Commands/Apps/AppsList.swift +++ b/Sources/ASCCommand/Commands/Apps/AppsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Apps/AppsPricePointsList.swift b/Sources/ASCCommand/Commands/Apps/AppsPricePointsList.swift index 3729bad5..b49c32a1 100644 --- a/Sources/ASCCommand/Commands/Apps/AppsPricePointsList.swift +++ b/Sources/ASCCommand/Commands/Apps/AppsPricePointsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppsPricePointsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Apps/AppsPricesSet.swift b/Sources/ASCCommand/Commands/Apps/AppsPricesSet.swift index 64b44f71..d5a43977 100644 --- a/Sources/ASCCommand/Commands/Apps/AppsPricesSet.swift +++ b/Sources/ASCCommand/Commands/Apps/AppsPricesSet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppsPricesSet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Apps/AppsUpdate.swift b/Sources/ASCCommand/Commands/Apps/AppsUpdate.swift index 7e45f618..80933c49 100644 --- a/Sources/ASCCommand/Commands/Apps/AppsUpdate.swift +++ b/Sources/ASCCommand/Commands/Apps/AppsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Apps/Availability/AppAvailabilityCreate.swift b/Sources/ASCCommand/Commands/Apps/Availability/AppAvailabilityCreate.swift index bba65520..8100feb1 100644 --- a/Sources/ASCCommand/Commands/Apps/Availability/AppAvailabilityCreate.swift +++ b/Sources/ASCCommand/Commands/Apps/Availability/AppAvailabilityCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AppAvailabilityCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Apps/Availability/AppAvailabilityGet.swift b/Sources/ASCCommand/Commands/Apps/Availability/AppAvailabilityGet.swift index 1e616ba2..59023faa 100644 --- a/Sources/ASCCommand/Commands/Apps/Availability/AppAvailabilityGet.swift +++ b/Sources/ASCCommand/Commands/Apps/Availability/AppAvailabilityGet.swift @@ -1,6 +1,6 @@ import Foundation import ArgumentParser -import Domain +import ASCKit struct AppAvailabilityGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AssetLibrary/AssetImagesCommand.swift b/Sources/ASCCommand/Commands/AssetLibrary/AssetImagesCommand.swift index 08a511bb..9ee18d77 100644 --- a/Sources/ASCCommand/Commands/AssetLibrary/AssetImagesCommand.swift +++ b/Sources/ASCCommand/Commands/AssetLibrary/AssetImagesCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct AssetImagesCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/AssetLibrary/AssetLibraryCommand.swift b/Sources/ASCCommand/Commands/AssetLibrary/AssetLibraryCommand.swift index d6923e13..98836752 100644 --- a/Sources/ASCCommand/Commands/AssetLibrary/AssetLibraryCommand.swift +++ b/Sources/ASCCommand/Commands/AssetLibrary/AssetLibraryCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit extension AssetPlacementType: ExpressibleByArgument {} extension LibraryAssetState: ExpressibleByArgument {} diff --git a/Sources/ASCCommand/Commands/AssetLibrary/AssetPlacementsCommand.swift b/Sources/ASCCommand/Commands/AssetLibrary/AssetPlacementsCommand.swift index 270afb1f..73c7d085 100644 --- a/Sources/ASCCommand/Commands/AssetLibrary/AssetPlacementsCommand.swift +++ b/Sources/ASCCommand/Commands/AssetLibrary/AssetPlacementsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct AssetPlacementsCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/AssetLibrary/AssetVideosCommand.swift b/Sources/ASCCommand/Commands/AssetLibrary/AssetVideosCommand.swift index a4c71e4e..7fc08e2d 100644 --- a/Sources/ASCCommand/Commands/AssetLibrary/AssetVideosCommand.swift +++ b/Sources/ASCCommand/Commands/AssetLibrary/AssetVideosCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct AssetVideosCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Auth/AuthCommand.swift b/Sources/ASCCommand/Commands/Auth/AuthCommand.swift index 24852f03..c8984e8d 100644 --- a/Sources/ASCCommand/Commands/Auth/AuthCommand.swift +++ b/Sources/ASCCommand/Commands/Auth/AuthCommand.swift @@ -1,6 +1,5 @@ import ArgumentParser -import Domain -import Infrastructure +import ASCKit struct AuthCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -19,8 +18,8 @@ struct AuthCheck: AsyncParsableCommand { @OptionGroup var globals: GlobalOptions func run() async throws { - let storage = FileAuthStorage() - let envProvider = EnvironmentAuthProvider() + let storage = ClientProvider.makeAuthStorage() + let envProvider = ClientProvider.makeEnvironmentAuthProvider() print(try await execute(storage: storage, envProvider: envProvider)) } diff --git a/Sources/ASCCommand/Commands/Auth/AuthList.swift b/Sources/ASCCommand/Commands/Auth/AuthList.swift index c92a3943..f1142ed6 100644 --- a/Sources/ASCCommand/Commands/Auth/AuthList.swift +++ b/Sources/ASCCommand/Commands/Auth/AuthList.swift @@ -1,6 +1,5 @@ import ArgumentParser -import Domain -import Infrastructure +import ASCKit struct AuthList: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -11,7 +10,7 @@ struct AuthList: AsyncParsableCommand { @OptionGroup var globals: GlobalOptions func run() async throws { - let storage = FileAuthStorage() + let storage = ClientProvider.makeAuthStorage() print(try await execute(storage: storage)) } diff --git a/Sources/ASCCommand/Commands/Auth/AuthLogin.swift b/Sources/ASCCommand/Commands/Auth/AuthLogin.swift index 7f1c63d1..9e227041 100644 --- a/Sources/ASCCommand/Commands/Auth/AuthLogin.swift +++ b/Sources/ASCCommand/Commands/Auth/AuthLogin.swift @@ -1,7 +1,6 @@ import ArgumentParser -import Domain +import ASCKit import Foundation -import Infrastructure struct AuthLogin: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -30,7 +29,7 @@ struct AuthLogin: AsyncParsableCommand { var vendorNumber: String? func run() async throws { - let storage = FileAuthStorage() + let storage = ClientProvider.makeAuthStorage() print(try await execute(storage: storage)) } diff --git a/Sources/ASCCommand/Commands/Auth/AuthLogout.swift b/Sources/ASCCommand/Commands/Auth/AuthLogout.swift index 74e521e6..857d5052 100644 --- a/Sources/ASCCommand/Commands/Auth/AuthLogout.swift +++ b/Sources/ASCCommand/Commands/Auth/AuthLogout.swift @@ -1,6 +1,5 @@ import ArgumentParser -import Domain -import Infrastructure +import ASCKit struct AuthLogout: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -14,7 +13,7 @@ struct AuthLogout: AsyncParsableCommand { var name: String? func run() async throws { - let storage = FileAuthStorage() + let storage = ClientProvider.makeAuthStorage() try await execute(storage: storage) } diff --git a/Sources/ASCCommand/Commands/Auth/AuthUpdate.swift b/Sources/ASCCommand/Commands/Auth/AuthUpdate.swift index 6ad28c6d..a075ced9 100644 --- a/Sources/ASCCommand/Commands/Auth/AuthUpdate.swift +++ b/Sources/ASCCommand/Commands/Auth/AuthUpdate.swift @@ -1,6 +1,5 @@ import ArgumentParser -import Domain -import Infrastructure +import ASCKit struct AuthUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -17,7 +16,7 @@ struct AuthUpdate: AsyncParsableCommand { var vendorNumber: String? func run() async throws { - let storage = FileAuthStorage() + let storage = ClientProvider.makeAuthStorage() print(try await execute(storage: storage)) } diff --git a/Sources/ASCCommand/Commands/Auth/AuthUse.swift b/Sources/ASCCommand/Commands/Auth/AuthUse.swift index 97c09af9..12012451 100644 --- a/Sources/ASCCommand/Commands/Auth/AuthUse.swift +++ b/Sources/ASCCommand/Commands/Auth/AuthUse.swift @@ -1,6 +1,5 @@ import ArgumentParser -import Domain -import Infrastructure +import ASCKit struct AuthUse: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -14,7 +13,7 @@ struct AuthUse: AsyncParsableCommand { var name: String func run() async throws { - let storage = FileAuthStorage() + let storage = ClientProvider.makeAuthStorage() try await execute(storage: storage) } diff --git a/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsCreate.swift b/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsCreate.swift index 3dce4bad..8481708a 100644 --- a/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsCreate.swift +++ b/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BetaAppLocalizationsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsDelete.swift b/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsDelete.swift index 7bffc92a..2162131f 100644 --- a/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsDelete.swift +++ b/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BetaAppLocalizationsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsGet.swift b/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsGet.swift index 07032cb0..11de68b9 100644 --- a/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsGet.swift +++ b/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BetaAppLocalizationsGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsList.swift b/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsList.swift index f7b20c63..5259cc6a 100644 --- a/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsList.swift +++ b/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BetaAppLocalizationsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsUpdate.swift b/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsUpdate.swift index 766ebd9e..89002b60 100644 --- a/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsUpdate.swift +++ b/Sources/ASCCommand/Commands/BetaAppLocalizations/BetaAppLocalizationsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BetaAppLocalizationsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BetaReview/BetaReviewDetailGet.swift b/Sources/ASCCommand/Commands/BetaReview/BetaReviewDetailGet.swift index 34235c97..647f46c9 100644 --- a/Sources/ASCCommand/Commands/BetaReview/BetaReviewDetailGet.swift +++ b/Sources/ASCCommand/Commands/BetaReview/BetaReviewDetailGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BetaReviewDetailGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BetaReview/BetaReviewDetailUpdate.swift b/Sources/ASCCommand/Commands/BetaReview/BetaReviewDetailUpdate.swift index d0c768be..fe5b7574 100644 --- a/Sources/ASCCommand/Commands/BetaReview/BetaReviewDetailUpdate.swift +++ b/Sources/ASCCommand/Commands/BetaReview/BetaReviewDetailUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BetaReviewDetailUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -42,7 +42,7 @@ struct BetaReviewDetailUpdate: AsyncParsableCommand { } func execute(repo: any BetaAppReviewRepository) async throws -> String { - let update = Domain.BetaAppReviewDetailUpdate( + let update = ASCKit.BetaAppReviewDetailUpdate( contactFirstName: contactFirstName, contactLastName: contactLastName, contactPhone: contactPhone, diff --git a/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsCreate.swift b/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsCreate.swift index f64003f9..1f1f62db 100644 --- a/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsCreate.swift +++ b/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BetaReviewSubmissionsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsGet.swift b/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsGet.swift index 8c252b51..9637cfcf 100644 --- a/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsGet.swift +++ b/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BetaReviewSubmissionsGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsList.swift b/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsList.swift index 9594e4e0..22002c43 100644 --- a/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsList.swift +++ b/Sources/ASCCommand/Commands/BetaReview/BetaReviewSubmissionsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BetaReviewSubmissionsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Builds/BuildsAddBetaGroup.swift b/Sources/ASCCommand/Commands/Builds/BuildsAddBetaGroup.swift index c6d7125f..32e88b12 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsAddBetaGroup.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsAddBetaGroup.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BuildsAddBetaGroup: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Builds/BuildsArchive.swift b/Sources/ASCCommand/Commands/Builds/BuildsArchive.swift index 43681698..5c3bf9b4 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsArchive.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsArchive.swift @@ -1,7 +1,6 @@ import ArgumentParser -import Domain +import ASCKit import Foundation -import Infrastructure struct BuildsArchive: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -53,7 +52,7 @@ struct BuildsArchive: AsyncParsableCommand { var buildNumber: String? func run() async throws { - let runner = ProcessXcodeBuildRunner() + let runner = ClientProvider.makeXcodeBuildRunner() let uploadRepo = upload ? try ClientProvider.makeBuildUploadRepository() : nil print(try await execute(runner: runner, uploadRepo: uploadRepo)) } diff --git a/Sources/ASCCommand/Commands/Builds/BuildsList.swift b/Sources/ASCCommand/Commands/Builds/BuildsList.swift index ebc74864..015d5f21 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsList.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BuildsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Builds/BuildsNextNumber.swift b/Sources/ASCCommand/Commands/Builds/BuildsNextNumber.swift index 256e8b80..5b3c42f1 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsNextNumber.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsNextNumber.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BuildsNextNumber: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Builds/BuildsRemoveBetaGroup.swift b/Sources/ASCCommand/Commands/Builds/BuildsRemoveBetaGroup.swift index f8bdaa16..58192ebc 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsRemoveBetaGroup.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsRemoveBetaGroup.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BuildsRemoveBetaGroup: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Builds/BuildsSetEncryptionCompliance.swift b/Sources/ASCCommand/Commands/Builds/BuildsSetEncryptionCompliance.swift index 42e5787c..f610c471 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsSetEncryptionCompliance.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsSetEncryptionCompliance.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BuildsSetEncryptionCompliance: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Builds/BuildsUpdateBetaNotes.swift b/Sources/ASCCommand/Commands/Builds/BuildsUpdateBetaNotes.swift index 159cb887..c0a0145c 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsUpdateBetaNotes.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsUpdateBetaNotes.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BuildsUpdateBetaNotes: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Builds/BuildsUpload.swift b/Sources/ASCCommand/Commands/Builds/BuildsUpload.swift index c6477ffd..8fe67264 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsUpload.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsUpload.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct BuildsUpload: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Builds/BuildsUploadsDelete.swift b/Sources/ASCCommand/Commands/Builds/BuildsUploadsDelete.swift index 5ddebcad..e480fd02 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsUploadsDelete.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsUploadsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BuildsUploadsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Builds/BuildsUploadsGet.swift b/Sources/ASCCommand/Commands/Builds/BuildsUploadsGet.swift index 511ce3e2..ee8117a0 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsUploadsGet.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsUploadsGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BuildsUploadsGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Builds/BuildsUploadsList.swift b/Sources/ASCCommand/Commands/Builds/BuildsUploadsList.swift index 23a8e880..23464f54 100644 --- a/Sources/ASCCommand/Commands/Builds/BuildsUploadsList.swift +++ b/Sources/ASCCommand/Commands/Builds/BuildsUploadsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BuildsUploadsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BundleIDs/BundleIDsCreate.swift b/Sources/ASCCommand/Commands/BundleIDs/BundleIDsCreate.swift index af9938d5..bcb71487 100644 --- a/Sources/ASCCommand/Commands/BundleIDs/BundleIDsCreate.swift +++ b/Sources/ASCCommand/Commands/BundleIDs/BundleIDsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BundleIDsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BundleIDs/BundleIDsDelete.swift b/Sources/ASCCommand/Commands/BundleIDs/BundleIDsDelete.swift index b1731eac..53df1d4a 100644 --- a/Sources/ASCCommand/Commands/BundleIDs/BundleIDsDelete.swift +++ b/Sources/ASCCommand/Commands/BundleIDs/BundleIDsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BundleIDsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/BundleIDs/BundleIDsList.swift b/Sources/ASCCommand/Commands/BundleIDs/BundleIDsList.swift index a6c3b7a6..88f94743 100644 --- a/Sources/ASCCommand/Commands/BundleIDs/BundleIDsList.swift +++ b/Sources/ASCCommand/Commands/BundleIDs/BundleIDsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct BundleIDsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Certificates/CertificatesCreate.swift b/Sources/ASCCommand/Commands/Certificates/CertificatesCreate.swift index 70a906de..9c4908ce 100644 --- a/Sources/ASCCommand/Commands/Certificates/CertificatesCreate.swift +++ b/Sources/ASCCommand/Commands/Certificates/CertificatesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct CertificatesCreate: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Certificates/CertificatesList.swift b/Sources/ASCCommand/Commands/Certificates/CertificatesList.swift index 062fed87..01b01589 100644 --- a/Sources/ASCCommand/Commands/Certificates/CertificatesList.swift +++ b/Sources/ASCCommand/Commands/Certificates/CertificatesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct CertificatesList: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Certificates/CertificatesRevoke.swift b/Sources/ASCCommand/Commands/Certificates/CertificatesRevoke.swift index 31331757..dce7e140 100644 --- a/Sources/ASCCommand/Commands/Certificates/CertificatesRevoke.swift +++ b/Sources/ASCCommand/Commands/Certificates/CertificatesRevoke.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct CertificatesRevoke: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Devices/DevicesList.swift b/Sources/ASCCommand/Commands/Devices/DevicesList.swift index b4cb3b98..92b3a364 100644 --- a/Sources/ASCCommand/Commands/Devices/DevicesList.swift +++ b/Sources/ASCCommand/Commands/Devices/DevicesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct DevicesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Devices/DevicesRegister.swift b/Sources/ASCCommand/Commands/Devices/DevicesRegister.swift index 6eaa65d6..f7e380c9 100644 --- a/Sources/ASCCommand/Commands/Devices/DevicesRegister.swift +++ b/Sources/ASCCommand/Commands/Devices/DevicesRegister.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct DevicesRegister: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsCreate.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsCreate.swift index 864bf08b..0088dd49 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsCreate.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentTreatmentLocalizationsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsDelete.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsDelete.swift index 581dda40..e6a1c079 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsDelete.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentTreatmentLocalizationsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsList.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsList.swift index 5b2f811c..35e84b78 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsList.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentLocalizationsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentTreatmentLocalizationsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsCreate.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsCreate.swift index 75ab37d0..71a47135 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsCreate.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentTreatmentsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsDelete.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsDelete.swift index efa2d5c8..403a2a04 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsDelete.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentTreatmentsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsList.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsList.swift index 90b3a52e..e39f2458 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsList.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentTreatmentsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsUpdate.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsUpdate.swift index 0f77130f..346da740 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsUpdate.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentTreatmentsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentTreatmentsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentsCreate.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentsCreate.swift index 7f89996e..5d9e4faa 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentsCreate.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentsDelete.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentsDelete.swift index b3925755..bbbba8dd 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentsDelete.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentsGet.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentsGet.swift index ee874734..41fad093 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentsGet.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentsGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentsGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentsList.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentsList.swift index f51c4f8a..dcd28eb8 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentsList.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentsStart.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentsStart.swift index c797bad0..0fe823c2 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentsStart.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentsStart.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentsStart: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentsStop.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentsStop.swift index 0773ff4b..59596f0e 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentsStop.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentsStop.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentsStop: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Experiments/ExperimentsUpdate.swift b/Sources/ASCCommand/Commands/Experiments/ExperimentsUpdate.swift index 357dce8d..f462291d 100644 --- a/Sources/ASCCommand/Commands/Experiments/ExperimentsUpdate.swift +++ b/Sources/ASCCommand/Commands/Experiments/ExperimentsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ExperimentsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/GameCenter/GameCenterCommand.swift b/Sources/ASCCommand/Commands/GameCenter/GameCenterCommand.swift index f5c178d0..21c9e372 100644 --- a/Sources/ASCCommand/Commands/GameCenter/GameCenterCommand.swift +++ b/Sources/ASCCommand/Commands/GameCenter/GameCenterCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit // MARK: - Parent Command diff --git a/Sources/ASCCommand/Commands/GameCenter/GameCenterModerationCommand.swift b/Sources/ASCCommand/Commands/GameCenter/GameCenterModerationCommand.swift index bd2a6999..97d637a0 100644 --- a/Sources/ASCCommand/Commands/GameCenter/GameCenterModerationCommand.swift +++ b/Sources/ASCCommand/Commands/GameCenter/GameCenterModerationCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit // MARK: - Score moderations diff --git a/Sources/ASCCommand/Commands/IAP/Availability/IAPAvailabilityCreate.swift b/Sources/ASCCommand/Commands/IAP/Availability/IAPAvailabilityCreate.swift index 652f52a8..e17aa1e4 100644 --- a/Sources/ASCCommand/Commands/IAP/Availability/IAPAvailabilityCreate.swift +++ b/Sources/ASCCommand/Commands/IAP/Availability/IAPAvailabilityCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPAvailabilityCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAP/Availability/IAPAvailabilityGet.swift b/Sources/ASCCommand/Commands/IAP/Availability/IAPAvailabilityGet.swift index 15b97be5..4181fa8e 100644 --- a/Sources/ASCCommand/Commands/IAP/Availability/IAPAvailabilityGet.swift +++ b/Sources/ASCCommand/Commands/IAP/Availability/IAPAvailabilityGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPAvailabilityGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAP/IAPCreate.swift b/Sources/ASCCommand/Commands/IAP/IAPCreate.swift index b2fc5e1e..d528a5d6 100644 --- a/Sources/ASCCommand/Commands/IAP/IAPCreate.swift +++ b/Sources/ASCCommand/Commands/IAP/IAPCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAP/IAPDelete.swift b/Sources/ASCCommand/Commands/IAP/IAPDelete.swift index 7565756a..448f09e7 100644 --- a/Sources/ASCCommand/Commands/IAP/IAPDelete.swift +++ b/Sources/ASCCommand/Commands/IAP/IAPDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAP/IAPList.swift b/Sources/ASCCommand/Commands/IAP/IAPList.swift index a70332a5..d93ae9e8 100644 --- a/Sources/ASCCommand/Commands/IAP/IAPList.swift +++ b/Sources/ASCCommand/Commands/IAP/IAPList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAP/IAPPricePointsList.swift b/Sources/ASCCommand/Commands/IAP/IAPPricePointsList.swift index 259214f4..02874deb 100644 --- a/Sources/ASCCommand/Commands/IAP/IAPPricePointsList.swift +++ b/Sources/ASCCommand/Commands/IAP/IAPPricePointsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPPricePointsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAP/IAPPricesSet.swift b/Sources/ASCCommand/Commands/IAP/IAPPricesSet.swift index f32b08cc..42c9cf7b 100644 --- a/Sources/ASCCommand/Commands/IAP/IAPPricesSet.swift +++ b/Sources/ASCCommand/Commands/IAP/IAPPricesSet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPPricesSet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAP/IAPSubmit.swift b/Sources/ASCCommand/Commands/IAP/IAPSubmit.swift index ba709fd5..03e3a020 100644 --- a/Sources/ASCCommand/Commands/IAP/IAPSubmit.swift +++ b/Sources/ASCCommand/Commands/IAP/IAPSubmit.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPSubmit: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAP/IAPUnsubmit.swift b/Sources/ASCCommand/Commands/IAP/IAPUnsubmit.swift index 86bd979a..a6f0d269 100644 --- a/Sources/ASCCommand/Commands/IAP/IAPUnsubmit.swift +++ b/Sources/ASCCommand/Commands/IAP/IAPUnsubmit.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPUnsubmit: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAP/IAPUpdate.swift b/Sources/ASCCommand/Commands/IAP/IAPUpdate.swift index a4823095..4989d987 100644 --- a/Sources/ASCCommand/Commands/IAP/IAPUpdate.swift +++ b/Sources/ASCCommand/Commands/IAP/IAPUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAP/IAPVersionsList.swift b/Sources/ASCCommand/Commands/IAP/IAPVersionsList.swift index 66035cb0..764ba9a4 100644 --- a/Sources/ASCCommand/Commands/IAP/IAPVersionsList.swift +++ b/Sources/ASCCommand/Commands/IAP/IAPVersionsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPVersionsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPEqualizations/IAPEqualizationsList.swift b/Sources/ASCCommand/Commands/IAPEqualizations/IAPEqualizationsList.swift index 3eae82b9..8ad5aacd 100644 --- a/Sources/ASCCommand/Commands/IAPEqualizations/IAPEqualizationsList.swift +++ b/Sources/ASCCommand/Commands/IAPEqualizations/IAPEqualizationsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPEqualizationsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPImages/IAPImagesDelete.swift b/Sources/ASCCommand/Commands/IAPImages/IAPImagesDelete.swift index 22dc2f06..5a3d444d 100644 --- a/Sources/ASCCommand/Commands/IAPImages/IAPImagesDelete.swift +++ b/Sources/ASCCommand/Commands/IAPImages/IAPImagesDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPImagesDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPImages/IAPImagesList.swift b/Sources/ASCCommand/Commands/IAPImages/IAPImagesList.swift index c7b0e6f2..e74006cb 100644 --- a/Sources/ASCCommand/Commands/IAPImages/IAPImagesList.swift +++ b/Sources/ASCCommand/Commands/IAPImages/IAPImagesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPImagesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPImages/IAPImagesUpload.swift b/Sources/ASCCommand/Commands/IAPImages/IAPImagesUpload.swift index 2ce7ad52..8c46a8da 100644 --- a/Sources/ASCCommand/Commands/IAPImages/IAPImagesUpload.swift +++ b/Sources/ASCCommand/Commands/IAPImages/IAPImagesUpload.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct IAPImagesUpload: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsCreate.swift b/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsCreate.swift index 8a09cbf7..c5a54112 100644 --- a/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsCreate.swift +++ b/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPLocalizationsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsDelete.swift b/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsDelete.swift index 3eced9c8..bf1d8db6 100644 --- a/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsDelete.swift +++ b/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPLocalizationsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsList.swift b/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsList.swift index 37879e65..12dd6ee6 100644 --- a/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsList.swift +++ b/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPLocalizationsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsUpdate.swift b/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsUpdate.swift index 9a7ae0c6..c4f59e64 100644 --- a/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsUpdate.swift +++ b/Sources/ASCCommand/Commands/IAPLocalizations/IAPLocalizationsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPLocalizationsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesCreate.swift b/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesCreate.swift index fa1a9f23..d579b54b 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesCreate.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPOfferCodeCustomCodesCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesList.swift b/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesList.swift index 1bd3aac5..7ab74073 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesList.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPOfferCodeCustomCodesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesUpdate.swift b/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesUpdate.swift index aa40804e..89e44883 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesUpdate.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPOfferCodeCustomCodesUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesCreate.swift b/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesCreate.swift index 21b253d5..b1b752b6 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesCreate.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit extension OfferCodeEnvironment: ExpressibleByArgument { public init?(argument: String) { diff --git a/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesList.swift b/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesList.swift index 6f8ce2c9..503d2848 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesList.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPOfferCodeOneTimeCodesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesUpdate.swift b/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesUpdate.swift index 0ef493a6..3d11201e 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesUpdate.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPOfferCodeOneTimeCodesUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesValues.swift b/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesValues.swift index 92220a99..a5a2e6d5 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesValues.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesValues.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPOfferCodeOneTimeCodesValues: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesCreate.swift b/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesCreate.swift index 0b2445ac..b1932b14 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesCreate.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPOfferCodesCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesList.swift b/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesList.swift index 5c07acee..36b30481 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesList.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPOfferCodesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesPricesList.swift b/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesPricesList.swift index 3fec25b9..801a9e95 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesPricesList.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesPricesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPOfferCodesPricesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesUpdate.swift b/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesUpdate.swift index 80e0bcc9..48af2c55 100644 --- a/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesUpdate.swift +++ b/Sources/ASCCommand/Commands/IAPOfferCodes/IAPOfferCodesUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPOfferCodesUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPPriceSchedule/IAPPriceScheduleGet.swift b/Sources/ASCCommand/Commands/IAPPriceSchedule/IAPPriceScheduleGet.swift index 28020917..e19fea02 100644 --- a/Sources/ASCCommand/Commands/IAPPriceSchedule/IAPPriceScheduleGet.swift +++ b/Sources/ASCCommand/Commands/IAPPriceSchedule/IAPPriceScheduleGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPPriceScheduleGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotDelete.swift b/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotDelete.swift index 41c4adb4..e0c20362 100644 --- a/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotDelete.swift +++ b/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPReviewScreenshotDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotGet.swift b/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotGet.swift index 4d842830..9a1aa19f 100644 --- a/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotGet.swift +++ b/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IAPReviewScreenshotGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotUpload.swift b/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotUpload.swift index 8fee8732..be6b84fa 100644 --- a/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotUpload.swift +++ b/Sources/ASCCommand/Commands/IAPReviewScreenshot/IAPReviewScreenshotUpload.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct IAPReviewScreenshotUpload: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Init/InitCommand.swift b/Sources/ASCCommand/Commands/Init/InitCommand.swift index 87abf9fb..16c220dd 100644 --- a/Sources/ASCCommand/Commands/Init/InitCommand.swift +++ b/Sources/ASCCommand/Commands/Init/InitCommand.swift @@ -1,7 +1,6 @@ import ArgumentParser -import Domain +import ASCKit import Foundation -import Infrastructure struct InitCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -31,7 +30,7 @@ struct InitCommand: AsyncParsableCommand { func run() async throws { let repo = try ClientProvider.makeAppRepository() - let storage = FileProjectConfigStorage() + let storage = ClientProvider.makeProjectConfigStorage() print(try await execute(repo: repo, storage: storage)) } diff --git a/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthLogin.swift b/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthLogin.swift index 1506f779..09a7c413 100644 --- a/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthLogin.swift +++ b/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthLogin.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct IrisAuthLogin: AsyncParsableCommand { @@ -22,7 +22,7 @@ struct IrisAuthLogin: AsyncParsableCommand { func run() async throws { let resolvedPassword = try password ?? promptForPassword() let creds = IrisAuthCredentials(appleId: appleId, password: resolvedPassword) - let authRepo = ClientProvider.makeIrisAuthRepository() + let authRepo = ClientProvider.makeIrisSignIn() let sessionRepo = ClientProvider.makeIrisSessionRepository() let pendingURL = ClientProvider.pendingTwoFactorURL() let codePrompt: (() throws -> String)? @@ -39,7 +39,7 @@ struct IrisAuthLogin: AsyncParsableCommand { func execute( credentials: IrisAuthCredentials, - authRepo: any IrisAuthRepository, + authRepo: any IrisSignIn, sessionRepo: any IrisSessionRepository, pendingURL: URL, interactivePromptForCode: (() throws -> String)? = nil, diff --git a/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthLogout.swift b/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthLogout.swift index c166aff5..fa8e452a 100644 --- a/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthLogout.swift +++ b/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthLogout.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct IrisAuthLogout: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthVerifyCode.swift b/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthVerifyCode.swift index 96e277a5..6207dd0d 100644 --- a/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthVerifyCode.swift +++ b/Sources/ASCCommand/Commands/Iris/Auth/IrisAuthVerifyCode.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct IrisAuthVerifyCode: AsyncParsableCommand { @@ -14,7 +14,7 @@ struct IrisAuthVerifyCode: AsyncParsableCommand { var code: String func run() async throws { - let authRepo = ClientProvider.makeIrisAuthRepository() + let authRepo = ClientProvider.makeIrisSignIn() let sessionRepo = ClientProvider.makeIrisSessionRepository() let pendingURL = ClientProvider.pendingTwoFactorURL() print(try await execute(code: code, authRepo: authRepo, sessionRepo: sessionRepo, pendingURL: pendingURL)) @@ -22,7 +22,7 @@ struct IrisAuthVerifyCode: AsyncParsableCommand { func execute( code: String, - authRepo: any IrisAuthRepository, + authRepo: any IrisSignIn, sessionRepo: any IrisSessionRepository, pendingURL: URL, affordanceMode: AffordanceMode = .cli diff --git a/Sources/ASCCommand/Commands/Iris/InAppPurchases/IrisIAPSubmissionsCreate.swift b/Sources/ASCCommand/Commands/Iris/InAppPurchases/IrisIAPSubmissionsCreate.swift index ce53d5d8..3dd3ad80 100644 --- a/Sources/ASCCommand/Commands/Iris/InAppPurchases/IrisIAPSubmissionsCreate.swift +++ b/Sources/ASCCommand/Commands/Iris/InAppPurchases/IrisIAPSubmissionsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit /// `asc iris iap-submissions create --iap-id ` — submits an IAP via the iris /// private API. The default `--with-next-version` (i.e. `submitWithNextAppStoreVersion: true`) diff --git a/Sources/ASCCommand/Commands/Iris/InAppPurchases/IrisIAPSubmissionsDelete.swift b/Sources/ASCCommand/Commands/Iris/InAppPurchases/IrisIAPSubmissionsDelete.swift index 3697a320..f78cda31 100644 --- a/Sources/ASCCommand/Commands/Iris/InAppPurchases/IrisIAPSubmissionsDelete.swift +++ b/Sources/ASCCommand/Commands/Iris/InAppPurchases/IrisIAPSubmissionsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit /// `asc iris iap-submissions delete --submission-id ` — removes an iris-queued /// IAP submission. Iris-queued submissions can only round-trip through the iris diff --git a/Sources/ASCCommand/Commands/Iris/IrisAppsCreate.swift b/Sources/ASCCommand/Commands/Iris/IrisAppsCreate.swift index 404e9951..41865a76 100644 --- a/Sources/ASCCommand/Commands/Iris/IrisAppsCreate.swift +++ b/Sources/ASCCommand/Commands/Iris/IrisAppsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IrisAppsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Iris/IrisAppsList.swift b/Sources/ASCCommand/Commands/Iris/IrisAppsList.swift index ebf19bda..bb06ee14 100644 --- a/Sources/ASCCommand/Commands/Iris/IrisAppsList.swift +++ b/Sources/ASCCommand/Commands/Iris/IrisAppsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IrisAppsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Iris/IrisStatus.swift b/Sources/ASCCommand/Commands/Iris/IrisStatus.swift index 06912f71..68448d3f 100644 --- a/Sources/ASCCommand/Commands/Iris/IrisStatus.swift +++ b/Sources/ASCCommand/Commands/Iris/IrisStatus.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct IrisStatus: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Iris/ResolutionCenter/IrisResolutionCenterGet.swift b/Sources/ASCCommand/Commands/Iris/ResolutionCenter/IrisResolutionCenterGet.swift index 9a428a92..171625bd 100644 --- a/Sources/ASCCommand/Commands/Iris/ResolutionCenter/IrisResolutionCenterGet.swift +++ b/Sources/ASCCommand/Commands/Iris/ResolutionCenter/IrisResolutionCenterGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation /// `asc iris resolution-center get --submission-id ` — reads App Review's diff --git a/Sources/ASCCommand/Commands/Performance/DiagnosticLogsCommand.swift b/Sources/ASCCommand/Commands/Performance/DiagnosticLogsCommand.swift index f505567c..8f6fa34f 100644 --- a/Sources/ASCCommand/Commands/Performance/DiagnosticLogsCommand.swift +++ b/Sources/ASCCommand/Commands/Performance/DiagnosticLogsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct DiagnosticLogsCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Performance/DiagnosticsCommand.swift b/Sources/ASCCommand/Commands/Performance/DiagnosticsCommand.swift index c24c4310..2ec66f0c 100644 --- a/Sources/ASCCommand/Commands/Performance/DiagnosticsCommand.swift +++ b/Sources/ASCCommand/Commands/Performance/DiagnosticsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct DiagnosticsCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Performance/PerfMetricsCommand.swift b/Sources/ASCCommand/Commands/Performance/PerfMetricsCommand.swift index 8860baf4..c2a68dcc 100644 --- a/Sources/ASCCommand/Commands/Performance/PerfMetricsCommand.swift +++ b/Sources/ASCCommand/Commands/Performance/PerfMetricsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct PerfMetricsCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Performance/PerfOverviewCommand.swift b/Sources/ASCCommand/Commands/Performance/PerfOverviewCommand.swift index a4b34360..a13c3fe3 100644 --- a/Sources/ASCCommand/Commands/Performance/PerfOverviewCommand.swift +++ b/Sources/ASCCommand/Commands/Performance/PerfOverviewCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct PerfOverviewCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Plugins/PluginsInstall.swift b/Sources/ASCCommand/Commands/Plugins/PluginsInstall.swift index e8e720f4..8526da94 100644 --- a/Sources/ASCCommand/Commands/Plugins/PluginsInstall.swift +++ b/Sources/ASCCommand/Commands/Plugins/PluginsInstall.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct PluginsInstall: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -13,11 +13,11 @@ struct PluginsInstall: AsyncParsableCommand { var name: String func run() async throws { - let repo = ClientProvider.makePluginRepository() + let repo = ClientProvider.makePlugins() print(try await execute(repo: repo)) } - func execute(repo: any PluginRepository, affordanceMode: AffordanceMode = .cli) async throws -> String { + func execute(repo: any Plugins, affordanceMode: AffordanceMode = .cli) async throws -> String { let plugin = try await repo.install(name: name) let formatter = OutputFormatter(format: globals.outputFormat, pretty: globals.pretty) return try formatter.formatAgentItems( diff --git a/Sources/ASCCommand/Commands/Plugins/PluginsList.swift b/Sources/ASCCommand/Commands/Plugins/PluginsList.swift index 5e523f8a..aa0fe137 100644 --- a/Sources/ASCCommand/Commands/Plugins/PluginsList.swift +++ b/Sources/ASCCommand/Commands/Plugins/PluginsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct PluginsList: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -10,11 +10,11 @@ struct PluginsList: AsyncParsableCommand { @OptionGroup var globals: GlobalOptions func run() async throws { - let repo = ClientProvider.makePluginRepository() + let repo = ClientProvider.makePlugins() print(try await execute(repo: repo)) } - func execute(repo: any PluginRepository, affordanceMode: AffordanceMode = .cli) async throws -> String { + func execute(repo: any Plugins, affordanceMode: AffordanceMode = .cli) async throws -> String { let plugins = try await repo.listInstalled() let formatter = OutputFormatter(format: globals.outputFormat, pretty: globals.pretty) return try formatter.formatAgentItems(plugins, affordanceMode: affordanceMode) diff --git a/Sources/ASCCommand/Commands/Plugins/PluginsMarket.swift b/Sources/ASCCommand/Commands/Plugins/PluginsMarket.swift index 1c1b766c..96f3cf8d 100644 --- a/Sources/ASCCommand/Commands/Plugins/PluginsMarket.swift +++ b/Sources/ASCCommand/Commands/Plugins/PluginsMarket.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct PluginsMarket: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -22,11 +22,11 @@ struct MarketList: AsyncParsableCommand { @OptionGroup var globals: GlobalOptions func run() async throws { - let repo = ClientProvider.makePluginRepository() + let repo = ClientProvider.makePlugins() print(try await execute(repo: repo)) } - func execute(repo: any PluginRepository, affordanceMode: AffordanceMode = .cli) async throws -> String { + func execute(repo: any Plugins, affordanceMode: AffordanceMode = .cli) async throws -> String { let plugins = try await repo.listAvailable() let formatter = OutputFormatter(format: globals.outputFormat, pretty: globals.pretty) return try formatter.formatAgentItems( @@ -50,11 +50,11 @@ struct MarketSearch: AsyncParsableCommand { var query: String func run() async throws { - let repo = ClientProvider.makePluginRepository() + let repo = ClientProvider.makePlugins() print(try await execute(repo: repo)) } - func execute(repo: any PluginRepository, affordanceMode: AffordanceMode = .cli) async throws -> String { + func execute(repo: any Plugins, affordanceMode: AffordanceMode = .cli) async throws -> String { let plugins = try await repo.searchAvailable(query: query) let formatter = OutputFormatter(format: globals.outputFormat, pretty: globals.pretty) return try formatter.formatAgentItems( diff --git a/Sources/ASCCommand/Commands/Plugins/PluginsUninstall.swift b/Sources/ASCCommand/Commands/Plugins/PluginsUninstall.swift index ed9161be..21ebf7bd 100644 --- a/Sources/ASCCommand/Commands/Plugins/PluginsUninstall.swift +++ b/Sources/ASCCommand/Commands/Plugins/PluginsUninstall.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct PluginsUninstall: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -11,11 +11,11 @@ struct PluginsUninstall: AsyncParsableCommand { var name: String func run() async throws { - let repo = ClientProvider.makePluginRepository() + let repo = ClientProvider.makePlugins() try await execute(repo: repo) } - func execute(repo: any PluginRepository) async throws { + func execute(repo: any Plugins) async throws { try await repo.uninstall(name: name) print("Plugin '\(name)' uninstalled successfully.") } diff --git a/Sources/ASCCommand/Commands/Plugins/PluginsUpdate.swift b/Sources/ASCCommand/Commands/Plugins/PluginsUpdate.swift index 03abdea4..52efa9a4 100644 --- a/Sources/ASCCommand/Commands/Plugins/PluginsUpdate.swift +++ b/Sources/ASCCommand/Commands/Plugins/PluginsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct PluginsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -13,11 +13,11 @@ struct PluginsUpdate: AsyncParsableCommand { var name: String func run() async throws { - let repo = ClientProvider.makePluginRepository() + let repo = ClientProvider.makePlugins() print(try await execute(repo: repo)) } - func execute(repo: any PluginRepository, affordanceMode: AffordanceMode = .cli) async throws -> String { + func execute(repo: any Plugins, affordanceMode: AffordanceMode = .cli) async throws -> String { let plugin = try await repo.update(name: name) let formatter = OutputFormatter(format: globals.outputFormat, pretty: globals.pretty) return try formatter.formatAgentItems( diff --git a/Sources/ASCCommand/Commands/Plugins/PluginsUpdates.swift b/Sources/ASCCommand/Commands/Plugins/PluginsUpdates.swift index 4de6eedd..fcbcd76f 100644 --- a/Sources/ASCCommand/Commands/Plugins/PluginsUpdates.swift +++ b/Sources/ASCCommand/Commands/Plugins/PluginsUpdates.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct PluginsUpdates: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -10,11 +10,11 @@ struct PluginsUpdates: AsyncParsableCommand { @OptionGroup var globals: GlobalOptions func run() async throws { - let repo = ClientProvider.makePluginRepository() + let repo = ClientProvider.makePlugins() print(try await execute(repo: repo)) } - func execute(repo: any PluginRepository, affordanceMode: AffordanceMode = .cli) async throws -> String { + func execute(repo: any Plugins, affordanceMode: AffordanceMode = .cli) async throws -> String { let updates = try await repo.listOutdated() let formatter = OutputFormatter(format: globals.outputFormat, pretty: globals.pretty) return try formatter.formatAgentItems( diff --git a/Sources/ASCCommand/Commands/Profiles/ProfilesCreate.swift b/Sources/ASCCommand/Commands/Profiles/ProfilesCreate.swift index 68a53411..ac17f210 100644 --- a/Sources/ASCCommand/Commands/Profiles/ProfilesCreate.swift +++ b/Sources/ASCCommand/Commands/Profiles/ProfilesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ProfilesCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Profiles/ProfilesDelete.swift b/Sources/ASCCommand/Commands/Profiles/ProfilesDelete.swift index 84615839..2e65537c 100644 --- a/Sources/ASCCommand/Commands/Profiles/ProfilesDelete.swift +++ b/Sources/ASCCommand/Commands/Profiles/ProfilesDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ProfilesDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Profiles/ProfilesList.swift b/Sources/ASCCommand/Commands/Profiles/ProfilesList.swift index d0feaad0..7168cb60 100644 --- a/Sources/ASCCommand/Commands/Profiles/ProfilesList.swift +++ b/Sources/ASCCommand/Commands/Profiles/ProfilesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ProfilesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesCreate.swift b/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesCreate.swift index 3f7f23b8..334c360d 100644 --- a/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesCreate.swift +++ b/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct PromotedPurchasesCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesDelete.swift b/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesDelete.swift index 7fc998cf..ddcc7c1b 100644 --- a/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesDelete.swift +++ b/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct PromotedPurchasesDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesList.swift b/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesList.swift index 27a1ac63..8a2453c3 100644 --- a/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesList.swift +++ b/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct PromotedPurchasesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesUpdate.swift b/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesUpdate.swift index 0eec33f1..c531f309 100644 --- a/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesUpdate.swift +++ b/Sources/ASCCommand/Commands/PromotedPurchases/PromotedPurchasesUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct PromotedPurchasesUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Reports/FinanceReportsDownload.swift b/Sources/ASCCommand/Commands/Reports/FinanceReportsDownload.swift index a549a49d..7be11651 100644 --- a/Sources/ASCCommand/Commands/Reports/FinanceReportsDownload.swift +++ b/Sources/ASCCommand/Commands/Reports/FinanceReportsDownload.swift @@ -1,6 +1,5 @@ import ArgumentParser -import Domain -import Infrastructure +import ASCKit struct FinanceReportsDownload: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -23,12 +22,12 @@ struct FinanceReportsDownload: AsyncParsableCommand { var reportDate: String func run() async throws { - let repo = try ClientProvider.makeReportRepository() - let storage = FileAuthStorage() + let repo = try ClientProvider.makeReports() + let storage = ClientProvider.makeAuthStorage() print(try await execute(repo: repo, storage: storage)) } - func execute(repo: any ReportRepository, storage: any AuthStorage = FileAuthStorage()) async throws -> String { + func execute(repo: any Reports, storage: any AuthStorage = ClientProvider.makeAuthStorage()) async throws -> String { let resolvedVendorNumber = try VendorNumberResolver.resolve(explicit: vendorNumber, storage: storage) guard let parsedReportType = FinanceReportType(cliArgument: reportType) else { diff --git a/Sources/ASCCommand/Commands/Reports/SalesReportsDownload.swift b/Sources/ASCCommand/Commands/Reports/SalesReportsDownload.swift index 89722498..cc3c973f 100644 --- a/Sources/ASCCommand/Commands/Reports/SalesReportsDownload.swift +++ b/Sources/ASCCommand/Commands/Reports/SalesReportsDownload.swift @@ -1,6 +1,5 @@ import ArgumentParser -import Domain -import Infrastructure +import ASCKit struct SalesReportsDownload: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -29,12 +28,12 @@ struct SalesReportsDownload: AsyncParsableCommand { var version: String? func run() async throws { - let repo = try ClientProvider.makeReportRepository() - let storage = FileAuthStorage() + let repo = try ClientProvider.makeReports() + let storage = ClientProvider.makeAuthStorage() print(try await execute(repo: repo, storage: storage)) } - func execute(repo: any ReportRepository, storage: any AuthStorage = FileAuthStorage()) async throws -> String { + func execute(repo: any Reports, storage: any AuthStorage = ClientProvider.makeAuthStorage()) async throws -> String { let resolvedVendorNumber = try VendorNumberResolver.resolve(explicit: vendorNumber, storage: storage) guard let parsedReportType = SalesReportType(cliArgument: reportType) else { diff --git a/Sources/ASCCommand/Commands/Reports/SalesReportsSummary.swift b/Sources/ASCCommand/Commands/Reports/SalesReportsSummary.swift index 6888e2a9..5d82cf3d 100644 --- a/Sources/ASCCommand/Commands/Reports/SalesReportsSummary.swift +++ b/Sources/ASCCommand/Commands/Reports/SalesReportsSummary.swift @@ -1,7 +1,6 @@ import ArgumentParser -import Domain +import ASCKit import Foundation -import Infrastructure struct SalesReportsSummary: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -21,12 +20,12 @@ struct SalesReportsSummary: AsyncParsableCommand { var to: String func run() async throws { - let repo = try ClientProvider.makeReportRepository() - let storage = FileAuthStorage() + let repo = try ClientProvider.makeReports() + let storage = ClientProvider.makeAuthStorage() print(try await execute(repo: repo, storage: storage)) } - func execute(repo: any ReportRepository, storage: any AuthStorage = FileAuthStorage()) async throws -> String { + func execute(repo: any Reports, storage: any AuthStorage = ClientProvider.makeAuthStorage()) async throws -> String { let resolvedVendorNumber = try VendorNumberResolver.resolve(explicit: vendorNumber, storage: storage) let dates = try expandDateRange(from: from, to: to) diff --git a/Sources/ASCCommand/Commands/Reports/VendorNumberResolver.swift b/Sources/ASCCommand/Commands/Reports/VendorNumberResolver.swift index f0316f78..eb6075d3 100644 --- a/Sources/ASCCommand/Commands/Reports/VendorNumberResolver.swift +++ b/Sources/ASCCommand/Commands/Reports/VendorNumberResolver.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit enum VendorNumberResolver { static func resolve(explicit: String?, storage: any AuthStorage) throws -> String { diff --git a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsAdd.swift b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsAdd.swift index 5c413b0f..0c10b602 100644 --- a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsAdd.swift +++ b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsAdd.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewSubmissionItemsAdd: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsList.swift b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsList.swift index e697ef4d..1c7dc168 100644 --- a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsList.swift +++ b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewSubmissionItemsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsRemove.swift b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsRemove.swift index 273229b4..1c88551d 100644 --- a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsRemove.swift +++ b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionItemsRemove.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewSubmissionItemsRemove: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsCreate.swift b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsCreate.swift index 7f7274d7..381bf35b 100644 --- a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsCreate.swift +++ b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewSubmissionsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsGet.swift b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsGet.swift index 82eef503..c2270fb2 100644 --- a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsGet.swift +++ b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewSubmissionsGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsList.swift b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsList.swift index 8065b65f..1fa86c13 100644 --- a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsList.swift +++ b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct ReviewSubmissionsList: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsSubmit.swift b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsSubmit.swift index 43863926..cec5a855 100644 --- a/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsSubmit.swift +++ b/Sources/ASCCommand/Commands/ReviewSubmissions/ReviewSubmissionsSubmit.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewSubmissionsSubmit: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Reviews/ReviewResponsesCreate.swift b/Sources/ASCCommand/Commands/Reviews/ReviewResponsesCreate.swift index baf50504..9f69b085 100644 --- a/Sources/ASCCommand/Commands/Reviews/ReviewResponsesCreate.swift +++ b/Sources/ASCCommand/Commands/Reviews/ReviewResponsesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewResponsesCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Reviews/ReviewResponsesDelete.swift b/Sources/ASCCommand/Commands/Reviews/ReviewResponsesDelete.swift index 57abc7f3..c523a9d0 100644 --- a/Sources/ASCCommand/Commands/Reviews/ReviewResponsesDelete.swift +++ b/Sources/ASCCommand/Commands/Reviews/ReviewResponsesDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewResponsesDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Reviews/ReviewResponsesGet.swift b/Sources/ASCCommand/Commands/Reviews/ReviewResponsesGet.swift index ef6d7664..6777b0a4 100644 --- a/Sources/ASCCommand/Commands/Reviews/ReviewResponsesGet.swift +++ b/Sources/ASCCommand/Commands/Reviews/ReviewResponsesGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewResponsesGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Reviews/ReviewsGet.swift b/Sources/ASCCommand/Commands/Reviews/ReviewsGet.swift index 87707637..a0072370 100644 --- a/Sources/ASCCommand/Commands/Reviews/ReviewsGet.swift +++ b/Sources/ASCCommand/Commands/Reviews/ReviewsGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewsGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Reviews/ReviewsList.swift b/Sources/ASCCommand/Commands/Reviews/ReviewsList.swift index dad94d78..59accf88 100644 --- a/Sources/ASCCommand/Commands/Reviews/ReviewsList.swift +++ b/Sources/ASCCommand/Commands/Reviews/ReviewsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ReviewsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsCommand.swift b/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsCommand.swift index 604e97b8..7546d7d7 100644 --- a/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsCommand.swift +++ b/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ScreenshotSetsCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsCreate.swift b/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsCreate.swift index 56596463..d474b58b 100644 --- a/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsCreate.swift +++ b/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ScreenshotSetsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsDelete.swift b/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsDelete.swift index a81211b8..79cc8c64 100644 --- a/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsDelete.swift +++ b/Sources/ASCCommand/Commands/ScreenshotSets/ScreenshotSetsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ScreenshotSetsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Screenshots/ScreenshotImportFiles.swift b/Sources/ASCCommand/Commands/Screenshots/ScreenshotImportFiles.swift index 11db1413..5e357903 100644 --- a/Sources/ASCCommand/Commands/Screenshots/ScreenshotImportFiles.swift +++ b/Sources/ASCCommand/Commands/Screenshots/ScreenshotImportFiles.swift @@ -1,6 +1,6 @@ import ArgumentParser import CryptoKit -import Domain +import ASCKit import Foundation import ImageIO diff --git a/Sources/ASCCommand/Commands/Screenshots/ScreenshotsCommand.swift b/Sources/ASCCommand/Commands/Screenshots/ScreenshotsCommand.swift index e799d292..1dd0f856 100644 --- a/Sources/ASCCommand/Commands/Screenshots/ScreenshotsCommand.swift +++ b/Sources/ASCCommand/Commands/Screenshots/ScreenshotsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ScreenshotsCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Screenshots/ScreenshotsDelete.swift b/Sources/ASCCommand/Commands/Screenshots/ScreenshotsDelete.swift index 250d69c1..06190109 100644 --- a/Sources/ASCCommand/Commands/Screenshots/ScreenshotsDelete.swift +++ b/Sources/ASCCommand/Commands/Screenshots/ScreenshotsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct ScreenshotsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Screenshots/ScreenshotsImport.swift b/Sources/ASCCommand/Commands/Screenshots/ScreenshotsImport.swift index 5d5e2279..0ec12128 100644 --- a/Sources/ASCCommand/Commands/Screenshots/ScreenshotsImport.swift +++ b/Sources/ASCCommand/Commands/Screenshots/ScreenshotsImport.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation extension ExistingScreenshotsPolicy: ExpressibleByArgument {} diff --git a/Sources/ASCCommand/Commands/Screenshots/ScreenshotsUpload.swift b/Sources/ASCCommand/Commands/Screenshots/ScreenshotsUpload.swift index ab7583b5..3d7ac9e8 100644 --- a/Sources/ASCCommand/Commands/Screenshots/ScreenshotsUpload.swift +++ b/Sources/ASCCommand/Commands/Screenshots/ScreenshotsUpload.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct ScreenshotsUpload: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Shared/OfferCodePriceParser.swift b/Sources/ASCCommand/Commands/Shared/OfferCodePriceParser.swift index 830e116f..70419c82 100644 --- a/Sources/ASCCommand/Commands/Shared/OfferCodePriceParser.swift +++ b/Sources/ASCCommand/Commands/Shared/OfferCodePriceParser.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit /// Parses CLI `--price =` and `--free-territory ` /// flags into the domain `OfferCodePriceInput` list. diff --git a/Sources/ASCCommand/Commands/Simulators/SimulatorsBoot.swift b/Sources/ASCCommand/Commands/Simulators/SimulatorsBoot.swift index a0e1293e..bbe68af7 100644 --- a/Sources/ASCCommand/Commands/Simulators/SimulatorsBoot.swift +++ b/Sources/ASCCommand/Commands/Simulators/SimulatorsBoot.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SimulatorsBoot: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -11,11 +11,11 @@ struct SimulatorsBoot: AsyncParsableCommand { var udid: String func run() async throws { - let repo = ClientProvider.makeSimulatorRepository() + let repo = ClientProvider.makeSimulators() print(try await execute(repo: repo)) } - func execute(repo: any SimulatorRepository) async throws -> String { + func execute(repo: any Simulators) async throws -> String { try await repo.bootSimulator(udid: udid) return "Simulator \(udid) booted successfully." } diff --git a/Sources/ASCCommand/Commands/Simulators/SimulatorsList.swift b/Sources/ASCCommand/Commands/Simulators/SimulatorsList.swift index d0d07e97..ce8590c1 100644 --- a/Sources/ASCCommand/Commands/Simulators/SimulatorsList.swift +++ b/Sources/ASCCommand/Commands/Simulators/SimulatorsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SimulatorsList: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -13,11 +13,11 @@ struct SimulatorsList: AsyncParsableCommand { var booted: Bool = false func run() async throws { - let repo = ClientProvider.makeSimulatorRepository() + let repo = ClientProvider.makeSimulators() print(try await execute(repo: repo)) } - func execute(repo: any SimulatorRepository, affordanceMode: AffordanceMode = .cli) async throws -> String { + func execute(repo: any Simulators, affordanceMode: AffordanceMode = .cli) async throws -> String { let filter: SimulatorFilter = booted ? .booted : .available let items = try await repo.listSimulators(filter: filter) let formatter = OutputFormatter(format: globals.outputFormat, pretty: globals.pretty) diff --git a/Sources/ASCCommand/Commands/Simulators/SimulatorsShutdown.swift b/Sources/ASCCommand/Commands/Simulators/SimulatorsShutdown.swift index 3618b566..b258a2b4 100644 --- a/Sources/ASCCommand/Commands/Simulators/SimulatorsShutdown.swift +++ b/Sources/ASCCommand/Commands/Simulators/SimulatorsShutdown.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SimulatorsShutdown: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -11,11 +11,11 @@ struct SimulatorsShutdown: AsyncParsableCommand { var udid: String func run() async throws { - let repo = ClientProvider.makeSimulatorRepository() + let repo = ClientProvider.makeSimulators() print(try await execute(repo: repo)) } - func execute(repo: any SimulatorRepository) async throws -> String { + func execute(repo: any Simulators) async throws -> String { try await repo.shutdownSimulator(udid: udid) return "Simulator \(udid) shut down successfully." } diff --git a/Sources/ASCCommand/Commands/Skills/SkillUpdateChecker.swift b/Sources/ASCCommand/Commands/Skills/SkillUpdateChecker.swift index 36aa15cc..ca29adb5 100644 --- a/Sources/ASCCommand/Commands/Skills/SkillUpdateChecker.swift +++ b/Sources/ASCCommand/Commands/Skills/SkillUpdateChecker.swift @@ -1,4 +1,4 @@ -import Domain +import ASCKit import Foundation /// Non-blocking auto-update checker called on every `asc` command. @@ -14,7 +14,7 @@ enum SkillUpdateChecker { static let checkInterval: TimeInterval = 24 * 60 * 60 // 24 hours static func checkIfNeeded( - repo: any SkillRepository, + repo: any Skills, storage: any SkillConfigStorage, environment: [String: String] = ProcessInfo.processInfo.environment, now: Date = Date() diff --git a/Sources/ASCCommand/Commands/Skills/SkillsCheck.swift b/Sources/ASCCommand/Commands/Skills/SkillsCheck.swift index f4cd197c..7b72ed8a 100644 --- a/Sources/ASCCommand/Commands/Skills/SkillsCheck.swift +++ b/Sources/ASCCommand/Commands/Skills/SkillsCheck.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct SkillsCheck: AsyncParsableCommand { @@ -11,12 +11,12 @@ struct SkillsCheck: AsyncParsableCommand { @OptionGroup var globals: GlobalOptions func run() async throws { - let repo = ClientProvider.makeSkillRepository() + let repo = ClientProvider.makeSkills() let storage = ClientProvider.makeSkillConfigStorage() print(try await execute(repo: repo, storage: storage)) } - func execute(repo: any SkillRepository, storage: any SkillConfigStorage) async throws -> String { + func execute(repo: any Skills, storage: any SkillConfigStorage) async throws -> String { let result = try await repo.check() // Persist the check timestamp diff --git a/Sources/ASCCommand/Commands/Skills/SkillsInstall.swift b/Sources/ASCCommand/Commands/Skills/SkillsInstall.swift index 4ef71286..073cc5f5 100644 --- a/Sources/ASCCommand/Commands/Skills/SkillsInstall.swift +++ b/Sources/ASCCommand/Commands/Skills/SkillsInstall.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SkillsInstall: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -16,11 +16,11 @@ struct SkillsInstall: AsyncParsableCommand { var all: Bool = false func run() async throws { - let repo = ClientProvider.makeSkillRepository() + let repo = ClientProvider.makeSkills() print(try await execute(repo: repo)) } - func execute(repo: any SkillRepository) async throws -> String { + func execute(repo: any Skills) async throws -> String { if all { return try await repo.installAll() } else if let name { diff --git a/Sources/ASCCommand/Commands/Skills/SkillsInstalled.swift b/Sources/ASCCommand/Commands/Skills/SkillsInstalled.swift index c3c06312..91a23c0d 100644 --- a/Sources/ASCCommand/Commands/Skills/SkillsInstalled.swift +++ b/Sources/ASCCommand/Commands/Skills/SkillsInstalled.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct SkillsInstalled: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Skills/SkillsList.swift b/Sources/ASCCommand/Commands/Skills/SkillsList.swift index 75a34f7f..41b4a516 100644 --- a/Sources/ASCCommand/Commands/Skills/SkillsList.swift +++ b/Sources/ASCCommand/Commands/Skills/SkillsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SkillsList: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -10,11 +10,11 @@ struct SkillsList: AsyncParsableCommand { @OptionGroup var globals: GlobalOptions func run() async throws { - let repo = ClientProvider.makeSkillRepository() + let repo = ClientProvider.makeSkills() print(try await execute(repo: repo)) } - func execute(repo: any SkillRepository) async throws -> String { + func execute(repo: any Skills) async throws -> String { let output = try await repo.listAvailable() return output } diff --git a/Sources/ASCCommand/Commands/Skills/SkillsUninstall.swift b/Sources/ASCCommand/Commands/Skills/SkillsUninstall.swift index 5a915c21..1ac05ba5 100644 --- a/Sources/ASCCommand/Commands/Skills/SkillsUninstall.swift +++ b/Sources/ASCCommand/Commands/Skills/SkillsUninstall.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct SkillsUninstall: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Skills/SkillsUpdate.swift b/Sources/ASCCommand/Commands/Skills/SkillsUpdate.swift index dafef13c..5e9bb353 100644 --- a/Sources/ASCCommand/Commands/Skills/SkillsUpdate.swift +++ b/Sources/ASCCommand/Commands/Skills/SkillsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SkillsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -10,11 +10,11 @@ struct SkillsUpdate: AsyncParsableCommand { @OptionGroup var globals: GlobalOptions func run() async throws { - let repo = ClientProvider.makeSkillRepository() + let repo = ClientProvider.makeSkills() print(try await execute(repo: repo)) } - func execute(repo: any SkillRepository) async throws -> String { + func execute(repo: any Skills) async throws -> String { try await repo.update() } } diff --git a/Sources/ASCCommand/Commands/SubscriptionEqualizations/SubscriptionEqualizationsList.swift b/Sources/ASCCommand/Commands/SubscriptionEqualizations/SubscriptionEqualizationsList.swift index 5a5557b0..af144c5a 100644 --- a/Sources/ASCCommand/Commands/SubscriptionEqualizations/SubscriptionEqualizationsList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionEqualizations/SubscriptionEqualizationsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionEqualizationsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsCreate.swift b/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsCreate.swift index c11d8ae9..4df0f986 100644 --- a/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsCreate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionGroupLocalizationsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsDelete.swift b/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsDelete.swift index 9fdedc10..4fcfc0c0 100644 --- a/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsDelete.swift +++ b/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionGroupLocalizationsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsList.swift b/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsList.swift index 35b08534..e66fc1f9 100644 --- a/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionGroupLocalizationsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsUpdate.swift b/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsUpdate.swift index 27d765ac..78122687 100644 --- a/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsUpdate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionGroupLocalizationsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupVersionsList.swift b/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupVersionsList.swift index 4996ff73..5e7ea110 100644 --- a/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupVersionsList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupVersionsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionGroupVersionsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsCreate.swift b/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsCreate.swift index 904b4f8b..8c076b29 100644 --- a/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsCreate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionGroupsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsDelete.swift b/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsDelete.swift index 15ea730c..5da749a6 100644 --- a/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsDelete.swift +++ b/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionGroupsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsList.swift b/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsList.swift index cfb161b2..28e6553b 100644 --- a/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionGroupsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsUpdate.swift b/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsUpdate.swift index 8464489d..6cd7aa23 100644 --- a/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsUpdate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionGroups/SubscriptionGroupsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionGroupsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesDelete.swift b/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesDelete.swift index 73c80faf..a73b9669 100644 --- a/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesDelete.swift +++ b/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionImagesDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesList.swift b/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesList.swift index c7538711..c57c2d38 100644 --- a/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionImagesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesUpload.swift b/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesUpload.swift index fccdc315..c40c5364 100644 --- a/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesUpload.swift +++ b/Sources/ASCCommand/Commands/SubscriptionImages/SubscriptionImagesUpload.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct SubscriptionImagesUpload: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsCreate.swift b/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsCreate.swift index e10d0c47..b4c504da 100644 --- a/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsCreate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionLocalizationsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsDelete.swift b/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsDelete.swift index 627a4503..00182753 100644 --- a/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsDelete.swift +++ b/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionLocalizationsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsList.swift b/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsList.swift index 5183e66f..8c7da946 100644 --- a/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionLocalizationsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsUpdate.swift b/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsUpdate.swift index b43884e5..75e1fd8f 100644 --- a/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsUpdate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionLocalizations/SubscriptionLocalizationsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionLocalizationsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesCreate.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesCreate.swift index d78c3cdf..819844a8 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesCreate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodeCustomCodesCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesList.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesList.swift index eebff9d4..3bef1272 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodeCustomCodesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesUpdate.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesUpdate.swift index 9558a148..790970aa 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesUpdate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodeCustomCodesUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesCreate.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesCreate.swift index 07719805..37b0eaae 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesCreate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodeOneTimeCodesCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesList.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesList.swift index 8b0e474b..bfdbcc9e 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodeOneTimeCodesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesUpdate.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesUpdate.swift index 0b5a6e26..ae57b2b4 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesUpdate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodeOneTimeCodesUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesValues.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesValues.swift index c916a27d..930d23cf 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesValues.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesValues.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodeOneTimeCodesValues: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesCreate.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesCreate.swift index 202a9fca..1e4446bc 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesCreate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodesCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesList.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesList.swift index 6c73d2f7..b6c25f1d 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesPricesList.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesPricesList.swift index 44c355b5..0e816cd8 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesPricesList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesPricesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodesPricesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesUpdate.swift b/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesUpdate.swift index d81e335a..640343ba 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesUpdate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOfferCodesUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersCreate.swift b/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersCreate.swift index 6b65b3d0..56de892d 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersCreate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOffersCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersDelete.swift b/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersDelete.swift index 89ab79f5..86b4926d 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersDelete.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOffersDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersList.swift b/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersList.swift index 6501d55f..3431672f 100644 --- a/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionOffers/SubscriptionOffersList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionOffersList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionPriceSchedule/SubscriptionPriceScheduleGet.swift b/Sources/ASCCommand/Commands/SubscriptionPriceSchedule/SubscriptionPriceScheduleGet.swift index 15e077ca..44413a7f 100644 --- a/Sources/ASCCommand/Commands/SubscriptionPriceSchedule/SubscriptionPriceScheduleGet.swift +++ b/Sources/ASCCommand/Commands/SubscriptionPriceSchedule/SubscriptionPriceScheduleGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionPriceScheduleGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersCreate.swift b/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersCreate.swift index 955cb56f..e7e66b93 100644 --- a/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersCreate.swift +++ b/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct SubscriptionPromotionalOffersCreate: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersDelete.swift b/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersDelete.swift index 2a7c2c78..ed42e06e 100644 --- a/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersDelete.swift +++ b/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionPromotionalOffersDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersList.swift b/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersList.swift index 0d2c9880..6d425915 100644 --- a/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionPromotionalOffersList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersPricesList.swift b/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersPricesList.swift index c59dff7d..a1c86865 100644 --- a/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersPricesList.swift +++ b/Sources/ASCCommand/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersPricesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionPromotionalOffersPricesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotDelete.swift b/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotDelete.swift index 0eb10d9c..f6469565 100644 --- a/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotDelete.swift +++ b/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionReviewScreenshotDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotGet.swift b/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotGet.swift index d5cf8257..dc0da55f 100644 --- a/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotGet.swift +++ b/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionReviewScreenshotGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotUpload.swift b/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotUpload.swift index eedbad25..1808eee6 100644 --- a/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotUpload.swift +++ b/Sources/ASCCommand/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotUpload.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct SubscriptionReviewScreenshotUpload: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Subscriptions/Availability/SubscriptionAvailabilityCreate.swift b/Sources/ASCCommand/Commands/Subscriptions/Availability/SubscriptionAvailabilityCreate.swift index 0700387c..d22f19f7 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/Availability/SubscriptionAvailabilityCreate.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/Availability/SubscriptionAvailabilityCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionAvailabilityCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/Availability/SubscriptionAvailabilityGet.swift b/Sources/ASCCommand/Commands/Subscriptions/Availability/SubscriptionAvailabilityGet.swift index f4ceded0..e578904e 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/Availability/SubscriptionAvailabilityGet.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/Availability/SubscriptionAvailabilityGet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionAvailabilityGet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricePointsList.swift b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricePointsList.swift index 649d9711..7fa946ff 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricePointsList.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricePointsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionPricePointsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricesSet.swift b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricesSet.swift index 6a173a58..418368be 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricesSet.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricesSet.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionPricesSet: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricesSetBatch.swift b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricesSetBatch.swift index 627ecf02..5f6b4301 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricesSetBatch.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionPricesSetBatch.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionPricesSetBatch: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionVersionsList.swift b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionVersionsList.swift index 4ec98088..1fd9d37a 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionVersionsList.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionVersionsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionVersionsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsCreate.swift b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsCreate.swift index d3970036..b1a1cdcf 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsCreate.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsDelete.swift b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsDelete.swift index fa248c87..b1be83f8 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsDelete.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionsDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsList.swift b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsList.swift index 519d538c..935185eb 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsList.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsSubmit.swift b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsSubmit.swift index 9d38ab49..e8a203b4 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsSubmit.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsSubmit.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionsSubmit: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsUnsubmit.swift b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsUnsubmit.swift index 3e393b59..f7b6abd8 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsUnsubmit.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsUnsubmit.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct SubscriptionsUnsubmit: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsUpdate.swift b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsUpdate.swift index 4252b072..1dbee4e5 100644 --- a/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsUpdate.swift +++ b/Sources/ASCCommand/Commands/Subscriptions/SubscriptionsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit extension SubscriptionPeriod: ExpressibleByArgument {} extension SubscriptionMultiSeatStatus: ExpressibleByArgument {} diff --git a/Sources/ASCCommand/Commands/TUI/TUIApp.swift b/Sources/ASCCommand/Commands/TUI/TUIApp.swift index b0082496..0b1bfea3 100644 --- a/Sources/ASCCommand/Commands/TUI/TUIApp.swift +++ b/Sources/ASCCommand/Commands/TUI/TUIApp.swift @@ -1,7 +1,6 @@ import Foundation import TauTUI -import Domain -import Infrastructure +import ASCKit @MainActor final class TUIApp { diff --git a/Sources/ASCCommand/Commands/Territories/TerritoriesList.swift b/Sources/ASCCommand/Commands/Territories/TerritoriesList.swift index e36d693c..9e1f6281 100644 --- a/Sources/ASCCommand/Commands/Territories/TerritoriesList.swift +++ b/Sources/ASCCommand/Commands/Territories/TerritoriesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct TerritoriesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/TestFlight/TestFlightCommand.swift b/Sources/ASCCommand/Commands/TestFlight/TestFlightCommand.swift index 3ee48832..bf550d2a 100644 --- a/Sources/ASCCommand/Commands/TestFlight/TestFlightCommand.swift +++ b/Sources/ASCCommand/Commands/TestFlight/TestFlightCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct TestFlightCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/Users/UserInvitationsCancel.swift b/Sources/ASCCommand/Commands/Users/UserInvitationsCancel.swift index 0e83603b..a0780d8a 100644 --- a/Sources/ASCCommand/Commands/Users/UserInvitationsCancel.swift +++ b/Sources/ASCCommand/Commands/Users/UserInvitationsCancel.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct UserInvitationsCancel: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Users/UserInvitationsInvite.swift b/Sources/ASCCommand/Commands/Users/UserInvitationsInvite.swift index bdcc35be..2fd2a5ef 100644 --- a/Sources/ASCCommand/Commands/Users/UserInvitationsInvite.swift +++ b/Sources/ASCCommand/Commands/Users/UserInvitationsInvite.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct UserInvitationsInvite: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Users/UserInvitationsList.swift b/Sources/ASCCommand/Commands/Users/UserInvitationsList.swift index e754bf46..97f64c9d 100644 --- a/Sources/ASCCommand/Commands/Users/UserInvitationsList.swift +++ b/Sources/ASCCommand/Commands/Users/UserInvitationsList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct UserInvitationsList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Users/UsersList.swift b/Sources/ASCCommand/Commands/Users/UsersList.swift index 821a80f3..13f1e8af 100644 --- a/Sources/ASCCommand/Commands/Users/UsersList.swift +++ b/Sources/ASCCommand/Commands/Users/UsersList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct UsersList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Users/UsersRemove.swift b/Sources/ASCCommand/Commands/Users/UsersRemove.swift index 40055290..963a3af5 100644 --- a/Sources/ASCCommand/Commands/Users/UsersRemove.swift +++ b/Sources/ASCCommand/Commands/Users/UsersRemove.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct UsersRemove: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Users/UsersUpdate.swift b/Sources/ASCCommand/Commands/Users/UsersUpdate.swift index dba6e941..99586232 100644 --- a/Sources/ASCCommand/Commands/Users/UsersUpdate.swift +++ b/Sources/ASCCommand/Commands/Users/UsersUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct UsersUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsCommand.swift b/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsCommand.swift index b1ad308a..a59ebc88 100644 --- a/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsCommand.swift +++ b/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct VersionLocalizationsCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsCreate.swift b/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsCreate.swift index 8234d9a6..9fde0ec5 100644 --- a/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsCreate.swift +++ b/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct VersionLocalizationsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsUpdate.swift b/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsUpdate.swift index 078e6360..94bc83d6 100644 --- a/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsUpdate.swift +++ b/Sources/ASCCommand/Commands/VersionLocalizations/VersionLocalizationsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct VersionLocalizationsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/VersionReviewDetail/VersionReviewDetailCommand.swift b/Sources/ASCCommand/Commands/VersionReviewDetail/VersionReviewDetailCommand.swift index 92b16c76..79436c7e 100644 --- a/Sources/ASCCommand/Commands/VersionReviewDetail/VersionReviewDetailCommand.swift +++ b/Sources/ASCCommand/Commands/VersionReviewDetail/VersionReviewDetailCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct VersionReviewDetailCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Versions/VersionsCheckReadiness.swift b/Sources/ASCCommand/Commands/Versions/VersionsCheckReadiness.swift index eab603d9..bf4dbfc5 100644 --- a/Sources/ASCCommand/Commands/Versions/VersionsCheckReadiness.swift +++ b/Sources/ASCCommand/Commands/Versions/VersionsCheckReadiness.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct VersionsCheckReadiness: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Versions/VersionsCommand.swift b/Sources/ASCCommand/Commands/Versions/VersionsCommand.swift index dbef9b41..145d26de 100644 --- a/Sources/ASCCommand/Commands/Versions/VersionsCommand.swift +++ b/Sources/ASCCommand/Commands/Versions/VersionsCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct VersionsCommand: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Versions/VersionsCreate.swift b/Sources/ASCCommand/Commands/Versions/VersionsCreate.swift index ee458f3c..201dfb8d 100644 --- a/Sources/ASCCommand/Commands/Versions/VersionsCreate.swift +++ b/Sources/ASCCommand/Commands/Versions/VersionsCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct VersionsCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Versions/VersionsSetBuild.swift b/Sources/ASCCommand/Commands/Versions/VersionsSetBuild.swift index d68dc7b1..ac3eab01 100644 --- a/Sources/ASCCommand/Commands/Versions/VersionsSetBuild.swift +++ b/Sources/ASCCommand/Commands/Versions/VersionsSetBuild.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct VersionsSetBuild: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Versions/VersionsSubmit.swift b/Sources/ASCCommand/Commands/Versions/VersionsSubmit.swift index bf403a70..8c6b78a2 100644 --- a/Sources/ASCCommand/Commands/Versions/VersionsSubmit.swift +++ b/Sources/ASCCommand/Commands/Versions/VersionsSubmit.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct VersionsSubmit: AsyncParsableCommand { static let configuration = CommandConfiguration( @@ -38,12 +38,16 @@ struct VersionsSubmit: AsyncParsableCommand { planner: planner )) } else { - print(try await execute(repo: try ClientProvider.makeSubmissionRepository())) + print(try await execute( + versionRepo: try ClientProvider.makeVersionRepository(), + submissionRepo: try ClientProvider.makeSubmissionRepository() + )) } } - func execute(repo: any SubmissionRepository) async throws -> String { - let submission = try await repo.submitVersion(versionId: versionId) + func execute(versionRepo: any VersionRepository, submissionRepo: any SubmissionRepository) async throws -> String { + let version = try await versionRepo.getVersion(id: versionId) + let submission = try await version.submitForReview(to: submissionRepo) let formatter = OutputFormatter(format: globals.outputFormat, pretty: globals.pretty) return try formatter.formatAgentItems( diff --git a/Sources/ASCCommand/Commands/Versions/VersionsUpdate.swift b/Sources/ASCCommand/Commands/Versions/VersionsUpdate.swift index 58efd66e..c421935d 100644 --- a/Sources/ASCCommand/Commands/Versions/VersionsUpdate.swift +++ b/Sources/ASCCommand/Commands/Versions/VersionsUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct VersionsUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/Web/Controllers/AgeRatingController.swift b/Sources/ASCCommand/Commands/Web/Controllers/AgeRatingController.swift index c79ae4da..dc3bc158 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/AgeRatingController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/AgeRatingController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `AgeRatingDeclaration` resources. struct AgeRatingController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/AppAvailabilityController.swift b/Sources/ASCCommand/Commands/Web/Controllers/AppAvailabilityController.swift index 3d5ac0a6..b92c9fb6 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/AppAvailabilityController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/AppAvailabilityController.swift @@ -1,8 +1,7 @@ import Foundation -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// `GET /apps/:appId/availability` — the app's availability (`data: []` when never set up). /// `POST /apps/:appId/availability` — set it up. Body keys match the CLI flags: diff --git a/Sources/ASCCommand/Commands/Web/Controllers/AppCategoriesController.swift b/Sources/ASCCommand/Commands/Web/Controllers/AppCategoriesController.swift index e7fa377f..5560b1bc 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/AppCategoriesController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/AppCategoriesController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `AppCategory` resources. struct AppCategoriesController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/AppInfosController.swift b/Sources/ASCCommand/Commands/Web/Controllers/AppInfosController.swift index e655535e..1baacdc4 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/AppInfosController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/AppInfosController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Returns the String value for a JSON key, or nil if missing/null. /// Use this for PATCH bodies where an absent key means "don't change". diff --git a/Sources/ASCCommand/Commands/Web/Controllers/AppPricingController.swift b/Sources/ASCCommand/Commands/Web/Controllers/AppPricingController.swift index 2d64d234..49b4b0c6 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/AppPricingController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/AppPricingController.swift @@ -1,8 +1,7 @@ import Foundation -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// App pricing (mirrors `IAPPricePointsController` / `IAPPricesController`): /// `GET /apps/:appId/price-points?territory=USA` and `POST /apps/:appId/prices/set` diff --git a/Sources/ASCCommand/Commands/Web/Controllers/AppShotsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/AppShotsController.swift index c639f623..69bb1c3f 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/AppShotsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/AppShotsController.swift @@ -1,15 +1,14 @@ import ArgumentParser -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket import ASCPlugin -import Infrastructure import Foundation /// /api/v1/app-shots — Screenshot template, theme, export, and AI generation. struct AppShotsController: Sendable { let templateRepo: any TemplateRepository - let themeRepo: any ThemeRepository + let themeRepo: any Themes let htmlRenderer: any HTMLRenderer let configStorage: any AppShotsConfigStorage let galleryTemplateRepo: any GalleryTemplateRepository diff --git a/Sources/ASCCommand/Commands/Web/Controllers/AppsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/AppsController.swift index 7f92c927..4f63bfd5 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/AppsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/AppsController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `App` resources. struct AppsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/AssetLibraryController.swift b/Sources/ASCCommand/Commands/Web/Controllers/AssetLibraryController.swift index f2eaa155..f7ec7ebe 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/AssetLibraryController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/AssetLibraryController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes for the App Asset Library: the library, its images, placement groups and placements. /// diff --git a/Sources/ASCCommand/Commands/Web/Controllers/AuthController.swift b/Sources/ASCCommand/Commands/Web/Controllers/AuthController.swift index c842a340..6d655cc8 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/AuthController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/AuthController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that manage saved App Store Connect API key credentials. /// diff --git a/Sources/ASCCommand/Commands/Web/Controllers/BetaAppLocalizationsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/BetaAppLocalizationsController.swift index 4bbd5a6c..038dc5db 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/BetaAppLocalizationsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/BetaAppLocalizationsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `BetaAppLocalization` resources. struct BetaAppLocalizationsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/BuildsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/BuildsController.swift index 88d902ce..7e227c99 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/BuildsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/BuildsController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `Build` resources (both fleet and per-app listings). struct BuildsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/CodeSigningController.swift b/Sources/ASCCommand/Commands/Web/Controllers/CodeSigningController.swift index f5a427b8..58af6aaa 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/CodeSigningController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/CodeSigningController.swift @@ -2,8 +2,7 @@ import Foundation import Hummingbird import HummingbirdWebSocket import ASCPlugin -import Domain -import Infrastructure +import ASCKit /// /api/v1/certificates, bundle-ids, devices, profiles — Code signing routes. struct CodeSigningController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/CustomerReviewsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/CustomerReviewsController.swift index c5b8ed50..d56bad33 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/CustomerReviewsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/CustomerReviewsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `CustomerReview` resources. struct CustomerReviewsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/DiagnosticsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/DiagnosticsController.swift index 09d5cd30..b7562711 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/DiagnosticsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/DiagnosticsController.swift @@ -1,8 +1,7 @@ import Foundation -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// `GET /builds/:buildId/diagnostics?diagnostic-type=…` — a build's diagnostic signatures; /// `GET /diagnostics/:signatureId/logs` — the logs behind one signature. diff --git a/Sources/ASCCommand/Commands/Web/Controllers/ExperimentsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/ExperimentsController.swift index 45c0bd3c..a8895e9d 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/ExperimentsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/ExperimentsController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes for product page optimization tests (`AppStoreVersionExperiment`), /// their treatments and treatment localizations. diff --git a/Sources/ASCCommand/Commands/Web/Controllers/GameCenterController.swift b/Sources/ASCCommand/Commands/Web/Controllers/GameCenterController.swift index e580f3d4..0197a514 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/GameCenterController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/GameCenterController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes for Game Center: the app's Game Center detail, its achievements and leaderboards, /// and moderation of leaderboard scores and players. diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPAvailabilityController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPAvailabilityController.swift index 32ac2e4b..76e7fdb4 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPAvailabilityController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPAvailabilityController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return the per-territory availability of an in-app purchase. struct IAPAvailabilityController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPController.swift index 29378c30..3ed9407a 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `InAppPurchase` resources. struct IAPController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPEqualizationsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPEqualizationsController.swift index 2d9e5820..8dda8a05 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPEqualizationsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPEqualizationsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return Apple's auto-equalized territory prices for an IAP price point. struct IAPEqualizationsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPLocalizationsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPLocalizationsController.swift index e4ce7837..eda48c00 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPLocalizationsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPLocalizationsController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// ASC's IAP localization field constraints. Public so future controllers and validators /// can stay in sync with the iOS app's `LocaleCard` limits (`limit: 30` / `limit: 45`). diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPOfferCodeOneTimeCodesController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPOfferCodeOneTimeCodesController.swift index 502ea3c1..e7126be8 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPOfferCodeOneTimeCodesController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPOfferCodeOneTimeCodesController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `InAppPurchaseOfferCodeOneTimeUseCode` resources. /// diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPOfferCodesController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPOfferCodesController.swift index 1be656e7..9732dbcd 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPOfferCodesController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPOfferCodesController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `InAppPurchaseOfferCode` resources. struct IAPOfferCodesController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPPricePointsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPPricePointsController.swift index 470f1aca..52296638 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPPricePointsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPPricePointsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `InAppPurchasePricePoint` resources. struct IAPPricePointsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPPriceScheduleController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPPriceScheduleController.swift index 2a442b95..8e2f1052 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPPriceScheduleController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPPriceScheduleController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return the manual price schedule for an in-app purchase. struct IAPPriceScheduleController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPPricesController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPPricesController.swift index dbc9a327..5d97799b 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPPricesController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPPricesController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes for setting (or changing) the manual base price of an IAP. Calling with a new /// `baseTerritory` is how the iOS app implements "Change Base Territory" — ASC replaces diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPReviewController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPReviewController.swift index 62c60a87..7010cf4e 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPReviewController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPReviewController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return IAP review screenshot + promotional images. struct IAPReviewController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IAPSubmissionController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IAPSubmissionController.swift index 0f3b4d0e..ac92bad4 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IAPSubmissionController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IAPSubmissionController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// `POST /iap/:iapId/submit` — submits an IAP for App Store review. /// `DELETE /iap-submissions/:submissionId` — unsubmits (withdraws from review). diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IrisIAPSubmissionsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IrisIAPSubmissionsController.swift index 51c22072..4eccbf28 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IrisIAPSubmissionsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IrisIAPSubmissionsController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// `POST /api/v1/iris/iap/:iapId/submissions` — submits an IAP via the iris private API, /// the only path that accepts `submitWithNextAppStoreVersion`. Body: diff --git a/Sources/ASCCommand/Commands/Web/Controllers/IrisResolutionCenterController.swift b/Sources/ASCCommand/Commands/Web/Controllers/IrisResolutionCenterController.swift index 1f6107b4..1ca59c0e 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/IrisResolutionCenterController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/IrisResolutionCenterController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// `GET /api/v1/iris/review-submissions/:submissionId/resolution-center` — /// App Review's Resolution Center messages and rejection reasons for a review diff --git a/Sources/ASCCommand/Commands/Web/Controllers/OfferCodePricesController.swift b/Sources/ASCCommand/Commands/Web/Controllers/OfferCodePricesController.swift index c546aacd..5d861ad7 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/OfferCodePricesController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/OfferCodePricesController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return per-territory prices attached to IAP and subscription offer codes. struct OfferCodePricesController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/PerfMetricsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/PerfMetricsController.swift index 38a112b0..552dab76 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/PerfMetricsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/PerfMetricsController.swift @@ -1,8 +1,7 @@ import Foundation -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// `GET /apps/:appId/perf-metrics` and `GET /builds/:buildId/perf-metrics` — power and /// performance metrics. The `metric-type` query param matches the CLI flag `--metric-type`. diff --git a/Sources/ASCCommand/Commands/Web/Controllers/PerfOverviewController.swift b/Sources/ASCCommand/Commands/Web/Controllers/PerfOverviewController.swift index 4a042b3b..f8959bef 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/PerfOverviewController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/PerfOverviewController.swift @@ -1,8 +1,7 @@ import Foundation -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// `GET /apps/:appId/perf-overview?device-type=…` — the app's Xcode Organizer overview. /// The query param matches the CLI flag `--device-type`. diff --git a/Sources/ASCCommand/Commands/Web/Controllers/PluginsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/PluginsController.swift index 22d75ef4..513b1699 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/PluginsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/PluginsController.swift @@ -1,9 +1,8 @@ import ASCPlugin -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// /api/v1/plugins — Plugin routes. /// @@ -14,7 +13,7 @@ import Infrastructure /// GET /plugins/market ↔ asc plugins market list /// GET /plugins/market?q=… ↔ asc plugins market search --query … struct PluginsController: Sendable { - let repo: any PluginRepository + let repo: any Plugins func addRoutes(to group: RouterGroup) { group.get("/plugins") { _, _ -> Response in diff --git a/Sources/ASCCommand/Commands/Web/Controllers/ProductVersionsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/ProductVersionsController.swift index ea1686d1..154659c1 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/ProductVersionsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/ProductVersionsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Review versions of in-app purchases, subscriptions and subscription groups. /// A submittable version is sent to review by adding it to a review submission. diff --git a/Sources/ASCCommand/Commands/Web/Controllers/PromotedPurchasesController.swift b/Sources/ASCCommand/Commands/Web/Controllers/PromotedPurchasesController.swift index fc318812..db70d4b0 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/PromotedPurchasesController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/PromotedPurchasesController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `PromotedPurchase` resources (App Store product page promoted slots). struct PromotedPurchasesController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/ReviewSubmissionsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/ReviewSubmissionsController.swift index d89e6938..2a875bdb 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/ReviewSubmissionsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/ReviewSubmissionsController.swift @@ -2,8 +2,7 @@ import Foundation import Hummingbird import HummingbirdWebSocket import ASCPlugin -import Domain -import Infrastructure +import ASCKit /// /api/v1/apps/{appId}/review-submissions — App Store review submissions. /// diff --git a/Sources/ASCCommand/Commands/Web/Controllers/RootController.swift b/Sources/ASCCommand/Commands/Web/Controllers/RootController.swift index f0c6ae39..691fe128 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/RootController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/RootController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import ASCPlugin -import Infrastructure /// GET /api/v1 — HATEOAS entry point listing all available resources. struct RootController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotImportController.swift b/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotImportController.swift index f2d12e77..a7694c58 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotImportController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotImportController.swift @@ -1,9 +1,8 @@ import ArgumentParser -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// `POST /api/v1/versions/:versionId/screenshots/import?to-library=true` — the body is the /// export ZIP. Query params match the CLI flags (`existing`, `dry-run`, repeated diff --git a/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotSetsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotSetsController.swift index 2c0c8a26..818b7984 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotSetsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotSetsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `AppScreenshotSet` resources. struct ScreenshotSetsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotsController.swift index a570c7b4..4fdec0a4 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/ScreenshotsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `AppScreenshot` resources. struct ScreenshotsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SimulatorsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SimulatorsController.swift index c504d865..583c91cb 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SimulatorsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SimulatorsController.swift @@ -1,11 +1,11 @@ import Hummingbird import HummingbirdWebSocket import ASCPlugin -import Domain +import ASCKit /// /api/v1/simulators — Simulator routes. struct SimulatorsController: Sendable { - let repo: any SimulatorRepository + let repo: any Simulators func addRoutes(to group: RouterGroup) { group.get("/simulators") { _, _ -> Response in diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionAvailabilityController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionAvailabilityController.swift index 2bb2abfb..457fcf1c 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionAvailabilityController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionAvailabilityController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return the per-territory availability of a subscription. struct SubscriptionAvailabilityController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionEqualizationsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionEqualizationsController.swift index 00963b39..5dc25e5a 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionEqualizationsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionEqualizationsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return Apple's auto-equalized territory prices for a subscription price point. struct SubscriptionEqualizationsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionGroupLocalizationsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionGroupLocalizationsController.swift index 7da5c8a7..05032d8f 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionGroupLocalizationsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionGroupLocalizationsController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `SubscriptionGroupLocalization` resources. struct SubscriptionGroupLocalizationsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionGroupsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionGroupsController.swift index c67550e3..ec8aaeba 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionGroupsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionGroupsController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `SubscriptionGroup` resources. struct SubscriptionGroupsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionIntroductoryOffersController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionIntroductoryOffersController.swift index fc97e4a3..0854f765 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionIntroductoryOffersController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionIntroductoryOffersController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `SubscriptionIntroductoryOffer` resources. struct SubscriptionIntroductoryOffersController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionLocalizationsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionLocalizationsController.swift index f62149f1..72c0cfae 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionLocalizationsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionLocalizationsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `SubscriptionLocalization` resources. struct SubscriptionLocalizationsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionOfferCodeOneTimeCodesController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionOfferCodeOneTimeCodesController.swift index fbb9a34c..a158b7aa 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionOfferCodeOneTimeCodesController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionOfferCodeOneTimeCodesController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `SubscriptionOfferCodeOneTimeUseCode` resources. /// diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionOfferCodesController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionOfferCodesController.swift index 39ec97a0..b240465d 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionOfferCodesController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionOfferCodesController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `SubscriptionOfferCode` resources. struct SubscriptionOfferCodesController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPricePointsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPricePointsController.swift index 94cd2ae3..151b294f 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPricePointsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPricePointsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `SubscriptionPricePoint` resources. struct SubscriptionPricePointsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPriceScheduleController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPriceScheduleController.swift index 2eafcf18..d46d0f02 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPriceScheduleController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPriceScheduleController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return the per-territory price schedule for a subscription. struct SubscriptionPriceScheduleController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPricesController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPricesController.swift index 4f5a8779..ffeff1e0 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPricesController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPricesController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes for batch-setting per-territory prices on a subscription. struct SubscriptionPricesController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPromotionalOffersController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPromotionalOffersController.swift index d9d75787..457928de 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPromotionalOffersController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionPromotionalOffersController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `SubscriptionPromotionalOffer` resources and their per-territory prices. struct SubscriptionPromotionalOffersController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionReviewController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionReviewController.swift index bb1cf8dc..3baff3fb 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionReviewController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionReviewController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return the subscription review screenshot and promotional images. struct SubscriptionReviewController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionSubmissionController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionSubmissionController.swift index c1b902cf..7ac587d6 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionSubmissionController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionSubmissionController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// `POST /subscriptions/:subscriptionId/submit` — submits a subscription for review. /// `DELETE /subscription-submissions/:submissionId` — unsubmits. diff --git a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionsController.swift index 520b5435..9a346430 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/SubscriptionsController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `Subscription` resources nested under a subscription group. struct SubscriptionsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/TerritoriesController.swift b/Sources/ASCCommand/Commands/Web/Controllers/TerritoriesController.swift index 7ef42a42..f0509d58 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/TerritoriesController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/TerritoriesController.swift @@ -1,7 +1,7 @@ import Hummingbird import HummingbirdWebSocket import ASCPlugin -import Domain +import ASCKit /// /api/v1/territories — Territory routes. struct TerritoriesController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/TestFlightController.swift b/Sources/ASCCommand/Commands/Web/Controllers/TestFlightController.swift index fce54b7e..b8071ba7 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/TestFlightController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/TestFlightController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return TestFlight `BetaGroup` resources. struct TestFlightController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/VersionLocalizationsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/VersionLocalizationsController.swift index 3f913a76..183273c6 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/VersionLocalizationsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/VersionLocalizationsController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `AppStoreVersionLocalization` resources. struct VersionLocalizationsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/VersionSubmissionController.swift b/Sources/ASCCommand/Commands/Web/Controllers/VersionSubmissionController.swift index eacfa064..e33b290f 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/VersionSubmissionController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/VersionSubmissionController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// `POST /api/v1/versions/:versionId/submit` — submits an app version for review. /// `?with-products=true` also sends every ready in-app purchase and subscription @@ -19,10 +18,16 @@ struct VersionSubmissionController: Sendable { let withProducts = query["with-products"].map { $0 == "true" } ?? false let dryRun = query["dry-run"].map { $0 == "true" } ?? false + let version = try await self.versionRepo.getVersion(id: versionId) guard withProducts || dryRun else { - return try restFormat(try await self.submissionRepo.submitVersion(versionId: versionId)) + do { + return try restFormat(try await version.submitForReview(to: self.submissionRepo)) + } catch let error as ReviewSubmissionError { + // Refused here, before anything reaches Apple: the version can't be edited. + guard case .versionNotEditable = error else { throw error } + return jsonError(error.description, status: .unprocessableContent) + } } - let version = try await self.versionRepo.getVersion(id: versionId) let plan = try await self.planner.plan(for: version) if dryRun { return try restFormat(plan.items) } return try restFormat(try await plan.submit(repo: self.submissionRepo)) diff --git a/Sources/ASCCommand/Commands/Web/Controllers/VersionsController.swift b/Sources/ASCCommand/Commands/Web/Controllers/VersionsController.swift index ed187695..23cfd7ac 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/VersionsController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/VersionsController.swift @@ -1,8 +1,7 @@ -import Domain +import ASCKit import Foundation import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `AppStoreVersion` resources. struct VersionsController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/Controllers/WinBackOffersController.swift b/Sources/ASCCommand/Commands/Web/Controllers/WinBackOffersController.swift index f3e187f7..9baf0039 100644 --- a/Sources/ASCCommand/Commands/Web/Controllers/WinBackOffersController.swift +++ b/Sources/ASCCommand/Commands/Web/Controllers/WinBackOffersController.swift @@ -1,7 +1,6 @@ -import Domain +import ASCKit import Hummingbird import HummingbirdWebSocket -import Infrastructure /// Routes that return `WinBackOffer` resources and their per-territory prices. struct WinBackOffersController: Sendable { diff --git a/Sources/ASCCommand/Commands/Web/RESTRoutes.swift b/Sources/ASCCommand/Commands/Web/RESTRoutes.swift index 15251749..1b29747b 100644 --- a/Sources/ASCCommand/Commands/Web/RESTRoutes.swift +++ b/Sources/ASCCommand/Commands/Web/RESTRoutes.swift @@ -1,6 +1,5 @@ -import Domain +import ASCKit import Hummingbird -import Infrastructure import ASCPlugin import Foundation @@ -16,78 +15,76 @@ enum RESTRoutes { let v1 = router.group("/api/v1") - // Create shared auth + factory once - let auth = CompositeAuthProvider() - let factory = ClientFactory() + // Every repository comes from the one composition root, ClientProvider. // App resource hierarchy — one focused controller per resource type. // Order is incidental; each controller registers its own routes. - if let appRepo = try? factory.makeAppRepository(authProvider: auth) { + if let appRepo = try? ClientProvider.makeAppRepository() { AppsController(repo: appRepo).addRoutes(to: v1) } - if let versionRepo = try? factory.makeVersionRepository(authProvider: auth) { + if let versionRepo = try? ClientProvider.makeVersionRepository() { VersionsController(repo: versionRepo).addRoutes(to: v1) } - if let localizationRepo = try? factory.makeVersionLocalizationRepository(authProvider: auth) { + if let localizationRepo = try? ClientProvider.makeVersionLocalizationRepository() { VersionLocalizationsController(repo: localizationRepo).addRoutes(to: v1) } - if let screenshotRepo = try? factory.makeScreenshotRepository(authProvider: auth) { + if let screenshotRepo = try? ClientProvider.makeScreenshotRepository() { ScreenshotSetsController(repo: screenshotRepo).addRoutes(to: v1) ScreenshotsController(repo: screenshotRepo).addRoutes(to: v1) } - if let libraryRepo = try? factory.makeAssetLibraryRepository(authProvider: auth), - let imageRepo = try? factory.makeLibraryImageRepository(authProvider: auth), - let videoRepo = try? factory.makeLibraryVideoRepository(authProvider: auth), - let placementRepo = try? factory.makeAssetPlacementRepository(authProvider: auth) { + if let libraryRepo = try? ClientProvider.makeAssetLibraryRepository(), + let imageRepo = try? ClientProvider.makeLibraryImageRepository(), + let videoRepo = try? ClientProvider.makeLibraryVideoRepository(), + let placementRepo = try? ClientProvider.makeAssetPlacementRepository() { AssetLibraryController( libraryRepo: libraryRepo, imageRepo: imageRepo, videoRepo: videoRepo, placementRepo: placementRepo ).addRoutes(to: v1) - if let versionRepo = try? factory.makeVersionRepository(authProvider: auth), - let localizationRepo = try? factory.makeVersionLocalizationRepository(authProvider: auth) { + if let versionRepo = try? ClientProvider.makeVersionRepository(), + let localizationRepo = try? ClientProvider.makeVersionLocalizationRepository() { ScreenshotImportController( versionRepo: versionRepo, localizationRepo: localizationRepo, libraryRepo: libraryRepo, imageRepo: imageRepo, placementRepo: placementRepo ).addRoutes(to: v1) } } - if let buildRepo = try? factory.makeBuildRepository(authProvider: auth) { + if let buildRepo = try? ClientProvider.makeBuildRepository() { BuildsController(repo: buildRepo).addRoutes(to: v1) } - if let testFlightRepo = try? factory.makeTestFlightRepository(authProvider: auth) { + if let testFlightRepo = try? ClientProvider.makeTestFlightRepository() { TestFlightController(repo: testFlightRepo).addRoutes(to: v1) } - if let betaAppLocRepo = try? factory.makeBetaAppLocalizationRepository(authProvider: auth) { + if let betaAppLocRepo = try? ClientProvider.makeBetaAppLocalizationRepository() { BetaAppLocalizationsController(repo: betaAppLocRepo).addRoutes(to: v1) } - if let reviewRepo = try? factory.makeCustomerReviewRepository(authProvider: auth) { + if let reviewRepo = try? ClientProvider.makeCustomerReviewRepository() { CustomerReviewsController(repo: reviewRepo).addRoutes(to: v1) } - if let iapRepo = try? factory.makeInAppPurchaseRepository(authProvider: auth) { + if let iapRepo = try? ClientProvider.makeInAppPurchaseRepository() { IAPController(repo: iapRepo).addRoutes(to: v1) } - if let subscriptionGroupRepo = try? factory.makeSubscriptionGroupRepository(authProvider: auth) { + if let subscriptionGroupRepo = try? ClientProvider.makeSubscriptionGroupRepository() { SubscriptionGroupsController(repo: subscriptionGroupRepo).addRoutes(to: v1) } - if let subscriptionRepo = try? factory.makeSubscriptionRepository(authProvider: auth) { + if let subscriptionRepo = try? ClientProvider.makeSubscriptionRepository() { SubscriptionsController(repo: subscriptionRepo).addRoutes(to: v1) } - if let promotedRepo = try? factory.makePromotedPurchaseRepository(authProvider: auth) { + if let promotedRepo = try? ClientProvider.makePromotedPurchaseRepository() { PromotedPurchasesController(repo: promotedRepo).addRoutes(to: v1) } - if let availabilityRepo = try? factory.makeAppAvailabilityRepository(authProvider: auth), - let territoryRepo = try? factory.makeTerritoryRepository(authProvider: auth) { + if let availabilityRepo = try? ClientProvider.makeAppAvailabilityRepository(), + let territoryRepo = try? ClientProvider.makeTerritoryRepository() { AppAvailabilityController(repo: availabilityRepo, territoryRepo: territoryRepo).addRoutes(to: v1) } - if let pricingRepo = try? factory.makePricingRepository(authProvider: auth) { + if let pricingRepo = try? ClientProvider.makePricingRepository() { AppPricingController(repo: pricingRepo).addRoutes(to: v1) } - if let productVersionRepo = try? factory.makeProductVersionRepository(authProvider: auth) { + if let productVersionRepo = try? ClientProvider.makeProductVersionRepository() { ProductVersionsController(repo: productVersionRepo).addRoutes(to: v1) - if let submissionRepo = try? factory.makeSubmissionRepository(authProvider: auth), - let versionRepo = try? factory.makeVersionRepository(authProvider: auth), - let iapRepo = try? factory.makeInAppPurchaseRepository(authProvider: auth), - let groupRepo = try? factory.makeSubscriptionGroupRepository(authProvider: auth), - let subscriptionRepo = try? factory.makeSubscriptionRepository(authProvider: auth) { + if let submissionRepo = try? ClientProvider.makeSubmissionRepository(), + let versionRepo = try? ClientProvider.makeVersionRepository(), + let iapRepo = try? ClientProvider.makeInAppPurchaseRepository(), + let groupRepo = try? ClientProvider.makeSubscriptionGroupRepository(), + let subscriptionRepo = try? ClientProvider.makeSubscriptionRepository() { VersionSubmissionController( submissionRepo: submissionRepo, versionRepo: versionRepo, @@ -96,80 +93,80 @@ enum RESTRoutes { ).addRoutes(to: v1) } } - if let perfOverviewRepo = try? factory.makePerfOverviewRepository(authProvider: auth) { + if let perfOverviewRepo = try? ClientProvider.makePerfOverviewRepository() { PerfOverviewController(repo: perfOverviewRepo).addRoutes(to: v1) } - if let perfMetricsRepo = try? factory.makePerfMetricsRepository(authProvider: auth) { + if let perfMetricsRepo = try? ClientProvider.makePerfMetricsRepository() { PerfMetricsController(repo: perfMetricsRepo).addRoutes(to: v1) } - if let diagnosticsRepo = try? factory.makeDiagnosticsRepository(authProvider: auth) { + if let diagnosticsRepo = try? ClientProvider.makeDiagnosticsRepository() { DiagnosticsController(repo: diagnosticsRepo).addRoutes(to: v1) } - if let experimentRepo = try? factory.makeExperimentRepository(authProvider: auth) { + if let experimentRepo = try? ClientProvider.makeExperimentRepository() { ExperimentsController(repo: experimentRepo).addRoutes(to: v1) } - if let gameCenterRepo = try? factory.makeGameCenterRepository(authProvider: auth), - let moderationRepo = try? factory.makeGameCenterModerationRepository(authProvider: auth) { + if let gameCenterRepo = try? ClientProvider.makeGameCenterRepository(), + let moderationRepo = try? ClientProvider.makeGameCenterModerationRepository() { GameCenterController(repo: gameCenterRepo, moderationRepo: moderationRepo).addRoutes(to: v1) } - if let groupLocRepo = try? factory.makeSubscriptionGroupLocalizationRepository(authProvider: auth) { + if let groupLocRepo = try? ClientProvider.makeSubscriptionGroupLocalizationRepository() { SubscriptionGroupLocalizationsController(repo: groupLocRepo).addRoutes(to: v1) } - if let promoRepo = try? factory.makeSubscriptionPromotionalOfferRepository(authProvider: auth) { + if let promoRepo = try? ClientProvider.makeSubscriptionPromotionalOfferRepository() { SubscriptionPromotionalOffersController(repo: promoRepo).addRoutes(to: v1) } - if let winBackRepo = try? factory.makeWinBackOfferRepository(authProvider: auth) { + if let winBackRepo = try? ClientProvider.makeWinBackOfferRepository() { WinBackOffersController(repo: winBackRepo).addRoutes(to: v1) } - if let subPriceRepo = try? factory.makeSubscriptionPriceRepository(authProvider: auth) { + if let subPriceRepo = try? ClientProvider.makeSubscriptionPriceRepository() { SubscriptionPricePointsController(repo: subPriceRepo).addRoutes(to: v1) SubscriptionPriceScheduleController(repo: subPriceRepo).addRoutes(to: v1) SubscriptionEqualizationsController(repo: subPriceRepo).addRoutes(to: v1) SubscriptionPricesController(repo: subPriceRepo).addRoutes(to: v1) } - if let iapOfferCodeRepo = try? factory.makeInAppPurchaseOfferCodeRepository(authProvider: auth), - let subOfferCodeRepo = try? factory.makeSubscriptionOfferCodeRepository(authProvider: auth) { + if let iapOfferCodeRepo = try? ClientProvider.makeInAppPurchaseOfferCodeRepository(), + let subOfferCodeRepo = try? ClientProvider.makeSubscriptionOfferCodeRepository() { OfferCodePricesController(iapRepo: iapOfferCodeRepo, subRepo: subOfferCodeRepo).addRoutes(to: v1) } - if let iapOfferCodeRepo = try? factory.makeInAppPurchaseOfferCodeRepository(authProvider: auth) { + if let iapOfferCodeRepo = try? ClientProvider.makeInAppPurchaseOfferCodeRepository() { IAPOfferCodeOneTimeCodesController(repo: iapOfferCodeRepo).addRoutes(to: v1) } - if let subOfferCodeRepo = try? factory.makeSubscriptionOfferCodeRepository(authProvider: auth) { + if let subOfferCodeRepo = try? ClientProvider.makeSubscriptionOfferCodeRepository() { SubscriptionOfferCodeOneTimeCodesController(repo: subOfferCodeRepo).addRoutes(to: v1) } - if let iapReviewRepo = try? factory.makeInAppPurchaseReviewRepository(authProvider: auth) { + if let iapReviewRepo = try? ClientProvider.makeInAppPurchaseReviewRepository() { IAPReviewController(repo: iapReviewRepo).addRoutes(to: v1) } - if let subReviewRepo = try? factory.makeSubscriptionReviewRepository(authProvider: auth) { + if let subReviewRepo = try? ClientProvider.makeSubscriptionReviewRepository() { SubscriptionReviewController(repo: subReviewRepo).addRoutes(to: v1) } - if let iapSubmissionRepo = try? factory.makeInAppPurchaseSubmissionRepository(authProvider: auth) { + if let iapSubmissionRepo = try? ClientProvider.makeInAppPurchaseSubmissionRepository() { IAPSubmissionController(repo: iapSubmissionRepo).addRoutes(to: v1) } IrisIAPSubmissionsController( - cookieProvider: factory.makeIrisCookieProvider(), - repo: factory.makeIrisInAppPurchaseSubmissionRepository() + cookieProvider: ClientProvider.makeIrisCookieProvider(), + repo: ClientProvider.makeIrisInAppPurchaseSubmissionRepository() ).addRoutes(to: v1) IrisResolutionCenterController( - cookieProvider: factory.makeIrisCookieProvider(), - repo: factory.makeIrisResolutionCenterRepository() + cookieProvider: ClientProvider.makeIrisCookieProvider(), + repo: ClientProvider.makeIrisResolutionCenterRepository() ).addRoutes(to: v1) - if let subSubmissionRepo = try? factory.makeSubscriptionSubmissionRepository(authProvider: auth) { + if let subSubmissionRepo = try? ClientProvider.makeSubscriptionSubmissionRepository() { SubscriptionSubmissionController(repo: subSubmissionRepo).addRoutes(to: v1) } // IAP detail listings - if let iapLocRepo = try? factory.makeInAppPurchaseLocalizationRepository(authProvider: auth) { + if let iapLocRepo = try? ClientProvider.makeInAppPurchaseLocalizationRepository() { IAPLocalizationsController(repo: iapLocRepo).addRoutes(to: v1) } - if let iapAvailRepo = try? factory.makeInAppPurchaseAvailabilityRepository(authProvider: auth), - let territoryRepo = try? factory.makeTerritoryRepository(authProvider: auth) { + if let iapAvailRepo = try? ClientProvider.makeInAppPurchaseAvailabilityRepository(), + let territoryRepo = try? ClientProvider.makeTerritoryRepository() { IAPAvailabilityController(repo: iapAvailRepo, territoryRepo: territoryRepo).addRoutes(to: v1) } - if let iapOfferCodeRepo = try? factory.makeInAppPurchaseOfferCodeRepository(authProvider: auth) { + if let iapOfferCodeRepo = try? ClientProvider.makeInAppPurchaseOfferCodeRepository() { IAPOfferCodesController(repo: iapOfferCodeRepo).addRoutes(to: v1) } - if let iapPriceRepo = try? factory.makeInAppPurchasePriceRepository(authProvider: auth) { + if let iapPriceRepo = try? ClientProvider.makeInAppPurchasePriceRepository() { IAPPricePointsController(repo: iapPriceRepo).addRoutes(to: v1) IAPPriceScheduleController(repo: iapPriceRepo).addRoutes(to: v1) IAPEqualizationsController(repo: iapPriceRepo).addRoutes(to: v1) @@ -177,60 +174,60 @@ enum RESTRoutes { } // Subscription detail listings - if let subLocRepo = try? factory.makeSubscriptionLocalizationRepository(authProvider: auth) { + if let subLocRepo = try? ClientProvider.makeSubscriptionLocalizationRepository() { SubscriptionLocalizationsController(repo: subLocRepo).addRoutes(to: v1) } - if let subAvailRepo = try? factory.makeSubscriptionAvailabilityRepository(authProvider: auth), - let territoryRepo = try? factory.makeTerritoryRepository(authProvider: auth) { + if let subAvailRepo = try? ClientProvider.makeSubscriptionAvailabilityRepository(), + let territoryRepo = try? ClientProvider.makeTerritoryRepository() { SubscriptionAvailabilityController(repo: subAvailRepo, territoryRepo: territoryRepo).addRoutes(to: v1) } - if let subOfferCodeRepo = try? factory.makeSubscriptionOfferCodeRepository(authProvider: auth) { + if let subOfferCodeRepo = try? ClientProvider.makeSubscriptionOfferCodeRepository() { SubscriptionOfferCodesController(repo: subOfferCodeRepo).addRoutes(to: v1) } - if let subIntroRepo = try? factory.makeSubscriptionIntroductoryOfferRepository(authProvider: auth) { + if let subIntroRepo = try? ClientProvider.makeSubscriptionIntroductoryOfferRepository() { SubscriptionIntroductoryOffersController(repo: subIntroRepo).addRoutes(to: v1) } - if let appInfoRepo = try? factory.makeAppInfoRepository(authProvider: auth) { + if let appInfoRepo = try? ClientProvider.makeAppInfoRepository() { AppInfosController(repo: appInfoRepo).addRoutes(to: v1) } - if let appCategoryRepo = try? factory.makeAppCategoryRepository(authProvider: auth) { + if let appCategoryRepo = try? ClientProvider.makeAppCategoryRepository() { AppCategoriesController(repo: appCategoryRepo).addRoutes(to: v1) } - if let ageRatingRepo = try? factory.makeAgeRatingDeclarationRepository(authProvider: auth) { + if let ageRatingRepo = try? ClientProvider.makeAgeRatingDeclarationRepository() { AgeRatingController(repo: ageRatingRepo).addRoutes(to: v1) } // Code signing if let signing = try? CodeSigningController( - certRepo: factory.makeCertificateRepository(authProvider: auth), - bundleIDRepo: factory.makeBundleIDRepository(authProvider: auth), - deviceRepo: factory.makeDeviceRepository(authProvider: auth), - profileRepo: factory.makeProfileRepository(authProvider: auth) + certRepo: ClientProvider.makeCertificateRepository(), + bundleIDRepo: ClientProvider.makeBundleIDRepository(), + deviceRepo: ClientProvider.makeDeviceRepository(), + profileRepo: ClientProvider.makeProfileRepository() ) { signing.addRoutes(to: v1) } // Review submissions if let submissions = try? ReviewSubmissionsController( - submissionRepo: factory.makeSubmissionRepository(authProvider: auth) + submissionRepo: ClientProvider.makeSubmissionRepository() ) { submissions.addRoutes(to: v1) } // Auth — manages the credential store the rest of the controllers consume. - AuthController(storage: FileAuthStorage()).addRoutes(to: v1) + AuthController(storage: ClientProvider.makeAuthStorage()).addRoutes(to: v1) // Non-authenticated resources - SimulatorsController(repo: factory.makeSimulatorRepository()).addRoutes(to: v1) - PluginsController(repo: factory.makePluginRepository()).addRoutes(to: v1) + SimulatorsController(repo: ClientProvider.makeSimulators()).addRoutes(to: v1) + PluginsController(repo: ClientProvider.makePlugins()).addRoutes(to: v1) if let territories = try? TerritoriesController( - repo: factory.makeTerritoryRepository(authProvider: auth) + repo: ClientProvider.makeTerritoryRepository() ) { territories.addRoutes(to: v1) } // App Shots AppShotsController( - templateRepo: AggregateTemplateRepository.shared, - themeRepo: AggregateThemeRepository.shared, - htmlRenderer: WebKitHTMLRenderer(), - configStorage: FileAppShotsConfigStorage(), - galleryTemplateRepo: AggregateGalleryTemplateRepository.shared + templateRepo: ClientProvider.makeTemplateRepository(), + themeRepo: ClientProvider.makeThemes(), + htmlRenderer: ClientProvider.makeHTMLRenderer(), + configStorage: ClientProvider.makeAppShotsConfigStorage(), + galleryTemplateRepo: ClientProvider.makeGalleryTemplateRepository() ).addRoutes(to: v1) } } diff --git a/Sources/ASCCommand/Commands/Web/WebCommand.swift b/Sources/ASCCommand/Commands/Web/WebCommand.swift index 321460b8..0824c959 100644 --- a/Sources/ASCCommand/Commands/Web/WebCommand.swift +++ b/Sources/ASCCommand/Commands/Web/WebCommand.swift @@ -1,7 +1,6 @@ import ArgumentParser import Foundation -import Domain -import Infrastructure +import ASCKit import ASCPlugin struct WebServerCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersCreate.swift b/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersCreate.swift index 8ff27058..367bf709 100644 --- a/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersCreate.swift +++ b/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersCreate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct WinBackOffersCreate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersDelete.swift b/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersDelete.swift index 2f20d5ac..26e6fb6a 100644 --- a/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersDelete.swift +++ b/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersDelete.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct WinBackOffersDelete: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersList.swift b/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersList.swift index ea73ed44..856973f1 100644 --- a/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersList.swift +++ b/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct WinBackOffersList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersPricesList.swift b/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersPricesList.swift index 98e40f37..942680a7 100644 --- a/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersPricesList.swift +++ b/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersPricesList.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct WinBackOffersPricesList: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersUpdate.swift b/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersUpdate.swift index 4b83abec..cd542e18 100644 --- a/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersUpdate.swift +++ b/Sources/ASCCommand/Commands/WinBackOffers/WinBackOffersUpdate.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct WinBackOffersUpdate: AsyncParsableCommand { static let configuration = CommandConfiguration( diff --git a/Sources/ASCCommand/Commands/XcodeCloud/XcodeCloudCommand.swift b/Sources/ASCCommand/Commands/XcodeCloud/XcodeCloudCommand.swift index e8f6caea..4cc56a55 100644 --- a/Sources/ASCCommand/Commands/XcodeCloud/XcodeCloudCommand.swift +++ b/Sources/ASCCommand/Commands/XcodeCloud/XcodeCloudCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit import Foundation struct XcodeCloudCommand: AsyncParsableCommand { diff --git a/Sources/ASCCommand/GlobalOptions.swift b/Sources/ASCCommand/GlobalOptions.swift index bb5d81ab..1228782e 100644 --- a/Sources/ASCCommand/GlobalOptions.swift +++ b/Sources/ASCCommand/GlobalOptions.swift @@ -1,5 +1,5 @@ import ArgumentParser -import Domain +import ASCKit struct GlobalOptions: ParsableArguments { @Option(name: .long, help: "Output format: json, table, markdown") diff --git a/Sources/ASCCommand/OutputFormatter.swift b/Sources/ASCCommand/OutputFormatter.swift index c4a40363..ae3bf24d 100644 --- a/Sources/ASCCommand/OutputFormatter.swift +++ b/Sources/ASCCommand/OutputFormatter.swift @@ -1,4 +1,4 @@ -import Domain +import ASCKit import Foundation // MARK: - Agent-first encoding helpers diff --git a/Sources/Domain/AppWall/AppWallRepository.swift b/Sources/ASCKit/AppWall/AppWall.swift similarity index 84% rename from Sources/Domain/AppWall/AppWallRepository.swift rename to Sources/ASCKit/AppWall/AppWall.swift index 6c4490b3..a4291e6b 100644 --- a/Sources/Domain/AppWall/AppWallRepository.swift +++ b/Sources/ASCKit/AppWall/AppWall.swift @@ -1,7 +1,7 @@ import Mockable @Mockable -public protocol AppWallRepository: Sendable { +public protocol AppWall: Sendable { /// Forks the upstream repo, adds `app` to `homepage/apps.json`, and opens a pull request. /// - Returns: The created pull request details. func submit(app: AppWallApp) async throws -> AppWallSubmission diff --git a/Sources/Domain/AppWall/AppWallApp.swift b/Sources/ASCKit/AppWall/AppWallApp.swift similarity index 100% rename from Sources/Domain/AppWall/AppWallApp.swift rename to Sources/ASCKit/AppWall/AppWallApp.swift diff --git a/Sources/Domain/AppWall/AppWallError.swift b/Sources/ASCKit/AppWall/AppWallError.swift similarity index 100% rename from Sources/Domain/AppWall/AppWallError.swift rename to Sources/ASCKit/AppWall/AppWallError.swift diff --git a/Sources/Domain/AppWall/AppWallSubmission.swift b/Sources/ASCKit/AppWall/AppWallSubmission.swift similarity index 100% rename from Sources/Domain/AppWall/AppWallSubmission.swift rename to Sources/ASCKit/AppWall/AppWallSubmission.swift diff --git a/Sources/Infrastructure/AppWall/GitHubAppWallRepository.swift b/Sources/ASCKit/AppWall/Internal/GitHubAppWall.swift similarity index 99% rename from Sources/Infrastructure/AppWall/GitHubAppWallRepository.swift rename to Sources/ASCKit/AppWall/Internal/GitHubAppWall.swift index f9b7df6d..972a76a2 100644 --- a/Sources/Infrastructure/AppWall/GitHubAppWallRepository.swift +++ b/Sources/ASCKit/AppWall/Internal/GitHubAppWall.swift @@ -1,7 +1,6 @@ -import Domain import Foundation -public struct GitHubAppWallRepository: AppWallRepository { +public struct GitHubAppWall: AppWall { private let token: String private let httpClient: any HTTPPerforming private let upstreamOwner: String @@ -25,7 +24,7 @@ public struct GitHubAppWallRepository: AppWallRepository { self.sleep = sleep ?? { try await Task.sleep(for: $0) } } - // MARK: - AppWallRepository + // MARK: - AppWall public func submit(app: AppWallApp) async throws -> AppWallSubmission { // 1. Resolve authenticated GitHub username diff --git a/Sources/Domain/Apps/App+RESTRoutes.swift b/Sources/ASCKit/Apps/App+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/App+RESTRoutes.swift rename to Sources/ASCKit/Apps/App+RESTRoutes.swift diff --git a/Sources/Domain/Apps/App.swift b/Sources/ASCKit/Apps/App.swift similarity index 100% rename from Sources/Domain/Apps/App.swift rename to Sources/ASCKit/Apps/App.swift diff --git a/Sources/Domain/Apps/AppClips/AppClip.swift b/Sources/ASCKit/Apps/AppClips/AppClip.swift similarity index 100% rename from Sources/Domain/Apps/AppClips/AppClip.swift rename to Sources/ASCKit/Apps/AppClips/AppClip.swift diff --git a/Sources/Domain/Apps/AppClips/AppClipRepository.swift b/Sources/ASCKit/Apps/AppClips/AppClipRepository.swift similarity index 100% rename from Sources/Domain/Apps/AppClips/AppClipRepository.swift rename to Sources/ASCKit/Apps/AppClips/AppClipRepository.swift diff --git a/Sources/Domain/Apps/AppClips/Experiences/AppClipDefaultExperience.swift b/Sources/ASCKit/Apps/AppClips/Experiences/AppClipDefaultExperience.swift similarity index 100% rename from Sources/Domain/Apps/AppClips/Experiences/AppClipDefaultExperience.swift rename to Sources/ASCKit/Apps/AppClips/Experiences/AppClipDefaultExperience.swift diff --git a/Sources/Domain/Apps/AppClips/Experiences/Localizations/AppClipDefaultExperienceLocalization.swift b/Sources/ASCKit/Apps/AppClips/Experiences/Localizations/AppClipDefaultExperienceLocalization.swift similarity index 100% rename from Sources/Domain/Apps/AppClips/Experiences/Localizations/AppClipDefaultExperienceLocalization.swift rename to Sources/ASCKit/Apps/AppClips/Experiences/Localizations/AppClipDefaultExperienceLocalization.swift diff --git a/Sources/Infrastructure/Apps/AppClips/SDKAppClipRepository.swift b/Sources/ASCKit/Apps/AppClips/Internal/SDKAppClipRepository.swift similarity index 84% rename from Sources/Infrastructure/Apps/AppClips/SDKAppClipRepository.swift rename to Sources/ASCKit/Apps/AppClips/Internal/SDKAppClipRepository.swift index 35491acb..553a1d34 100644 --- a/Sources/Infrastructure/Apps/AppClips/SDKAppClipRepository.swift +++ b/Sources/ASCKit/Apps/AppClips/Internal/SDKAppClipRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKAppClipRepository: AppClipRepository, @unchecked Sendable { private let client: any APIClient @@ -8,19 +7,19 @@ public struct SDKAppClipRepository: AppClipRepository, @unchecked Sendable { self.client = client } - public func listAppClips(appId: String) async throws -> [Domain.AppClip] { + public func listAppClips(appId: String) async throws -> [ASCKit.AppClip] { let request = APIEndpoint.v1.apps.id(appId).appClips.get() let response = try await client.request(request) return response.data.map { mapAppClip($0, appId: appId) } } - public func listExperiences(appClipId: String) async throws -> [Domain.AppClipDefaultExperience] { + public func listExperiences(appClipId: String) async throws -> [ASCKit.AppClipDefaultExperience] { let request = APIEndpoint.v1.appClips.id(appClipId).appClipDefaultExperiences.get() let response = try await client.request(request) return response.data.map { mapExperience($0, appClipId: appClipId) } } - public func createExperience(appClipId: String, action: Domain.AppClipAction?) async throws -> Domain.AppClipDefaultExperience { + public func createExperience(appClipId: String, action: ASCKit.AppClipAction?) async throws -> ASCKit.AppClipDefaultExperience { let sdkAction = action.map { mapActionToSDK($0) } let body = AppClipDefaultExperienceCreateRequest( data: .init( @@ -37,13 +36,13 @@ public struct SDKAppClipRepository: AppClipRepository, @unchecked Sendable { try await client.request(APIEndpoint.v1.appClipDefaultExperiences.id(id).delete) } - public func listLocalizations(experienceId: String) async throws -> [Domain.AppClipDefaultExperienceLocalization] { + public func listLocalizations(experienceId: String) async throws -> [ASCKit.AppClipDefaultExperienceLocalization] { let request = APIEndpoint.v1.appClipDefaultExperiences.id(experienceId).appClipDefaultExperienceLocalizations.get() let response = try await client.request(request) return response.data.map { mapLocalization($0, experienceId: experienceId) } } - public func createLocalization(experienceId: String, locale: String, subtitle: String?) async throws -> Domain.AppClipDefaultExperienceLocalization { + public func createLocalization(experienceId: String, locale: String, subtitle: String?) async throws -> ASCKit.AppClipDefaultExperienceLocalization { let body = AppClipDefaultExperienceLocalizationCreateRequest( data: .init( type: .appClipDefaultExperienceLocalizations, @@ -64,8 +63,8 @@ public struct SDKAppClipRepository: AppClipRepository, @unchecked Sendable { private func mapAppClip( _ sdkClip: AppStoreConnect_Swift_SDK.AppClip, appId: String - ) -> Domain.AppClip { - Domain.AppClip( + ) -> ASCKit.AppClip { + ASCKit.AppClip( id: sdkClip.id, appId: appId, bundleId: sdkClip.attributes?.bundleID @@ -75,8 +74,8 @@ public struct SDKAppClipRepository: AppClipRepository, @unchecked Sendable { private func mapExperience( _ sdkExp: AppStoreConnect_Swift_SDK.AppClipDefaultExperience, appClipId: String - ) -> Domain.AppClipDefaultExperience { - Domain.AppClipDefaultExperience( + ) -> ASCKit.AppClipDefaultExperience { + ASCKit.AppClipDefaultExperience( id: sdkExp.id, appClipId: appClipId, action: sdkExp.attributes?.action.map { mapActionFromSDK($0) } @@ -86,8 +85,8 @@ public struct SDKAppClipRepository: AppClipRepository, @unchecked Sendable { private func mapLocalization( _ sdkLoc: AppStoreConnect_Swift_SDK.AppClipDefaultExperienceLocalization, experienceId: String - ) -> Domain.AppClipDefaultExperienceLocalization { - Domain.AppClipDefaultExperienceLocalization( + ) -> ASCKit.AppClipDefaultExperienceLocalization { + ASCKit.AppClipDefaultExperienceLocalization( id: sdkLoc.id, experienceId: experienceId, locale: sdkLoc.attributes?.locale ?? "", @@ -95,7 +94,7 @@ public struct SDKAppClipRepository: AppClipRepository, @unchecked Sendable { ) } - private func mapActionFromSDK(_ sdkAction: AppStoreConnect_Swift_SDK.AppClipAction) -> Domain.AppClipAction { + private func mapActionFromSDK(_ sdkAction: AppStoreConnect_Swift_SDK.AppClipAction) -> ASCKit.AppClipAction { switch sdkAction { case .open: return .open case .view: return .view @@ -103,7 +102,7 @@ public struct SDKAppClipRepository: AppClipRepository, @unchecked Sendable { } } - private func mapActionToSDK(_ action: Domain.AppClipAction) -> AppStoreConnect_Swift_SDK.AppClipAction { + private func mapActionToSDK(_ action: ASCKit.AppClipAction) -> AppStoreConnect_Swift_SDK.AppClipAction { switch action { case .open: return .open case .view: return .view diff --git a/Sources/Domain/Apps/AppInfos/AgeRatingDeclaration.swift b/Sources/ASCKit/Apps/AppInfos/AgeRatingDeclaration.swift similarity index 100% rename from Sources/Domain/Apps/AppInfos/AgeRatingDeclaration.swift rename to Sources/ASCKit/Apps/AppInfos/AgeRatingDeclaration.swift diff --git a/Sources/Domain/Apps/AppInfos/AgeRatingDeclarationRepository.swift b/Sources/ASCKit/Apps/AppInfos/AgeRatingDeclarationRepository.swift similarity index 100% rename from Sources/Domain/Apps/AppInfos/AgeRatingDeclarationRepository.swift rename to Sources/ASCKit/Apps/AppInfos/AgeRatingDeclarationRepository.swift diff --git a/Sources/Domain/Apps/AppInfos/AppCategory.swift b/Sources/ASCKit/Apps/AppInfos/AppCategory.swift similarity index 100% rename from Sources/Domain/Apps/AppInfos/AppCategory.swift rename to Sources/ASCKit/Apps/AppInfos/AppCategory.swift diff --git a/Sources/Domain/Apps/AppInfos/AppInfo+RESTRoutes.swift b/Sources/ASCKit/Apps/AppInfos/AppInfo+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/AppInfos/AppInfo+RESTRoutes.swift rename to Sources/ASCKit/Apps/AppInfos/AppInfo+RESTRoutes.swift diff --git a/Sources/Domain/Apps/AppInfos/AppInfo.swift b/Sources/ASCKit/Apps/AppInfos/AppInfo.swift similarity index 100% rename from Sources/Domain/Apps/AppInfos/AppInfo.swift rename to Sources/ASCKit/Apps/AppInfos/AppInfo.swift diff --git a/Sources/Domain/Apps/AppInfos/AppInfoLocalization.swift b/Sources/ASCKit/Apps/AppInfos/AppInfoLocalization.swift similarity index 100% rename from Sources/Domain/Apps/AppInfos/AppInfoLocalization.swift rename to Sources/ASCKit/Apps/AppInfos/AppInfoLocalization.swift diff --git a/Sources/Domain/Apps/AppInfos/AppInfoRepository.swift b/Sources/ASCKit/Apps/AppInfos/AppInfoRepository.swift similarity index 100% rename from Sources/Domain/Apps/AppInfos/AppInfoRepository.swift rename to Sources/ASCKit/Apps/AppInfos/AppInfoRepository.swift diff --git a/Sources/Infrastructure/Apps/AppInfos/SDKAgeRatingDeclarationRepository.swift b/Sources/ASCKit/Apps/AppInfos/Internal/SDKAgeRatingDeclarationRepository.swift similarity index 90% rename from Sources/Infrastructure/Apps/AppInfos/SDKAgeRatingDeclarationRepository.swift rename to Sources/ASCKit/Apps/AppInfos/Internal/SDKAgeRatingDeclarationRepository.swift index a7abc4f0..b40a1c3e 100644 --- a/Sources/Infrastructure/Apps/AppInfos/SDKAgeRatingDeclarationRepository.swift +++ b/Sources/ASCKit/Apps/AppInfos/Internal/SDKAgeRatingDeclarationRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKAgeRatingDeclarationRepository: AgeRatingDeclarationRepository, @unchecked Sendable { @@ -9,13 +8,13 @@ public struct SDKAgeRatingDeclarationRepository: AgeRatingDeclarationRepository, self.client = client } - public func getDeclaration(appInfoId: String) async throws -> Domain.AgeRatingDeclaration { + public func getDeclaration(appInfoId: String) async throws -> ASCKit.AgeRatingDeclaration { let request = APIEndpoint.v1.appInfos.id(appInfoId).ageRatingDeclaration.get() let response = try await client.request(request) return mapDeclaration(response.data, appInfoId: appInfoId) } - public func updateDeclaration(id: String, update: Domain.AgeRatingDeclarationUpdate) async throws -> Domain.AgeRatingDeclaration { + public func updateDeclaration(id: String, update: ASCKit.AgeRatingDeclarationUpdate) async throws -> ASCKit.AgeRatingDeclaration { let body = AgeRatingDeclarationUpdateRequest( data: .init( type: .ageRatingDeclarations, @@ -33,9 +32,9 @@ public struct SDKAgeRatingDeclarationRepository: AgeRatingDeclarationRepository, private func mapDeclaration( _ sdk: AppStoreConnect_Swift_SDK.AgeRatingDeclaration, appInfoId: String - ) -> Domain.AgeRatingDeclaration { + ) -> ASCKit.AgeRatingDeclaration { let a = sdk.attributes - return Domain.AgeRatingDeclaration( + return ASCKit.AgeRatingDeclaration( id: sdk.id, appInfoId: appInfoId, isAdvertising: a?.isAdvertising, @@ -62,21 +61,21 @@ public struct SDKAgeRatingDeclarationRepository: AgeRatingDeclarationRepository, violenceCartoonOrFantasy: mapIntensity(a?.violenceCartoonOrFantasy), violenceRealisticProlongedGraphicOrSadistic: mapIntensity(a?.violenceRealisticProlongedGraphicOrSadistic), violenceRealistic: mapIntensity(a?.violenceRealistic), - kidsAgeBand: a?.kidsAgeBand.flatMap { Domain.KidsAgeBand(rawValue: $0.rawValue) }, - ageRatingOverride: a?.ageRatingOverrideV2.flatMap { Domain.AgeRatingOverride(rawValue: $0.rawValue) }, - koreaAgeRatingOverride: a?.koreaAgeRatingOverride.flatMap { Domain.KoreaAgeRatingOverride(rawValue: $0.rawValue) }, + kidsAgeBand: a?.kidsAgeBand.flatMap { ASCKit.KidsAgeBand(rawValue: $0.rawValue) }, + ageRatingOverride: a?.ageRatingOverrideV2.flatMap { ASCKit.AgeRatingOverride(rawValue: $0.rawValue) }, + koreaAgeRatingOverride: a?.koreaAgeRatingOverride.flatMap { ASCKit.KoreaAgeRatingOverride(rawValue: $0.rawValue) }, gracRatingClassificationNumber: a?.gracRatingClassificationNumber, developerAgeRatingInfoUrl: a?.developerAgeRatingInfoURL?.absoluteString ) } - private func mapIntensity(_ value: T?) -> Domain.ContentIntensity? where T.RawValue == String { + private func mapIntensity(_ value: T?) -> ASCKit.ContentIntensity? where T.RawValue == String { guard let value else { return nil } - return Domain.ContentIntensity(rawValue: value.rawValue) + return ASCKit.ContentIntensity(rawValue: value.rawValue) } private func mapUpdateAttributes( - _ update: Domain.AgeRatingDeclarationUpdate + _ update: ASCKit.AgeRatingDeclarationUpdate ) -> AgeRatingDeclarationUpdateRequest.Data.Attributes { .init( isAdvertising: update.isAdvertising, diff --git a/Sources/Infrastructure/Apps/AppInfos/SDKAppCategoryRepository.swift b/Sources/ASCKit/Apps/AppInfos/Internal/SDKAppCategoryRepository.swift similarity index 88% rename from Sources/Infrastructure/Apps/AppInfos/SDKAppCategoryRepository.swift rename to Sources/ASCKit/Apps/AppInfos/Internal/SDKAppCategoryRepository.swift index 6042ea31..2382553d 100644 --- a/Sources/Infrastructure/Apps/AppInfos/SDKAppCategoryRepository.swift +++ b/Sources/ASCKit/Apps/AppInfos/Internal/SDKAppCategoryRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKAppCategoryRepository: AppCategoryRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKAppCategoryRepository: AppCategoryRepository, @unchecked Sendab self.client = client } - public func listCategories(platform: String?) async throws -> [Domain.AppCategory] { + public func listCategories(platform: String?) async throws -> [ASCKit.AppCategory] { let filterPlatforms: [APIEndpoint.V1.AppCategories.GetParameters.FilterPlatforms]? if let platform { filterPlatforms = APIEndpoint.V1.AppCategories.GetParameters.FilterPlatforms(rawValue: platform).map { [$0] } ?? [] @@ -26,7 +25,7 @@ public struct SDKAppCategoryRepository: AppCategoryRepository, @unchecked Sendab return topLevel + subcategories } - public func getCategory(id: String) async throws -> Domain.AppCategory { + public func getCategory(id: String) async throws -> ASCKit.AppCategory { let request = APIEndpoint.v1.appCategories.id(id).get() let response = try await client.request(request) return mapCategory(response.data) @@ -34,9 +33,9 @@ public struct SDKAppCategoryRepository: AppCategoryRepository, @unchecked Sendab // MARK: - Mapper - private func mapCategory(_ sdkCategory: AppStoreConnect_Swift_SDK.AppCategory) -> Domain.AppCategory { + private func mapCategory(_ sdkCategory: AppStoreConnect_Swift_SDK.AppCategory) -> ASCKit.AppCategory { let platforms = sdkCategory.attributes?.platforms?.map { $0.rawValue } ?? [] let parentId = sdkCategory.relationships?.parent?.data?.id - return Domain.AppCategory(id: sdkCategory.id, platforms: platforms, parentId: parentId) + return ASCKit.AppCategory(id: sdkCategory.id, platforms: platforms, parentId: parentId) } } diff --git a/Sources/Infrastructure/Apps/AppInfos/SDKAppInfoRepository.swift b/Sources/ASCKit/Apps/AppInfos/Internal/SDKAppInfoRepository.swift similarity index 93% rename from Sources/Infrastructure/Apps/AppInfos/SDKAppInfoRepository.swift rename to Sources/ASCKit/Apps/AppInfos/Internal/SDKAppInfoRepository.swift index 11ce080b..2117245a 100644 --- a/Sources/Infrastructure/Apps/AppInfos/SDKAppInfoRepository.swift +++ b/Sources/ASCKit/Apps/AppInfos/Internal/SDKAppInfoRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKAppInfoRepository: AppInfoRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKAppInfoRepository: AppInfoRepository, @unchecked Sendable { self.client = client } - public func listAppInfos(appId: String) async throws -> [Domain.AppInfo] { + public func listAppInfos(appId: String) async throws -> [ASCKit.AppInfo] { // `fields[appInfos]` alone returns only relationship `links`, not `data.id`. // `include=...` forces ASC to populate `data` so we can read the category ids. let request = APIEndpoint.v1.apps.id(appId).appInfos.get( @@ -29,13 +28,13 @@ public struct SDKAppInfoRepository: AppInfoRepository, @unchecked Sendable { return response.data.map { mapAppInfo($0, appId: appId) } } - public func listLocalizations(appInfoId: String) async throws -> [Domain.AppInfoLocalization] { + public func listLocalizations(appInfoId: String) async throws -> [ASCKit.AppInfoLocalization] { let request = APIEndpoint.v1.appInfos.id(appInfoId).appInfoLocalizations.get() let response = try await client.request(request) return response.data.map { mapLocalization($0, appInfoId: appInfoId) } } - public func createLocalization(appInfoId: String, locale: String, name: String) async throws -> Domain.AppInfoLocalization { + public func createLocalization(appInfoId: String, locale: String, name: String) async throws -> ASCKit.AppInfoLocalization { let body = AppInfoLocalizationCreateRequest( data: .init( type: .appInfoLocalizations, @@ -47,7 +46,7 @@ public struct SDKAppInfoRepository: AppInfoRepository, @unchecked Sendable { return mapLocalization(response.data, appInfoId: appInfoId) } - public func updateLocalization(id: String, name: String?, subtitle: String?, privacyPolicyUrl: String?, privacyChoicesUrl: String?, privacyPolicyText: String?) async throws -> Domain.AppInfoLocalization { + public func updateLocalization(id: String, name: String?, subtitle: String?, privacyPolicyUrl: String?, privacyChoicesUrl: String?, privacyPolicyText: String?) async throws -> ASCKit.AppInfoLocalization { let body = AppInfoLocalizationUpdateRequest( data: .init( type: .appInfoLocalizations, @@ -72,7 +71,7 @@ public struct SDKAppInfoRepository: AppInfoRepository, @unchecked Sendable { secondaryCategoryId: String?, secondarySubcategoryOneId: String?, secondarySubcategoryTwoId: String? - ) async throws -> Domain.AppInfo { + ) async throws -> ASCKit.AppInfo { let relationships = AppInfoUpdateRequest.Data.Relationships( primaryCategory: primaryCategoryId.map { .init(data: .init(type: .appCategories, id: $0)) }, primarySubcategoryOne: primarySubcategoryOneId.map { .init(data: .init(type: .appCategories, id: $0)) }, @@ -92,8 +91,8 @@ public struct SDKAppInfoRepository: AppInfoRepository, @unchecked Sendable { private func mapAppInfo( _ sdkInfo: AppStoreConnect_Swift_SDK.AppInfo, appId: String - ) -> Domain.AppInfo { - Domain.AppInfo( + ) -> ASCKit.AppInfo { + ASCKit.AppInfo( id: sdkInfo.id, appId: appId, appStoreState: sdkInfo.attributes?.appStoreState?.rawValue, @@ -111,8 +110,8 @@ public struct SDKAppInfoRepository: AppInfoRepository, @unchecked Sendable { private func mapLocalization( _ sdkLoc: AppStoreConnect_Swift_SDK.AppInfoLocalization, appInfoId: String - ) -> Domain.AppInfoLocalization { - Domain.AppInfoLocalization( + ) -> ASCKit.AppInfoLocalization { + ASCKit.AppInfoLocalization( id: sdkLoc.id, appInfoId: appInfoId, locale: sdkLoc.attributes?.locale ?? "", diff --git a/Sources/Domain/Apps/AppRepository.swift b/Sources/ASCKit/Apps/AppRepository.swift similarity index 100% rename from Sources/Domain/Apps/AppRepository.swift rename to Sources/ASCKit/Apps/AppRepository.swift diff --git a/Sources/Domain/Apps/AssetLibrary/AppAssetLibrary.swift b/Sources/ASCKit/Apps/AssetLibrary/AppAssetLibrary.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/AppAssetLibrary.swift rename to Sources/ASCKit/Apps/AssetLibrary/AppAssetLibrary.swift diff --git a/Sources/Domain/Apps/AssetLibrary/AssetLibrary+RESTRoutes.swift b/Sources/ASCKit/Apps/AssetLibrary/AssetLibrary+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/AssetLibrary+RESTRoutes.swift rename to Sources/ASCKit/Apps/AssetLibrary/AssetLibrary+RESTRoutes.swift diff --git a/Sources/Domain/Apps/AssetLibrary/AssetLibraryRepository.swift b/Sources/ASCKit/Apps/AssetLibrary/AssetLibraryRepository.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/AssetLibraryRepository.swift rename to Sources/ASCKit/Apps/AssetLibrary/AssetLibraryRepository.swift diff --git a/Sources/Domain/Apps/AssetLibrary/AssetLibraryTypes.swift b/Sources/ASCKit/Apps/AssetLibrary/AssetLibraryTypes.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/AssetLibraryTypes.swift rename to Sources/ASCKit/Apps/AssetLibrary/AssetLibraryTypes.swift diff --git a/Sources/Domain/Apps/AssetLibrary/AssetProcessingWait.swift b/Sources/ASCKit/Apps/AssetLibrary/AssetProcessingWait.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/AssetProcessingWait.swift rename to Sources/ASCKit/Apps/AssetLibrary/AssetProcessingWait.swift diff --git a/Sources/Infrastructure/Apps/AssetLibrary/Images/SDKLibraryImageRepository.swift b/Sources/ASCKit/Apps/AssetLibrary/Images/Internal/SDKLibraryImageRepository.swift similarity index 99% rename from Sources/Infrastructure/Apps/AssetLibrary/Images/SDKLibraryImageRepository.swift rename to Sources/ASCKit/Apps/AssetLibrary/Images/Internal/SDKLibraryImageRepository.swift index 625b9d36..2d25f56d 100644 --- a/Sources/Infrastructure/Apps/AssetLibrary/Images/SDKLibraryImageRepository.swift +++ b/Sources/ASCKit/Apps/AssetLibrary/Images/Internal/SDKLibraryImageRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKLibraryImageRepository: LibraryImageRepository, @unchecked Sendable { diff --git a/Sources/Domain/Apps/AssetLibrary/Images/LibraryImage.swift b/Sources/ASCKit/Apps/AssetLibrary/Images/LibraryImage.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/Images/LibraryImage.swift rename to Sources/ASCKit/Apps/AssetLibrary/Images/LibraryImage.swift diff --git a/Sources/Domain/Apps/AssetLibrary/Images/LibraryImageRepository.swift b/Sources/ASCKit/Apps/AssetLibrary/Images/LibraryImageRepository.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/Images/LibraryImageRepository.swift rename to Sources/ASCKit/Apps/AssetLibrary/Images/LibraryImageRepository.swift diff --git a/Sources/Domain/Apps/AssetLibrary/Import/ScreenshotImport+RESTRoutes.swift b/Sources/ASCKit/Apps/AssetLibrary/Import/ScreenshotImport+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/Import/ScreenshotImport+RESTRoutes.swift rename to Sources/ASCKit/Apps/AssetLibrary/Import/ScreenshotImport+RESTRoutes.swift diff --git a/Sources/Domain/Apps/AssetLibrary/Import/ScreenshotImportGroupResult.swift b/Sources/ASCKit/Apps/AssetLibrary/Import/ScreenshotImportGroupResult.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/Import/ScreenshotImportGroupResult.swift rename to Sources/ASCKit/Apps/AssetLibrary/Import/ScreenshotImportGroupResult.swift diff --git a/Sources/Domain/Apps/AssetLibrary/Import/ScreenshotImportPlan.swift b/Sources/ASCKit/Apps/AssetLibrary/Import/ScreenshotImportPlan.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/Import/ScreenshotImportPlan.swift rename to Sources/ASCKit/Apps/AssetLibrary/Import/ScreenshotImportPlan.swift diff --git a/Sources/Infrastructure/Apps/AssetLibrary/AssetLibraryDTOs.swift b/Sources/ASCKit/Apps/AssetLibrary/Internal/AssetLibraryDTOs.swift similarity index 100% rename from Sources/Infrastructure/Apps/AssetLibrary/AssetLibraryDTOs.swift rename to Sources/ASCKit/Apps/AssetLibrary/Internal/AssetLibraryDTOs.swift diff --git a/Sources/Infrastructure/Apps/AssetLibrary/SDKAssetLibraryRepository.swift b/Sources/ASCKit/Apps/AssetLibrary/Internal/SDKAssetLibraryRepository.swift similarity index 95% rename from Sources/Infrastructure/Apps/AssetLibrary/SDKAssetLibraryRepository.swift rename to Sources/ASCKit/Apps/AssetLibrary/Internal/SDKAssetLibraryRepository.swift index 8272c170..bcc09963 100644 --- a/Sources/Infrastructure/Apps/AssetLibrary/SDKAssetLibraryRepository.swift +++ b/Sources/ASCKit/Apps/AssetLibrary/Internal/SDKAssetLibraryRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKAssetLibraryRepository: AssetLibraryRepository, @unchecked Sendable { @@ -9,9 +8,9 @@ public struct SDKAssetLibraryRepository: AssetLibraryRepository, @unchecked Send self.client = client } - public func getAssetLibrary(appId: String) async throws -> Domain.AppAssetLibrary { + public func getAssetLibrary(appId: String) async throws -> ASCKit.AppAssetLibrary { let response = try await client.request(APIEndpoint.v1.apps.id(appId).assetLibrary.get()) - return Domain.AppAssetLibrary(id: response.data.id, appId: appId) + return ASCKit.AppAssetLibrary(id: response.data.id, appId: appId) } public func listPlacementGroups(placementType: AssetPlacementType?, feature: String?) async throws -> [AssetPlacementGroup] { diff --git a/Sources/Domain/Apps/AssetLibrary/Placements/AssetPlacement.swift b/Sources/ASCKit/Apps/AssetLibrary/Placements/AssetPlacement.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/Placements/AssetPlacement.swift rename to Sources/ASCKit/Apps/AssetLibrary/Placements/AssetPlacement.swift diff --git a/Sources/Domain/Apps/AssetLibrary/Placements/AssetPlacementRepository.swift b/Sources/ASCKit/Apps/AssetLibrary/Placements/AssetPlacementRepository.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/Placements/AssetPlacementRepository.swift rename to Sources/ASCKit/Apps/AssetLibrary/Placements/AssetPlacementRepository.swift diff --git a/Sources/Infrastructure/Apps/AssetLibrary/Placements/AssetPlacementDTOs.swift b/Sources/ASCKit/Apps/AssetLibrary/Placements/Internal/AssetPlacementDTOs.swift similarity index 99% rename from Sources/Infrastructure/Apps/AssetLibrary/Placements/AssetPlacementDTOs.swift rename to Sources/ASCKit/Apps/AssetLibrary/Placements/Internal/AssetPlacementDTOs.swift index d9b2018f..721e6550 100644 --- a/Sources/Infrastructure/Apps/AssetLibrary/Placements/AssetPlacementDTOs.swift +++ b/Sources/ASCKit/Apps/AssetLibrary/Placements/Internal/AssetPlacementDTOs.swift @@ -1,4 +1,3 @@ -import Domain import Foundation // MARK: - Responses (see AssetLibraryDTOs.swift for why asc decodes its own types) diff --git a/Sources/Infrastructure/Apps/AssetLibrary/Placements/SDKAssetPlacementRepository.swift b/Sources/ASCKit/Apps/AssetLibrary/Placements/Internal/SDKAssetPlacementRepository.swift similarity index 99% rename from Sources/Infrastructure/Apps/AssetLibrary/Placements/SDKAssetPlacementRepository.swift rename to Sources/ASCKit/Apps/AssetLibrary/Placements/Internal/SDKAssetPlacementRepository.swift index 3ace294d..54b44d0d 100644 --- a/Sources/Infrastructure/Apps/AssetLibrary/Placements/SDKAssetPlacementRepository.swift +++ b/Sources/ASCKit/Apps/AssetLibrary/Placements/Internal/SDKAssetPlacementRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKAssetPlacementRepository: AssetPlacementRepository, @unchecked Sendable { diff --git a/Sources/Domain/Apps/AssetLibrary/RefData/AssetPlacementGroup.swift b/Sources/ASCKit/Apps/AssetLibrary/RefData/AssetPlacementGroup.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/RefData/AssetPlacementGroup.swift rename to Sources/ASCKit/Apps/AssetLibrary/RefData/AssetPlacementGroup.swift diff --git a/Sources/Infrastructure/Apps/AssetLibrary/Videos/SDKLibraryVideoRepository.swift b/Sources/ASCKit/Apps/AssetLibrary/Videos/Internal/SDKLibraryVideoRepository.swift similarity index 99% rename from Sources/Infrastructure/Apps/AssetLibrary/Videos/SDKLibraryVideoRepository.swift rename to Sources/ASCKit/Apps/AssetLibrary/Videos/Internal/SDKLibraryVideoRepository.swift index 14c46bdd..ebfeb464 100644 --- a/Sources/Infrastructure/Apps/AssetLibrary/Videos/SDKLibraryVideoRepository.swift +++ b/Sources/ASCKit/Apps/AssetLibrary/Videos/Internal/SDKLibraryVideoRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKLibraryVideoRepository: LibraryVideoRepository, @unchecked Sendable { diff --git a/Sources/Domain/Apps/AssetLibrary/Videos/LibraryVideo.swift b/Sources/ASCKit/Apps/AssetLibrary/Videos/LibraryVideo.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/Videos/LibraryVideo.swift rename to Sources/ASCKit/Apps/AssetLibrary/Videos/LibraryVideo.swift diff --git a/Sources/Domain/Apps/AssetLibrary/Videos/LibraryVideoRepository.swift b/Sources/ASCKit/Apps/AssetLibrary/Videos/LibraryVideoRepository.swift similarity index 100% rename from Sources/Domain/Apps/AssetLibrary/Videos/LibraryVideoRepository.swift rename to Sources/ASCKit/Apps/AssetLibrary/Videos/LibraryVideoRepository.swift diff --git a/Sources/Domain/Apps/Availability/AppAvailability.swift b/Sources/ASCKit/Apps/Availability/AppAvailability.swift similarity index 100% rename from Sources/Domain/Apps/Availability/AppAvailability.swift rename to Sources/ASCKit/Apps/Availability/AppAvailability.swift diff --git a/Sources/Domain/Apps/Availability/AppAvailabilityRepository.swift b/Sources/ASCKit/Apps/Availability/AppAvailabilityRepository.swift similarity index 100% rename from Sources/Domain/Apps/Availability/AppAvailabilityRepository.swift rename to Sources/ASCKit/Apps/Availability/AppAvailabilityRepository.swift diff --git a/Sources/Domain/Apps/Availability/AppTerritoryAvailability.swift b/Sources/ASCKit/Apps/Availability/AppTerritoryAvailability.swift similarity index 100% rename from Sources/Domain/Apps/Availability/AppTerritoryAvailability.swift rename to Sources/ASCKit/Apps/Availability/AppTerritoryAvailability.swift diff --git a/Sources/Infrastructure/Apps/Availability/SDKAppAvailabilityRepository.swift b/Sources/ASCKit/Apps/Availability/Internal/SDKAppAvailabilityRepository.swift similarity index 93% rename from Sources/Infrastructure/Apps/Availability/SDKAppAvailabilityRepository.swift rename to Sources/ASCKit/Apps/Availability/Internal/SDKAppAvailabilityRepository.swift index 9ca7bed1..6fc45449 100644 --- a/Sources/Infrastructure/Apps/Availability/SDKAppAvailabilityRepository.swift +++ b/Sources/ASCKit/Apps/Availability/Internal/SDKAppAvailabilityRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKAppAvailabilityRepository: AppAvailabilityRepository, @unchecked Sendable { private let client: any APIClient @@ -17,7 +16,7 @@ public struct SDKAppAvailabilityRepository: AppAvailabilityRepository, @unchecke /// The territory code (e.g. `USA`) only appears via the territory relationship — /// `TerritoryAvailability.id` itself is an opaque base64 blob — so include the /// relationship and read its `data.id`. - public func getAppAvailability(appId: String) async throws -> Domain.AppAvailability? { + public func getAppAvailability(appId: String) async throws -> ASCKit.AppAvailability? { let parentRequest = APIEndpoint.v1.apps.id(appId).appAvailabilityV2.get(parameters: .init( fieldsAppAvailabilities: [.availableInNewTerritories] )) @@ -37,7 +36,7 @@ public struct SDKAppAvailabilityRepository: AppAvailabilityRepository, @unchecke let territoriesResponse = try await client.request(territoriesRequest) let territories = territoriesResponse.data.compactMap { mapTerritoryAvailability($0) } - return Domain.AppAvailability( + return ASCKit.AppAvailability( id: availabilityId, appId: appId, isAvailableInNewTerritories: parent.data.attributes?.isAvailableInNewTerritories ?? false, @@ -49,7 +48,7 @@ public struct SDKAppAvailabilityRepository: AppAvailabilityRepository, @unchecke appId: String, isAvailableInNewTerritories: Bool, territoryIds: [String] - ) async throws -> Domain.AppAvailability { + ) async throws -> ASCKit.AppAvailability { // Each territory is an inline-created territoryAvailability, correlated by a `${...}` local id. let localIds = territoryIds.map { "${ta-\($0)}" } let body = AppAvailabilityV2CreateRequest( @@ -80,12 +79,12 @@ public struct SDKAppAvailabilityRepository: AppAvailabilityRepository, @unchecke private func mapTerritoryAvailability( _ sdk: AppStoreConnect_Swift_SDK.TerritoryAvailability - ) -> Domain.AppTerritoryAvailability? { + ) -> ASCKit.AppTerritoryAvailability? { guard let territoryId = sdk.relationships?.territory?.data?.id else { return nil } let contentStatuses = (sdk.attributes?.contentStatuses ?? []).compactMap { sdkStatus in - Domain.ContentStatus(rawValue: sdkStatus.rawValue) + ASCKit.ContentStatus(rawValue: sdkStatus.rawValue) } - return Domain.AppTerritoryAvailability( + return ASCKit.AppTerritoryAvailability( id: sdk.id, territoryId: territoryId, isAvailable: sdk.attributes?.isAvailable ?? false, diff --git a/Sources/Domain/Apps/Builds/BetaBuildLocalization.swift b/Sources/ASCKit/Apps/Builds/BetaBuildLocalization.swift similarity index 100% rename from Sources/Domain/Apps/Builds/BetaBuildLocalization.swift rename to Sources/ASCKit/Apps/Builds/BetaBuildLocalization.swift diff --git a/Sources/Domain/Apps/Builds/BetaBuildLocalizationRepository.swift b/Sources/ASCKit/Apps/Builds/BetaBuildLocalizationRepository.swift similarity index 100% rename from Sources/Domain/Apps/Builds/BetaBuildLocalizationRepository.swift rename to Sources/ASCKit/Apps/Builds/BetaBuildLocalizationRepository.swift diff --git a/Sources/Domain/Apps/Builds/Build.swift b/Sources/ASCKit/Apps/Builds/Build.swift similarity index 100% rename from Sources/Domain/Apps/Builds/Build.swift rename to Sources/ASCKit/Apps/Builds/Build.swift diff --git a/Sources/Domain/Apps/Builds/BuildRepository.swift b/Sources/ASCKit/Apps/Builds/BuildRepository.swift similarity index 100% rename from Sources/Domain/Apps/Builds/BuildRepository.swift rename to Sources/ASCKit/Apps/Builds/BuildRepository.swift diff --git a/Sources/Domain/Apps/Builds/BuildUpload.swift b/Sources/ASCKit/Apps/Builds/BuildUpload.swift similarity index 100% rename from Sources/Domain/Apps/Builds/BuildUpload.swift rename to Sources/ASCKit/Apps/Builds/BuildUpload.swift diff --git a/Sources/Domain/Apps/Builds/BuildUploadRepository.swift b/Sources/ASCKit/Apps/Builds/BuildUploadRepository.swift similarity index 100% rename from Sources/Domain/Apps/Builds/BuildUploadRepository.swift rename to Sources/ASCKit/Apps/Builds/BuildUploadRepository.swift diff --git a/Sources/Infrastructure/Apps/Builds/OpenAPIBuildRepository.swift b/Sources/ASCKit/Apps/Builds/Internal/OpenAPIBuildRepository.swift similarity index 93% rename from Sources/Infrastructure/Apps/Builds/OpenAPIBuildRepository.swift rename to Sources/ASCKit/Apps/Builds/Internal/OpenAPIBuildRepository.swift index 48fd40ee..8f2adc0c 100644 --- a/Sources/Infrastructure/Apps/Builds/OpenAPIBuildRepository.swift +++ b/Sources/ASCKit/Apps/Builds/Internal/OpenAPIBuildRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKBuildRepository: BuildRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKBuildRepository: BuildRepository, @unchecked Sendable { self.client = client } - public func listBuilds(appId: String?, platform: BuildUploadPlatform?, version: String?, limit: Int?) async throws -> PaginatedResponse { + public func listBuilds(appId: String?, platform: BuildUploadPlatform?, version: String?, limit: Int?) async throws -> PaginatedResponse { var filterApp: [String]? if let appId { filterApp = [appId] @@ -51,7 +50,7 @@ public struct SDKBuildRepository: BuildRepository, @unchecked Sendable { return PaginatedResponse(data: builds, nextCursor: nextCursor) } - public func getBuild(id: String) async throws -> Domain.Build { + public func getBuild(id: String) async throws -> ASCKit.Build { let request = APIEndpoint.v1.builds.id(id).get() let response = try await client.request(request) return mapBuild(response.data) @@ -71,7 +70,7 @@ public struct SDKBuildRepository: BuildRepository, @unchecked Sendable { try await client.request(APIEndpoint.v1.builds.id(buildId).relationships.betaGroups.delete(body)) } - public func updateBuildEncryptionCompliance(buildId: String, usesNonExemptEncryption: Bool) async throws -> Domain.Build { + public func updateBuildEncryptionCompliance(buildId: String, usesNonExemptEncryption: Bool) async throws -> ASCKit.Build { let body = BuildUpdateRequest( data: .init( type: .builds, @@ -83,12 +82,12 @@ public struct SDKBuildRepository: BuildRepository, @unchecked Sendable { return mapBuild(response.data) } - private func mapBuild(_ sdkBuild: AppStoreConnect_Swift_SDK.Build, preReleaseVersion: PrereleaseVersion? = nil) -> Domain.Build { + private func mapBuild(_ sdkBuild: AppStoreConnect_Swift_SDK.Build, preReleaseVersion: PrereleaseVersion? = nil) -> ASCKit.Build { let buildString = sdkBuild.attributes?.version let marketingVersion = preReleaseVersion?.attributes?.version let platform = preReleaseVersion?.attributes?.platform.flatMap { mapPlatform($0) } - return Domain.Build( + return ASCKit.Build( id: sdkBuild.id, version: marketingVersion ?? buildString ?? "", uploadedDate: sdkBuild.attributes?.uploadedDate, @@ -110,7 +109,7 @@ public struct SDKBuildRepository: BuildRepository, @unchecked Sendable { } } - private func mapProcessingState(_ state: AppStoreConnect_Swift_SDK.Build.Attributes.ProcessingState?) -> Domain.Build.ProcessingState { + private func mapProcessingState(_ state: AppStoreConnect_Swift_SDK.Build.Attributes.ProcessingState?) -> ASCKit.Build.ProcessingState { guard let state else { return .processing } switch state { case .processing: return .processing diff --git a/Sources/Infrastructure/Apps/Builds/SDKBetaBuildLocalizationRepository.swift b/Sources/ASCKit/Apps/Builds/Internal/SDKBetaBuildLocalizationRepository.swift similarity index 91% rename from Sources/Infrastructure/Apps/Builds/SDKBetaBuildLocalizationRepository.swift rename to Sources/ASCKit/Apps/Builds/Internal/SDKBetaBuildLocalizationRepository.swift index f9c0d633..89741ff3 100644 --- a/Sources/Infrastructure/Apps/Builds/SDKBetaBuildLocalizationRepository.swift +++ b/Sources/ASCKit/Apps/Builds/Internal/SDKBetaBuildLocalizationRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKBetaBuildLocalizationRepository: BetaBuildLocalizationRepository, @unchecked Sendable { private let client: any APIClient @@ -8,13 +7,13 @@ public struct SDKBetaBuildLocalizationRepository: BetaBuildLocalizationRepositor self.client = client } - public func listBetaBuildLocalizations(buildId: String) async throws -> [Domain.BetaBuildLocalization] { + public func listBetaBuildLocalizations(buildId: String) async throws -> [ASCKit.BetaBuildLocalization] { let request = APIEndpoint.v1.builds.id(buildId).betaBuildLocalizations.get() let response = try await client.request(request) return response.data.map { mapLocalization($0, buildId: buildId) } } - public func upsertBetaBuildLocalization(buildId: String, locale: String, whatsNew: String) async throws -> Domain.BetaBuildLocalization { + public func upsertBetaBuildLocalization(buildId: String, locale: String, whatsNew: String) async throws -> ASCKit.BetaBuildLocalization { // Check for existing localization for this build + locale let existing = try await listBetaBuildLocalizations(buildId: buildId) @@ -50,8 +49,8 @@ public struct SDKBetaBuildLocalizationRepository: BetaBuildLocalizationRepositor private func mapLocalization( _ sdk: AppStoreConnect_Swift_SDK.BetaBuildLocalization, buildId: String - ) -> Domain.BetaBuildLocalization { - Domain.BetaBuildLocalization( + ) -> ASCKit.BetaBuildLocalization { + ASCKit.BetaBuildLocalization( id: sdk.id, buildId: buildId, locale: sdk.attributes?.locale ?? "", diff --git a/Sources/Infrastructure/Apps/Builds/SDKBuildUploadRepository.swift b/Sources/ASCKit/Apps/Builds/Internal/SDKBuildUploadRepository.swift similarity index 91% rename from Sources/Infrastructure/Apps/Builds/SDKBuildUploadRepository.swift rename to Sources/ASCKit/Apps/Builds/Internal/SDKBuildUploadRepository.swift index 7959d30a..7a274264 100644 --- a/Sources/Infrastructure/Apps/Builds/SDKBuildUploadRepository.swift +++ b/Sources/ASCKit/Apps/Builds/Internal/SDKBuildUploadRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKBuildUploadRepository: BuildUploadRepository, @unchecked Sendable { @@ -15,11 +14,11 @@ public struct SDKBuildUploadRepository: BuildUploadRepository, @unchecked Sendab appId: String, version: String, buildNumber: String, - platform: Domain.BuildUploadPlatform, + platform: ASCKit.BuildUploadPlatform, fileURL: URL - ) async throws -> Domain.BuildUpload { + ) async throws -> ASCKit.BuildUpload { guard let sdkPlatform = AppStoreConnect_Swift_SDK.Platform(rawValue: platform.rawValue) else { - throw Domain.APIError.unknown("Unsupported platform: \(platform.rawValue)") + throw ASCKit.APIError.unknown("Unsupported platform: \(platform.rawValue)") } // Step 1: Create upload session @@ -84,7 +83,7 @@ public struct SDKBuildUploadRepository: BuildUploadRepository, @unchecked Sendab return mapBuildUpload(finalResponse.data, appId: appId) } - public func listBuildUploads(appId: String) async throws -> [Domain.BuildUpload] { + public func listBuildUploads(appId: String) async throws -> [ASCKit.BuildUpload] { let pages = try await client.requestAllPages( APIEndpoint.v1.apps.id(appId).buildUploads.get(parameters: .init(limit: 200)), nextCursor: { $0.meta?.paging.nextCursor } @@ -92,7 +91,7 @@ public struct SDKBuildUploadRepository: BuildUploadRepository, @unchecked Sendab return pages.flatMap(\.data).map { mapBuildUpload($0, appId: appId) } } - public func getBuildUpload(id: String) async throws -> Domain.BuildUpload { + public func getBuildUpload(id: String) async throws -> ASCKit.BuildUpload { let request = APIEndpoint.v1.buildUploads.id(id).get() let response = try await client.request(request) // appId is not available in a single-resource GET — inject empty string @@ -107,9 +106,9 @@ public struct SDKBuildUploadRepository: BuildUploadRepository, @unchecked Sendab private func mapBuildUpload( _ sdk: AppStoreConnect_Swift_SDK.BuildUpload, appId: String - ) -> Domain.BuildUpload { + ) -> ASCKit.BuildUpload { let sdkState = sdk.attributes?.state - return Domain.BuildUpload( + return ASCKit.BuildUpload( id: sdk.id, appId: appId, version: sdk.attributes?.cfBundleShortVersionString ?? "", @@ -124,14 +123,14 @@ public struct SDKBuildUploadRepository: BuildUploadRepository, @unchecked Sendab ) } - private func mapStateDetails(_ details: [AppStoreConnect_Swift_SDK.StateDetail]?) -> [Domain.BuildUploadStateDetail] { + private func mapStateDetails(_ details: [AppStoreConnect_Swift_SDK.StateDetail]?) -> [ASCKit.BuildUploadStateDetail] { (details ?? []).compactMap { detail in guard let code = detail.code, let desc = detail.description else { return nil } - return Domain.BuildUploadStateDetail(code: code, description: desc) + return ASCKit.BuildUploadStateDetail(code: code, description: desc) } } - private func mapState(_ sdkState: AppStoreConnect_Swift_SDK.BuildUploadState?) -> Domain.BuildUploadState { + private func mapState(_ sdkState: AppStoreConnect_Swift_SDK.BuildUploadState?) -> ASCKit.BuildUploadState { guard let sdkState else { return .awaitingUpload } switch sdkState { case .awaitingUpload: return .awaitingUpload @@ -141,7 +140,7 @@ public struct SDKBuildUploadRepository: BuildUploadRepository, @unchecked Sendab } } - private func mapPlatform(_ sdk: AppStoreConnect_Swift_SDK.Platform?) -> Domain.BuildUploadPlatform { + private func mapPlatform(_ sdk: AppStoreConnect_Swift_SDK.Platform?) -> ASCKit.BuildUploadPlatform { guard let sdk else { return .iOS } switch sdk { case .macOs: return .macOS diff --git a/Sources/Domain/Apps/Builds/NextBuildNumber.swift b/Sources/ASCKit/Apps/Builds/NextBuildNumber.swift similarity index 100% rename from Sources/Domain/Apps/Builds/NextBuildNumber.swift rename to Sources/ASCKit/Apps/Builds/NextBuildNumber.swift diff --git a/Sources/Infrastructure/Apps/Builds/XcodeBuild/ProcessXcodeBuildRunner.swift b/Sources/ASCKit/Apps/Builds/XcodeBuild/Internal/ProcessXcodeBuildRunner.swift similarity index 99% rename from Sources/Infrastructure/Apps/Builds/XcodeBuild/ProcessXcodeBuildRunner.swift rename to Sources/ASCKit/Apps/Builds/XcodeBuild/Internal/ProcessXcodeBuildRunner.swift index dce4d1f8..82124b4a 100644 --- a/Sources/Infrastructure/Apps/Builds/XcodeBuild/ProcessXcodeBuildRunner.swift +++ b/Sources/ASCKit/Apps/Builds/XcodeBuild/Internal/ProcessXcodeBuildRunner.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Error thrown when xcodebuild fails. diff --git a/Sources/Domain/Apps/Builds/XcodeBuild/XcodeBuildRunner.swift b/Sources/ASCKit/Apps/Builds/XcodeBuild/XcodeBuildRunner.swift similarity index 100% rename from Sources/Domain/Apps/Builds/XcodeBuild/XcodeBuildRunner.swift rename to Sources/ASCKit/Apps/Builds/XcodeBuild/XcodeBuildRunner.swift diff --git a/Sources/Domain/Apps/Experiments/AppStoreVersionExperiment+RESTRoutes.swift b/Sources/ASCKit/Apps/Experiments/AppStoreVersionExperiment+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/Experiments/AppStoreVersionExperiment+RESTRoutes.swift rename to Sources/ASCKit/Apps/Experiments/AppStoreVersionExperiment+RESTRoutes.swift diff --git a/Sources/Domain/Apps/Experiments/AppStoreVersionExperiment.swift b/Sources/ASCKit/Apps/Experiments/AppStoreVersionExperiment.swift similarity index 100% rename from Sources/Domain/Apps/Experiments/AppStoreVersionExperiment.swift rename to Sources/ASCKit/Apps/Experiments/AppStoreVersionExperiment.swift diff --git a/Sources/Domain/Apps/Experiments/ExperimentRepository.swift b/Sources/ASCKit/Apps/Experiments/ExperimentRepository.swift similarity index 100% rename from Sources/Domain/Apps/Experiments/ExperimentRepository.swift rename to Sources/ASCKit/Apps/Experiments/ExperimentRepository.swift diff --git a/Sources/Domain/Apps/Experiments/ExperimentTreatment.swift b/Sources/ASCKit/Apps/Experiments/ExperimentTreatment.swift similarity index 100% rename from Sources/Domain/Apps/Experiments/ExperimentTreatment.swift rename to Sources/ASCKit/Apps/Experiments/ExperimentTreatment.swift diff --git a/Sources/Domain/Apps/Experiments/ExperimentTreatmentLocalization.swift b/Sources/ASCKit/Apps/Experiments/ExperimentTreatmentLocalization.swift similarity index 100% rename from Sources/Domain/Apps/Experiments/ExperimentTreatmentLocalization.swift rename to Sources/ASCKit/Apps/Experiments/ExperimentTreatmentLocalization.swift diff --git a/Sources/Infrastructure/Apps/Experiments/SDKExperimentRepository.swift b/Sources/ASCKit/Apps/Experiments/Internal/SDKExperimentRepository.swift similarity index 88% rename from Sources/Infrastructure/Apps/Experiments/SDKExperimentRepository.swift rename to Sources/ASCKit/Apps/Experiments/Internal/SDKExperimentRepository.swift index 177cb580..fb1ae744 100644 --- a/Sources/Infrastructure/Apps/Experiments/SDKExperimentRepository.swift +++ b/Sources/ASCKit/Apps/Experiments/Internal/SDKExperimentRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation /// Adapts the App Store Connect "product page optimization" endpoints @@ -15,9 +14,9 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable public func listExperiments( appId: String, - state: Domain.AppStoreVersionExperimentState?, + state: ASCKit.AppStoreVersionExperimentState?, limit: Int? - ) async throws -> PaginatedResponse { + ) async throws -> PaginatedResponse { let filterState = state.flatMap { APIEndpoint.V1.Apps.WithID.AppStoreVersionExperimentsV2.GetParameters.FilterState(rawValue: $0.rawValue) } @@ -29,7 +28,7 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable return PaginatedResponse(data: experiments, nextCursor: response.links.next) } - public func getExperiment(experimentId: String) async throws -> Domain.AppStoreVersionExperiment { + public func getExperiment(experimentId: String) async throws -> ASCKit.AppStoreVersionExperiment { // Apple omits `relationships.app` unless it is explicitly included; without it // the model's appId (and every `--app-id` affordance) would be empty. let request = APIEndpoint.v2.appStoreVersionExperiments.id(experimentId).get(parameters: .init(include: [.app])) @@ -40,11 +39,11 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable public func createExperiment( appId: String, name: String, - platform: Domain.AppStorePlatform, + platform: ASCKit.AppStorePlatform, trafficProportion: Int - ) async throws -> Domain.AppStoreVersionExperiment { + ) async throws -> ASCKit.AppStoreVersionExperiment { guard let sdkPlatform = AppStoreConnect_Swift_SDK.Platform(rawValue: platform.rawValue) else { - throw Domain.APIError.unknown("Unsupported platform for create: \(platform.rawValue)") + throw ASCKit.APIError.unknown("Unsupported platform for create: \(platform.rawValue)") } let body = AppStoreVersionExperimentV2CreateRequest(data: .init( type: .appStoreVersionExperiments, @@ -60,7 +59,7 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable name: String?, trafficProportion: Int?, isStarted: Bool? - ) async throws -> Domain.AppStoreVersionExperiment { + ) async throws -> ASCKit.AppStoreVersionExperiment { let body = AppStoreVersionExperimentV2UpdateRequest(data: .init( type: .appStoreVersionExperiments, id: experimentId, @@ -77,7 +76,7 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable // MARK: - Treatments - public func listTreatments(experimentId: String, limit: Int?) async throws -> PaginatedResponse { + public func listTreatments(experimentId: String, limit: Int?) async throws -> PaginatedResponse { let request = APIEndpoint.v2.appStoreVersionExperiments.id(experimentId) .appStoreVersionExperimentTreatments.get(parameters: .init(limit: limit)) let response = try await client.request(request) @@ -85,7 +84,7 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable return PaginatedResponse(data: treatments, nextCursor: response.links.next) } - public func createTreatment(experimentId: String, name: String, appIconName: String?) async throws -> Domain.ExperimentTreatment { + public func createTreatment(experimentId: String, name: String, appIconName: String?) async throws -> ASCKit.ExperimentTreatment { let body = AppStoreVersionExperimentTreatmentCreateRequest(data: .init( type: .appStoreVersionExperimentTreatments, attributes: .init(name: name, appIconName: appIconName), @@ -97,7 +96,7 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable return mapTreatment(response.data, experimentId: experimentId) } - public func updateTreatment(treatmentId: String, name: String?, appIconName: String?) async throws -> Domain.ExperimentTreatment { + public func updateTreatment(treatmentId: String, name: String?, appIconName: String?) async throws -> ASCKit.ExperimentTreatment { let body = AppStoreVersionExperimentTreatmentUpdateRequest(data: .init( type: .appStoreVersionExperimentTreatments, id: treatmentId, @@ -121,14 +120,14 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable // MARK: - Treatment localizations - public func listTreatmentLocalizations(treatmentId: String, limit: Int?) async throws -> [Domain.ExperimentTreatmentLocalization] { + public func listTreatmentLocalizations(treatmentId: String, limit: Int?) async throws -> [ASCKit.ExperimentTreatmentLocalization] { let request = APIEndpoint.v1.appStoreVersionExperimentTreatments.id(treatmentId) .appStoreVersionExperimentTreatmentLocalizations.get(parameters: .init(limit: limit)) let response = try await client.request(request) return response.data.map { mapLocalization($0, treatmentId: treatmentId) } } - public func createTreatmentLocalization(treatmentId: String, locale: String) async throws -> Domain.ExperimentTreatmentLocalization { + public func createTreatmentLocalization(treatmentId: String, locale: String) async throws -> ASCKit.ExperimentTreatmentLocalization { let body = AppStoreVersionExperimentTreatmentLocalizationCreateRequest(data: .init( type: .appStoreVersionExperimentTreatmentLocalizations, attributes: .init(locale: locale), @@ -149,10 +148,10 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable private func mapExperiment( _ sdk: AppStoreConnect_Swift_SDK.AppStoreVersionExperimentV2, appId: String - ) -> Domain.AppStoreVersionExperiment { - let platform = sdk.attributes?.platform.flatMap { Domain.AppStorePlatform(rawValue: $0.rawValue) } ?? .iOS - let state = sdk.attributes?.state.flatMap { Domain.AppStoreVersionExperimentState(rawValue: $0.rawValue) } ?? .prepareForSubmission - return Domain.AppStoreVersionExperiment( + ) -> ASCKit.AppStoreVersionExperiment { + let platform = sdk.attributes?.platform.flatMap { ASCKit.AppStorePlatform(rawValue: $0.rawValue) } ?? .iOS + let state = sdk.attributes?.state.flatMap { ASCKit.AppStoreVersionExperimentState(rawValue: $0.rawValue) } ?? .prepareForSubmission + return ASCKit.AppStoreVersionExperiment( id: sdk.id, appId: appId, name: sdk.attributes?.name ?? "", @@ -169,8 +168,8 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable private func mapTreatment( _ sdk: AppStoreConnect_Swift_SDK.AppStoreVersionExperimentTreatment, experimentId: String - ) -> Domain.ExperimentTreatment { - Domain.ExperimentTreatment( + ) -> ASCKit.ExperimentTreatment { + ASCKit.ExperimentTreatment( id: sdk.id, experimentId: experimentId, name: sdk.attributes?.name ?? "", @@ -182,8 +181,8 @@ public struct SDKExperimentRepository: ExperimentRepository, @unchecked Sendable private func mapLocalization( _ sdk: AppStoreConnect_Swift_SDK.AppStoreVersionExperimentTreatmentLocalization, treatmentId: String - ) -> Domain.ExperimentTreatmentLocalization { - Domain.ExperimentTreatmentLocalization( + ) -> ASCKit.ExperimentTreatmentLocalization { + ASCKit.ExperimentTreatmentLocalization( id: sdk.id, treatmentId: treatmentId, locale: sdk.attributes?.locale ?? "" diff --git a/Sources/Domain/Apps/InAppPurchases/Availability/InAppPurchaseAvailability.swift b/Sources/ASCKit/Apps/InAppPurchases/Availability/InAppPurchaseAvailability.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/Availability/InAppPurchaseAvailability.swift rename to Sources/ASCKit/Apps/InAppPurchases/Availability/InAppPurchaseAvailability.swift diff --git a/Sources/Domain/Apps/InAppPurchases/Availability/InAppPurchaseAvailabilityRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/Availability/InAppPurchaseAvailabilityRepository.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/Availability/InAppPurchaseAvailabilityRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/Availability/InAppPurchaseAvailabilityRepository.swift diff --git a/Sources/Infrastructure/Apps/InAppPurchases/Availability/SDKInAppPurchaseAvailabilityRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/Availability/Internal/SDKInAppPurchaseAvailabilityRepository.swift similarity index 87% rename from Sources/Infrastructure/Apps/InAppPurchases/Availability/SDKInAppPurchaseAvailabilityRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/Availability/Internal/SDKInAppPurchaseAvailabilityRepository.swift index 555492a9..9066676f 100644 --- a/Sources/Infrastructure/Apps/InAppPurchases/Availability/SDKInAppPurchaseAvailabilityRepository.swift +++ b/Sources/ASCKit/Apps/InAppPurchases/Availability/Internal/SDKInAppPurchaseAvailabilityRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKInAppPurchaseAvailabilityRepository: InAppPurchaseAvailabilityRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKInAppPurchaseAvailabilityRepository: InAppPurchaseAvailabilityR self.client = client } - public func getAvailability(iapId: String) async throws -> Domain.InAppPurchaseAvailability? { + public func getAvailability(iapId: String) async throws -> ASCKit.InAppPurchaseAvailability? { // Two parallel calls — `include=availableTerritories` on the parent endpoint truncates // the relationship to ~10 entries. Fetching `/availableTerritories?limit=200` returns // the full territory list (Apple's max is 175 today). @@ -29,9 +28,9 @@ public struct SDKInAppPurchaseAvailabilityRepository: InAppPurchaseAvailabilityR let (avail, terr) = try await (availResponse, terrResponse) let territories = terr.data.map { t in - Domain.Territory(id: t.id, currency: t.attributes?.currency) + ASCKit.Territory(id: t.id, currency: t.attributes?.currency) } - return Domain.InAppPurchaseAvailability( + return ASCKit.InAppPurchaseAvailability( id: avail.data.id, iapId: iapId, isAvailableInNewTerritories: avail.data.attributes?.isAvailableInNewTerritories ?? false, @@ -46,7 +45,7 @@ public struct SDKInAppPurchaseAvailabilityRepository: InAppPurchaseAvailabilityR iapId: String, isAvailableInNewTerritories: Bool, territoryIds: [String] - ) async throws -> Domain.InAppPurchaseAvailability { + ) async throws -> ASCKit.InAppPurchaseAvailability { let body = InAppPurchaseAvailabilityCreateRequest(data: .init( type: .inAppPurchaseAvailabilities, attributes: .init(isAvailableInNewTerritories: isAvailableInNewTerritories), @@ -63,15 +62,15 @@ public struct SDKInAppPurchaseAvailabilityRepository: InAppPurchaseAvailabilityR _ sdk: AppStoreConnect_Swift_SDK.InAppPurchaseAvailability, included: [AppStoreConnect_Swift_SDK.Territory]?, iapId: String - ) -> Domain.InAppPurchaseAvailability { + ) -> ASCKit.InAppPurchaseAvailability { let territoryIds = sdk.relationships?.availableTerritories?.data?.map(\.id) ?? [] let includedMap = Dictionary( uniqueKeysWithValues: (included ?? []).map { ($0.id, $0) } ) let territories = territoryIds.map { id in - Domain.Territory(id: id, currency: includedMap[id]?.attributes?.currency) + ASCKit.Territory(id: id, currency: includedMap[id]?.attributes?.currency) } - return Domain.InAppPurchaseAvailability( + return ASCKit.InAppPurchaseAvailability( id: sdk.id, iapId: iapId, isAvailableInNewTerritories: sdk.attributes?.isAvailableInNewTerritories ?? false, diff --git a/Sources/Domain/Apps/InAppPurchases/InAppPurchase+RESTRoutes.swift b/Sources/ASCKit/Apps/InAppPurchases/InAppPurchase+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/InAppPurchase+RESTRoutes.swift rename to Sources/ASCKit/Apps/InAppPurchases/InAppPurchase+RESTRoutes.swift diff --git a/Sources/Domain/Apps/InAppPurchases/InAppPurchase.swift b/Sources/ASCKit/Apps/InAppPurchases/InAppPurchase.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/InAppPurchase.swift rename to Sources/ASCKit/Apps/InAppPurchases/InAppPurchase.swift diff --git a/Sources/Domain/Apps/InAppPurchases/InAppPurchasePricePoint.swift b/Sources/ASCKit/Apps/InAppPurchases/InAppPurchasePricePoint.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/InAppPurchasePricePoint.swift rename to Sources/ASCKit/Apps/InAppPurchases/InAppPurchasePricePoint.swift diff --git a/Sources/Domain/Apps/InAppPurchases/InAppPurchasePriceRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/InAppPurchasePriceRepository.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/InAppPurchasePriceRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/InAppPurchasePriceRepository.swift diff --git a/Sources/Domain/Apps/InAppPurchases/InAppPurchasePriceSchedule.swift b/Sources/ASCKit/Apps/InAppPurchases/InAppPurchasePriceSchedule.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/InAppPurchasePriceSchedule.swift rename to Sources/ASCKit/Apps/InAppPurchases/InAppPurchasePriceSchedule.swift diff --git a/Sources/Domain/Apps/InAppPurchases/InAppPurchaseRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/InAppPurchaseRepository.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/InAppPurchaseRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/InAppPurchaseRepository.swift diff --git a/Sources/Domain/Apps/InAppPurchases/InAppPurchaseSubmission.swift b/Sources/ASCKit/Apps/InAppPurchases/InAppPurchaseSubmission.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/InAppPurchaseSubmission.swift rename to Sources/ASCKit/Apps/InAppPurchases/InAppPurchaseSubmission.swift diff --git a/Sources/Domain/Apps/InAppPurchases/InAppPurchaseSubmissionRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/InAppPurchaseSubmissionRepository.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/InAppPurchaseSubmissionRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/InAppPurchaseSubmissionRepository.swift diff --git a/Sources/Infrastructure/Apps/InAppPurchases/SDKInAppPurchasePriceRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/Internal/SDKInAppPurchasePriceRepository.swift similarity index 86% rename from Sources/Infrastructure/Apps/InAppPurchases/SDKInAppPurchasePriceRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/Internal/SDKInAppPurchasePriceRepository.swift index 432d2e00..609e4fd4 100644 --- a/Sources/Infrastructure/Apps/InAppPurchases/SDKInAppPurchasePriceRepository.swift +++ b/Sources/ASCKit/Apps/InAppPurchases/Internal/SDKInAppPurchasePriceRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @un self.client = client } - public func getPriceSchedule(iapId: String) async throws -> Domain.InAppPurchasePriceSchedule? { + public func getPriceSchedule(iapId: String) async throws -> ASCKit.InAppPurchasePriceSchedule? { // Step 1: schedule + base territory. let schedule: AppStoreConnect_Swift_SDK.InAppPurchasePriceScheduleResponse do { @@ -44,18 +43,18 @@ public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @un let manualData = manualPages.flatMap(\.data) // Index included territories + price points for lookup. - var territoriesById: [String: Domain.Territory] = [:] + var territoriesById: [String: ASCKit.Territory] = [:] var pricePointsById: [String: AppStoreConnect_Swift_SDK.InAppPurchasePricePoint] = [:] for item in manualPages.flatMap({ $0.included ?? [] }) { switch item { case .territory(let t): - territoriesById[t.id] = Domain.Territory(id: t.id, currency: t.attributes?.currency) + territoriesById[t.id] = ASCKit.Territory(id: t.id, currency: t.attributes?.currency) case .inAppPurchasePricePoint(let pp): pricePointsById[pp.id] = pp } } - let manualPrices: [Domain.TerritoryPrice] = manualData.compactMap { price in + let manualPrices: [ASCKit.TerritoryPrice] = manualData.compactMap { price in guard let territoryId = price.relationships?.territory?.data?.id, let territory = territoriesById[territoryId], @@ -64,24 +63,24 @@ public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @un let customerPrice = pricePoint.attributes?.customerPrice, let proceeds = pricePoint.attributes?.proceeds else { return nil } - return Domain.TerritoryPrice(territory: territory, customerPrice: customerPrice, proceeds: proceeds) + return ASCKit.TerritoryPrice(territory: territory, customerPrice: customerPrice, proceeds: proceeds) } // Step 3: equalizations — fetch the full ~175-territory list using the manual price's // price point. If there are no manual prices we have nothing to equalize from. let manualPricePointId = manualData.first?.relationships?.inAppPurchasePricePoint?.data?.id - var equalizedPrices: [Domain.TerritoryPrice] = [] + var equalizedPrices: [ASCKit.TerritoryPrice] = [] if let pricePointId = manualPricePointId { equalizedPrices = (try? await fetchEqualizedTerritoryPrices(pricePointId: pricePointId)) ?? [] } // Merge: manual entries override equalized entries for the same territory. - var byTerritory: [String: Domain.TerritoryPrice] = [:] + var byTerritory: [String: ASCKit.TerritoryPrice] = [:] for entry in equalizedPrices { byTerritory[entry.territory.id] = entry } for entry in manualPrices { byTerritory[entry.territory.id] = entry } let merged = byTerritory.values.sorted { $0.territory.id < $1.territory.id } - return Domain.InAppPurchasePriceSchedule( + return ASCKit.InAppPurchasePriceSchedule( id: scheduleId, iapId: iapId, baseTerritory: baseTerritory, @@ -89,7 +88,7 @@ public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @un ) } - private func fetchEqualizedTerritoryPrices(pricePointId: String) async throws -> [Domain.TerritoryPrice] { + private func fetchEqualizedTerritoryPrices(pricePointId: String) async throws -> [ASCKit.TerritoryPrice] { let response = try await client.request( APIEndpoint.v1.inAppPurchasePricePoints.id(pricePointId).equalizations.get(parameters: .init( fieldsInAppPurchasePricePoints: [.customerPrice, .proceeds, .territory], @@ -99,9 +98,9 @@ public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @un )) ) - var territoriesById: [String: Domain.Territory] = [:] + var territoriesById: [String: ASCKit.Territory] = [:] for t in response.included ?? [] { - territoriesById[t.id] = Domain.Territory(id: t.id, currency: t.attributes?.currency) + territoriesById[t.id] = ASCKit.Territory(id: t.id, currency: t.attributes?.currency) } return response.data.compactMap { pp in @@ -110,12 +109,12 @@ public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @un let customerPrice = pp.attributes?.customerPrice, let proceeds = pp.attributes?.proceeds else { return nil } - let territory = territoriesById[territoryId] ?? Domain.Territory(id: territoryId, currency: nil) - return Domain.TerritoryPrice(territory: territory, customerPrice: customerPrice, proceeds: proceeds) + let territory = territoriesById[territoryId] ?? ASCKit.Territory(id: territoryId, currency: nil) + return ASCKit.TerritoryPrice(territory: territory, customerPrice: customerPrice, proceeds: proceeds) } } - public func listEqualizations(pricePointId: String, limit: Int?) async throws -> [Domain.InAppPurchasePricePoint] { + public func listEqualizations(pricePointId: String, limit: Int?) async throws -> [ASCKit.InAppPurchasePricePoint] { let request = APIEndpoint.v1.inAppPurchasePricePoints.id(pricePointId).equalizations.get( parameters: .init( fieldsInAppPurchasePricePoints: [.customerPrice, .proceeds, .territory], @@ -133,14 +132,14 @@ public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @un private func extractTerritory( id: String, included: [AppStoreConnect_Swift_SDK.InAppPurchasePriceScheduleResponse.IncludedItem]? - ) -> Domain.Territory? { + ) -> ASCKit.Territory? { for item in included ?? [] { if case let .territory(t) = item, t.id == id { - return Domain.Territory(id: t.id, currency: t.attributes?.currency) + return ASCKit.Territory(id: t.id, currency: t.attributes?.currency) } } // Fall back to id-only territory if the include didn't return it. - return Domain.Territory(id: id, currency: nil) + return ASCKit.Territory(id: id, currency: nil) } public func listPricePoints( @@ -148,7 +147,7 @@ public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @un territory: String?, limit: Int?, cursor: String? - ) async throws -> Domain.PaginatedResponse { + ) async throws -> ASCKit.PaginatedResponse { var request = APIEndpoint.v2.inAppPurchases.id(iapId).pricePoints.get( parameters: .init( filterTerritory: territory.map { [$0] }, @@ -163,21 +162,21 @@ public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @un request.query = query } let response = try await client.request(request) - return Domain.PaginatedResponse( + return ASCKit.PaginatedResponse( data: response.data.map { mapPricePoint($0, iapId: iapId) }, nextCursor: response.meta?.paging.nextCursor, totalCount: response.meta?.paging.total ) } - public func setPriceSchedule(iapId: String, baseTerritory: String, pricePointId: String) async throws -> Domain.InAppPurchasePriceSchedule { + public func setPriceSchedule(iapId: String, baseTerritory: String, pricePointId: String) async throws -> ASCKit.InAppPurchasePriceSchedule { let body = Self.makePriceScheduleCreateRequest( iapId: iapId, baseTerritory: baseTerritory, pricePointId: pricePointId ) let response = try await client.request(APIEndpoint.v1.inAppPurchasePriceSchedules.post(body)) - return Domain.InAppPurchasePriceSchedule(id: response.data.id, iapId: iapId) + return ASCKit.InAppPurchasePriceSchedule(id: response.data.id, iapId: iapId) } /// Mirrors the iOS app's price-schedule POST shape. ASC requires the inline manual price @@ -211,8 +210,8 @@ public struct SDKInAppPurchasePriceRepository: InAppPurchasePriceRepository, @un ) } - private func mapPricePoint(_ sdk: AppStoreConnect_Swift_SDK.InAppPurchasePricePoint, iapId: String) -> Domain.InAppPurchasePricePoint { - Domain.InAppPurchasePricePoint( + private func mapPricePoint(_ sdk: AppStoreConnect_Swift_SDK.InAppPurchasePricePoint, iapId: String) -> ASCKit.InAppPurchasePricePoint { + ASCKit.InAppPurchasePricePoint( id: sdk.id, iapId: iapId, territory: sdk.relationships?.territory?.data?.id, diff --git a/Sources/Infrastructure/Apps/InAppPurchases/SDKInAppPurchaseRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/Internal/SDKInAppPurchaseRepository.swift similarity index 90% rename from Sources/Infrastructure/Apps/InAppPurchases/SDKInAppPurchaseRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/Internal/SDKInAppPurchaseRepository.swift index 1880795e..f6911df1 100644 --- a/Sources/Infrastructure/Apps/InAppPurchases/SDKInAppPurchaseRepository.swift +++ b/Sources/ASCKit/Apps/InAppPurchases/Internal/SDKInAppPurchaseRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKInAppPurchaseRepository: InAppPurchaseRepository, @unchecked Sendable { private let client: any APIClient @@ -18,7 +17,7 @@ public struct SDKInAppPurchaseRepository: InAppPurchaseRepository, @unchecked Se self.irisFlagsProvider = irisFlagsProvider } - public func listInAppPurchases(appId: String, limit: Int?) async throws -> PaginatedResponse { + public func listInAppPurchases(appId: String, limit: Int?) async throws -> PaginatedResponse { let request = APIEndpoint.v1.apps.id(appId).inAppPurchasesV2.get(parameters: .init( limit: limit )) @@ -34,7 +33,7 @@ public struct SDKInAppPurchaseRepository: InAppPurchaseRepository, @unchecked Se return mapped.hasBeenApproved } let irisFlags = await irisFlagsProvider?(appId) ?? [:] - let purchases = response.data.map { sdkIAP -> Domain.InAppPurchase in + let purchases = response.data.map { sdkIAP -> ASCKit.InAppPurchase in let state = mapState(sdkIAP.attributes?.state) let isFirstTime = !hasShippedIAP && !state.hasBeenApproved let submitWithNextVersion = irisFlags[sdkIAP.id] ?? false @@ -51,8 +50,8 @@ public struct SDKInAppPurchaseRepository: InAppPurchaseRepository, @unchecked Se appId: String, referenceName: String, productId: String, - type: Domain.InAppPurchaseType - ) async throws -> Domain.InAppPurchase { + type: ASCKit.InAppPurchaseType + ) async throws -> ASCKit.InAppPurchase { guard let sdkType = mapToSDKType(type) else { throw APIError.unknown("Unsupported IAP type: \(type.rawValue)") } @@ -76,7 +75,7 @@ public struct SDKInAppPurchaseRepository: InAppPurchaseRepository, @unchecked Se referenceName: String?, reviewNote: String?, isFamilySharable: Bool? - ) async throws -> Domain.InAppPurchase { + ) async throws -> ASCKit.InAppPurchase { let body = InAppPurchaseV2UpdateRequest(data: .init( type: .inAppPurchases, id: iapId, @@ -101,8 +100,8 @@ public struct SDKInAppPurchaseRepository: InAppPurchaseRepository, @unchecked Se appId: String, isFirstTimeSubmission: Bool = false, submitWithNextAppStoreVersion: Bool = false - ) -> Domain.InAppPurchase { - Domain.InAppPurchase( + ) -> ASCKit.InAppPurchase { + ASCKit.InAppPurchase( id: sdk.id, appId: appId, referenceName: sdk.attributes?.name ?? "", @@ -115,7 +114,7 @@ public struct SDKInAppPurchaseRepository: InAppPurchaseRepository, @unchecked Se ) } - private func mapFromSDKType(_ sdkType: AppStoreConnect_Swift_SDK.InAppPurchaseType?) -> Domain.InAppPurchaseType? { + private func mapFromSDKType(_ sdkType: AppStoreConnect_Swift_SDK.InAppPurchaseType?) -> ASCKit.InAppPurchaseType? { guard let sdkType else { return nil } switch sdkType { case .consumable: return .consumable @@ -124,7 +123,7 @@ public struct SDKInAppPurchaseRepository: InAppPurchaseRepository, @unchecked Se } } - private func mapToSDKType(_ type: Domain.InAppPurchaseType) -> AppStoreConnect_Swift_SDK.InAppPurchaseType? { + private func mapToSDKType(_ type: ASCKit.InAppPurchaseType) -> AppStoreConnect_Swift_SDK.InAppPurchaseType? { switch type { case .consumable: return .consumable case .nonConsumable: return .nonConsumable @@ -133,8 +132,8 @@ public struct SDKInAppPurchaseRepository: InAppPurchaseRepository, @unchecked Se } } - private func mapState(_ sdkState: AppStoreConnect_Swift_SDK.InAppPurchaseState?) -> Domain.InAppPurchaseState { + private func mapState(_ sdkState: AppStoreConnect_Swift_SDK.InAppPurchaseState?) -> ASCKit.InAppPurchaseState { guard let sdkState else { return .missingMetadata } - return Domain.InAppPurchaseState(rawValue: sdkState.rawValue) ?? .missingMetadata + return ASCKit.InAppPurchaseState(rawValue: sdkState.rawValue) ?? .missingMetadata } } diff --git a/Sources/Infrastructure/Apps/InAppPurchases/SDKInAppPurchaseSubmissionRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/Internal/SDKInAppPurchaseSubmissionRepository.swift similarity index 90% rename from Sources/Infrastructure/Apps/InAppPurchases/SDKInAppPurchaseSubmissionRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/Internal/SDKInAppPurchaseSubmissionRepository.swift index 8013de3c..4f348d2b 100644 --- a/Sources/Infrastructure/Apps/InAppPurchases/SDKInAppPurchaseSubmissionRepository.swift +++ b/Sources/ASCKit/Apps/InAppPurchases/Internal/SDKInAppPurchaseSubmissionRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKInAppPurchaseSubmissionRepository: InAppPurchaseSubmissionRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKInAppPurchaseSubmissionRepository: InAppPurchaseSubmissionRepos self.client = client } - public func submitInAppPurchase(iapId: String) async throws -> Domain.InAppPurchaseSubmission { + public func submitInAppPurchase(iapId: String) async throws -> ASCKit.InAppPurchaseSubmission { let body = InAppPurchaseSubmissionCreateRequest(data: .init( type: .inAppPurchaseSubmissions, relationships: .init( @@ -16,7 +15,7 @@ public struct SDKInAppPurchaseSubmissionRepository: InAppPurchaseSubmissionRepos ) )) let response = try await client.request(APIEndpoint.v1.inAppPurchaseSubmissions.post(body)) - return Domain.InAppPurchaseSubmission(id: response.data.id, iapId: iapId) + return ASCKit.InAppPurchaseSubmission(id: response.data.id, iapId: iapId) } public func deleteSubmission(submissionId: String) async throws { diff --git a/Sources/Domain/Apps/InAppPurchases/Localizations/InAppPurchaseLocalization.swift b/Sources/ASCKit/Apps/InAppPurchases/Localizations/InAppPurchaseLocalization.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/Localizations/InAppPurchaseLocalization.swift rename to Sources/ASCKit/Apps/InAppPurchases/Localizations/InAppPurchaseLocalization.swift diff --git a/Sources/Domain/Apps/InAppPurchases/Localizations/InAppPurchaseLocalizationRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/Localizations/InAppPurchaseLocalizationRepository.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/Localizations/InAppPurchaseLocalizationRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/Localizations/InAppPurchaseLocalizationRepository.swift diff --git a/Sources/Infrastructure/Apps/InAppPurchases/Localizations/SDKInAppPurchaseLocalizationRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/Localizations/Internal/SDKInAppPurchaseLocalizationRepository.swift similarity index 88% rename from Sources/Infrastructure/Apps/InAppPurchases/Localizations/SDKInAppPurchaseLocalizationRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/Localizations/Internal/SDKInAppPurchaseLocalizationRepository.swift index 0f6d003d..0d472495 100644 --- a/Sources/Infrastructure/Apps/InAppPurchases/Localizations/SDKInAppPurchaseLocalizationRepository.swift +++ b/Sources/ASCKit/Apps/InAppPurchases/Localizations/Internal/SDKInAppPurchaseLocalizationRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKInAppPurchaseLocalizationRepository: InAppPurchaseLocalizationRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKInAppPurchaseLocalizationRepository: InAppPurchaseLocalizationR self.client = client } - public func listLocalizations(iapId: String) async throws -> [Domain.InAppPurchaseLocalization] { + public func listLocalizations(iapId: String) async throws -> [ASCKit.InAppPurchaseLocalization] { let request = APIEndpoint.v2.inAppPurchases.id(iapId).inAppPurchaseLocalizations.get() let response = try await client.request(request) return response.data.map { mapLocalization($0, iapId: iapId) } @@ -19,7 +18,7 @@ public struct SDKInAppPurchaseLocalizationRepository: InAppPurchaseLocalizationR locale: String, name: String, description: String? - ) async throws -> Domain.InAppPurchaseLocalization { + ) async throws -> ASCKit.InAppPurchaseLocalization { let body = InAppPurchaseLocalizationCreateRequest(data: .init( type: .inAppPurchaseLocalizations, attributes: .init(name: name, locale: locale, description: description), @@ -35,7 +34,7 @@ public struct SDKInAppPurchaseLocalizationRepository: InAppPurchaseLocalizationR localizationId: String, name: String?, description: String? - ) async throws -> Domain.InAppPurchaseLocalization { + ) async throws -> ASCKit.InAppPurchaseLocalization { let body = InAppPurchaseLocalizationUpdateRequest(data: .init( type: .inAppPurchaseLocalizations, id: localizationId, @@ -56,8 +55,8 @@ public struct SDKInAppPurchaseLocalizationRepository: InAppPurchaseLocalizationR private func mapLocalization( _ sdk: AppStoreConnect_Swift_SDK.InAppPurchaseLocalization, iapId: String - ) -> Domain.InAppPurchaseLocalization { - Domain.InAppPurchaseLocalization( + ) -> ASCKit.InAppPurchaseLocalization { + ASCKit.InAppPurchaseLocalization( id: sdk.id, iapId: iapId, locale: sdk.attributes?.locale ?? "", @@ -69,8 +68,8 @@ public struct SDKInAppPurchaseLocalizationRepository: InAppPurchaseLocalizationR private func mapState( _ sdkState: AppStoreConnect_Swift_SDK.InAppPurchaseLocalization.Attributes.State? - ) -> Domain.InAppPurchaseLocalizationState? { + ) -> ASCKit.InAppPurchaseLocalizationState? { guard let sdkState else { return nil } - return Domain.InAppPurchaseLocalizationState(rawValue: sdkState.rawValue) + return ASCKit.InAppPurchaseLocalizationState(rawValue: sdkState.rawValue) } } diff --git a/Sources/Domain/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCode.swift b/Sources/ASCKit/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCode.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCode.swift rename to Sources/ASCKit/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCode.swift diff --git a/Sources/Domain/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeCustomCode.swift b/Sources/ASCKit/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeCustomCode.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeCustomCode.swift rename to Sources/ASCKit/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeCustomCode.swift diff --git a/Sources/Domain/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeOneTimeUseCode.swift b/Sources/ASCKit/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeOneTimeUseCode.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeOneTimeUseCode.swift rename to Sources/ASCKit/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeOneTimeUseCode.swift diff --git a/Sources/Domain/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodePrice.swift b/Sources/ASCKit/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodePrice.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodePrice.swift rename to Sources/ASCKit/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodePrice.swift diff --git a/Sources/Domain/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeRepository.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeRepository.swift diff --git a/Sources/Infrastructure/Apps/InAppPurchases/OfferCodes/SDKInAppPurchaseOfferCodeRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/OfferCodes/Internal/SDKInAppPurchaseOfferCodeRepository.swift similarity index 86% rename from Sources/Infrastructure/Apps/InAppPurchases/OfferCodes/SDKInAppPurchaseOfferCodeRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/OfferCodes/Internal/SDKInAppPurchaseOfferCodeRepository.swift index 47b084be..ee4d06a9 100644 --- a/Sources/Infrastructure/Apps/InAppPurchases/OfferCodes/SDKInAppPurchaseOfferCodeRepository.swift +++ b/Sources/ASCKit/Apps/InAppPurchases/OfferCodes/Internal/SDKInAppPurchaseOfferCodeRepository.swift @@ -1,6 +1,5 @@ import Foundation @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeRepository, @unchecked Sendable { private let client: any APIClient @@ -11,7 +10,7 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit // MARK: - Offer Codes - public func listOfferCodes(iapId: String) async throws -> [Domain.InAppPurchaseOfferCode] { + public func listOfferCodes(iapId: String) async throws -> [ASCKit.InAppPurchaseOfferCode] { let request = APIEndpoint.v2.inAppPurchases.id(iapId).offerCodes.get() let response = try await client.request(request) return response.data.map { mapOfferCode($0, iapId: iapId) } @@ -20,9 +19,9 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit public func createOfferCode( iapId: String, name: String, - customerEligibilities: [Domain.IAPCustomerEligibility], - prices: [Domain.OfferCodePriceInput] - ) async throws -> Domain.InAppPurchaseOfferCode { + customerEligibilities: [ASCKit.IAPCustomerEligibility], + prices: [ASCKit.OfferCodePriceInput] + ) async throws -> ASCKit.InAppPurchaseOfferCode { let sdkEligibilities = customerEligibilities.compactMap { InAppPurchaseOfferCodeCreateRequest.Data.Attributes.CustomerEligibility(rawValue: $0.rawValue) } @@ -30,7 +29,7 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit // Each price needs a placeholder id that correlates between `included[]` and // `relationships.prices.data` — ASC reads the placeholders and replaces them with // generated server-side ids. Mirrors the iOS app's offer-code create payload. - let pricesPayload: [(localId: String, input: Domain.OfferCodePriceInput)] = prices.enumerated().map { + let pricesPayload: [(localId: String, input: ASCKit.OfferCodePriceInput)] = prices.enumerated().map { (localId: "${local-price-\($0.offset + 1)}", input: $0.element) } let pricesRelationship = pricesPayload.map { @@ -69,7 +68,7 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit return mapOfferCode(response.data, iapId: iapId) } - public func updateOfferCode(offerCodeId: String, isActive: Bool) async throws -> Domain.InAppPurchaseOfferCode { + public func updateOfferCode(offerCodeId: String, isActive: Bool) async throws -> ASCKit.InAppPurchaseOfferCode { let body = InAppPurchaseOfferCodeUpdateRequest( data: .init( type: .inAppPurchaseOfferCodes, @@ -83,7 +82,7 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit // MARK: - Prices - public func listPrices(offerCodeId: String) async throws -> [Domain.InAppPurchaseOfferCodePrice] { + public func listPrices(offerCodeId: String) async throws -> [ASCKit.InAppPurchaseOfferCodePrice] { // One price per territory — follow every page to get all 175. `include` makes Apple // return each price's territory and price point linkage, which the mapper reads. let pages = try await client.requestAllPages( @@ -95,7 +94,7 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit // MARK: - Custom Codes - public func listCustomCodes(offerCodeId: String) async throws -> [Domain.InAppPurchaseOfferCodeCustomCode] { + public func listCustomCodes(offerCodeId: String) async throws -> [ASCKit.InAppPurchaseOfferCodeCustomCode] { let request = APIEndpoint.v1.inAppPurchaseOfferCodes.id(offerCodeId).customCodes.get() let response = try await client.request(request) return response.data.map { mapCustomCode($0, offerCodeId: offerCodeId) } @@ -106,7 +105,7 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit customCode: String, numberOfCodes: Int, expirationDate: String? - ) async throws -> Domain.InAppPurchaseOfferCodeCustomCode { + ) async throws -> ASCKit.InAppPurchaseOfferCodeCustomCode { let body = InAppPurchaseOfferCodeCustomCodeCreateRequest( data: .init( type: .inAppPurchaseOfferCodeCustomCodes, @@ -124,7 +123,7 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit return mapCustomCode(response.data, offerCodeId: offerCodeId) } - public func updateCustomCode(customCodeId: String, isActive: Bool) async throws -> Domain.InAppPurchaseOfferCodeCustomCode { + public func updateCustomCode(customCodeId: String, isActive: Bool) async throws -> ASCKit.InAppPurchaseOfferCodeCustomCode { let body = InAppPurchaseOfferCodeCustomCodeUpdateRequest( data: .init( type: .inAppPurchaseOfferCodeCustomCodes, @@ -138,7 +137,7 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit // MARK: - One-Time Use Codes - public func listOneTimeUseCodes(offerCodeId: String) async throws -> [Domain.InAppPurchaseOfferCodeOneTimeUseCode] { + public func listOneTimeUseCodes(offerCodeId: String) async throws -> [ASCKit.InAppPurchaseOfferCodeOneTimeUseCode] { let request = APIEndpoint.v1.inAppPurchaseOfferCodes.id(offerCodeId).oneTimeUseCodes.get() let response = try await client.request(request) return response.data.map { mapOneTimeUseCode($0, offerCodeId: offerCodeId) } @@ -148,8 +147,8 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit offerCodeId: String, numberOfCodes: Int, expirationDate: String, - environment: Domain.OfferCodeEnvironment - ) async throws -> Domain.InAppPurchaseOfferCodeOneTimeUseCode { + environment: ASCKit.OfferCodeEnvironment + ) async throws -> ASCKit.InAppPurchaseOfferCodeOneTimeUseCode { let sdkEnv = AppStoreConnect_Swift_SDK.OfferCodeEnvironment(rawValue: environment.rawValue) let body = InAppPurchaseOfferCodeOneTimeUseCodeCreateRequest( data: .init( @@ -168,7 +167,7 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit return mapOneTimeUseCode(response.data, offerCodeId: offerCodeId) } - public func updateOneTimeUseCode(oneTimeCodeId: String, isActive: Bool) async throws -> Domain.InAppPurchaseOfferCodeOneTimeUseCode { + public func updateOneTimeUseCode(oneTimeCodeId: String, isActive: Bool) async throws -> ASCKit.InAppPurchaseOfferCodeOneTimeUseCode { let body = InAppPurchaseOfferCodeOneTimeUseCodeUpdateRequest( data: .init( type: .inAppPurchaseOfferCodeOneTimeUseCodes, @@ -190,12 +189,12 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit private func mapOfferCode( _ sdk: AppStoreConnect_Swift_SDK.InAppPurchaseOfferCode, iapId: String - ) -> Domain.InAppPurchaseOfferCode { - let customerEligibilities = (sdk.attributes?.customerEligibilities ?? []).compactMap { sdkEligibility -> Domain.IAPCustomerEligibility? in - Domain.IAPCustomerEligibility(rawValue: sdkEligibility.rawValue) + ) -> ASCKit.InAppPurchaseOfferCode { + let customerEligibilities = (sdk.attributes?.customerEligibilities ?? []).compactMap { sdkEligibility -> ASCKit.IAPCustomerEligibility? in + ASCKit.IAPCustomerEligibility(rawValue: sdkEligibility.rawValue) } - return Domain.InAppPurchaseOfferCode( + return ASCKit.InAppPurchaseOfferCode( id: sdk.id, iapId: iapId, name: sdk.attributes?.name ?? "", @@ -210,10 +209,10 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit private func mapCustomCode( _ sdk: AppStoreConnect_Swift_SDK.InAppPurchaseOfferCodeCustomCode, offerCodeId: String - ) -> Domain.InAppPurchaseOfferCodeCustomCode { + ) -> ASCKit.InAppPurchaseOfferCodeCustomCode { let createdDateString: String? = sdk.attributes?.createdDate.map { ISO8601DateFormatter().string(from: $0) } - return Domain.InAppPurchaseOfferCodeCustomCode( + return ASCKit.InAppPurchaseOfferCodeCustomCode( id: sdk.id, offerCodeId: offerCodeId, customCode: sdk.attributes?.customCode ?? "", @@ -227,8 +226,8 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit private func mapPrice( _ sdk: AppStoreConnect_Swift_SDK.InAppPurchaseOfferPrice, offerCodeId: String - ) -> Domain.InAppPurchaseOfferCodePrice { - Domain.InAppPurchaseOfferCodePrice( + ) -> ASCKit.InAppPurchaseOfferCodePrice { + ASCKit.InAppPurchaseOfferCodePrice( id: sdk.id, offerCodeId: offerCodeId, territory: sdk.relationships?.territory?.data?.id, @@ -239,13 +238,13 @@ public struct SDKInAppPurchaseOfferCodeRepository: InAppPurchaseOfferCodeReposit private func mapOneTimeUseCode( _ sdk: AppStoreConnect_Swift_SDK.InAppPurchaseOfferCodeOneTimeUseCode, offerCodeId: String - ) -> Domain.InAppPurchaseOfferCodeOneTimeUseCode { + ) -> ASCKit.InAppPurchaseOfferCodeOneTimeUseCode { let createdDateString: String? = sdk.attributes?.createdDate.map { ISO8601DateFormatter().string(from: $0) } - let environment: Domain.OfferCodeEnvironment? = sdk.attributes?.environment.flatMap { - Domain.OfferCodeEnvironment(rawValue: $0.rawValue) + let environment: ASCKit.OfferCodeEnvironment? = sdk.attributes?.environment.flatMap { + ASCKit.OfferCodeEnvironment(rawValue: $0.rawValue) } - return Domain.InAppPurchaseOfferCodeOneTimeUseCode( + return ASCKit.InAppPurchaseOfferCodeOneTimeUseCode( id: sdk.id, offerCodeId: offerCodeId, numberOfCodes: sdk.attributes?.numberOfCodes ?? 0, diff --git a/Sources/Domain/Apps/InAppPurchases/Review/InAppPurchaseReviewRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/Review/InAppPurchaseReviewRepository.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/Review/InAppPurchaseReviewRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/Review/InAppPurchaseReviewRepository.swift diff --git a/Sources/Domain/Apps/InAppPurchases/Review/InAppPurchaseReviewScreenshot.swift b/Sources/ASCKit/Apps/InAppPurchases/Review/InAppPurchaseReviewScreenshot.swift similarity index 100% rename from Sources/Domain/Apps/InAppPurchases/Review/InAppPurchaseReviewScreenshot.swift rename to Sources/ASCKit/Apps/InAppPurchases/Review/InAppPurchaseReviewScreenshot.swift diff --git a/Sources/Infrastructure/Apps/InAppPurchases/Review/SDKInAppPurchaseReviewRepository.swift b/Sources/ASCKit/Apps/InAppPurchases/Review/Internal/SDKInAppPurchaseReviewRepository.swift similarity index 91% rename from Sources/Infrastructure/Apps/InAppPurchases/Review/SDKInAppPurchaseReviewRepository.swift rename to Sources/ASCKit/Apps/InAppPurchases/Review/Internal/SDKInAppPurchaseReviewRepository.swift index 09a7aa6f..eb5fd9e0 100644 --- a/Sources/Infrastructure/Apps/InAppPurchases/Review/SDKInAppPurchaseReviewRepository.swift +++ b/Sources/ASCKit/Apps/InAppPurchases/Review/Internal/SDKInAppPurchaseReviewRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKInAppPurchaseReviewRepository: InAppPurchaseReviewRepository, @unchecked Sendable { @@ -23,7 +22,7 @@ public struct SDKInAppPurchaseReviewRepository: InAppPurchaseReviewRepository, @ // MARK: - Review Screenshot - public func getReviewScreenshot(iapId: String) async throws -> Domain.InAppPurchaseReviewScreenshot? { + public func getReviewScreenshot(iapId: String) async throws -> ASCKit.InAppPurchaseReviewScreenshot? { do { let response = try await client.request( APIEndpoint.v2.inAppPurchases.id(iapId).appStoreReviewScreenshot.get() @@ -38,7 +37,7 @@ public struct SDKInAppPurchaseReviewRepository: InAppPurchaseReviewRepository, @ public func uploadReviewScreenshot( iapId: String, fileURL: URL - ) async throws -> Domain.InAppPurchaseReviewScreenshot { + ) async throws -> ASCKit.InAppPurchaseReviewScreenshot { let fileData = try Data(contentsOf: fileURL) let fileName = fileURL.lastPathComponent logUploadStep("iap-review-screenshot reserve fileName=\(fileName) bytes=\(fileData.count) iapId=\(iapId)") @@ -88,13 +87,13 @@ public struct SDKInAppPurchaseReviewRepository: InAppPurchaseReviewRepository, @ // MARK: - Promotional Images - public func listImages(iapId: String) async throws -> [Domain.InAppPurchasePromotionalImage] { + public func listImages(iapId: String) async throws -> [ASCKit.InAppPurchasePromotionalImage] { let request = APIEndpoint.v2.inAppPurchases.id(iapId).images.get() let response = try await client.request(request) return response.data.map { mapImage($0, iapId: iapId) } } - public func uploadImage(iapId: String, fileURL: URL) async throws -> Domain.InAppPurchasePromotionalImage { + public func uploadImage(iapId: String, fileURL: URL) async throws -> ASCKit.InAppPurchasePromotionalImage { let fileData = try Data(contentsOf: fileURL) let fileName = fileURL.lastPathComponent logUploadStep("iap-image reserve fileName=\(fileName) bytes=\(fileData.count) iapId=\(iapId)") @@ -136,8 +135,8 @@ public struct SDKInAppPurchaseReviewRepository: InAppPurchaseReviewRepository, @ /// Re-fetches the screenshot until ASC reports `assetDeliveryState == COMPLETE` /// (imageAsset URL populated). Stops on `FAILED`. Falls back to whatever the latest /// fetch returned if processing exceeds `pollMaxAttempts × pollDelayNanos`. - private func pollReviewScreenshotReady(screenshotId: String, iapId: String) async throws -> Domain.InAppPurchaseReviewScreenshot { - var latest: Domain.InAppPurchaseReviewScreenshot? + private func pollReviewScreenshotReady(screenshotId: String, iapId: String) async throws -> ASCKit.InAppPurchaseReviewScreenshot { + var latest: ASCKit.InAppPurchaseReviewScreenshot? for attempt in 1...pollMaxAttempts { let response = try await client.request( APIEndpoint.v1.inAppPurchaseAppStoreReviewScreenshots.id(screenshotId).get() @@ -164,8 +163,8 @@ public struct SDKInAppPurchaseReviewRepository: InAppPurchaseReviewRepository, @ /// Re-fetches the image until state is one of `PREPARE_FOR_SUBMISSION / /// WAITING_FOR_REVIEW / APPROVED` (imageAsset URL populated). Stops on `FAILED`/`REJECTED`. - private func pollImageReady(imageId: String, iapId: String) async throws -> Domain.InAppPurchasePromotionalImage { - var latest: Domain.InAppPurchasePromotionalImage? + private func pollImageReady(imageId: String, iapId: String) async throws -> ASCKit.InAppPurchasePromotionalImage { + var latest: ASCKit.InAppPurchasePromotionalImage? for attempt in 1...pollMaxAttempts { let response = try await client.request( APIEndpoint.v1.inAppPurchaseImages.id(imageId).get() @@ -197,10 +196,10 @@ public struct SDKInAppPurchaseReviewRepository: InAppPurchaseReviewRepository, @ private func mapReviewScreenshot( _ sdk: AppStoreConnect_Swift_SDK.InAppPurchaseAppStoreReviewScreenshot, iapId: String - ) -> Domain.InAppPurchaseReviewScreenshot { + ) -> ASCKit.InAppPurchaseReviewScreenshot { let stateRaw = sdk.attributes?.assetDeliveryState?.state?.rawValue - let state = stateRaw.flatMap { Domain.InAppPurchaseReviewScreenshot.AssetState(rawValue: $0) } - return Domain.InAppPurchaseReviewScreenshot( + let state = stateRaw.flatMap { ASCKit.InAppPurchaseReviewScreenshot.AssetState(rawValue: $0) } + return ASCKit.InAppPurchaseReviewScreenshot( id: sdk.id, iapId: iapId, fileName: sdk.attributes?.fileName ?? "", @@ -213,10 +212,10 @@ public struct SDKInAppPurchaseReviewRepository: InAppPurchaseReviewRepository, @ private func mapImage( _ sdk: AppStoreConnect_Swift_SDK.InAppPurchaseImage, iapId: String - ) -> Domain.InAppPurchasePromotionalImage { + ) -> ASCKit.InAppPurchasePromotionalImage { let stateRaw = sdk.attributes?.state?.rawValue - let state = stateRaw.flatMap { Domain.InAppPurchasePromotionalImage.ImageState(rawValue: $0) } - return Domain.InAppPurchasePromotionalImage( + let state = stateRaw.flatMap { ASCKit.InAppPurchasePromotionalImage.ImageState(rawValue: $0) } + return ASCKit.InAppPurchasePromotionalImage( id: sdk.id, iapId: iapId, fileName: sdk.attributes?.fileName ?? "", @@ -226,11 +225,11 @@ public struct SDKInAppPurchaseReviewRepository: InAppPurchaseReviewRepository, @ ) } - private func mapImageAsset(_ sdk: AppStoreConnect_Swift_SDK.ImageAsset?) -> Domain.ImageAsset? { + private func mapImageAsset(_ sdk: AppStoreConnect_Swift_SDK.ImageAsset?) -> ASCKit.ImageAsset? { guard let templateUrl = sdk?.templateURL, !templateUrl.isEmpty, let width = sdk?.width, width > 0, let height = sdk?.height, height > 0 else { return nil } - return Domain.ImageAsset(templateUrl: templateUrl, width: width, height: height) + return ASCKit.ImageAsset(templateUrl: templateUrl, width: width, height: height) } } diff --git a/Sources/Infrastructure/Apps/OpenAPIAppRepository.swift b/Sources/ASCKit/Apps/Internal/OpenAPIAppRepository.swift similarity index 85% rename from Sources/Infrastructure/Apps/OpenAPIAppRepository.swift rename to Sources/ASCKit/Apps/Internal/OpenAPIAppRepository.swift index 9cc15a04..33d7f7dd 100644 --- a/Sources/Infrastructure/Apps/OpenAPIAppRepository.swift +++ b/Sources/ASCKit/Apps/Internal/OpenAPIAppRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKAppRepository: AppRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKAppRepository: AppRepository, @unchecked Sendable { self.client = client } - public func listApps(limit: Int?) async throws -> PaginatedResponse { + public func listApps(limit: Int?) async throws -> PaginatedResponse { let request = APIEndpoint.v1.apps.get(parameters: .init( limit: limit )) @@ -18,13 +17,13 @@ public struct SDKAppRepository: AppRepository, @unchecked Sendable { return PaginatedResponse(data: apps, nextCursor: nextCursor) } - public func getApp(id: String) async throws -> Domain.App { + public func getApp(id: String) async throws -> ASCKit.App { let request = APIEndpoint.v1.apps.id(id).get() let response = try await client.request(request) return mapApp(response.data) } - public func fetchAppIcon(appId: String) async throws -> Domain.ImageAsset? { + public func fetchAppIcon(appId: String) async throws -> ASCKit.ImageAsset? { let request = APIEndpoint.v1.apps.id(appId).appStoreVersions.get( parameters: .init( fieldsBuilds: [.iconAssetToken], @@ -48,12 +47,12 @@ public struct SDKAppRepository: AppRepository, @unchecked Sendable { let width = token.width, let height = token.height else { continue } - return Domain.ImageAsset(templateUrl: templateURL, width: width, height: height) + return ASCKit.ImageAsset(templateUrl: templateURL, width: width, height: height) } return nil } - public func updateContentRights(appId: String, declaration: Domain.ContentRightsDeclaration?) async throws -> Domain.App { + public func updateContentRights(appId: String, declaration: ASCKit.ContentRightsDeclaration?) async throws -> ASCKit.App { let sdkDeclaration = declaration.map { AppUpdateRequest.Data.Attributes.ContentRightsDeclaration(rawValue: $0.rawValue) } ?? nil let body = AppUpdateRequest( data: .init( @@ -66,12 +65,12 @@ public struct SDKAppRepository: AppRepository, @unchecked Sendable { return mapApp(response.data) } - private func mapApp(_ sdkApp: AppStoreConnect_Swift_SDK.App) -> Domain.App { - let rights: Domain.ContentRightsDeclaration? = { + private func mapApp(_ sdkApp: AppStoreConnect_Swift_SDK.App) -> ASCKit.App { + let rights: ASCKit.ContentRightsDeclaration? = { guard let raw = sdkApp.attributes?.contentRightsDeclaration?.rawValue else { return nil } - return Domain.ContentRightsDeclaration(rawValue: raw) + return ASCKit.ContentRightsDeclaration(rawValue: raw) }() - return Domain.App( + return ASCKit.App( id: sdkApp.id, name: sdkApp.attributes?.name ?? "", bundleId: sdkApp.attributes?.bundleID ?? "", diff --git a/Sources/Domain/Apps/Performance/DiagnosticLogEntry.swift b/Sources/ASCKit/Apps/Performance/DiagnosticLogEntry.swift similarity index 100% rename from Sources/Domain/Apps/Performance/DiagnosticLogEntry.swift rename to Sources/ASCKit/Apps/Performance/DiagnosticLogEntry.swift diff --git a/Sources/Domain/Apps/Performance/DiagnosticSignatureInfo.swift b/Sources/ASCKit/Apps/Performance/DiagnosticSignatureInfo.swift similarity index 100% rename from Sources/Domain/Apps/Performance/DiagnosticSignatureInfo.swift rename to Sources/ASCKit/Apps/Performance/DiagnosticSignatureInfo.swift diff --git a/Sources/Domain/Apps/Performance/DiagnosticsRepository.swift b/Sources/ASCKit/Apps/Performance/DiagnosticsRepository.swift similarity index 100% rename from Sources/Domain/Apps/Performance/DiagnosticsRepository.swift rename to Sources/ASCKit/Apps/Performance/DiagnosticsRepository.swift diff --git a/Sources/Infrastructure/Apps/Performance/SDKDiagnosticsRepository.swift b/Sources/ASCKit/Apps/Performance/Internal/SDKDiagnosticsRepository.swift similarity index 99% rename from Sources/Infrastructure/Apps/Performance/SDKDiagnosticsRepository.swift rename to Sources/ASCKit/Apps/Performance/Internal/SDKDiagnosticsRepository.swift index 180f63da..d8a8ffff 100644 --- a/Sources/Infrastructure/Apps/Performance/SDKDiagnosticsRepository.swift +++ b/Sources/ASCKit/Apps/Performance/Internal/SDKDiagnosticsRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKDiagnosticsRepository: DiagnosticsRepository, @unchecked Sendable { private let client: any APIClient diff --git a/Sources/Infrastructure/Apps/Performance/SDKPerfMetricsRepository.swift b/Sources/ASCKit/Apps/Performance/Internal/SDKPerfMetricsRepository.swift similarity index 99% rename from Sources/Infrastructure/Apps/Performance/SDKPerfMetricsRepository.swift rename to Sources/ASCKit/Apps/Performance/Internal/SDKPerfMetricsRepository.swift index cc9259fb..af0e2eec 100644 --- a/Sources/Infrastructure/Apps/Performance/SDKPerfMetricsRepository.swift +++ b/Sources/ASCKit/Apps/Performance/Internal/SDKPerfMetricsRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKPerfMetricsRepository: PerfMetricsRepository, @unchecked Sendable { private let client: any APIClient diff --git a/Sources/Infrastructure/Apps/Performance/SDKPerfOverviewRepository.swift b/Sources/ASCKit/Apps/Performance/Internal/SDKPerfOverviewRepository.swift similarity index 96% rename from Sources/Infrastructure/Apps/Performance/SDKPerfOverviewRepository.swift rename to Sources/ASCKit/Apps/Performance/Internal/SDKPerfOverviewRepository.swift index 5d9f0b2f..fcb92c30 100644 --- a/Sources/Infrastructure/Apps/Performance/SDKPerfOverviewRepository.swift +++ b/Sources/ASCKit/Apps/Performance/Internal/SDKPerfOverviewRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKPerfOverviewRepository: PerfOverviewRepository, @unchecked Sendable { @@ -9,7 +8,7 @@ public struct SDKPerfOverviewRepository: PerfOverviewRepository, @unchecked Send self.client = client } - public func getOverview(appId: String, deviceType: String?) async throws -> Domain.PerformanceOverview { + public func getOverview(appId: String, deviceType: String?) async throws -> ASCKit.PerformanceOverview { // The endpoint returns `application/vnd.apple.xcode-overview+json` as raw Data. let request = APIEndpoint.v1.apps.id(appId).performanceOverviews.get( filterDeviceType: deviceType.map { [$0] } @@ -19,8 +18,8 @@ public struct SDKPerfOverviewRepository: PerfOverviewRepository, @unchecked Send return mapOverview(overview, appId: appId, deviceType: deviceType) } - private func mapOverview(_ overview: XcodeOverview, appId: String, deviceType: String?) -> Domain.PerformanceOverview { - Domain.PerformanceOverview( + private func mapOverview(_ overview: XcodeOverview, appId: String, deviceType: String?) -> ASCKit.PerformanceOverview { + ASCKit.PerformanceOverview( appId: appId, deviceType: deviceType, platform: overview.appMetadata?.platform, diff --git a/Sources/Domain/Apps/Performance/PerfMetricsRepository.swift b/Sources/ASCKit/Apps/Performance/PerfMetricsRepository.swift similarity index 100% rename from Sources/Domain/Apps/Performance/PerfMetricsRepository.swift rename to Sources/ASCKit/Apps/Performance/PerfMetricsRepository.swift diff --git a/Sources/Domain/Apps/Performance/PerfOverviewRepository.swift b/Sources/ASCKit/Apps/Performance/PerfOverviewRepository.swift similarity index 100% rename from Sources/Domain/Apps/Performance/PerfOverviewRepository.swift rename to Sources/ASCKit/Apps/Performance/PerfOverviewRepository.swift diff --git a/Sources/Domain/Apps/Performance/PerfPowerMetric.swift b/Sources/ASCKit/Apps/Performance/PerfPowerMetric.swift similarity index 100% rename from Sources/Domain/Apps/Performance/PerfPowerMetric.swift rename to Sources/ASCKit/Apps/Performance/PerfPowerMetric.swift diff --git a/Sources/Domain/Apps/Performance/Performance+RESTRoutes.swift b/Sources/ASCKit/Apps/Performance/Performance+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/Performance/Performance+RESTRoutes.swift rename to Sources/ASCKit/Apps/Performance/Performance+RESTRoutes.swift diff --git a/Sources/Domain/Apps/Performance/PerformanceOverview.swift b/Sources/ASCKit/Apps/Performance/PerformanceOverview.swift similarity index 100% rename from Sources/Domain/Apps/Performance/PerformanceOverview.swift rename to Sources/ASCKit/Apps/Performance/PerformanceOverview.swift diff --git a/Sources/Domain/Apps/Pricing/AppPricePoint.swift b/Sources/ASCKit/Apps/Pricing/AppPricePoint.swift similarity index 100% rename from Sources/Domain/Apps/Pricing/AppPricePoint.swift rename to Sources/ASCKit/Apps/Pricing/AppPricePoint.swift diff --git a/Sources/Domain/Apps/Pricing/AppPriceSchedule.swift b/Sources/ASCKit/Apps/Pricing/AppPriceSchedule.swift similarity index 100% rename from Sources/Domain/Apps/Pricing/AppPriceSchedule.swift rename to Sources/ASCKit/Apps/Pricing/AppPriceSchedule.swift diff --git a/Sources/Domain/Apps/Pricing/AppPricing+RESTRoutes.swift b/Sources/ASCKit/Apps/Pricing/AppPricing+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/Pricing/AppPricing+RESTRoutes.swift rename to Sources/ASCKit/Apps/Pricing/AppPricing+RESTRoutes.swift diff --git a/Sources/Infrastructure/Apps/Pricing/SDKPricingRepository.swift b/Sources/ASCKit/Apps/Pricing/Internal/SDKPricingRepository.swift similarity index 90% rename from Sources/Infrastructure/Apps/Pricing/SDKPricingRepository.swift rename to Sources/ASCKit/Apps/Pricing/Internal/SDKPricingRepository.swift index 3c1ac3ab..42eb497e 100644 --- a/Sources/Infrastructure/Apps/Pricing/SDKPricingRepository.swift +++ b/Sources/ASCKit/Apps/Pricing/Internal/SDKPricingRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKPricingRepository: PricingRepository, @unchecked Sendable { private let client: any APIClient @@ -18,7 +17,7 @@ public struct SDKPricingRepository: PricingRepository, @unchecked Sendable { } } - public func listPricePoints(appId: String, territory: String) async throws -> [Domain.AppPricePoint] { + public func listPricePoints(appId: String, territory: String) async throws -> [ASCKit.AppPricePoint] { let pages = try await client.requestAllPages( APIEndpoint.v1.apps.id(appId).appPricePoints.get(parameters: .init( filterTerritory: [territory], @@ -29,12 +28,12 @@ public struct SDKPricingRepository: PricingRepository, @unchecked Sendable { ) // Filtered to one territory, so every point belongs to it. return pages.flatMap(\.data).map { - Domain.AppPricePoint(id: $0.id, appId: appId, territory: territory, + ASCKit.AppPricePoint(id: $0.id, appId: appId, territory: territory, customerPrice: $0.attributes?.customerPrice, proceeds: $0.attributes?.proceeds) } } - public func setPriceSchedule(appId: String, baseTerritory: String, pricePointId: String) async throws -> Domain.AppPriceSchedule { + public func setPriceSchedule(appId: String, baseTerritory: String, pricePointId: String) async throws -> ASCKit.AppPriceSchedule { // One inline manual price, correlated by a `${...}` local id (same shape as IAP price schedules). let localId = "${local-app-price-1}" let body = AppPriceScheduleCreateRequest( @@ -55,6 +54,6 @@ public struct SDKPricingRepository: PricingRepository, @unchecked Sendable { ] ) let response = try await client.request(APIEndpoint.v1.appPriceSchedules.post(body)) - return Domain.AppPriceSchedule(id: response.data.id, appId: appId, baseTerritory: baseTerritory) + return ASCKit.AppPriceSchedule(id: response.data.id, appId: appId, baseTerritory: baseTerritory) } } diff --git a/Sources/Domain/Apps/Pricing/PricingRepository.swift b/Sources/ASCKit/Apps/Pricing/PricingRepository.swift similarity index 100% rename from Sources/Domain/Apps/Pricing/PricingRepository.swift rename to Sources/ASCKit/Apps/Pricing/PricingRepository.swift diff --git a/Sources/Infrastructure/Apps/ProductVersions/SDKProductVersionRepository.swift b/Sources/ASCKit/Apps/ProductVersions/Internal/SDKProductVersionRepository.swift similarity index 86% rename from Sources/Infrastructure/Apps/ProductVersions/SDKProductVersionRepository.swift rename to Sources/ASCKit/Apps/ProductVersions/Internal/SDKProductVersionRepository.swift index 7ac62fee..bf287dce 100644 --- a/Sources/Infrastructure/Apps/ProductVersions/SDKProductVersionRepository.swift +++ b/Sources/ASCKit/Apps/ProductVersions/Internal/SDKProductVersionRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKProductVersionRepository: ProductVersionRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKProductVersionRepository: ProductVersionRepository, @unchecked self.client = client } - public func listInAppPurchaseVersions(iapId: String) async throws -> [Domain.ProductVersion] { + public func listInAppPurchaseVersions(iapId: String) async throws -> [ASCKit.ProductVersion] { let pages = try await client.requestAllPages( APIEndpoint.v2.inAppPurchases.id(iapId).versions.get(parameters: .init(limit: 200)), nextCursor: { $0.meta?.paging.nextCursor } @@ -19,7 +18,7 @@ public struct SDKProductVersionRepository: ProductVersionRepository, @unchecked } } - public func listSubscriptionVersions(subscriptionId: String) async throws -> [Domain.ProductVersion] { + public func listSubscriptionVersions(subscriptionId: String) async throws -> [ASCKit.ProductVersion] { let pages = try await client.requestAllPages( APIEndpoint.v1.subscriptions.id(subscriptionId).versions.get(parameters: .init(limit: 200)), nextCursor: { $0.meta?.paging.nextCursor } @@ -30,7 +29,7 @@ public struct SDKProductVersionRepository: ProductVersionRepository, @unchecked } } - public func listSubscriptionGroupVersions(groupId: String) async throws -> [Domain.ProductVersion] { + public func listSubscriptionGroupVersions(groupId: String) async throws -> [ASCKit.ProductVersion] { let pages = try await client.requestAllPages( APIEndpoint.v1.subscriptionGroups.id(groupId).versions.get(parameters: .init(limit: 200)), nextCursor: { $0.meta?.paging.nextCursor } @@ -43,11 +42,11 @@ public struct SDKProductVersionRepository: ProductVersionRepository, @unchecked /// The three SDK version types share the same attributes and state values. private func map( - id: String, productId: String, kind: Domain.ProductVersionKind, version: Int?, state: String? - ) -> Domain.ProductVersion { - Domain.ProductVersion( + id: String, productId: String, kind: ASCKit.ProductVersionKind, version: Int?, state: String? + ) -> ASCKit.ProductVersion { + ASCKit.ProductVersion( id: id, productId: productId, kind: kind, version: version, - state: state.flatMap(Domain.ProductVersionState.init(rawValue:)) ?? .prepareForSubmission + state: state.flatMap(ASCKit.ProductVersionState.init(rawValue:)) ?? .prepareForSubmission ) } } diff --git a/Sources/Domain/Apps/ProductVersions/ProductVersion+RESTRoutes.swift b/Sources/ASCKit/Apps/ProductVersions/ProductVersion+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/ProductVersions/ProductVersion+RESTRoutes.swift rename to Sources/ASCKit/Apps/ProductVersions/ProductVersion+RESTRoutes.swift diff --git a/Sources/Domain/Apps/ProductVersions/ProductVersion.swift b/Sources/ASCKit/Apps/ProductVersions/ProductVersion.swift similarity index 100% rename from Sources/Domain/Apps/ProductVersions/ProductVersion.swift rename to Sources/ASCKit/Apps/ProductVersions/ProductVersion.swift diff --git a/Sources/Domain/Apps/ProductVersions/ProductVersionRepository.swift b/Sources/ASCKit/Apps/ProductVersions/ProductVersionRepository.swift similarity index 100% rename from Sources/Domain/Apps/ProductVersions/ProductVersionRepository.swift rename to Sources/ASCKit/Apps/ProductVersions/ProductVersionRepository.swift diff --git a/Sources/Infrastructure/Apps/PromotedPurchases/SDKPromotedPurchaseRepository.swift b/Sources/ASCKit/Apps/PromotedPurchases/Internal/SDKPromotedPurchaseRepository.swift similarity index 90% rename from Sources/Infrastructure/Apps/PromotedPurchases/SDKPromotedPurchaseRepository.swift rename to Sources/ASCKit/Apps/PromotedPurchases/Internal/SDKPromotedPurchaseRepository.swift index 35ed84a9..fc18c2c2 100644 --- a/Sources/Infrastructure/Apps/PromotedPurchases/SDKPromotedPurchaseRepository.swift +++ b/Sources/ASCKit/Apps/PromotedPurchases/Internal/SDKPromotedPurchaseRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKPromotedPurchaseRepository: PromotedPurchaseRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKPromotedPurchaseRepository: PromotedPurchaseRepository, @unchec self.client = client } - public func listPromotedPurchases(appId: String, limit: Int?) async throws -> PaginatedResponse { + public func listPromotedPurchases(appId: String, limit: Int?) async throws -> PaginatedResponse { let request = APIEndpoint.v1.apps.id(appId).promotedPurchases.get(parameters: .init(limit: limit)) let response = try await client.request(request) let purchases = response.data.map { mapPurchase($0, appId: appId) } @@ -21,7 +20,7 @@ public struct SDKPromotedPurchaseRepository: PromotedPurchaseRepository, @unchec isEnabled: Bool?, inAppPurchaseId: String?, subscriptionId: String? - ) async throws -> Domain.PromotedPurchase { + ) async throws -> ASCKit.PromotedPurchase { let iapRel = inAppPurchaseId.map { PromotedPurchaseCreateRequest.Data.Relationships.InAppPurchaseV2(data: .init(type: .inAppPurchases, id: $0)) } @@ -45,7 +44,7 @@ public struct SDKPromotedPurchaseRepository: PromotedPurchaseRepository, @unchec promotedId: String, isVisibleForAllUsers: Bool?, isEnabled: Bool? - ) async throws -> Domain.PromotedPurchase { + ) async throws -> ASCKit.PromotedPurchase { let body = PromotedPurchaseUpdateRequest(data: .init( type: .promotedPurchases, id: promotedId, @@ -63,10 +62,10 @@ public struct SDKPromotedPurchaseRepository: PromotedPurchaseRepository, @unchec private func mapPurchase( _ sdk: AppStoreConnect_Swift_SDK.PromotedPurchase, appId: String - ) -> Domain.PromotedPurchase { + ) -> ASCKit.PromotedPurchase { let stateRaw = sdk.attributes?.state?.rawValue - let state = stateRaw.flatMap { Domain.PromotedPurchaseState(rawValue: $0) } - return Domain.PromotedPurchase( + let state = stateRaw.flatMap { ASCKit.PromotedPurchaseState(rawValue: $0) } + return ASCKit.PromotedPurchase( id: sdk.id, appId: appId, isVisibleForAllUsers: sdk.attributes?.isVisibleForAllUsers ?? false, diff --git a/Sources/Domain/Apps/PromotedPurchases/PromotedPurchase.swift b/Sources/ASCKit/Apps/PromotedPurchases/PromotedPurchase.swift similarity index 100% rename from Sources/Domain/Apps/PromotedPurchases/PromotedPurchase.swift rename to Sources/ASCKit/Apps/PromotedPurchases/PromotedPurchase.swift diff --git a/Sources/Domain/Apps/PromotedPurchases/PromotedPurchaseRepository.swift b/Sources/ASCKit/Apps/PromotedPurchases/PromotedPurchaseRepository.swift similarity index 100% rename from Sources/Domain/Apps/PromotedPurchases/PromotedPurchaseRepository.swift rename to Sources/ASCKit/Apps/PromotedPurchases/PromotedPurchaseRepository.swift diff --git a/Sources/Domain/Apps/Reviews/CustomerReview.swift b/Sources/ASCKit/Apps/Reviews/CustomerReview.swift similarity index 100% rename from Sources/Domain/Apps/Reviews/CustomerReview.swift rename to Sources/ASCKit/Apps/Reviews/CustomerReview.swift diff --git a/Sources/Domain/Apps/Reviews/CustomerReviewRepository.swift b/Sources/ASCKit/Apps/Reviews/CustomerReviewRepository.swift similarity index 100% rename from Sources/Domain/Apps/Reviews/CustomerReviewRepository.swift rename to Sources/ASCKit/Apps/Reviews/CustomerReviewRepository.swift diff --git a/Sources/Domain/Apps/Reviews/CustomerReviewResponse.swift b/Sources/ASCKit/Apps/Reviews/CustomerReviewResponse.swift similarity index 100% rename from Sources/Domain/Apps/Reviews/CustomerReviewResponse.swift rename to Sources/ASCKit/Apps/Reviews/CustomerReviewResponse.swift diff --git a/Sources/Infrastructure/Apps/Reviews/SDKCustomerReviewRepository.swift b/Sources/ASCKit/Apps/Reviews/Internal/SDKCustomerReviewRepository.swift similarity index 84% rename from Sources/Infrastructure/Apps/Reviews/SDKCustomerReviewRepository.swift rename to Sources/ASCKit/Apps/Reviews/Internal/SDKCustomerReviewRepository.swift index 63025a66..7c6a7e3a 100644 --- a/Sources/Infrastructure/Apps/Reviews/SDKCustomerReviewRepository.swift +++ b/Sources/ASCKit/Apps/Reviews/Internal/SDKCustomerReviewRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKCustomerReviewRepository: CustomerReviewRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKCustomerReviewRepository: CustomerReviewRepository, @unchecked self.client = client } - public func listReviews(appId: String) async throws -> [Domain.CustomerReview] { + public func listReviews(appId: String) async throws -> [ASCKit.CustomerReview] { let pages = try await client.requestAllPages( APIEndpoint.v1.apps.id(appId).customerReviews.get( parameters: .init(sort: [.minuscreatedDate], limit: 200) @@ -18,19 +17,19 @@ public struct SDKCustomerReviewRepository: CustomerReviewRepository, @unchecked return pages.flatMap(\.data).map { mapReview($0, appId: appId) } } - public func getReview(reviewId: String) async throws -> Domain.CustomerReview { + public func getReview(reviewId: String) async throws -> ASCKit.CustomerReview { let request = APIEndpoint.v1.customerReviews.id(reviewId).get() let response = try await client.request(request) return mapReview(response.data, appId: "") } - public func getResponse(reviewId: String) async throws -> Domain.CustomerReviewResponse { + public func getResponse(reviewId: String) async throws -> ASCKit.CustomerReviewResponse { let request = APIEndpoint.v1.customerReviews.id(reviewId).response.get() let response = try await client.request(request) return mapResponse(response.data, reviewId: reviewId) } - public func createResponse(reviewId: String, responseBody: String) async throws -> Domain.CustomerReviewResponse { + public func createResponse(reviewId: String, responseBody: String) async throws -> ASCKit.CustomerReviewResponse { let body = CustomerReviewResponseV1CreateRequest( data: .init( type: .customerReviewResponses, @@ -51,8 +50,8 @@ public struct SDKCustomerReviewRepository: CustomerReviewRepository, @unchecked private func mapReview( _ sdkReview: AppStoreConnect_Swift_SDK.CustomerReview, appId: String - ) -> Domain.CustomerReview { - Domain.CustomerReview( + ) -> ASCKit.CustomerReview { + ASCKit.CustomerReview( id: sdkReview.id, appId: appId, rating: sdkReview.attributes?.rating ?? 0, @@ -67,8 +66,8 @@ public struct SDKCustomerReviewRepository: CustomerReviewRepository, @unchecked private func mapResponse( _ sdkResponse: AppStoreConnect_Swift_SDK.CustomerReviewResponseV1, reviewId: String - ) -> Domain.CustomerReviewResponse { - Domain.CustomerReviewResponse( + ) -> ASCKit.CustomerReviewResponse { + ASCKit.CustomerReviewResponse( id: sdkResponse.id, reviewId: reviewId, responseBody: sdkResponse.attributes?.responseBody ?? "", @@ -77,7 +76,7 @@ public struct SDKCustomerReviewRepository: CustomerReviewRepository, @unchecked ) } - private func mapState(_ sdkState: AppStoreConnect_Swift_SDK.CustomerReviewResponseV1.Attributes.State?) -> Domain.ReviewResponseState { + private func mapState(_ sdkState: AppStoreConnect_Swift_SDK.CustomerReviewResponseV1.Attributes.State?) -> ASCKit.ReviewResponseState { switch sdkState { case .published: return .published case .pendingPublish: return .pendingPublish diff --git a/Sources/Infrastructure/Apps/Subscriptions/Availability/SDKSubscriptionAvailabilityRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Availability/Internal/SDKSubscriptionAvailabilityRepository.swift similarity index 88% rename from Sources/Infrastructure/Apps/Subscriptions/Availability/SDKSubscriptionAvailabilityRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Availability/Internal/SDKSubscriptionAvailabilityRepository.swift index d3a290ea..4a33786c 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/Availability/SDKSubscriptionAvailabilityRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/Availability/Internal/SDKSubscriptionAvailabilityRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKSubscriptionAvailabilityRepository: SubscriptionAvailabilityRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKSubscriptionAvailabilityRepository: SubscriptionAvailabilityRep self.client = client } - public func getAvailability(subscriptionId: String) async throws -> Domain.SubscriptionAvailability? { + public func getAvailability(subscriptionId: String) async throws -> ASCKit.SubscriptionAvailability? { // Two parallel calls — see SDKInAppPurchaseAvailabilityRepository for rationale. // 404 → nil (no availability configured yet on a fresh subscription). do { @@ -24,9 +23,9 @@ public struct SDKSubscriptionAvailabilityRepository: SubscriptionAvailabilityRep let (avail, terr) = try await (availResponse, terrResponse) let territories = terr.data.map { t in - Domain.Territory(id: t.id, currency: t.attributes?.currency) + ASCKit.Territory(id: t.id, currency: t.attributes?.currency) } - return Domain.SubscriptionAvailability( + return ASCKit.SubscriptionAvailability( id: avail.data.id, subscriptionId: subscriptionId, isAvailableInNewTerritories: avail.data.attributes?.isAvailableInNewTerritories ?? false, @@ -41,7 +40,7 @@ public struct SDKSubscriptionAvailabilityRepository: SubscriptionAvailabilityRep subscriptionId: String, isAvailableInNewTerritories: Bool, territoryIds: [String] - ) async throws -> Domain.SubscriptionAvailability { + ) async throws -> ASCKit.SubscriptionAvailability { let body = SubscriptionAvailabilityCreateRequest(data: .init( type: .subscriptionAvailabilities, attributes: .init(isAvailableInNewTerritories: isAvailableInNewTerritories), @@ -58,15 +57,15 @@ public struct SDKSubscriptionAvailabilityRepository: SubscriptionAvailabilityRep _ sdk: AppStoreConnect_Swift_SDK.SubscriptionAvailability, included: [AppStoreConnect_Swift_SDK.Territory]?, subscriptionId: String - ) -> Domain.SubscriptionAvailability { + ) -> ASCKit.SubscriptionAvailability { let territoryIds = sdk.relationships?.availableTerritories?.data?.map(\.id) ?? [] let includedMap = Dictionary( uniqueKeysWithValues: (included ?? []).map { ($0.id, $0) } ) let territories = territoryIds.map { id in - Domain.Territory(id: id, currency: includedMap[id]?.attributes?.currency) + ASCKit.Territory(id: id, currency: includedMap[id]?.attributes?.currency) } - return Domain.SubscriptionAvailability( + return ASCKit.SubscriptionAvailability( id: sdk.id, subscriptionId: subscriptionId, isAvailableInNewTerritories: sdk.attributes?.isAvailableInNewTerritories ?? false, diff --git a/Sources/Domain/Apps/Subscriptions/Availability/SubscriptionAvailability.swift b/Sources/ASCKit/Apps/Subscriptions/Availability/SubscriptionAvailability.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Availability/SubscriptionAvailability.swift rename to Sources/ASCKit/Apps/Subscriptions/Availability/SubscriptionAvailability.swift diff --git a/Sources/Domain/Apps/Subscriptions/Availability/SubscriptionAvailabilityRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Availability/SubscriptionAvailabilityRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Availability/SubscriptionAvailabilityRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Availability/SubscriptionAvailabilityRepository.swift diff --git a/Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionGroupRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionGroupRepository.swift similarity index 88% rename from Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionGroupRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionGroupRepository.swift index a1f5503e..591b52c4 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionGroupRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionGroupRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKSubscriptionGroupRepository: SubscriptionGroupRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKSubscriptionGroupRepository: SubscriptionGroupRepository, @unch self.client = client } - public func listSubscriptionGroups(appId: String, limit: Int?) async throws -> PaginatedResponse { + public func listSubscriptionGroups(appId: String, limit: Int?) async throws -> PaginatedResponse { let request = APIEndpoint.v1.apps.id(appId).subscriptionGroups.get(parameters: .init( limit: limit )) @@ -17,7 +16,7 @@ public struct SDKSubscriptionGroupRepository: SubscriptionGroupRepository, @unch return PaginatedResponse(data: groups, nextCursor: response.links.next) } - public func createSubscriptionGroup(appId: String, referenceName: String) async throws -> Domain.SubscriptionGroup { + public func createSubscriptionGroup(appId: String, referenceName: String) async throws -> ASCKit.SubscriptionGroup { let body = SubscriptionGroupCreateRequest(data: .init( type: .subscriptionGroups, attributes: .init(referenceName: referenceName), @@ -32,7 +31,7 @@ public struct SDKSubscriptionGroupRepository: SubscriptionGroupRepository, @unch public func updateSubscriptionGroup( groupId: String, referenceName: String - ) async throws -> Domain.SubscriptionGroup { + ) async throws -> ASCKit.SubscriptionGroup { let body = SubscriptionGroupUpdateRequest(data: .init( type: .subscriptionGroups, id: groupId, @@ -47,8 +46,8 @@ public struct SDKSubscriptionGroupRepository: SubscriptionGroupRepository, @unch _ = try await client.request(APIEndpoint.v1.subscriptionGroups.id(groupId).delete) } - private func mapGroup(_ sdk: AppStoreConnect_Swift_SDK.SubscriptionGroup, appId: String) -> Domain.SubscriptionGroup { - Domain.SubscriptionGroup( + private func mapGroup(_ sdk: AppStoreConnect_Swift_SDK.SubscriptionGroup, appId: String) -> ASCKit.SubscriptionGroup { + ASCKit.SubscriptionGroup( id: sdk.id, appId: appId, referenceName: sdk.attributes?.referenceName ?? "" diff --git a/Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionPriceRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionPriceRepository.swift similarity index 86% rename from Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionPriceRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionPriceRepository.swift index f43a9b37..055afa0c 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionPriceRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionPriceRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unchecked Sendable { private let client: any APIClient @@ -13,7 +12,7 @@ public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unch territory: String?, limit: Int?, cursor: String? - ) async throws -> Domain.PaginatedResponse { + ) async throws -> ASCKit.PaginatedResponse { var request = APIEndpoint.v1.subscriptions.id(subscriptionId).pricePoints.get( parameters: .init( filterTerritory: territory.map { [$0] }, @@ -27,7 +26,7 @@ public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unch request.query = query } let response = try await client.request(request) - return Domain.PaginatedResponse( + return ASCKit.PaginatedResponse( data: response.data.map { mapPricePoint($0, subscriptionId: subscriptionId) }, nextCursor: response.meta?.paging.nextCursor, totalCount: response.meta?.paging.total @@ -40,7 +39,7 @@ public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unch pricePointId: String, startDate: String?, preserveCurrentPrice: Bool? - ) async throws -> Domain.SubscriptionPrice { + ) async throws -> ASCKit.SubscriptionPrice { let body = SubscriptionPriceCreateRequest(data: .init( type: .subscriptionPrices, attributes: .init(startDate: startDate, isPreserveCurrentPrice: preserveCurrentPrice), @@ -51,13 +50,13 @@ public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unch ) )) let response = try await client.request(APIEndpoint.v1.subscriptionPrices.post(body)) - return Domain.SubscriptionPrice(id: response.data.id, subscriptionId: subscriptionId) + return ASCKit.SubscriptionPrice(id: response.data.id, subscriptionId: subscriptionId) } public func setPrices( subscriptionId: String, - prices: [Domain.SubscriptionPriceInput] - ) async throws -> Domain.SubscriptionPriceSchedule { + prices: [ASCKit.SubscriptionPriceInput] + ) async throws -> ASCKit.SubscriptionPriceSchedule { // One PATCH with every price inlined — a single request instead of one POST per // territory, and Apple applies it all-or-nothing. let localIds = prices.indices.map { "${price-\($0)}" } @@ -82,10 +81,10 @@ public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unch _ = try await client.request(APIEndpoint.v1.subscriptions.id(subscriptionId).patch(body)) // Re-read the schedule so the caller gets the post-write state. return try await getPriceSchedule(subscriptionId: subscriptionId) - ?? Domain.SubscriptionPriceSchedule(id: subscriptionId, subscriptionId: subscriptionId) + ?? ASCKit.SubscriptionPriceSchedule(id: subscriptionId, subscriptionId: subscriptionId) } - public func listEqualizations(pricePointId: String, limit: Int?) async throws -> [Domain.SubscriptionPricePoint] { + public func listEqualizations(pricePointId: String, limit: Int?) async throws -> [ASCKit.SubscriptionPricePoint] { let request = APIEndpoint.v1.subscriptionPricePoints.id(pricePointId).equalizations.get( parameters: .init( fieldsSubscriptionPricePoints: [.customerPrice, .proceeds, .proceedsYear2, .territory], @@ -100,7 +99,7 @@ public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unch return response.data.map { mapPricePoint($0, subscriptionId: "") } } - public func getPriceSchedule(subscriptionId: String) async throws -> Domain.SubscriptionPriceSchedule? { + public func getPriceSchedule(subscriptionId: String) async throws -> ASCKit.SubscriptionPriceSchedule? { // Step 1: GET /v1/subscriptions/{id}/prices?include=territory,subscriptionPricePoint, // following every page — a subscription can have a manual price in all 175 territories. let pages = try await client.requestAllPages( @@ -119,18 +118,18 @@ public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unch // No prices set → no schedule yet. guard !pricesData.isEmpty else { return nil } - var territoriesById: [String: Domain.Territory] = [:] + var territoriesById: [String: ASCKit.Territory] = [:] var pricePointsById: [String: AppStoreConnect_Swift_SDK.SubscriptionPricePoint] = [:] for item in pricesIncluded { switch item { case .territory(let t): - territoriesById[t.id] = Domain.Territory(id: t.id, currency: t.attributes?.currency) + territoriesById[t.id] = ASCKit.Territory(id: t.id, currency: t.attributes?.currency) case .subscriptionPricePoint(let pp): pricePointsById[pp.id] = pp } } - let manualPrices: [Domain.TerritoryPrice] = pricesData.compactMap { price in + let manualPrices: [ASCKit.TerritoryPrice] = pricesData.compactMap { price in guard let territoryId = price.relationships?.territory?.data?.id, let territory = territoriesById[territoryId], @@ -139,30 +138,30 @@ public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unch let customerPrice = pricePoint.attributes?.customerPrice, let proceeds = pricePoint.attributes?.proceeds else { return nil } - return Domain.TerritoryPrice(territory: territory, customerPrice: customerPrice, proceeds: proceeds) + return ASCKit.TerritoryPrice(territory: territory, customerPrice: customerPrice, proceeds: proceeds) } // Step 2: equalize using the first manual price's price point. let firstPricePointId = pricesData.first?.relationships?.subscriptionPricePoint?.data?.id - var equalized: [Domain.TerritoryPrice] = [] + var equalized: [ASCKit.TerritoryPrice] = [] if let pricePointId = firstPricePointId { equalized = (try? await fetchEqualizedTerritoryPrices(pricePointId: pricePointId)) ?? [] } // Merge: manual entries override equalized for the same territory. - var byTerritory: [String: Domain.TerritoryPrice] = [:] + var byTerritory: [String: ASCKit.TerritoryPrice] = [:] for entry in equalized { byTerritory[entry.territory.id] = entry } for entry in manualPrices { byTerritory[entry.territory.id] = entry } let merged = byTerritory.values.sorted { $0.territory.id < $1.territory.id } - return Domain.SubscriptionPriceSchedule( + return ASCKit.SubscriptionPriceSchedule( id: subscriptionId, subscriptionId: subscriptionId, territoryPrices: merged ) } - private func fetchEqualizedTerritoryPrices(pricePointId: String) async throws -> [Domain.TerritoryPrice] { + private func fetchEqualizedTerritoryPrices(pricePointId: String) async throws -> [ASCKit.TerritoryPrice] { let response = try await client.request( APIEndpoint.v1.subscriptionPricePoints.id(pricePointId).equalizations.get(parameters: .init( fieldsSubscriptionPricePoints: [.customerPrice, .proceeds, .proceedsYear2, .territory], @@ -172,9 +171,9 @@ public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unch )) ) - var territoriesById: [String: Domain.Territory] = [:] + var territoriesById: [String: ASCKit.Territory] = [:] for t in response.included ?? [] { - territoriesById[t.id] = Domain.Territory(id: t.id, currency: t.attributes?.currency) + territoriesById[t.id] = ASCKit.Territory(id: t.id, currency: t.attributes?.currency) } return response.data.compactMap { pp in @@ -183,16 +182,16 @@ public struct SDKSubscriptionPriceRepository: SubscriptionPriceRepository, @unch let customerPrice = pp.attributes?.customerPrice, let proceeds = pp.attributes?.proceeds else { return nil } - let territory = territoriesById[territoryId] ?? Domain.Territory(id: territoryId, currency: nil) - return Domain.TerritoryPrice(territory: territory, customerPrice: customerPrice, proceeds: proceeds) + let territory = territoriesById[territoryId] ?? ASCKit.Territory(id: territoryId, currency: nil) + return ASCKit.TerritoryPrice(territory: territory, customerPrice: customerPrice, proceeds: proceeds) } } private func mapPricePoint( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionPricePoint, subscriptionId: String - ) -> Domain.SubscriptionPricePoint { - Domain.SubscriptionPricePoint( + ) -> ASCKit.SubscriptionPricePoint { + ASCKit.SubscriptionPricePoint( id: sdk.id, subscriptionId: subscriptionId, territory: sdk.relationships?.territory?.data?.id, diff --git a/Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionRepository.swift similarity index 90% rename from Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionRepository.swift index fe2f2da2..e12e3c66 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKSubscriptionRepository: SubscriptionRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKSubscriptionRepository: SubscriptionRepository, @unchecked Send self.client = client } - public func listSubscriptions(groupId: String, limit: Int?) async throws -> PaginatedResponse { + public func listSubscriptions(groupId: String, limit: Int?) async throws -> PaginatedResponse { let request = APIEndpoint.v1.subscriptionGroups.id(groupId).subscriptions.get(parameters: .init( limit: limit )) @@ -21,10 +20,10 @@ public struct SDKSubscriptionRepository: SubscriptionRepository, @unchecked Send groupId: String, name: String, productId: String, - period: Domain.SubscriptionPeriod, + period: ASCKit.SubscriptionPeriod, isFamilySharable: Bool, groupLevel: Int? - ) async throws -> Domain.Subscription { + ) async throws -> ASCKit.Subscription { let sdkPeriod = SubscriptionCreateRequest.Data.Attributes.SubscriptionPeriod(rawValue: period.rawValue) let body = SubscriptionCreateRequest(data: .init( type: .subscriptions, @@ -48,11 +47,11 @@ public struct SDKSubscriptionRepository: SubscriptionRepository, @unchecked Send name: String?, isFamilySharable: Bool?, groupLevel: Int?, - subscriptionPeriod: Domain.SubscriptionPeriod?, + subscriptionPeriod: ASCKit.SubscriptionPeriod?, reviewNote: String?, multiSeatStatus: SubscriptionMultiSeatStatus?, marketSettings: [SubscriptionMarketSetting]? - ) async throws -> Domain.Subscription { + ) async throws -> ASCKit.Subscription { let sdkPeriod = subscriptionPeriod.flatMap { SubscriptionUpdateRequest.Data.Attributes.SubscriptionPeriod(rawValue: $0.rawValue) } @@ -81,12 +80,12 @@ public struct SDKSubscriptionRepository: SubscriptionRepository, @unchecked Send _ = try await client.request(APIEndpoint.v1.subscriptions.id(subscriptionId).delete) } - private func mapSubscription(_ sdk: AppStoreConnect_Swift_SDK.Subscription, groupId: String) -> Domain.Subscription { + private func mapSubscription(_ sdk: AppStoreConnect_Swift_SDK.Subscription, groupId: String) -> ASCKit.Subscription { let periodRaw = sdk.attributes?.subscriptionPeriod?.rawValue ?? SubscriptionPeriod.oneMonth.rawValue - let period = Domain.SubscriptionPeriod(rawValue: periodRaw) ?? .oneMonth + let period = ASCKit.SubscriptionPeriod(rawValue: periodRaw) ?? .oneMonth let stateRaw = sdk.attributes?.state?.rawValue ?? SubscriptionState.missingMetadata.rawValue - let state = Domain.SubscriptionState(rawValue: stateRaw) ?? .missingMetadata - return Domain.Subscription( + let state = ASCKit.SubscriptionState(rawValue: stateRaw) ?? .missingMetadata + return ASCKit.Subscription( id: sdk.id, groupId: groupId, name: sdk.attributes?.name ?? "", diff --git a/Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionSubmissionRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionSubmissionRepository.swift similarity index 90% rename from Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionSubmissionRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionSubmissionRepository.swift index 051acfed..67728f8d 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/SDKSubscriptionSubmissionRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/Internal/SDKSubscriptionSubmissionRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKSubscriptionSubmissionRepository: SubscriptionSubmissionRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKSubscriptionSubmissionRepository: SubscriptionSubmissionReposit self.client = client } - public func submitSubscription(subscriptionId: String) async throws -> Domain.SubscriptionSubmission { + public func submitSubscription(subscriptionId: String) async throws -> ASCKit.SubscriptionSubmission { let body = SubscriptionSubmissionCreateRequest(data: .init( type: .subscriptionSubmissions, relationships: .init( @@ -16,7 +15,7 @@ public struct SDKSubscriptionSubmissionRepository: SubscriptionSubmissionReposit ) )) let response = try await client.request(APIEndpoint.v1.subscriptionSubmissions.post(body)) - return Domain.SubscriptionSubmission(id: response.data.id, subscriptionId: subscriptionId) + return ASCKit.SubscriptionSubmission(id: response.data.id, subscriptionId: subscriptionId) } public func deleteSubmission(submissionId: String) async throws { diff --git a/Sources/Infrastructure/Apps/Subscriptions/IntroductoryOffers/SDKSubscriptionIntroductoryOfferRepository.swift b/Sources/ASCKit/Apps/Subscriptions/IntroductoryOffers/Internal/SDKSubscriptionIntroductoryOfferRepository.swift similarity index 83% rename from Sources/Infrastructure/Apps/Subscriptions/IntroductoryOffers/SDKSubscriptionIntroductoryOfferRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/IntroductoryOffers/Internal/SDKSubscriptionIntroductoryOfferRepository.swift index 09bc8818..6f28309b 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/IntroductoryOffers/SDKSubscriptionIntroductoryOfferRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/IntroductoryOffers/Internal/SDKSubscriptionIntroductoryOfferRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKSubscriptionIntroductoryOfferRepository: SubscriptionIntroductoryOfferRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKSubscriptionIntroductoryOfferRepository: SubscriptionIntroducto self.client = client } - public func listIntroductoryOffers(subscriptionId: String) async throws -> [Domain.SubscriptionIntroductoryOffer] { + public func listIntroductoryOffers(subscriptionId: String) async throws -> [ASCKit.SubscriptionIntroductoryOffer] { let request = APIEndpoint.v1.subscriptions.id(subscriptionId).introductoryOffers.get() let response = try await client.request(request) return response.data.map { mapOffer($0, subscriptionId: subscriptionId) } @@ -16,14 +15,14 @@ public struct SDKSubscriptionIntroductoryOfferRepository: SubscriptionIntroducto public func createIntroductoryOffer( subscriptionId: String, - duration: Domain.SubscriptionOfferDuration, - offerMode: Domain.SubscriptionOfferMode, + duration: ASCKit.SubscriptionOfferDuration, + offerMode: ASCKit.SubscriptionOfferMode, numberOfPeriods: Int, startDate: String?, endDate: String?, territory: String?, pricePointId: String? - ) async throws -> Domain.SubscriptionIntroductoryOffer { + ) async throws -> ASCKit.SubscriptionIntroductoryOffer { let sdkDuration = AppStoreConnect_Swift_SDK.SubscriptionOfferDuration(rawValue: duration.rawValue) ?? .oneMonth let sdkMode = AppStoreConnect_Swift_SDK.SubscriptionOfferMode(rawValue: offerMode.rawValue) ?? .freeTrial @@ -60,14 +59,14 @@ public struct SDKSubscriptionIntroductoryOfferRepository: SubscriptionIntroducto private func mapOffer( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionIntroductoryOffer, subscriptionId: String - ) -> Domain.SubscriptionIntroductoryOffer { - let durationRaw = sdk.attributes?.duration?.rawValue ?? Domain.SubscriptionOfferDuration.oneMonth.rawValue - let duration = Domain.SubscriptionOfferDuration(rawValue: durationRaw) ?? .oneMonth - let modeRaw = sdk.attributes?.offerMode?.rawValue ?? Domain.SubscriptionOfferMode.freeTrial.rawValue - let offerMode = Domain.SubscriptionOfferMode(rawValue: modeRaw) ?? .freeTrial + ) -> ASCKit.SubscriptionIntroductoryOffer { + let durationRaw = sdk.attributes?.duration?.rawValue ?? ASCKit.SubscriptionOfferDuration.oneMonth.rawValue + let duration = ASCKit.SubscriptionOfferDuration(rawValue: durationRaw) ?? .oneMonth + let modeRaw = sdk.attributes?.offerMode?.rawValue ?? ASCKit.SubscriptionOfferMode.freeTrial.rawValue + let offerMode = ASCKit.SubscriptionOfferMode(rawValue: modeRaw) ?? .freeTrial let territory = sdk.relationships?.territory?.data?.id - return Domain.SubscriptionIntroductoryOffer( + return ASCKit.SubscriptionIntroductoryOffer( id: sdk.id, subscriptionId: subscriptionId, duration: duration, diff --git a/Sources/Domain/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOffer.swift b/Sources/ASCKit/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOffer.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOffer.swift rename to Sources/ASCKit/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOffer.swift diff --git a/Sources/Domain/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOfferRepository.swift b/Sources/ASCKit/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOfferRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOfferRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOfferRepository.swift diff --git a/Sources/Infrastructure/Apps/Subscriptions/Localizations/SDKSubscriptionGroupLocalizationRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Localizations/Internal/SDKSubscriptionGroupLocalizationRepository.swift similarity index 86% rename from Sources/Infrastructure/Apps/Subscriptions/Localizations/SDKSubscriptionGroupLocalizationRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Localizations/Internal/SDKSubscriptionGroupLocalizationRepository.swift index 803ecf21..d948093d 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/Localizations/SDKSubscriptionGroupLocalizationRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/Localizations/Internal/SDKSubscriptionGroupLocalizationRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKSubscriptionGroupLocalizationRepository: SubscriptionGroupLocalizationRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKSubscriptionGroupLocalizationRepository: SubscriptionGroupLocal self.client = client } - public func listLocalizations(groupId: String) async throws -> [Domain.SubscriptionGroupLocalization] { + public func listLocalizations(groupId: String) async throws -> [ASCKit.SubscriptionGroupLocalization] { let request = APIEndpoint.v1.subscriptionGroups.id(groupId).subscriptionGroupLocalizations.get() let response = try await client.request(request) return response.data.map { mapLocalization($0, groupId: groupId) } @@ -19,7 +18,7 @@ public struct SDKSubscriptionGroupLocalizationRepository: SubscriptionGroupLocal locale: String, name: String, customAppName: String? - ) async throws -> Domain.SubscriptionGroupLocalization { + ) async throws -> ASCKit.SubscriptionGroupLocalization { let body = SubscriptionGroupLocalizationCreateRequest(data: .init( type: .subscriptionGroupLocalizations, attributes: .init(name: name, customAppName: customAppName, locale: locale), @@ -35,7 +34,7 @@ public struct SDKSubscriptionGroupLocalizationRepository: SubscriptionGroupLocal localizationId: String, name: String?, customAppName: String? - ) async throws -> Domain.SubscriptionGroupLocalization { + ) async throws -> ASCKit.SubscriptionGroupLocalization { let body = SubscriptionGroupLocalizationUpdateRequest(data: .init( type: .subscriptionGroupLocalizations, id: localizationId, @@ -52,8 +51,8 @@ public struct SDKSubscriptionGroupLocalizationRepository: SubscriptionGroupLocal private func mapLocalization( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionGroupLocalization, groupId: String - ) -> Domain.SubscriptionGroupLocalization { - Domain.SubscriptionGroupLocalization( + ) -> ASCKit.SubscriptionGroupLocalization { + ASCKit.SubscriptionGroupLocalization( id: sdk.id, groupId: groupId, locale: sdk.attributes?.locale ?? "", @@ -65,8 +64,8 @@ public struct SDKSubscriptionGroupLocalizationRepository: SubscriptionGroupLocal private func mapState( _ sdkState: AppStoreConnect_Swift_SDK.SubscriptionGroupLocalization.Attributes.State? - ) -> Domain.SubscriptionGroupLocalizationState? { + ) -> ASCKit.SubscriptionGroupLocalizationState? { guard let sdkState else { return nil } - return Domain.SubscriptionGroupLocalizationState(rawValue: sdkState.rawValue) + return ASCKit.SubscriptionGroupLocalizationState(rawValue: sdkState.rawValue) } } diff --git a/Sources/Infrastructure/Apps/Subscriptions/Localizations/SDKSubscriptionLocalizationRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Localizations/Internal/SDKSubscriptionLocalizationRepository.swift similarity index 87% rename from Sources/Infrastructure/Apps/Subscriptions/Localizations/SDKSubscriptionLocalizationRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Localizations/Internal/SDKSubscriptionLocalizationRepository.swift index 7eac10ca..8923fa7a 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/Localizations/SDKSubscriptionLocalizationRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/Localizations/Internal/SDKSubscriptionLocalizationRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKSubscriptionLocalizationRepository: SubscriptionLocalizationRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKSubscriptionLocalizationRepository: SubscriptionLocalizationRep self.client = client } - public func listLocalizations(subscriptionId: String) async throws -> [Domain.SubscriptionLocalization] { + public func listLocalizations(subscriptionId: String) async throws -> [ASCKit.SubscriptionLocalization] { let request = APIEndpoint.v1.subscriptions.id(subscriptionId).subscriptionLocalizations.get() let response = try await client.request(request) return response.data.map { mapLocalization($0, subscriptionId: subscriptionId) } @@ -19,7 +18,7 @@ public struct SDKSubscriptionLocalizationRepository: SubscriptionLocalizationRep locale: String, name: String, description: String? - ) async throws -> Domain.SubscriptionLocalization { + ) async throws -> ASCKit.SubscriptionLocalization { let body = SubscriptionLocalizationCreateRequest(data: .init( type: .subscriptionLocalizations, attributes: .init(name: name, locale: locale, description: description), @@ -35,7 +34,7 @@ public struct SDKSubscriptionLocalizationRepository: SubscriptionLocalizationRep localizationId: String, name: String?, description: String? - ) async throws -> Domain.SubscriptionLocalization { + ) async throws -> ASCKit.SubscriptionLocalization { let body = SubscriptionLocalizationUpdateRequest(data: .init( type: .subscriptionLocalizations, id: localizationId, @@ -54,8 +53,8 @@ public struct SDKSubscriptionLocalizationRepository: SubscriptionLocalizationRep private func mapLocalization( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionLocalization, subscriptionId: String - ) -> Domain.SubscriptionLocalization { - Domain.SubscriptionLocalization( + ) -> ASCKit.SubscriptionLocalization { + ASCKit.SubscriptionLocalization( id: sdk.id, subscriptionId: subscriptionId, locale: sdk.attributes?.locale ?? "", @@ -67,8 +66,8 @@ public struct SDKSubscriptionLocalizationRepository: SubscriptionLocalizationRep private func mapState( _ sdkState: AppStoreConnect_Swift_SDK.SubscriptionLocalization.Attributes.State? - ) -> Domain.SubscriptionLocalizationState? { + ) -> ASCKit.SubscriptionLocalizationState? { guard let sdkState else { return nil } - return Domain.SubscriptionLocalizationState(rawValue: sdkState.rawValue) + return ASCKit.SubscriptionLocalizationState(rawValue: sdkState.rawValue) } } diff --git a/Sources/Domain/Apps/Subscriptions/Localizations/SubscriptionGroupLocalization.swift b/Sources/ASCKit/Apps/Subscriptions/Localizations/SubscriptionGroupLocalization.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Localizations/SubscriptionGroupLocalization.swift rename to Sources/ASCKit/Apps/Subscriptions/Localizations/SubscriptionGroupLocalization.swift diff --git a/Sources/Domain/Apps/Subscriptions/Localizations/SubscriptionGroupLocalizationRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Localizations/SubscriptionGroupLocalizationRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Localizations/SubscriptionGroupLocalizationRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Localizations/SubscriptionGroupLocalizationRepository.swift diff --git a/Sources/Domain/Apps/Subscriptions/Localizations/SubscriptionLocalization.swift b/Sources/ASCKit/Apps/Subscriptions/Localizations/SubscriptionLocalization.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Localizations/SubscriptionLocalization.swift rename to Sources/ASCKit/Apps/Subscriptions/Localizations/SubscriptionLocalization.swift diff --git a/Sources/Domain/Apps/Subscriptions/Localizations/SubscriptionLocalizationRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Localizations/SubscriptionLocalizationRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Localizations/SubscriptionLocalizationRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Localizations/SubscriptionLocalizationRepository.swift diff --git a/Sources/Infrastructure/Apps/Subscriptions/OfferCodes/SDKSubscriptionOfferCodeRepository.swift b/Sources/ASCKit/Apps/Subscriptions/OfferCodes/Internal/SDKSubscriptionOfferCodeRepository.swift similarity index 85% rename from Sources/Infrastructure/Apps/Subscriptions/OfferCodes/SDKSubscriptionOfferCodeRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/OfferCodes/Internal/SDKSubscriptionOfferCodeRepository.swift index e25567dc..fc44ed93 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/OfferCodes/SDKSubscriptionOfferCodeRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/OfferCodes/Internal/SDKSubscriptionOfferCodeRepository.swift @@ -1,6 +1,5 @@ import Foundation @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepository, @unchecked Sendable { private let client: any APIClient @@ -11,7 +10,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor // MARK: - Offer Codes - public func listOfferCodes(subscriptionId: String) async throws -> [Domain.SubscriptionOfferCode] { + public func listOfferCodes(subscriptionId: String) async throws -> [ASCKit.SubscriptionOfferCode] { let request = APIEndpoint.v1.subscriptions.id(subscriptionId).offerCodes.get() let response = try await client.request(request) return response.data.map { mapOfferCode($0, subscriptionId: subscriptionId) } @@ -20,14 +19,14 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor public func createOfferCode( subscriptionId: String, name: String, - customerEligibilities: [Domain.SubscriptionCustomerEligibility], - offerEligibility: Domain.SubscriptionOfferEligibility, - duration: Domain.SubscriptionOfferDuration, - offerMode: Domain.SubscriptionOfferMode, + customerEligibilities: [ASCKit.SubscriptionCustomerEligibility], + offerEligibility: ASCKit.SubscriptionOfferEligibility, + duration: ASCKit.SubscriptionOfferDuration, + offerMode: ASCKit.SubscriptionOfferMode, numberOfPeriods: Int, isAutoRenewEnabled: Bool, - prices: [Domain.OfferCodePriceInput] - ) async throws -> Domain.SubscriptionOfferCode { + prices: [ASCKit.OfferCodePriceInput] + ) async throws -> ASCKit.SubscriptionOfferCode { let sdkEligibilities = customerEligibilities.compactMap { AppStoreConnect_Swift_SDK.SubscriptionCustomerEligibility(rawValue: mapCustomerEligibilityToSDK($0)) } @@ -38,7 +37,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor // Same `${local-price-N}` placeholder pattern as IAP — ties `included[]` items // back to the parent's `relationships.prices.data` references. - let pricesPayload: [(localId: String, input: Domain.OfferCodePriceInput)] = prices.enumerated().map { + let pricesPayload: [(localId: String, input: ASCKit.OfferCodePriceInput)] = prices.enumerated().map { (localId: "${local-price-\($0.offset + 1)}", input: $0.element) } let pricesRelationship = pricesPayload.map { @@ -82,7 +81,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor return mapOfferCode(response.data, subscriptionId: subscriptionId) } - public func updateOfferCode(offerCodeId: String, isActive: Bool) async throws -> Domain.SubscriptionOfferCode { + public func updateOfferCode(offerCodeId: String, isActive: Bool) async throws -> ASCKit.SubscriptionOfferCode { let body = SubscriptionOfferCodeUpdateRequest( data: .init( type: .subscriptionOfferCodes, @@ -96,7 +95,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor // MARK: - Custom Codes - public func listCustomCodes(offerCodeId: String) async throws -> [Domain.SubscriptionOfferCodeCustomCode] { + public func listCustomCodes(offerCodeId: String) async throws -> [ASCKit.SubscriptionOfferCodeCustomCode] { let request = APIEndpoint.v1.subscriptionOfferCodes.id(offerCodeId).customCodes.get() let response = try await client.request(request) return response.data.map { mapCustomCode($0, offerCodeId: offerCodeId) } @@ -107,7 +106,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor customCode: String, numberOfCodes: Int, expirationDate: String? - ) async throws -> Domain.SubscriptionOfferCodeCustomCode { + ) async throws -> ASCKit.SubscriptionOfferCodeCustomCode { let body = SubscriptionOfferCodeCustomCodeCreateRequest( data: .init( type: .subscriptionOfferCodeCustomCodes, @@ -125,7 +124,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor return mapCustomCode(response.data, offerCodeId: offerCodeId) } - public func updateCustomCode(customCodeId: String, isActive: Bool) async throws -> Domain.SubscriptionOfferCodeCustomCode { + public func updateCustomCode(customCodeId: String, isActive: Bool) async throws -> ASCKit.SubscriptionOfferCodeCustomCode { let body = SubscriptionOfferCodeCustomCodeUpdateRequest( data: .init( type: .subscriptionOfferCodeCustomCodes, @@ -139,7 +138,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor // MARK: - One-Time Use Codes - public func listOneTimeUseCodes(offerCodeId: String) async throws -> [Domain.SubscriptionOfferCodeOneTimeUseCode] { + public func listOneTimeUseCodes(offerCodeId: String) async throws -> [ASCKit.SubscriptionOfferCodeOneTimeUseCode] { let request = APIEndpoint.v1.subscriptionOfferCodes.id(offerCodeId).oneTimeUseCodes.get() let response = try await client.request(request) return response.data.map { mapOneTimeUseCode($0, offerCodeId: offerCodeId) } @@ -149,8 +148,8 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor offerCodeId: String, numberOfCodes: Int, expirationDate: String, - environment: Domain.OfferCodeEnvironment - ) async throws -> Domain.SubscriptionOfferCodeOneTimeUseCode { + environment: ASCKit.OfferCodeEnvironment + ) async throws -> ASCKit.SubscriptionOfferCodeOneTimeUseCode { let sdkEnv = AppStoreConnect_Swift_SDK.OfferCodeEnvironment(rawValue: environment.rawValue) let body = SubscriptionOfferCodeOneTimeUseCodeCreateRequest( data: .init( @@ -169,7 +168,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor return mapOneTimeUseCode(response.data, offerCodeId: offerCodeId) } - public func updateOneTimeUseCode(oneTimeCodeId: String, isActive: Bool) async throws -> Domain.SubscriptionOfferCodeOneTimeUseCode { + public func updateOneTimeUseCode(oneTimeCodeId: String, isActive: Bool) async throws -> ASCKit.SubscriptionOfferCodeOneTimeUseCode { let body = SubscriptionOfferCodeOneTimeUseCodeUpdateRequest( data: .init( type: .subscriptionOfferCodeOneTimeUseCodes, @@ -188,7 +187,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor // MARK: - Prices - public func listPrices(offerCodeId: String) async throws -> [Domain.SubscriptionOfferCodePrice] { + public func listPrices(offerCodeId: String) async throws -> [ASCKit.SubscriptionOfferCodePrice] { // One price per territory — follow every page to get all 175. `include` makes Apple // return each price's territory and price point linkage, which the mapper reads. let pages = try await client.requestAllPages( @@ -201,8 +200,8 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor private func mapPrice( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionOfferCodePrice, offerCodeId: String - ) -> Domain.SubscriptionOfferCodePrice { - Domain.SubscriptionOfferCodePrice( + ) -> ASCKit.SubscriptionOfferCodePrice { + ASCKit.SubscriptionOfferCodePrice( id: sdk.id, offerCodeId: offerCodeId, territory: sdk.relationships?.territory?.data?.id, @@ -215,17 +214,17 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor private func mapOfferCode( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionOfferCode, subscriptionId: String - ) -> Domain.SubscriptionOfferCode { - let customerEligibilities = (sdk.attributes?.customerEligibilities ?? []).compactMap { sdkEligibility -> Domain.SubscriptionCustomerEligibility? in + ) -> ASCKit.SubscriptionOfferCode { + let customerEligibilities = (sdk.attributes?.customerEligibilities ?? []).compactMap { sdkEligibility -> ASCKit.SubscriptionCustomerEligibility? in mapCustomerEligibilityToDomain(sdkEligibility) } let offerEligibility = sdk.attributes?.offerEligibility.flatMap { mapOfferEligibilityToDomain($0) } ?? .stackable - let durationRaw = sdk.attributes?.duration?.rawValue ?? Domain.SubscriptionOfferDuration.oneMonth.rawValue - let duration = Domain.SubscriptionOfferDuration(rawValue: durationRaw) ?? .oneMonth - let modeRaw = sdk.attributes?.offerMode?.rawValue ?? Domain.SubscriptionOfferMode.freeTrial.rawValue - let offerMode = Domain.SubscriptionOfferMode(rawValue: modeRaw) ?? .freeTrial + let durationRaw = sdk.attributes?.duration?.rawValue ?? ASCKit.SubscriptionOfferDuration.oneMonth.rawValue + let duration = ASCKit.SubscriptionOfferDuration(rawValue: durationRaw) ?? .oneMonth + let modeRaw = sdk.attributes?.offerMode?.rawValue ?? ASCKit.SubscriptionOfferMode.freeTrial.rawValue + let offerMode = ASCKit.SubscriptionOfferMode(rawValue: modeRaw) ?? .freeTrial - return Domain.SubscriptionOfferCode( + return ASCKit.SubscriptionOfferCode( id: sdk.id, subscriptionId: subscriptionId, name: sdk.attributes?.name ?? "", @@ -244,10 +243,10 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor private func mapCustomCode( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionOfferCodeCustomCode, offerCodeId: String - ) -> Domain.SubscriptionOfferCodeCustomCode { + ) -> ASCKit.SubscriptionOfferCodeCustomCode { let createdDateString: String? = sdk.attributes?.createdDate.map { ISO8601DateFormatter().string(from: $0) } - return Domain.SubscriptionOfferCodeCustomCode( + return ASCKit.SubscriptionOfferCodeCustomCode( id: sdk.id, offerCodeId: offerCodeId, customCode: sdk.attributes?.customCode ?? "", @@ -261,13 +260,13 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor private func mapOneTimeUseCode( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionOfferCodeOneTimeUseCode, offerCodeId: String - ) -> Domain.SubscriptionOfferCodeOneTimeUseCode { + ) -> ASCKit.SubscriptionOfferCodeOneTimeUseCode { let createdDateString: String? = sdk.attributes?.createdDate.map { ISO8601DateFormatter().string(from: $0) } - let environment: Domain.OfferCodeEnvironment? = sdk.attributes?.environment.flatMap { - Domain.OfferCodeEnvironment(rawValue: $0.rawValue) + let environment: ASCKit.OfferCodeEnvironment? = sdk.attributes?.environment.flatMap { + ASCKit.OfferCodeEnvironment(rawValue: $0.rawValue) } - return Domain.SubscriptionOfferCodeOneTimeUseCode( + return ASCKit.SubscriptionOfferCodeOneTimeUseCode( id: sdk.id, offerCodeId: offerCodeId, numberOfCodes: sdk.attributes?.numberOfCodes ?? 0, @@ -283,7 +282,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor /// Maps domain customer eligibility to SDK raw value /// Domain: NEW, LAPSED, WIN_BACK, PAID_SUBSCRIBER /// SDK: NEW, EXISTING, EXPIRED - private func mapCustomerEligibilityToSDK(_ domain: Domain.SubscriptionCustomerEligibility) -> String { + private func mapCustomerEligibilityToSDK(_ domain: ASCKit.SubscriptionCustomerEligibility) -> String { switch domain { case .new: return "NEW" case .lapsed: return "EXPIRED" @@ -293,7 +292,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor } /// Maps SDK customer eligibility to domain - private func mapCustomerEligibilityToDomain(_ sdk: AppStoreConnect_Swift_SDK.SubscriptionCustomerEligibility) -> Domain.SubscriptionCustomerEligibility? { + private func mapCustomerEligibilityToDomain(_ sdk: AppStoreConnect_Swift_SDK.SubscriptionCustomerEligibility) -> ASCKit.SubscriptionCustomerEligibility? { switch sdk { case .new: return .new case .existing: return .paidSubscriber @@ -304,7 +303,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor /// Maps domain offer eligibility to SDK raw value /// Domain: STACKABLE, INTRODUCTORY, SUBSCRIPTION_OFFER /// SDK: STACK_WITH_INTRO_OFFERS, REPLACE_INTRO_OFFERS - private func mapOfferEligibilityToSDK(_ domain: Domain.SubscriptionOfferEligibility) -> String { + private func mapOfferEligibilityToSDK(_ domain: ASCKit.SubscriptionOfferEligibility) -> String { switch domain { case .stackable: return "STACK_WITH_INTRO_OFFERS" case .introductory: return "REPLACE_INTRO_OFFERS" @@ -313,7 +312,7 @@ public struct SDKSubscriptionOfferCodeRepository: SubscriptionOfferCodeRepositor } /// Maps SDK offer eligibility to domain - private func mapOfferEligibilityToDomain(_ sdk: AppStoreConnect_Swift_SDK.SubscriptionOfferEligibility) -> Domain.SubscriptionOfferEligibility { + private func mapOfferEligibilityToDomain(_ sdk: AppStoreConnect_Swift_SDK.SubscriptionOfferEligibility) -> ASCKit.SubscriptionOfferEligibility { switch sdk { case .stackWithIntroOffers: return .stackable case .replaceIntroOffers: return .introductory diff --git a/Sources/Domain/Apps/Subscriptions/OfferCodes/SubscriptionOfferCode.swift b/Sources/ASCKit/Apps/Subscriptions/OfferCodes/SubscriptionOfferCode.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/OfferCodes/SubscriptionOfferCode.swift rename to Sources/ASCKit/Apps/Subscriptions/OfferCodes/SubscriptionOfferCode.swift diff --git a/Sources/Domain/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeCustomCode.swift b/Sources/ASCKit/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeCustomCode.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeCustomCode.swift rename to Sources/ASCKit/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeCustomCode.swift diff --git a/Sources/Domain/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeOneTimeUseCode.swift b/Sources/ASCKit/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeOneTimeUseCode.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeOneTimeUseCode.swift rename to Sources/ASCKit/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeOneTimeUseCode.swift diff --git a/Sources/Domain/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodePrice.swift b/Sources/ASCKit/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodePrice.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodePrice.swift rename to Sources/ASCKit/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodePrice.swift diff --git a/Sources/Domain/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeRepository.swift b/Sources/ASCKit/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeRepository.swift diff --git a/Sources/Infrastructure/Apps/Subscriptions/PromotionalOffers/SDKSubscriptionPromotionalOfferRepository.swift b/Sources/ASCKit/Apps/Subscriptions/PromotionalOffers/Internal/SDKSubscriptionPromotionalOfferRepository.swift similarity index 83% rename from Sources/Infrastructure/Apps/Subscriptions/PromotionalOffers/SDKSubscriptionPromotionalOfferRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/PromotionalOffers/Internal/SDKSubscriptionPromotionalOfferRepository.swift index db6c6f66..48750260 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/PromotionalOffers/SDKSubscriptionPromotionalOfferRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/PromotionalOffers/Internal/SDKSubscriptionPromotionalOfferRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKSubscriptionPromotionalOfferRepository: SubscriptionPromotionalOfferRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKSubscriptionPromotionalOfferRepository: SubscriptionPromotional self.client = client } - public func listPromotionalOffers(subscriptionId: String) async throws -> [Domain.SubscriptionPromotionalOffer] { + public func listPromotionalOffers(subscriptionId: String) async throws -> [ASCKit.SubscriptionPromotionalOffer] { let request = APIEndpoint.v1.subscriptions.id(subscriptionId).promotionalOffers.get() let response = try await client.request(request) return response.data.map { mapOffer($0, subscriptionId: subscriptionId) } @@ -18,11 +17,11 @@ public struct SDKSubscriptionPromotionalOfferRepository: SubscriptionPromotional subscriptionId: String, name: String, offerCode: String, - duration: Domain.SubscriptionOfferDuration, - offerMode: Domain.SubscriptionOfferMode, + duration: ASCKit.SubscriptionOfferDuration, + offerMode: ASCKit.SubscriptionOfferMode, numberOfPeriods: Int, - prices: [Domain.PromotionalOfferPriceInput] - ) async throws -> Domain.SubscriptionPromotionalOffer { + prices: [ASCKit.PromotionalOfferPriceInput] + ) async throws -> ASCKit.SubscriptionPromotionalOffer { let sdkDuration = AppStoreConnect_Swift_SDK.SubscriptionOfferDuration(rawValue: duration.rawValue) ?? .oneMonth let sdkMode = AppStoreConnect_Swift_SDK.SubscriptionOfferMode(rawValue: offerMode.rawValue) ?? .freeTrial @@ -68,7 +67,7 @@ public struct SDKSubscriptionPromotionalOfferRepository: SubscriptionPromotional _ = try await client.request(APIEndpoint.v1.subscriptionPromotionalOffers.id(offerId).delete) } - public func listPrices(offerId: String) async throws -> [Domain.SubscriptionPromotionalOfferPrice] { + public func listPrices(offerId: String) async throws -> [ASCKit.SubscriptionPromotionalOfferPrice] { // One price per territory — follow every page to get all 175. `include` makes Apple // return each price's territory and price point linkage, which the mapper reads. let pages = try await client.requestAllPages( @@ -81,13 +80,13 @@ public struct SDKSubscriptionPromotionalOfferRepository: SubscriptionPromotional private func mapOffer( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionPromotionalOffer, subscriptionId: String - ) -> Domain.SubscriptionPromotionalOffer { - let durationRaw = sdk.attributes?.duration?.rawValue ?? Domain.SubscriptionOfferDuration.oneMonth.rawValue - let duration = Domain.SubscriptionOfferDuration(rawValue: durationRaw) ?? .oneMonth - let modeRaw = sdk.attributes?.offerMode?.rawValue ?? Domain.SubscriptionOfferMode.freeTrial.rawValue - let mode = Domain.SubscriptionOfferMode(rawValue: modeRaw) ?? .freeTrial + ) -> ASCKit.SubscriptionPromotionalOffer { + let durationRaw = sdk.attributes?.duration?.rawValue ?? ASCKit.SubscriptionOfferDuration.oneMonth.rawValue + let duration = ASCKit.SubscriptionOfferDuration(rawValue: durationRaw) ?? .oneMonth + let modeRaw = sdk.attributes?.offerMode?.rawValue ?? ASCKit.SubscriptionOfferMode.freeTrial.rawValue + let mode = ASCKit.SubscriptionOfferMode(rawValue: modeRaw) ?? .freeTrial - return Domain.SubscriptionPromotionalOffer( + return ASCKit.SubscriptionPromotionalOffer( id: sdk.id, subscriptionId: subscriptionId, name: sdk.attributes?.name ?? "", @@ -101,8 +100,8 @@ public struct SDKSubscriptionPromotionalOfferRepository: SubscriptionPromotional private func mapPrice( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionPromotionalOfferPrice, offerId: String - ) -> Domain.SubscriptionPromotionalOfferPrice { - Domain.SubscriptionPromotionalOfferPrice( + ) -> ASCKit.SubscriptionPromotionalOfferPrice { + ASCKit.SubscriptionPromotionalOfferPrice( id: sdk.id, offerId: offerId, territory: sdk.relationships?.territory?.data?.id, diff --git a/Sources/Domain/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOffer.swift b/Sources/ASCKit/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOffer.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOffer.swift rename to Sources/ASCKit/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOffer.swift diff --git a/Sources/Domain/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOfferPrice.swift b/Sources/ASCKit/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOfferPrice.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOfferPrice.swift rename to Sources/ASCKit/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOfferPrice.swift diff --git a/Sources/Domain/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOfferRepository.swift b/Sources/ASCKit/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOfferRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOfferRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/PromotionalOffers/SubscriptionPromotionalOfferRepository.swift diff --git a/Sources/Infrastructure/Apps/Subscriptions/Review/SDKSubscriptionReviewRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Review/Internal/SDKSubscriptionReviewRepository.swift similarity index 91% rename from Sources/Infrastructure/Apps/Subscriptions/Review/SDKSubscriptionReviewRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Review/Internal/SDKSubscriptionReviewRepository.swift index 2b51312e..d2ac535c 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/Review/SDKSubscriptionReviewRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/Review/Internal/SDKSubscriptionReviewRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKSubscriptionReviewRepository: SubscriptionReviewRepository, @unchecked Sendable { @@ -22,7 +21,7 @@ public struct SDKSubscriptionReviewRepository: SubscriptionReviewRepository, @un self.pollMaxAttempts = pollMaxAttempts } - public func getReviewScreenshot(subscriptionId: String) async throws -> Domain.SubscriptionReviewScreenshot? { + public func getReviewScreenshot(subscriptionId: String) async throws -> ASCKit.SubscriptionReviewScreenshot? { do { let response = try await client.request( APIEndpoint.v1.subscriptions.id(subscriptionId).appStoreReviewScreenshot.get() @@ -36,7 +35,7 @@ public struct SDKSubscriptionReviewRepository: SubscriptionReviewRepository, @un public func uploadReviewScreenshot( subscriptionId: String, fileURL: URL - ) async throws -> Domain.SubscriptionReviewScreenshot { + ) async throws -> ASCKit.SubscriptionReviewScreenshot { let fileData = try Data(contentsOf: fileURL) let fileName = fileURL.lastPathComponent logUploadStep("subscription-review-screenshot reserve fileName=\(fileName) bytes=\(fileData.count) subscriptionId=\(subscriptionId)") @@ -83,13 +82,13 @@ public struct SDKSubscriptionReviewRepository: SubscriptionReviewRepository, @un // MARK: - Promotional Images - public func listImages(subscriptionId: String) async throws -> [Domain.SubscriptionPromotionalImage] { + public func listImages(subscriptionId: String) async throws -> [ASCKit.SubscriptionPromotionalImage] { let request = APIEndpoint.v1.subscriptions.id(subscriptionId).images.get() let response = try await client.request(request) return response.data.map { mapImage($0, subscriptionId: subscriptionId) } } - public func uploadImage(subscriptionId: String, fileURL: URL) async throws -> Domain.SubscriptionPromotionalImage { + public func uploadImage(subscriptionId: String, fileURL: URL) async throws -> ASCKit.SubscriptionPromotionalImage { let fileData = try Data(contentsOf: fileURL) let fileName = fileURL.lastPathComponent logUploadStep("subscription-image reserve fileName=\(fileName) bytes=\(fileData.count) subscriptionId=\(subscriptionId)") @@ -135,8 +134,8 @@ public struct SDKSubscriptionReviewRepository: SubscriptionReviewRepository, @un /// Re-fetches the screenshot until ASC reports `assetDeliveryState == COMPLETE` /// (imageAsset URL populated). Stops on `FAILED`. Falls back to whatever the latest /// fetch returned if processing exceeds `pollMaxAttempts × pollDelayNanos`. - private func pollReviewScreenshotReady(screenshotId: String, subscriptionId: String) async throws -> Domain.SubscriptionReviewScreenshot { - var latest: Domain.SubscriptionReviewScreenshot? + private func pollReviewScreenshotReady(screenshotId: String, subscriptionId: String) async throws -> ASCKit.SubscriptionReviewScreenshot { + var latest: ASCKit.SubscriptionReviewScreenshot? for attempt in 1...pollMaxAttempts { let response = try await client.request( APIEndpoint.v1.subscriptionAppStoreReviewScreenshots.id(screenshotId).get() @@ -163,8 +162,8 @@ public struct SDKSubscriptionReviewRepository: SubscriptionReviewRepository, @un /// Re-fetches the image until state is one of `PREPARE_FOR_SUBMISSION / /// WAITING_FOR_REVIEW / APPROVED` (imageAsset URL populated). Stops on `FAILED`/`REJECTED`. - private func pollImageReady(imageId: String, subscriptionId: String) async throws -> Domain.SubscriptionPromotionalImage { - var latest: Domain.SubscriptionPromotionalImage? + private func pollImageReady(imageId: String, subscriptionId: String) async throws -> ASCKit.SubscriptionPromotionalImage { + var latest: ASCKit.SubscriptionPromotionalImage? for attempt in 1...pollMaxAttempts { let response = try await client.request( APIEndpoint.v1.subscriptionImages.id(imageId).get() @@ -190,10 +189,10 @@ public struct SDKSubscriptionReviewRepository: SubscriptionReviewRepository, @un private func mapImage( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionImage, subscriptionId: String - ) -> Domain.SubscriptionPromotionalImage { + ) -> ASCKit.SubscriptionPromotionalImage { let stateRaw = sdk.attributes?.state?.rawValue - let state = stateRaw.flatMap { Domain.SubscriptionPromotionalImage.ImageState(rawValue: $0) } - return Domain.SubscriptionPromotionalImage( + let state = stateRaw.flatMap { ASCKit.SubscriptionPromotionalImage.ImageState(rawValue: $0) } + return ASCKit.SubscriptionPromotionalImage( id: sdk.id, subscriptionId: subscriptionId, fileName: sdk.attributes?.fileName ?? "", @@ -206,10 +205,10 @@ public struct SDKSubscriptionReviewRepository: SubscriptionReviewRepository, @un private func mapReviewScreenshot( _ sdk: AppStoreConnect_Swift_SDK.SubscriptionAppStoreReviewScreenshot, subscriptionId: String - ) -> Domain.SubscriptionReviewScreenshot { + ) -> ASCKit.SubscriptionReviewScreenshot { let stateRaw = sdk.attributes?.assetDeliveryState?.state?.rawValue - let state = stateRaw.flatMap { Domain.SubscriptionReviewScreenshot.AssetState(rawValue: $0) } - return Domain.SubscriptionReviewScreenshot( + let state = stateRaw.flatMap { ASCKit.SubscriptionReviewScreenshot.AssetState(rawValue: $0) } + return ASCKit.SubscriptionReviewScreenshot( id: sdk.id, subscriptionId: subscriptionId, fileName: sdk.attributes?.fileName ?? "", @@ -219,11 +218,11 @@ public struct SDKSubscriptionReviewRepository: SubscriptionReviewRepository, @un ) } - private func mapImageAsset(_ sdk: AppStoreConnect_Swift_SDK.ImageAsset?) -> Domain.ImageAsset? { + private func mapImageAsset(_ sdk: AppStoreConnect_Swift_SDK.ImageAsset?) -> ASCKit.ImageAsset? { guard let templateUrl = sdk?.templateURL, !templateUrl.isEmpty, let width = sdk?.width, width > 0, let height = sdk?.height, height > 0 else { return nil } - return Domain.ImageAsset(templateUrl: templateUrl, width: width, height: height) + return ASCKit.ImageAsset(templateUrl: templateUrl, width: width, height: height) } } diff --git a/Sources/Domain/Apps/Subscriptions/Review/SubscriptionPromotionalImage.swift b/Sources/ASCKit/Apps/Subscriptions/Review/SubscriptionPromotionalImage.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Review/SubscriptionPromotionalImage.swift rename to Sources/ASCKit/Apps/Subscriptions/Review/SubscriptionPromotionalImage.swift diff --git a/Sources/Domain/Apps/Subscriptions/Review/SubscriptionReviewRepository.swift b/Sources/ASCKit/Apps/Subscriptions/Review/SubscriptionReviewRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Review/SubscriptionReviewRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/Review/SubscriptionReviewRepository.swift diff --git a/Sources/Domain/Apps/Subscriptions/Review/SubscriptionReviewScreenshot.swift b/Sources/ASCKit/Apps/Subscriptions/Review/SubscriptionReviewScreenshot.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Review/SubscriptionReviewScreenshot.swift rename to Sources/ASCKit/Apps/Subscriptions/Review/SubscriptionReviewScreenshot.swift diff --git a/Sources/Domain/Apps/Subscriptions/Subscription+RESTRoutes.swift b/Sources/ASCKit/Apps/Subscriptions/Subscription+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Subscription+RESTRoutes.swift rename to Sources/ASCKit/Apps/Subscriptions/Subscription+RESTRoutes.swift diff --git a/Sources/Domain/Apps/Subscriptions/Subscription.swift b/Sources/ASCKit/Apps/Subscriptions/Subscription.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/Subscription.swift rename to Sources/ASCKit/Apps/Subscriptions/Subscription.swift diff --git a/Sources/Domain/Apps/Subscriptions/SubscriptionGroup.swift b/Sources/ASCKit/Apps/Subscriptions/SubscriptionGroup.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/SubscriptionGroup.swift rename to Sources/ASCKit/Apps/Subscriptions/SubscriptionGroup.swift diff --git a/Sources/Domain/Apps/Subscriptions/SubscriptionGroupRepository.swift b/Sources/ASCKit/Apps/Subscriptions/SubscriptionGroupRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/SubscriptionGroupRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/SubscriptionGroupRepository.swift diff --git a/Sources/Domain/Apps/Subscriptions/SubscriptionPrice.swift b/Sources/ASCKit/Apps/Subscriptions/SubscriptionPrice.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/SubscriptionPrice.swift rename to Sources/ASCKit/Apps/Subscriptions/SubscriptionPrice.swift diff --git a/Sources/Domain/Apps/Subscriptions/SubscriptionPricePoint.swift b/Sources/ASCKit/Apps/Subscriptions/SubscriptionPricePoint.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/SubscriptionPricePoint.swift rename to Sources/ASCKit/Apps/Subscriptions/SubscriptionPricePoint.swift diff --git a/Sources/Domain/Apps/Subscriptions/SubscriptionPriceRepository.swift b/Sources/ASCKit/Apps/Subscriptions/SubscriptionPriceRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/SubscriptionPriceRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/SubscriptionPriceRepository.swift diff --git a/Sources/Domain/Apps/Subscriptions/SubscriptionPriceSchedule.swift b/Sources/ASCKit/Apps/Subscriptions/SubscriptionPriceSchedule.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/SubscriptionPriceSchedule.swift rename to Sources/ASCKit/Apps/Subscriptions/SubscriptionPriceSchedule.swift diff --git a/Sources/Domain/Apps/Subscriptions/SubscriptionRepository.swift b/Sources/ASCKit/Apps/Subscriptions/SubscriptionRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/SubscriptionRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/SubscriptionRepository.swift diff --git a/Sources/Domain/Apps/Subscriptions/SubscriptionSubmission.swift b/Sources/ASCKit/Apps/Subscriptions/SubscriptionSubmission.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/SubscriptionSubmission.swift rename to Sources/ASCKit/Apps/Subscriptions/SubscriptionSubmission.swift diff --git a/Sources/Domain/Apps/Subscriptions/SubscriptionSubmissionRepository.swift b/Sources/ASCKit/Apps/Subscriptions/SubscriptionSubmissionRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/SubscriptionSubmissionRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/SubscriptionSubmissionRepository.swift diff --git a/Sources/Infrastructure/Apps/Subscriptions/WinBackOffers/SDKWinBackOfferRepository.swift b/Sources/ASCKit/Apps/Subscriptions/WinBackOffers/Internal/SDKWinBackOfferRepository.swift similarity index 88% rename from Sources/Infrastructure/Apps/Subscriptions/WinBackOffers/SDKWinBackOfferRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/WinBackOffers/Internal/SDKWinBackOfferRepository.swift index 62d64256..78b9bc9c 100644 --- a/Sources/Infrastructure/Apps/Subscriptions/WinBackOffers/SDKWinBackOfferRepository.swift +++ b/Sources/ASCKit/Apps/Subscriptions/WinBackOffers/Internal/SDKWinBackOfferRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKWinBackOfferRepository: WinBackOfferRepository, @unchecked Sendable { @@ -9,7 +8,7 @@ public struct SDKWinBackOfferRepository: WinBackOfferRepository, @unchecked Send self.client = client } - public func listWinBackOffers(subscriptionId: String) async throws -> [Domain.WinBackOffer] { + public func listWinBackOffers(subscriptionId: String) async throws -> [ASCKit.WinBackOffer] { let request = APIEndpoint.v1.subscriptions.id(subscriptionId).winBackOffers.get() let response = try await client.request(request) return response.data.map { mapOffer($0, subscriptionId: subscriptionId) } @@ -19,8 +18,8 @@ public struct SDKWinBackOfferRepository: WinBackOfferRepository, @unchecked Send subscriptionId: String, referenceName: String, offerId: String, - duration: Domain.SubscriptionOfferDuration, - offerMode: Domain.SubscriptionOfferMode, + duration: ASCKit.SubscriptionOfferDuration, + offerMode: ASCKit.SubscriptionOfferMode, periodCount: Int, paidSubscriptionDurationInMonths: Int, timeSinceLastSubscribedMin: Int, @@ -28,10 +27,10 @@ public struct SDKWinBackOfferRepository: WinBackOfferRepository, @unchecked Send waitBetweenOffersInMonths: Int?, startDate: String, endDate: String?, - priority: Domain.WinBackOfferPriority, - promotionIntent: Domain.WinBackOfferPromotionIntent?, - prices: [Domain.WinBackOfferPriceInput] - ) async throws -> Domain.WinBackOffer { + priority: ASCKit.WinBackOfferPriority, + promotionIntent: ASCKit.WinBackOfferPromotionIntent?, + prices: [ASCKit.WinBackOfferPriceInput] + ) async throws -> ASCKit.WinBackOffer { // The generated SDK's `WinBackOfferPriceInlineCreate` lacks territory + pricePoint // relationships, so we build the body by hand. ASC web uses 1-based ${newPromoOfferPrice-N} // local IDs in the included[] array. @@ -118,13 +117,13 @@ public struct SDKWinBackOfferRepository: WinBackOfferRepository, @unchecked Send offerId: String, startDate: String?, endDate: String?, - priority: Domain.WinBackOfferPriority?, - promotionIntent: Domain.WinBackOfferPromotionIntent?, + priority: ASCKit.WinBackOfferPriority?, + promotionIntent: ASCKit.WinBackOfferPromotionIntent?, paidSubscriptionDurationInMonths: Int?, timeSinceLastSubscribedMin: Int?, timeSinceLastSubscribedMax: Int?, waitBetweenOffersInMonths: Int? - ) async throws -> Domain.WinBackOffer { + ) async throws -> ASCKit.WinBackOffer { let timeRange: AppStoreConnect_Swift_SDK.IntegerRange? = { guard let timeSinceLastSubscribedMin, let timeSinceLastSubscribedMax else { return nil } return AppStoreConnect_Swift_SDK.IntegerRange( @@ -157,7 +156,7 @@ public struct SDKWinBackOfferRepository: WinBackOfferRepository, @unchecked Send _ = try await client.request(APIEndpoint.v1.winBackOffers.id(offerId).delete) } - public func listPrices(offerId: String) async throws -> [Domain.WinBackOfferPrice] { + public func listPrices(offerId: String) async throws -> [ASCKit.WinBackOfferPrice] { // One price per territory — follow every page to get all 175. `include` makes Apple // return each price's territory and price point linkage, which the mapper reads. let pages = try await client.requestAllPages( @@ -170,16 +169,16 @@ public struct SDKWinBackOfferRepository: WinBackOfferRepository, @unchecked Send private func mapOffer( _ sdk: AppStoreConnect_Swift_SDK.WinBackOffer, subscriptionId: String - ) -> Domain.WinBackOffer { - let durationRaw = sdk.attributes?.duration?.rawValue ?? Domain.SubscriptionOfferDuration.oneMonth.rawValue - let duration = Domain.SubscriptionOfferDuration(rawValue: durationRaw) ?? .oneMonth - let modeRaw = sdk.attributes?.offerMode?.rawValue ?? Domain.SubscriptionOfferMode.payAsYouGo.rawValue - let mode = Domain.SubscriptionOfferMode(rawValue: modeRaw) ?? .payAsYouGo - let priorityRaw = sdk.attributes?.priority?.rawValue ?? Domain.WinBackOfferPriority.normal.rawValue - let priority = Domain.WinBackOfferPriority(rawValue: priorityRaw) ?? .normal - let promo = sdk.attributes?.promotionIntent.flatMap { Domain.WinBackOfferPromotionIntent(rawValue: $0.rawValue) } - - return Domain.WinBackOffer( + ) -> ASCKit.WinBackOffer { + let durationRaw = sdk.attributes?.duration?.rawValue ?? ASCKit.SubscriptionOfferDuration.oneMonth.rawValue + let duration = ASCKit.SubscriptionOfferDuration(rawValue: durationRaw) ?? .oneMonth + let modeRaw = sdk.attributes?.offerMode?.rawValue ?? ASCKit.SubscriptionOfferMode.payAsYouGo.rawValue + let mode = ASCKit.SubscriptionOfferMode(rawValue: modeRaw) ?? .payAsYouGo + let priorityRaw = sdk.attributes?.priority?.rawValue ?? ASCKit.WinBackOfferPriority.normal.rawValue + let priority = ASCKit.WinBackOfferPriority(rawValue: priorityRaw) ?? .normal + let promo = sdk.attributes?.promotionIntent.flatMap { ASCKit.WinBackOfferPromotionIntent(rawValue: $0.rawValue) } + + return ASCKit.WinBackOffer( id: sdk.id, subscriptionId: subscriptionId, referenceName: sdk.attributes?.referenceName ?? "", @@ -201,8 +200,8 @@ public struct SDKWinBackOfferRepository: WinBackOfferRepository, @unchecked Send private func mapPrice( _ sdk: AppStoreConnect_Swift_SDK.WinBackOfferPrice, offerId: String - ) -> Domain.WinBackOfferPrice { - Domain.WinBackOfferPrice( + ) -> ASCKit.WinBackOfferPrice { + ASCKit.WinBackOfferPrice( id: sdk.id, offerId: offerId, territory: sdk.relationships?.territory?.data?.id, diff --git a/Sources/Domain/Apps/Subscriptions/WinBackOffers/WinBackOffer.swift b/Sources/ASCKit/Apps/Subscriptions/WinBackOffers/WinBackOffer.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/WinBackOffers/WinBackOffer.swift rename to Sources/ASCKit/Apps/Subscriptions/WinBackOffers/WinBackOffer.swift diff --git a/Sources/Domain/Apps/Subscriptions/WinBackOffers/WinBackOfferRepository.swift b/Sources/ASCKit/Apps/Subscriptions/WinBackOffers/WinBackOfferRepository.swift similarity index 100% rename from Sources/Domain/Apps/Subscriptions/WinBackOffers/WinBackOfferRepository.swift rename to Sources/ASCKit/Apps/Subscriptions/WinBackOffers/WinBackOfferRepository.swift diff --git a/Sources/Domain/Apps/TestFlight/BetaAppLocalization.swift b/Sources/ASCKit/Apps/TestFlight/BetaAppLocalization.swift similarity index 100% rename from Sources/Domain/Apps/TestFlight/BetaAppLocalization.swift rename to Sources/ASCKit/Apps/TestFlight/BetaAppLocalization.swift diff --git a/Sources/Domain/Apps/TestFlight/BetaAppLocalizationRepository.swift b/Sources/ASCKit/Apps/TestFlight/BetaAppLocalizationRepository.swift similarity index 100% rename from Sources/Domain/Apps/TestFlight/BetaAppLocalizationRepository.swift rename to Sources/ASCKit/Apps/TestFlight/BetaAppLocalizationRepository.swift diff --git a/Sources/Domain/Apps/TestFlight/BetaAppReviewDetail.swift b/Sources/ASCKit/Apps/TestFlight/BetaAppReviewDetail.swift similarity index 100% rename from Sources/Domain/Apps/TestFlight/BetaAppReviewDetail.swift rename to Sources/ASCKit/Apps/TestFlight/BetaAppReviewDetail.swift diff --git a/Sources/Domain/Apps/TestFlight/BetaAppReviewRepository.swift b/Sources/ASCKit/Apps/TestFlight/BetaAppReviewRepository.swift similarity index 100% rename from Sources/Domain/Apps/TestFlight/BetaAppReviewRepository.swift rename to Sources/ASCKit/Apps/TestFlight/BetaAppReviewRepository.swift diff --git a/Sources/Domain/Apps/TestFlight/BetaAppReviewSubmission.swift b/Sources/ASCKit/Apps/TestFlight/BetaAppReviewSubmission.swift similarity index 100% rename from Sources/Domain/Apps/TestFlight/BetaAppReviewSubmission.swift rename to Sources/ASCKit/Apps/TestFlight/BetaAppReviewSubmission.swift diff --git a/Sources/Domain/Apps/TestFlight/BetaGroup+RESTRoutes.swift b/Sources/ASCKit/Apps/TestFlight/BetaGroup+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/TestFlight/BetaGroup+RESTRoutes.swift rename to Sources/ASCKit/Apps/TestFlight/BetaGroup+RESTRoutes.swift diff --git a/Sources/Domain/Apps/TestFlight/BetaGroup.swift b/Sources/ASCKit/Apps/TestFlight/BetaGroup.swift similarity index 100% rename from Sources/Domain/Apps/TestFlight/BetaGroup.swift rename to Sources/ASCKit/Apps/TestFlight/BetaGroup.swift diff --git a/Sources/Domain/Apps/TestFlight/BetaTester.swift b/Sources/ASCKit/Apps/TestFlight/BetaTester.swift similarity index 100% rename from Sources/Domain/Apps/TestFlight/BetaTester.swift rename to Sources/ASCKit/Apps/TestFlight/BetaTester.swift diff --git a/Sources/Infrastructure/Apps/TestFlight/OpenAPITestFlightRepository.swift b/Sources/ASCKit/Apps/TestFlight/Internal/OpenAPITestFlightRepository.swift similarity index 89% rename from Sources/Infrastructure/Apps/TestFlight/OpenAPITestFlightRepository.swift rename to Sources/ASCKit/Apps/TestFlight/Internal/OpenAPITestFlightRepository.swift index 2d841976..22c5a182 100644 --- a/Sources/Infrastructure/Apps/TestFlight/OpenAPITestFlightRepository.swift +++ b/Sources/ASCKit/Apps/TestFlight/Internal/OpenAPITestFlightRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKTestFlightRepository: TestFlightRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKTestFlightRepository: TestFlightRepository, @unchecked Sendable self.client = client } - public func listBetaGroups(appId: String?, limit: Int?) async throws -> PaginatedResponse { + public func listBetaGroups(appId: String?, limit: Int?) async throws -> PaginatedResponse { var filterApp: [String]? if let appId { filterApp = [appId] @@ -30,7 +29,7 @@ public struct SDKTestFlightRepository: TestFlightRepository, @unchecked Sendable isInternalGroup: Bool, publicLinkEnabled: Bool?, feedbackEnabled: Bool? - ) async throws -> Domain.BetaGroup { + ) async throws -> ASCKit.BetaGroup { let body = BetaGroupCreateRequest(data: .init( type: .betaGroups, attributes: .init( @@ -47,7 +46,7 @@ public struct SDKTestFlightRepository: TestFlightRepository, @unchecked Sendable return mapBetaGroup(response.data, appIdHint: appId) } - public func listBetaTesters(groupId: String, limit: Int?) async throws -> PaginatedResponse { + public func listBetaTesters(groupId: String, limit: Int?) async throws -> PaginatedResponse { let request = APIEndpoint.v1.betaTesters.get(parameters: .init( filterBetaGroups: [groupId], limit: limit @@ -58,7 +57,7 @@ public struct SDKTestFlightRepository: TestFlightRepository, @unchecked Sendable return PaginatedResponse(data: testers, nextCursor: nextCursor) } - public func addBetaTester(groupId: String, email: String, firstName: String?, lastName: String?) async throws -> Domain.BetaTester { + public func addBetaTester(groupId: String, email: String, firstName: String?, lastName: String?) async throws -> ASCKit.BetaTester { let body = BetaTesterCreateRequest(data: .init( type: .betaTesters, attributes: .init(firstName: firstName, lastName: lastName, email: email), @@ -77,9 +76,9 @@ public struct SDKTestFlightRepository: TestFlightRepository, @unchecked Sendable try await client.request(APIEndpoint.v1.betaGroups.id(groupId).relationships.betaTesters.delete(body)) } - private func mapBetaGroup(_ sdkGroup: AppStoreConnect_Swift_SDK.BetaGroup, appIdHint: String?) -> Domain.BetaGroup { + private func mapBetaGroup(_ sdkGroup: AppStoreConnect_Swift_SDK.BetaGroup, appIdHint: String?) -> ASCKit.BetaGroup { let appId = appIdHint ?? sdkGroup.relationships?.app?.data?.id ?? "" - return Domain.BetaGroup( + return ASCKit.BetaGroup( id: sdkGroup.id, appId: appId, name: sdkGroup.attributes?.name ?? "", @@ -89,8 +88,8 @@ public struct SDKTestFlightRepository: TestFlightRepository, @unchecked Sendable ) } - private func mapBetaTester(_ sdkTester: AppStoreConnect_Swift_SDK.BetaTester, groupId: String) -> Domain.BetaTester { - Domain.BetaTester( + private func mapBetaTester(_ sdkTester: AppStoreConnect_Swift_SDK.BetaTester, groupId: String) -> ASCKit.BetaTester { + ASCKit.BetaTester( id: sdkTester.id, groupId: groupId, firstName: sdkTester.attributes?.firstName, @@ -100,7 +99,7 @@ public struct SDKTestFlightRepository: TestFlightRepository, @unchecked Sendable ) } - private func mapInviteType(_ type: AppStoreConnect_Swift_SDK.BetaInviteType?) -> Domain.BetaTester.InviteType? { + private func mapInviteType(_ type: AppStoreConnect_Swift_SDK.BetaInviteType?) -> ASCKit.BetaTester.InviteType? { guard let type else { return nil } switch type { case .email: return .email diff --git a/Sources/Infrastructure/Apps/TestFlight/SDKBetaAppLocalizationRepository.swift b/Sources/ASCKit/Apps/TestFlight/Internal/SDKBetaAppLocalizationRepository.swift similarity index 89% rename from Sources/Infrastructure/Apps/TestFlight/SDKBetaAppLocalizationRepository.swift rename to Sources/ASCKit/Apps/TestFlight/Internal/SDKBetaAppLocalizationRepository.swift index 5d6ccdeb..f7aa86c6 100644 --- a/Sources/Infrastructure/Apps/TestFlight/SDKBetaAppLocalizationRepository.swift +++ b/Sources/ASCKit/Apps/TestFlight/Internal/SDKBetaAppLocalizationRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKBetaAppLocalizationRepository: BetaAppLocalizationRepository, @unchecked Sendable { private let client: any APIClient @@ -8,14 +7,14 @@ public struct SDKBetaAppLocalizationRepository: BetaAppLocalizationRepository, @ self.client = client } - public func listBetaAppLocalizations(appId: String) async throws -> [Domain.BetaAppLocalization] { + public func listBetaAppLocalizations(appId: String) async throws -> [ASCKit.BetaAppLocalization] { let response = try await client.request( APIEndpoint.v1.apps.id(appId).betaAppLocalizations.get() ) return response.data.map { map($0, fallbackAppId: appId) } } - public func getBetaAppLocalization(localizationId: String) async throws -> Domain.BetaAppLocalization { + public func getBetaAppLocalization(localizationId: String) async throws -> ASCKit.BetaAppLocalization { let response = try await client.request( APIEndpoint.v1.betaAppLocalizations.id(localizationId).get() ) @@ -25,8 +24,8 @@ public struct SDKBetaAppLocalizationRepository: BetaAppLocalizationRepository, @ public func createBetaAppLocalization( appId: String, locale: String, - update: Domain.BetaAppLocalizationUpdate - ) async throws -> Domain.BetaAppLocalization { + update: ASCKit.BetaAppLocalizationUpdate + ) async throws -> ASCKit.BetaAppLocalization { let body = BetaAppLocalizationCreateRequest( data: .init( type: .betaAppLocalizations, @@ -51,8 +50,8 @@ public struct SDKBetaAppLocalizationRepository: BetaAppLocalizationRepository, @ public func updateBetaAppLocalization( localizationId: String, - update: Domain.BetaAppLocalizationUpdate - ) async throws -> Domain.BetaAppLocalization { + update: ASCKit.BetaAppLocalizationUpdate + ) async throws -> ASCKit.BetaAppLocalization { let body = BetaAppLocalizationUpdateRequest( data: .init( type: .betaAppLocalizations, @@ -81,9 +80,9 @@ public struct SDKBetaAppLocalizationRepository: BetaAppLocalizationRepository, @ private func map( _ sdk: AppStoreConnect_Swift_SDK.BetaAppLocalization, fallbackAppId: String - ) -> Domain.BetaAppLocalization { + ) -> ASCKit.BetaAppLocalization { let appId = sdk.relationships?.app?.data?.id ?? fallbackAppId - return Domain.BetaAppLocalization( + return ASCKit.BetaAppLocalization( id: sdk.id, appId: appId, locale: sdk.attributes?.locale ?? "", diff --git a/Sources/Infrastructure/Apps/TestFlight/SDKBetaAppReviewRepository.swift b/Sources/ASCKit/Apps/TestFlight/Internal/SDKBetaAppReviewRepository.swift similarity index 85% rename from Sources/Infrastructure/Apps/TestFlight/SDKBetaAppReviewRepository.swift rename to Sources/ASCKit/Apps/TestFlight/Internal/SDKBetaAppReviewRepository.swift index f24f446d..1ee9352f 100644 --- a/Sources/Infrastructure/Apps/TestFlight/SDKBetaAppReviewRepository.swift +++ b/Sources/ASCKit/Apps/TestFlight/Internal/SDKBetaAppReviewRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKBetaAppReviewRepository: BetaAppReviewRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKBetaAppReviewRepository: BetaAppReviewRepository, @unchecked Se self.client = client } - public func listSubmissions(buildId: String) async throws -> [Domain.BetaAppReviewSubmission] { + public func listSubmissions(buildId: String) async throws -> [ASCKit.BetaAppReviewSubmission] { let request = APIEndpoint.v1.betaAppReviewSubmissions.get(parameters: .init( filterBuild: [buildId] )) @@ -16,7 +15,7 @@ public struct SDKBetaAppReviewRepository: BetaAppReviewRepository, @unchecked Se return response.data.map { mapSubmission($0, buildId: buildId) } } - public func createSubmission(buildId: String) async throws -> Domain.BetaAppReviewSubmission { + public func createSubmission(buildId: String) async throws -> ASCKit.BetaAppReviewSubmission { let body = BetaAppReviewSubmissionCreateRequest(data: .init( type: .betaAppReviewSubmissions, relationships: .init(build: .init(data: .init(type: .builds, id: buildId))) @@ -25,25 +24,25 @@ public struct SDKBetaAppReviewRepository: BetaAppReviewRepository, @unchecked Se return mapSubmission(response.data, buildId: buildId) } - public func getSubmission(id: String) async throws -> Domain.BetaAppReviewSubmission { + public func getSubmission(id: String) async throws -> ASCKit.BetaAppReviewSubmission { let request = APIEndpoint.v1.betaAppReviewSubmissions.id(id).get() let response = try await client.request(request) let buildId = response.data.relationships?.build?.data?.id ?? "" return mapSubmission(response.data, buildId: buildId) } - public func getDetail(appId: String) async throws -> Domain.BetaAppReviewDetail { + public func getDetail(appId: String) async throws -> ASCKit.BetaAppReviewDetail { let request = APIEndpoint.v1.betaAppReviewDetails.get(parameters: .init( filterApp: [appId] )) let response = try await client.request(request) guard let detail = response.data.first else { - throw Domain.APIError.notFound("No beta app review detail found for app \(appId)") + throw ASCKit.APIError.notFound("No beta app review detail found for app \(appId)") } return mapDetail(detail, appId: appId) } - public func updateDetail(id: String, update: Domain.BetaAppReviewDetailUpdate) async throws -> Domain.BetaAppReviewDetail { + public func updateDetail(id: String, update: ASCKit.BetaAppReviewDetailUpdate) async throws -> ASCKit.BetaAppReviewDetail { let body = BetaAppReviewDetailUpdateRequest(data: .init( type: .betaAppReviewDetails, id: id, @@ -65,8 +64,8 @@ public struct SDKBetaAppReviewRepository: BetaAppReviewRepository, @unchecked Se // MARK: - Mappers - private func mapSubmission(_ sdk: AppStoreConnect_Swift_SDK.BetaAppReviewSubmission, buildId: String) -> Domain.BetaAppReviewSubmission { - Domain.BetaAppReviewSubmission( + private func mapSubmission(_ sdk: AppStoreConnect_Swift_SDK.BetaAppReviewSubmission, buildId: String) -> ASCKit.BetaAppReviewSubmission { + ASCKit.BetaAppReviewSubmission( id: sdk.id, buildId: buildId, state: mapState(sdk.attributes?.betaReviewState), @@ -74,7 +73,7 @@ public struct SDKBetaAppReviewRepository: BetaAppReviewRepository, @unchecked Se ) } - private func mapState(_ state: AppStoreConnect_Swift_SDK.BetaReviewState?) -> Domain.BetaReviewState { + private func mapState(_ state: AppStoreConnect_Swift_SDK.BetaReviewState?) -> ASCKit.BetaReviewState { guard let state else { return .waitingForReview } switch state { case .waitingForReview: return .waitingForReview @@ -84,8 +83,8 @@ public struct SDKBetaAppReviewRepository: BetaAppReviewRepository, @unchecked Se } } - private func mapDetail(_ sdk: AppStoreConnect_Swift_SDK.BetaAppReviewDetail, appId: String) -> Domain.BetaAppReviewDetail { - Domain.BetaAppReviewDetail( + private func mapDetail(_ sdk: AppStoreConnect_Swift_SDK.BetaAppReviewDetail, appId: String) -> ASCKit.BetaAppReviewDetail { + ASCKit.BetaAppReviewDetail( id: sdk.id, appId: appId, contactFirstName: sdk.attributes?.contactFirstName, diff --git a/Sources/Domain/Apps/TestFlight/TestFlightRepository.swift b/Sources/ASCKit/Apps/TestFlight/TestFlightRepository.swift similarity index 100% rename from Sources/Domain/Apps/TestFlight/TestFlightRepository.swift rename to Sources/ASCKit/Apps/TestFlight/TestFlightRepository.swift diff --git a/Sources/Domain/Apps/Versions/AppStoreReviewDetail.swift b/Sources/ASCKit/Apps/Versions/AppStoreReviewDetail.swift similarity index 100% rename from Sources/Domain/Apps/Versions/AppStoreReviewDetail.swift rename to Sources/ASCKit/Apps/Versions/AppStoreReviewDetail.swift diff --git a/Sources/Domain/Apps/Versions/AppStoreVersion+RESTRoutes.swift b/Sources/ASCKit/Apps/Versions/AppStoreVersion+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Apps/Versions/AppStoreVersion+RESTRoutes.swift rename to Sources/ASCKit/Apps/Versions/AppStoreVersion+RESTRoutes.swift diff --git a/Sources/ASCKit/Apps/Versions/AppStoreVersion+Review.swift b/Sources/ASCKit/Apps/Versions/AppStoreVersion+Review.swift new file mode 100644 index 00000000..a6a270e2 --- /dev/null +++ b/Sources/ASCKit/Apps/Versions/AppStoreVersion+Review.swift @@ -0,0 +1,18 @@ +extension AppStoreVersion { + /// Sends this version to App Review: into its app's open draft for its platform + /// (Apple allows one), adding the version unless the draft already holds it, + /// then submitting the draft. Only an editable version can go — the same + /// `isEditable` that offers the `submitForReview` affordance. + public func submitForReview(to submissions: any SubmissionRepository) async throws -> ReviewSubmission { + guard isEditable else { + throw ReviewSubmissionError.versionNotEditable(versionString: versionString, state: state) + } + let draft = try await submissions.createSubmission(appId: appId, platform: platform) + // A refused submit leaves its draft open, so it may already hold this version. + let items = try await submissions.listSubmissionItems(submissionId: draft.id) + if !items.contains(where: { $0.linkedResourceId == id }) { + _ = try await submissions.addItem(submissionId: draft.id, target: .appStoreVersion(id)) + } + return try await submissions.submit(submissionId: draft.id) + } +} diff --git a/Sources/Domain/Apps/Versions/AppStoreVersion.swift b/Sources/ASCKit/Apps/Versions/AppStoreVersion.swift similarity index 100% rename from Sources/Domain/Apps/Versions/AppStoreVersion.swift rename to Sources/ASCKit/Apps/Versions/AppStoreVersion.swift diff --git a/Sources/Domain/Apps/Versions/AppStoreVersionState.swift b/Sources/ASCKit/Apps/Versions/AppStoreVersionState.swift similarity index 100% rename from Sources/Domain/Apps/Versions/AppStoreVersionState.swift rename to Sources/ASCKit/Apps/Versions/AppStoreVersionState.swift diff --git a/Sources/Infrastructure/Apps/Versions/SDKReviewDetailRepository.swift b/Sources/ASCKit/Apps/Versions/Internal/SDKReviewDetailRepository.swift similarity index 90% rename from Sources/Infrastructure/Apps/Versions/SDKReviewDetailRepository.swift rename to Sources/ASCKit/Apps/Versions/Internal/SDKReviewDetailRepository.swift index 626e8a31..b116c6aa 100644 --- a/Sources/Infrastructure/Apps/Versions/SDKReviewDetailRepository.swift +++ b/Sources/ASCKit/Apps/Versions/Internal/SDKReviewDetailRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKReviewDetailRepository: ReviewDetailRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKReviewDetailRepository: ReviewDetailRepository, @unchecked Send self.client = client } - public func getReviewDetail(versionId: String) async throws -> Domain.AppStoreReviewDetail { + public func getReviewDetail(versionId: String) async throws -> ASCKit.AppStoreReviewDetail { let request = APIEndpoint.v1.appStoreVersions.id(versionId).appStoreReviewDetail.get() do { let response = try await client.request(request) @@ -16,11 +15,11 @@ public struct SDKReviewDetailRepository: ReviewDetailRepository, @unchecked Send } catch { // The API returns {"data": null} when review information has never been submitted. // Treat as empty — reviewContactCheck will surface this as a SHOULD FIX warning. - return Domain.AppStoreReviewDetail(id: "", versionId: versionId) + return ASCKit.AppStoreReviewDetail(id: "", versionId: versionId) } } - public func upsertReviewDetail(versionId: String, update: Domain.ReviewDetailUpdate) async throws -> Domain.AppStoreReviewDetail { + public func upsertReviewDetail(versionId: String, update: ASCKit.ReviewDetailUpdate) async throws -> ASCKit.AppStoreReviewDetail { let existing = try await getReviewDetail(versionId: versionId) let attributes = makeAttributes(from: update) if existing.id.isEmpty { @@ -55,7 +54,7 @@ public struct SDKReviewDetailRepository: ReviewDetailRepository, @unchecked Send } } - private func makeAttributes(from update: Domain.ReviewDetailUpdate) -> AppStoreReviewDetailCreateRequest.Data.Attributes { + private func makeAttributes(from update: ASCKit.ReviewDetailUpdate) -> AppStoreReviewDetailCreateRequest.Data.Attributes { AppStoreReviewDetailCreateRequest.Data.Attributes( contactFirstName: update.contactFirstName, contactLastName: update.contactLastName, @@ -71,8 +70,8 @@ public struct SDKReviewDetailRepository: ReviewDetailRepository, @unchecked Send private func mapReviewDetail( _ sdk: AppStoreConnect_Swift_SDK.AppStoreReviewDetail, versionId: String - ) -> Domain.AppStoreReviewDetail { - Domain.AppStoreReviewDetail( + ) -> ASCKit.AppStoreReviewDetail { + ASCKit.AppStoreReviewDetail( id: sdk.id, versionId: versionId, contactFirstName: sdk.attributes?.contactFirstName, diff --git a/Sources/Infrastructure/Apps/Versions/SDKVersionRepository.swift b/Sources/ASCKit/Apps/Versions/Internal/SDKVersionRepository.swift similarity index 87% rename from Sources/Infrastructure/Apps/Versions/SDKVersionRepository.swift rename to Sources/ASCKit/Apps/Versions/Internal/SDKVersionRepository.swift index aeee8e52..c5e31531 100644 --- a/Sources/Infrastructure/Apps/Versions/SDKVersionRepository.swift +++ b/Sources/ASCKit/Apps/Versions/Internal/SDKVersionRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKVersionRepository: VersionRepository, @unchecked Sendable { @@ -9,7 +8,7 @@ public struct SDKVersionRepository: VersionRepository, @unchecked Sendable { self.client = client } - public func listVersions(appId: String) async throws -> [Domain.AppStoreVersion] { + public func listVersions(appId: String) async throws -> [ASCKit.AppStoreVersion] { let pages = try await client.requestAllPages( APIEndpoint.v1.apps.id(appId).appStoreVersions.get(parameters: .init(limit: 200)), nextCursor: { $0.meta?.paging.nextCursor } @@ -17,7 +16,7 @@ public struct SDKVersionRepository: VersionRepository, @unchecked Sendable { return pages.flatMap(\.data).compactMap { mapVersion($0, appId: appId) } } - public func getVersion(id: String) async throws -> Domain.AppStoreVersion { + public func getVersion(id: String) async throws -> ASCKit.AppStoreVersion { let request = APIEndpoint.v1.appStoreVersions.id(id).get( parameters: .init(include: [.app, .build]) ) @@ -25,14 +24,14 @@ public struct SDKVersionRepository: VersionRepository, @unchecked Sendable { let appId = response.data.relationships?.app?.data?.id ?? "" let buildId = response.data.relationships?.build?.data?.id guard let version = mapVersion(response.data, appId: appId, buildId: buildId) else { - throw Domain.APIError.unknown("Failed to map version \(id)") + throw ASCKit.APIError.unknown("Failed to map version \(id)") } return version } - public func createVersion(appId: String, versionString: String, platform: Domain.AppStorePlatform) async throws -> Domain.AppStoreVersion { + public func createVersion(appId: String, versionString: String, platform: ASCKit.AppStorePlatform) async throws -> ASCKit.AppStoreVersion { guard let sdkPlatform = AppStoreConnect_Swift_SDK.Platform(rawValue: platform.rawValue) else { - throw Domain.APIError.unknown("Unsupported platform for create: \(platform.rawValue)") + throw ASCKit.APIError.unknown("Unsupported platform for create: \(platform.rawValue)") } let body = AppStoreVersionCreateRequest( data: .init( @@ -43,7 +42,7 @@ public struct SDKVersionRepository: VersionRepository, @unchecked Sendable { ) let response = try await client.request(APIEndpoint.v1.appStoreVersions.post(body)) guard let version = mapVersion(response.data, appId: appId) else { - throw Domain.APIError.unknown("Failed to map created version") + throw ASCKit.APIError.unknown("Failed to map created version") } return version } @@ -54,7 +53,7 @@ public struct SDKVersionRepository: VersionRepository, @unchecked Sendable { copyright: String?, releaseType: String?, earliestReleaseDate: String? - ) async throws -> Domain.AppStoreVersion { + ) async throws -> ASCKit.AppStoreVersion { // Only send the fields the caller actually wants to change. Apple's // SDK uses `encodeIfPresent`, so nil keys never reach the wire and // unchanged attributes are preserved server-side. @@ -77,7 +76,7 @@ public struct SDKVersionRepository: VersionRepository, @unchecked Sendable { let response = try await client.request(APIEndpoint.v1.appStoreVersions.id(id).patch(body)) let appId = response.data.relationships?.app?.data?.id ?? "" guard let version = mapVersion(response.data, appId: appId) else { - throw Domain.APIError.unknown("Failed to map updated version \(id)") + throw ASCKit.APIError.unknown("Failed to map updated version \(id)") } return version } @@ -99,11 +98,11 @@ public struct SDKVersionRepository: VersionRepository, @unchecked Sendable { _ sdkVersion: AppStoreConnect_Swift_SDK.AppStoreVersion, appId: String, buildId: String? = nil - ) -> Domain.AppStoreVersion? { - guard let platform = Domain.AppStorePlatform( + ) -> ASCKit.AppStoreVersion? { + guard let platform = ASCKit.AppStorePlatform( rawValue: sdkVersion.attributes?.platform?.rawValue ?? "" ) else { return nil } - let state = Domain.AppStoreVersionState( + let state = ASCKit.AppStoreVersionState( rawValue: sdkVersion.attributes?.appStoreState?.rawValue ?? "" ) ?? .prepareForSubmission // Hoist the three editable attributes onto the Domain so the web @@ -113,7 +112,7 @@ public struct SDKVersionRepository: VersionRepository, @unchecked Sendable { let isoFormatter = ISO8601DateFormatter() let earliestReleaseDate: String? = sdkVersion.attributes?.earliestReleaseDate .map { isoFormatter.string(from: $0) } - return Domain.AppStoreVersion( + return ASCKit.AppStoreVersion( id: sdkVersion.id, appId: appId, versionString: sdkVersion.attributes?.versionString ?? "", diff --git a/Sources/Domain/Apps/Versions/Localizations/AppStoreVersionLocalization.swift b/Sources/ASCKit/Apps/Versions/Localizations/AppStoreVersionLocalization.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/AppStoreVersionLocalization.swift rename to Sources/ASCKit/Apps/Versions/Localizations/AppStoreVersionLocalization.swift diff --git a/Sources/Infrastructure/Apps/Versions/Localizations/SDKLocalizationRepository.swift b/Sources/ASCKit/Apps/Versions/Localizations/Internal/SDKLocalizationRepository.swift similarity index 91% rename from Sources/Infrastructure/Apps/Versions/Localizations/SDKLocalizationRepository.swift rename to Sources/ASCKit/Apps/Versions/Localizations/Internal/SDKLocalizationRepository.swift index 1779c967..d77d7ebb 100644 --- a/Sources/Infrastructure/Apps/Versions/Localizations/SDKLocalizationRepository.swift +++ b/Sources/ASCKit/Apps/Versions/Localizations/Internal/SDKLocalizationRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKLocalizationRepository: VersionLocalizationRepository, @unchecked Sendable { @@ -9,13 +8,13 @@ public struct SDKLocalizationRepository: VersionLocalizationRepository, @uncheck self.client = client } - public func listLocalizations(versionId: String) async throws -> [Domain.AppStoreVersionLocalization] { + public func listLocalizations(versionId: String) async throws -> [ASCKit.AppStoreVersionLocalization] { let request = APIEndpoint.v1.appStoreVersions.id(versionId).appStoreVersionLocalizations.get() let response = try await client.request(request) return response.data.map { mapLocalization($0, versionId: versionId) } } - public func createLocalization(versionId: String, locale: String) async throws -> Domain.AppStoreVersionLocalization { + public func createLocalization(versionId: String, locale: String) async throws -> ASCKit.AppStoreVersionLocalization { let body = AppStoreVersionLocalizationCreateRequest( data: .init( type: .appStoreVersionLocalizations, @@ -35,7 +34,7 @@ public struct SDKLocalizationRepository: VersionLocalizationRepository, @uncheck marketingUrl: String?, supportUrl: String?, promotionalText: String? - ) async throws -> Domain.AppStoreVersionLocalization { + ) async throws -> ASCKit.AppStoreVersionLocalization { let body = AppStoreVersionLocalizationUpdateRequest( data: .init( type: .appStoreVersionLocalizations, @@ -59,8 +58,8 @@ public struct SDKLocalizationRepository: VersionLocalizationRepository, @uncheck private func mapLocalization( _ sdkLoc: AppStoreConnect_Swift_SDK.AppStoreVersionLocalization, versionId: String - ) -> Domain.AppStoreVersionLocalization { - Domain.AppStoreVersionLocalization( + ) -> ASCKit.AppStoreVersionLocalization { + ASCKit.AppStoreVersionLocalization( id: sdkLoc.id, versionId: versionId, locale: sdkLoc.attributes?.locale ?? "", diff --git a/Sources/Domain/Apps/Versions/Localizations/PreviewSets/AppPreviewSet.swift b/Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/AppPreviewSet.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/PreviewSets/AppPreviewSet.swift rename to Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/AppPreviewSet.swift diff --git a/Sources/Domain/Apps/Versions/Localizations/PreviewSets/AppPreviews/AppPreview.swift b/Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/AppPreviews/AppPreview.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/PreviewSets/AppPreviews/AppPreview.swift rename to Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/AppPreviews/AppPreview.swift diff --git a/Sources/Infrastructure/Apps/Versions/Localizations/PreviewSets/OpenAPIPreviewRepository.swift b/Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/Internal/OpenAPIPreviewRepository.swift similarity index 90% rename from Sources/Infrastructure/Apps/Versions/Localizations/PreviewSets/OpenAPIPreviewRepository.swift rename to Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/Internal/OpenAPIPreviewRepository.swift index 7afe7b27..4cc76a48 100644 --- a/Sources/Infrastructure/Apps/Versions/Localizations/PreviewSets/OpenAPIPreviewRepository.swift +++ b/Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/Internal/OpenAPIPreviewRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct OpenAPIPreviewRepository: PreviewRepository, @unchecked Sendable { @@ -11,7 +10,7 @@ public struct OpenAPIPreviewRepository: PreviewRepository, @unchecked Sendable { self.uploader = uploader } - public func listPreviewSets(localizationId: String) async throws -> [Domain.AppPreviewSet] { + public func listPreviewSets(localizationId: String) async throws -> [ASCKit.AppPreviewSet] { let request = APIEndpoint.v1.appStoreVersionLocalizations.id(localizationId).appPreviewSets.get( parameters: .init(include: [.appPreviews]) ) @@ -19,9 +18,9 @@ public struct OpenAPIPreviewRepository: PreviewRepository, @unchecked Sendable { return response.data.map { mapPreviewSet($0, localizationId: localizationId) } } - public func createPreviewSet(localizationId: String, previewType: Domain.PreviewType) async throws -> Domain.AppPreviewSet { + public func createPreviewSet(localizationId: String, previewType: ASCKit.PreviewType) async throws -> ASCKit.AppPreviewSet { guard let sdkPreviewType = AppStoreConnect_Swift_SDK.PreviewType(rawValue: previewType.rawValue) else { - throw Domain.APIError.unknown("Unsupported preview type: \(previewType.rawValue)") + throw ASCKit.APIError.unknown("Unsupported preview type: \(previewType.rawValue)") } let body = AppPreviewSetCreateRequest( data: .init( @@ -38,13 +37,13 @@ public struct OpenAPIPreviewRepository: PreviewRepository, @unchecked Sendable { return mapPreviewSet(response.data, localizationId: localizationId) } - public func listPreviews(setId: String) async throws -> [Domain.AppPreview] { + public func listPreviews(setId: String) async throws -> [ASCKit.AppPreview] { let request = APIEndpoint.v1.appPreviewSets.id(setId).appPreviews.get() let response = try await client.request(request) return response.data.map { mapPreview($0, setId: setId) } } - public func uploadPreview(setId: String, fileURL: URL, previewFrameTimeCode: String?) async throws -> Domain.AppPreview { + public func uploadPreview(setId: String, fileURL: URL, previewFrameTimeCode: String?) async throws -> ASCKit.AppPreview { let fileData = try Data(contentsOf: fileURL) let fileName = fileURL.lastPathComponent let fileSize = fileData.count @@ -90,10 +89,10 @@ public struct OpenAPIPreviewRepository: PreviewRepository, @unchecked Sendable { private func mapPreviewSet( _ sdkSet: AppStoreConnect_Swift_SDK.AppPreviewSet, localizationId: String - ) -> Domain.AppPreviewSet { - let previewType = Domain.PreviewType(rawValue: sdkSet.attributes?.previewType?.rawValue ?? "") ?? .iphone67 + ) -> ASCKit.AppPreviewSet { + let previewType = ASCKit.PreviewType(rawValue: sdkSet.attributes?.previewType?.rawValue ?? "") ?? .iphone67 let count = sdkSet.relationships?.appPreviews?.data?.count ?? 0 - return Domain.AppPreviewSet( + return ASCKit.AppPreviewSet( id: sdkSet.id, localizationId: localizationId, previewType: previewType, @@ -104,10 +103,10 @@ public struct OpenAPIPreviewRepository: PreviewRepository, @unchecked Sendable { private func mapPreview( _ sdkPreview: AppStoreConnect_Swift_SDK.AppPreview, setId: String - ) -> Domain.AppPreview { + ) -> ASCKit.AppPreview { let assetState = mapAssetState(sdkPreview.attributes?.assetDeliveryState?.state) let videoState = mapVideoState(sdkPreview.attributes?.videoDeliveryState?.state) - return Domain.AppPreview( + return ASCKit.AppPreview( id: sdkPreview.id, setId: setId, fileName: sdkPreview.attributes?.fileName ?? "", @@ -122,7 +121,7 @@ public struct OpenAPIPreviewRepository: PreviewRepository, @unchecked Sendable { private func mapAssetState( _ state: AppStoreConnect_Swift_SDK.AppMediaAssetState.State? - ) -> Domain.AppPreview.AssetDeliveryState? { + ) -> ASCKit.AppPreview.AssetDeliveryState? { guard let state else { return nil } switch state { case .awaitingUpload: return .awaitingUpload @@ -134,7 +133,7 @@ public struct OpenAPIPreviewRepository: PreviewRepository, @unchecked Sendable { private func mapVideoState( _ state: AppStoreConnect_Swift_SDK.AppMediaVideoState.State? - ) -> Domain.AppPreview.VideoDeliveryState? { + ) -> ASCKit.AppPreview.VideoDeliveryState? { guard let state else { return nil } switch state { case .awaitingUpload: return .awaitingUpload diff --git a/Sources/Domain/Apps/Versions/Localizations/PreviewSets/PreviewRepository.swift b/Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/PreviewRepository.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/PreviewSets/PreviewRepository.swift rename to Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/PreviewRepository.swift diff --git a/Sources/Domain/Apps/Versions/Localizations/PreviewSets/PreviewType.swift b/Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/PreviewType.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/PreviewSets/PreviewType.swift rename to Sources/ASCKit/Apps/Versions/Localizations/PreviewSets/PreviewType.swift diff --git a/Sources/Domain/Apps/Versions/Localizations/ScreenshotSets/AppScreenshotSet.swift b/Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/AppScreenshotSet.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/ScreenshotSets/AppScreenshotSet.swift rename to Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/AppScreenshotSet.swift diff --git a/Sources/Infrastructure/Apps/Versions/Localizations/ScreenshotSets/OpenAPIScreenshotRepository.swift b/Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/Internal/OpenAPIScreenshotRepository.swift similarity index 91% rename from Sources/Infrastructure/Apps/Versions/Localizations/ScreenshotSets/OpenAPIScreenshotRepository.swift rename to Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/Internal/OpenAPIScreenshotRepository.swift index d90a29bb..4431e625 100644 --- a/Sources/Infrastructure/Apps/Versions/Localizations/ScreenshotSets/OpenAPIScreenshotRepository.swift +++ b/Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/Internal/OpenAPIScreenshotRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKScreenshotRepository: ScreenshotRepository, @unchecked Sendable { @@ -11,7 +10,7 @@ public struct SDKScreenshotRepository: ScreenshotRepository, @unchecked Sendable self.uploader = uploader } - public func listScreenshotSets(localizationId: String) async throws -> [Domain.AppScreenshotSet] { + public func listScreenshotSets(localizationId: String) async throws -> [ASCKit.AppScreenshotSet] { let request = APIEndpoint.v1.appStoreVersionLocalizations.id(localizationId).appScreenshotSets.get( parameters: .init(include: [.appScreenshots]) ) @@ -19,15 +18,15 @@ public struct SDKScreenshotRepository: ScreenshotRepository, @unchecked Sendable return response.data.map { mapScreenshotSet($0, localizationId: localizationId) } } - public func listScreenshots(setId: String) async throws -> [Domain.AppScreenshot] { + public func listScreenshots(setId: String) async throws -> [ASCKit.AppScreenshot] { let request = APIEndpoint.v1.appScreenshotSets.id(setId).appScreenshots.get() let response = try await client.request(request) return response.data.map { mapScreenshot($0, setId: setId) } } - public func createScreenshotSet(localizationId: String, displayType: Domain.ScreenshotDisplayType) async throws -> Domain.AppScreenshotSet { + public func createScreenshotSet(localizationId: String, displayType: ASCKit.ScreenshotDisplayType) async throws -> ASCKit.AppScreenshotSet { guard let sdkDisplayType = AppStoreConnect_Swift_SDK.ScreenshotDisplayType(rawValue: displayType.rawValue) else { - throw Domain.APIError.unknown("Unsupported display type: \(displayType.rawValue)") + throw ASCKit.APIError.unknown("Unsupported display type: \(displayType.rawValue)") } let body = AppScreenshotSetCreateRequest( data: .init( @@ -42,7 +41,7 @@ public struct SDKScreenshotRepository: ScreenshotRepository, @unchecked Sendable return mapScreenshotSet(response.data, localizationId: localizationId) } - public func uploadScreenshot(setId: String, fileURL: URL) async throws -> Domain.AppScreenshot { + public func uploadScreenshot(setId: String, fileURL: URL) async throws -> ASCKit.AppScreenshot { let fileData = try Data(contentsOf: fileURL) let fileName = fileURL.lastPathComponent let fileSize = fileData.count @@ -86,12 +85,12 @@ public struct SDKScreenshotRepository: ScreenshotRepository, @unchecked Sendable private func mapScreenshotSet( _ sdkSet: AppStoreConnect_Swift_SDK.AppScreenshotSet, localizationId: String - ) -> Domain.AppScreenshotSet { - let displayType = Domain.ScreenshotDisplayType( + ) -> ASCKit.AppScreenshotSet { + let displayType = ASCKit.ScreenshotDisplayType( rawValue: sdkSet.attributes?.screenshotDisplayType?.rawValue ?? "" ) ?? .iphone67 let count = sdkSet.relationships?.appScreenshots?.data?.count ?? 0 - return Domain.AppScreenshotSet( + return ASCKit.AppScreenshotSet( id: sdkSet.id, localizationId: localizationId, screenshotDisplayType: displayType, @@ -103,9 +102,9 @@ public struct SDKScreenshotRepository: ScreenshotRepository, @unchecked Sendable private func mapScreenshot( _ sdkScreenshot: AppStoreConnect_Swift_SDK.AppScreenshot, setId: String - ) -> Domain.AppScreenshot { + ) -> ASCKit.AppScreenshot { let state = mapAssetState(sdkScreenshot.attributes?.assetDeliveryState?.state) - return Domain.AppScreenshot( + return ASCKit.AppScreenshot( id: sdkScreenshot.id, setId: setId, fileName: sdkScreenshot.attributes?.fileName ?? "", @@ -119,7 +118,7 @@ public struct SDKScreenshotRepository: ScreenshotRepository, @unchecked Sendable private func mapAssetState( _ state: AppStoreConnect_Swift_SDK.AppMediaAssetState.State? - ) -> Domain.AppScreenshot.AssetDeliveryState? { + ) -> ASCKit.AppScreenshot.AssetDeliveryState? { guard let state else { return nil } switch state { case .awaitingUpload: return .awaitingUpload diff --git a/Sources/Domain/Apps/Versions/Localizations/ScreenshotSets/ScreenshotDisplayType.swift b/Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/ScreenshotDisplayType.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/ScreenshotSets/ScreenshotDisplayType.swift rename to Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/ScreenshotDisplayType.swift diff --git a/Sources/Domain/Apps/Versions/Localizations/ScreenshotSets/ScreenshotImport.swift b/Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/ScreenshotImport.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/ScreenshotSets/ScreenshotImport.swift rename to Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/ScreenshotImport.swift diff --git a/Sources/Domain/Apps/Versions/Localizations/ScreenshotSets/ScreenshotRepository.swift b/Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/ScreenshotRepository.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/ScreenshotSets/ScreenshotRepository.swift rename to Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/ScreenshotRepository.swift diff --git a/Sources/Domain/Apps/Versions/Localizations/ScreenshotSets/Screenshots/AppScreenshot.swift b/Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/Screenshots/AppScreenshot.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/ScreenshotSets/Screenshots/AppScreenshot.swift rename to Sources/ASCKit/Apps/Versions/Localizations/ScreenshotSets/Screenshots/AppScreenshot.swift diff --git a/Sources/Domain/Apps/Versions/Localizations/VersionLocalizationRepository.swift b/Sources/ASCKit/Apps/Versions/Localizations/VersionLocalizationRepository.swift similarity index 100% rename from Sources/Domain/Apps/Versions/Localizations/VersionLocalizationRepository.swift rename to Sources/ASCKit/Apps/Versions/Localizations/VersionLocalizationRepository.swift diff --git a/Sources/Domain/Apps/Versions/ReviewDetailRepository.swift b/Sources/ASCKit/Apps/Versions/ReviewDetailRepository.swift similarity index 100% rename from Sources/Domain/Apps/Versions/ReviewDetailRepository.swift rename to Sources/ASCKit/Apps/Versions/ReviewDetailRepository.swift diff --git a/Sources/Domain/Apps/Versions/ReviewDetailUpdate.swift b/Sources/ASCKit/Apps/Versions/ReviewDetailUpdate.swift similarity index 100% rename from Sources/Domain/Apps/Versions/ReviewDetailUpdate.swift rename to Sources/ASCKit/Apps/Versions/ReviewDetailUpdate.swift diff --git a/Sources/Domain/Apps/Versions/VersionReadiness.swift b/Sources/ASCKit/Apps/Versions/VersionReadiness.swift similarity index 100% rename from Sources/Domain/Apps/Versions/VersionReadiness.swift rename to Sources/ASCKit/Apps/Versions/VersionReadiness.swift diff --git a/Sources/Domain/Apps/Versions/VersionRepository.swift b/Sources/ASCKit/Apps/Versions/VersionRepository.swift similarity index 100% rename from Sources/Domain/Apps/Versions/VersionRepository.swift rename to Sources/ASCKit/Apps/Versions/VersionRepository.swift diff --git a/Sources/Domain/Auth/AuthCredentials.swift b/Sources/ASCKit/Auth/AuthCredentials.swift similarity index 100% rename from Sources/Domain/Auth/AuthCredentials.swift rename to Sources/ASCKit/Auth/AuthCredentials.swift diff --git a/Sources/Domain/Auth/AuthError.swift b/Sources/ASCKit/Auth/AuthError.swift similarity index 100% rename from Sources/Domain/Auth/AuthError.swift rename to Sources/ASCKit/Auth/AuthError.swift diff --git a/Sources/Domain/Auth/AuthProvider.swift b/Sources/ASCKit/Auth/AuthProvider.swift similarity index 100% rename from Sources/Domain/Auth/AuthProvider.swift rename to Sources/ASCKit/Auth/AuthProvider.swift diff --git a/Sources/Domain/Auth/AuthStatus.swift b/Sources/ASCKit/Auth/AuthStatus.swift similarity index 100% rename from Sources/Domain/Auth/AuthStatus.swift rename to Sources/ASCKit/Auth/AuthStatus.swift diff --git a/Sources/Domain/Auth/AuthStorage.swift b/Sources/ASCKit/Auth/AuthStorage.swift similarity index 100% rename from Sources/Domain/Auth/AuthStorage.swift rename to Sources/ASCKit/Auth/AuthStorage.swift diff --git a/Sources/Domain/Auth/ConnectAccount.swift b/Sources/ASCKit/Auth/ConnectAccount.swift similarity index 100% rename from Sources/Domain/Auth/ConnectAccount.swift rename to Sources/ASCKit/Auth/ConnectAccount.swift diff --git a/Sources/Domain/Auth/CredentialSource.swift b/Sources/ASCKit/Auth/CredentialSource.swift similarity index 100% rename from Sources/Domain/Auth/CredentialSource.swift rename to Sources/ASCKit/Auth/CredentialSource.swift diff --git a/Sources/Infrastructure/Auth/CompositeAuthProvider.swift b/Sources/ASCKit/Auth/Internal/CompositeAuthProvider.swift similarity index 97% rename from Sources/Infrastructure/Auth/CompositeAuthProvider.swift rename to Sources/ASCKit/Auth/Internal/CompositeAuthProvider.swift index c870ed7d..531626e6 100644 --- a/Sources/Infrastructure/Auth/CompositeAuthProvider.swift +++ b/Sources/ASCKit/Auth/Internal/CompositeAuthProvider.swift @@ -1,4 +1,3 @@ -import Domain public struct CompositeAuthProvider: AuthProvider { private let fileProvider: any AuthProvider diff --git a/Sources/Infrastructure/Auth/EnvironmentAuthProvider.swift b/Sources/ASCKit/Auth/Internal/EnvironmentAuthProvider.swift similarity index 99% rename from Sources/Infrastructure/Auth/EnvironmentAuthProvider.swift rename to Sources/ASCKit/Auth/Internal/EnvironmentAuthProvider.swift index 86d626ea..09afbb15 100644 --- a/Sources/Infrastructure/Auth/EnvironmentAuthProvider.swift +++ b/Sources/ASCKit/Auth/Internal/EnvironmentAuthProvider.swift @@ -1,5 +1,4 @@ import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct EnvironmentAuthProvider: AuthProvider { diff --git a/Sources/Infrastructure/Auth/FileAuthProvider.swift b/Sources/ASCKit/Auth/Internal/FileAuthProvider.swift similarity index 96% rename from Sources/Infrastructure/Auth/FileAuthProvider.swift rename to Sources/ASCKit/Auth/Internal/FileAuthProvider.swift index 093b8d9d..993776ca 100644 --- a/Sources/Infrastructure/Auth/FileAuthProvider.swift +++ b/Sources/ASCKit/Auth/Internal/FileAuthProvider.swift @@ -1,4 +1,3 @@ -import Domain public struct FileAuthProvider: AuthProvider { private let storage: any AuthStorage diff --git a/Sources/Infrastructure/Auth/FileAuthStorage.swift b/Sources/ASCKit/Auth/Internal/FileAuthStorage.swift similarity index 99% rename from Sources/Infrastructure/Auth/FileAuthStorage.swift rename to Sources/ASCKit/Auth/Internal/FileAuthStorage.swift index b10edfeb..d8a0552f 100644 --- a/Sources/Infrastructure/Auth/FileAuthStorage.swift +++ b/Sources/ASCKit/Auth/Internal/FileAuthStorage.swift @@ -1,4 +1,3 @@ -import Domain import Foundation public struct FileAuthStorage: AuthStorage { diff --git a/Sources/Domain/Auth/Iris/IrisAuthCredentials.swift b/Sources/ASCKit/Auth/Iris/IrisAuthCredentials.swift similarity index 100% rename from Sources/Domain/Auth/Iris/IrisAuthCredentials.swift rename to Sources/ASCKit/Auth/Iris/IrisAuthCredentials.swift diff --git a/Sources/Domain/Auth/Iris/IrisAuthError.swift b/Sources/ASCKit/Auth/Iris/IrisAuthError.swift similarity index 100% rename from Sources/Domain/Auth/Iris/IrisAuthError.swift rename to Sources/ASCKit/Auth/Iris/IrisAuthError.swift diff --git a/Sources/Domain/Auth/Iris/IrisAuthSession.swift b/Sources/ASCKit/Auth/Iris/IrisAuthSession.swift similarity index 100% rename from Sources/Domain/Auth/Iris/IrisAuthSession.swift rename to Sources/ASCKit/Auth/Iris/IrisAuthSession.swift diff --git a/Sources/Domain/Auth/Iris/IrisAuthSummary.swift b/Sources/ASCKit/Auth/Iris/IrisAuthSummary.swift similarity index 100% rename from Sources/Domain/Auth/Iris/IrisAuthSummary.swift rename to Sources/ASCKit/Auth/Iris/IrisAuthSummary.swift diff --git a/Sources/Domain/Auth/Iris/IrisSessionRepository.swift b/Sources/ASCKit/Auth/Iris/IrisSessionRepository.swift similarity index 100% rename from Sources/Domain/Auth/Iris/IrisSessionRepository.swift rename to Sources/ASCKit/Auth/Iris/IrisSessionRepository.swift diff --git a/Sources/Domain/Auth/Iris/IrisAuthRepository.swift b/Sources/ASCKit/Auth/Iris/IrisSignIn.swift similarity index 85% rename from Sources/Domain/Auth/Iris/IrisAuthRepository.swift rename to Sources/ASCKit/Auth/Iris/IrisSignIn.swift index e669d197..27ba45c6 100644 --- a/Sources/Domain/Auth/Iris/IrisAuthRepository.swift +++ b/Sources/ASCKit/Auth/Iris/IrisSignIn.swift @@ -3,10 +3,10 @@ import Mockable /// Drives the iris SRP login + 2FA flow against `idmsa.apple.com`. /// -/// Implementations live in Infrastructure (`IrisAuthSDKRepository`). The protocol stays +/// Implementations live in Infrastructure (`IrisSDKSignIn`). The protocol stays /// here so commands and tests don't have to know about Apple's HTTP shape. @Mockable -public protocol IrisAuthRepository: Sendable { +public protocol IrisSignIn: Sendable { /// Drives `signin/init` + `signin/complete`. /// - Returns: a fully-formed `IrisAuthSession` when no 2FA is required. /// - Throws: `IrisAuthError.twoFactorRequired(_)` carrying the state needed to resume, diff --git a/Sources/Domain/Auth/Iris/PendingTwoFactorState.swift b/Sources/ASCKit/Auth/Iris/PendingTwoFactorState.swift similarity index 100% rename from Sources/Domain/Auth/Iris/PendingTwoFactorState.swift rename to Sources/ASCKit/Auth/Iris/PendingTwoFactorState.swift diff --git a/Sources/Domain/Auth/Iris/TwoFactorChallenge.swift b/Sources/ASCKit/Auth/Iris/TwoFactorChallenge.swift similarity index 100% rename from Sources/Domain/Auth/Iris/TwoFactorChallenge.swift rename to Sources/ASCKit/Auth/Iris/TwoFactorChallenge.swift diff --git a/Sources/Domain/CodeSigning/BundleIDs/BundleID.swift b/Sources/ASCKit/CodeSigning/BundleIDs/BundleID.swift similarity index 100% rename from Sources/Domain/CodeSigning/BundleIDs/BundleID.swift rename to Sources/ASCKit/CodeSigning/BundleIDs/BundleID.swift diff --git a/Sources/Domain/CodeSigning/BundleIDs/BundleIDRepository.swift b/Sources/ASCKit/CodeSigning/BundleIDs/BundleIDRepository.swift similarity index 100% rename from Sources/Domain/CodeSigning/BundleIDs/BundleIDRepository.swift rename to Sources/ASCKit/CodeSigning/BundleIDs/BundleIDRepository.swift diff --git a/Sources/Domain/CodeSigning/Certificates/Certificate.swift b/Sources/ASCKit/CodeSigning/Certificates/Certificate.swift similarity index 100% rename from Sources/Domain/CodeSigning/Certificates/Certificate.swift rename to Sources/ASCKit/CodeSigning/Certificates/Certificate.swift diff --git a/Sources/Domain/CodeSigning/Certificates/CertificateRepository.swift b/Sources/ASCKit/CodeSigning/Certificates/CertificateRepository.swift similarity index 100% rename from Sources/Domain/CodeSigning/Certificates/CertificateRepository.swift rename to Sources/ASCKit/CodeSigning/Certificates/CertificateRepository.swift diff --git a/Sources/Domain/CodeSigning/CodeSigning+RESTRoutes.swift b/Sources/ASCKit/CodeSigning/CodeSigning+RESTRoutes.swift similarity index 100% rename from Sources/Domain/CodeSigning/CodeSigning+RESTRoutes.swift rename to Sources/ASCKit/CodeSigning/CodeSigning+RESTRoutes.swift diff --git a/Sources/Domain/CodeSigning/Devices/Device.swift b/Sources/ASCKit/CodeSigning/Devices/Device.swift similarity index 100% rename from Sources/Domain/CodeSigning/Devices/Device.swift rename to Sources/ASCKit/CodeSigning/Devices/Device.swift diff --git a/Sources/Domain/CodeSigning/Devices/DeviceRepository.swift b/Sources/ASCKit/CodeSigning/Devices/DeviceRepository.swift similarity index 100% rename from Sources/Domain/CodeSigning/Devices/DeviceRepository.swift rename to Sources/ASCKit/CodeSigning/Devices/DeviceRepository.swift diff --git a/Sources/Infrastructure/CodeSigning/SDKBundleIDRepository.swift b/Sources/ASCKit/CodeSigning/Internal/SDKBundleIDRepository.swift similarity index 85% rename from Sources/Infrastructure/CodeSigning/SDKBundleIDRepository.swift rename to Sources/ASCKit/CodeSigning/Internal/SDKBundleIDRepository.swift index b848f8b9..2f666abc 100644 --- a/Sources/Infrastructure/CodeSigning/SDKBundleIDRepository.swift +++ b/Sources/ASCKit/CodeSigning/Internal/SDKBundleIDRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKBundleIDRepository: BundleIDRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKBundleIDRepository: BundleIDRepository, @unchecked Sendable { self.client = client } - public func listBundleIDs(platform: Domain.BundleIDPlatform?, identifier: String?) async throws -> [Domain.BundleID] { + public func listBundleIDs(platform: ASCKit.BundleIDPlatform?, identifier: String?) async throws -> [ASCKit.BundleID] { let filterPlatform = platform.flatMap { APIEndpoint.V1.BundleIDs.GetParameters.FilterPlatform(rawValue: $0.rawValue) } @@ -23,7 +22,7 @@ public struct SDKBundleIDRepository: BundleIDRepository, @unchecked Sendable { return pages.flatMap(\.data).map(mapBundleID) } - public func createBundleID(name: String, identifier: String, platform: Domain.BundleIDPlatform) async throws -> Domain.BundleID { + public func createBundleID(name: String, identifier: String, platform: ASCKit.BundleIDPlatform) async throws -> ASCKit.BundleID { guard let sdkPlatform = AppStoreConnect_Swift_SDK.BundleIDPlatform(rawValue: platform.rawValue) else { throw APIError.unknown("Unsupported platform: \(platform.rawValue)") } @@ -41,11 +40,11 @@ public struct SDKBundleIDRepository: BundleIDRepository, @unchecked Sendable { // MARK: - Mapper - private func mapBundleID(_ sdkBundleID: AppStoreConnect_Swift_SDK.BundleID) -> Domain.BundleID { + private func mapBundleID(_ sdkBundleID: AppStoreConnect_Swift_SDK.BundleID) -> ASCKit.BundleID { let platform = sdkBundleID.attributes?.platform.flatMap { - Domain.BundleIDPlatform(rawValue: $0.rawValue) + ASCKit.BundleIDPlatform(rawValue: $0.rawValue) } ?? .universal - return Domain.BundleID( + return ASCKit.BundleID( id: sdkBundleID.id, name: sdkBundleID.attributes?.name ?? "", identifier: sdkBundleID.attributes?.identifier ?? "", diff --git a/Sources/Infrastructure/CodeSigning/SDKCertificateRepository.swift b/Sources/ASCKit/CodeSigning/Internal/SDKCertificateRepository.swift similarity index 81% rename from Sources/Infrastructure/CodeSigning/SDKCertificateRepository.swift rename to Sources/ASCKit/CodeSigning/Internal/SDKCertificateRepository.swift index d0e95d13..81c685f0 100644 --- a/Sources/Infrastructure/CodeSigning/SDKCertificateRepository.swift +++ b/Sources/ASCKit/CodeSigning/Internal/SDKCertificateRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKCertificateRepository: CertificateRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKCertificateRepository: CertificateRepository, @unchecked Sendab self.client = client } - public func listCertificates(certificateType: Domain.CertificateType?, limit: Int?) async throws -> [Domain.Certificate] { + public func listCertificates(certificateType: ASCKit.CertificateType?, limit: Int?) async throws -> [ASCKit.Certificate] { let filterType = certificateType.flatMap { APIEndpoint.V1.Certificates.GetParameters.FilterCertificateType(rawValue: $0.rawValue) } @@ -20,7 +19,7 @@ public struct SDKCertificateRepository: CertificateRepository, @unchecked Sendab return response.data.map(mapCertificate) } - public func createCertificate(certificateType: Domain.CertificateType, csrContent: String) async throws -> Domain.Certificate { + public func createCertificate(certificateType: ASCKit.CertificateType, csrContent: String) async throws -> ASCKit.Certificate { guard let sdkType = AppStoreConnect_Swift_SDK.CertificateType(rawValue: certificateType.rawValue) else { throw APIError.unknown("Unsupported certificate type: \(certificateType.rawValue)") } @@ -38,14 +37,14 @@ public struct SDKCertificateRepository: CertificateRepository, @unchecked Sendab // MARK: - Mapper - private func mapCertificate(_ sdkCert: AppStoreConnect_Swift_SDK.Certificate) -> Domain.Certificate { + private func mapCertificate(_ sdkCert: AppStoreConnect_Swift_SDK.Certificate) -> ASCKit.Certificate { let certType = sdkCert.attributes?.certificateType.flatMap { - Domain.CertificateType(rawValue: $0.rawValue) + ASCKit.CertificateType(rawValue: $0.rawValue) } ?? .distribution let platform = sdkCert.attributes?.platform.flatMap { - Domain.BundleIDPlatform(rawValue: $0.rawValue) + ASCKit.BundleIDPlatform(rawValue: $0.rawValue) } - return Domain.Certificate( + return ASCKit.Certificate( id: sdkCert.id, name: sdkCert.attributes?.name ?? "", certificateType: certType, diff --git a/Sources/Infrastructure/CodeSigning/SDKDeviceRepository.swift b/Sources/ASCKit/CodeSigning/Internal/SDKDeviceRepository.swift similarity index 83% rename from Sources/Infrastructure/CodeSigning/SDKDeviceRepository.swift rename to Sources/ASCKit/CodeSigning/Internal/SDKDeviceRepository.swift index 936d37da..5af1044a 100644 --- a/Sources/Infrastructure/CodeSigning/SDKDeviceRepository.swift +++ b/Sources/ASCKit/CodeSigning/Internal/SDKDeviceRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKDeviceRepository: DeviceRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKDeviceRepository: DeviceRepository, @unchecked Sendable { self.client = client } - public func listDevices(platform: Domain.BundleIDPlatform?) async throws -> [Domain.Device] { + public func listDevices(platform: ASCKit.BundleIDPlatform?) async throws -> [ASCKit.Device] { let filterPlatform = platform.flatMap { APIEndpoint.V1.Devices.GetParameters.FilterPlatform(rawValue: $0.rawValue) } @@ -22,7 +21,7 @@ public struct SDKDeviceRepository: DeviceRepository, @unchecked Sendable { return pages.flatMap(\.data).map(mapDevice) } - public func registerDevice(name: String, udid: String, platform: Domain.BundleIDPlatform) async throws -> Domain.Device { + public func registerDevice(name: String, udid: String, platform: ASCKit.BundleIDPlatform) async throws -> ASCKit.Device { guard let sdkPlatform = AppStoreConnect_Swift_SDK.BundleIDPlatform(rawValue: platform.rawValue) else { throw APIError.unknown("Unsupported platform: \(platform.rawValue)") } @@ -36,17 +35,17 @@ public struct SDKDeviceRepository: DeviceRepository, @unchecked Sendable { // MARK: - Mapper - private func mapDevice(_ sdkDevice: AppStoreConnect_Swift_SDK.Device) -> Domain.Device { + private func mapDevice(_ sdkDevice: AppStoreConnect_Swift_SDK.Device) -> ASCKit.Device { let deviceClass = sdkDevice.attributes?.deviceClass.flatMap { - Domain.DeviceClass(rawValue: $0.rawValue) + ASCKit.DeviceClass(rawValue: $0.rawValue) } ?? .iPhone let platform = sdkDevice.attributes?.platform.flatMap { - Domain.BundleIDPlatform(rawValue: $0.rawValue) + ASCKit.BundleIDPlatform(rawValue: $0.rawValue) } ?? .iOS let status = sdkDevice.attributes?.status.flatMap { - Domain.DeviceStatus(rawValue: $0.rawValue) + ASCKit.DeviceStatus(rawValue: $0.rawValue) } ?? .enabled - return Domain.Device( + return ASCKit.Device( id: sdkDevice.id, name: sdkDevice.attributes?.name ?? "", udid: sdkDevice.attributes?.udid ?? "", diff --git a/Sources/Infrastructure/CodeSigning/SDKProfileRepository.swift b/Sources/ASCKit/CodeSigning/Internal/SDKProfileRepository.swift similarity index 90% rename from Sources/Infrastructure/CodeSigning/SDKProfileRepository.swift rename to Sources/ASCKit/CodeSigning/Internal/SDKProfileRepository.swift index 3edaa72d..c9783b83 100644 --- a/Sources/Infrastructure/CodeSigning/SDKProfileRepository.swift +++ b/Sources/ASCKit/CodeSigning/Internal/SDKProfileRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKProfileRepository: ProfileRepository, @unchecked Sendable { private let client: any APIClient @@ -8,7 +7,7 @@ public struct SDKProfileRepository: ProfileRepository, @unchecked Sendable { self.client = client } - public func listProfiles(bundleIdId: String?, profileType: Domain.ProfileType?) async throws -> [Domain.Profile] { + public func listProfiles(bundleIdId: String?, profileType: ASCKit.ProfileType?) async throws -> [ASCKit.Profile] { if let bundleIdId { // Use the bundle ID relationship endpoint for server-side filtering let pages = try await client.requestAllPages( @@ -38,11 +37,11 @@ public struct SDKProfileRepository: ProfileRepository, @unchecked Sendable { public func createProfile( name: String, - profileType: Domain.ProfileType, + profileType: ASCKit.ProfileType, bundleIdId: String, certificateIds: [String], deviceIds: [String] - ) async throws -> Domain.Profile { + ) async throws -> ASCKit.Profile { guard let sdkProfileType = ProfileCreateRequest.Data.Attributes.ProfileType(rawValue: profileType.rawValue) else { throw APIError.unknown("Unsupported profile type: \(profileType.rawValue)") } @@ -71,14 +70,14 @@ public struct SDKProfileRepository: ProfileRepository, @unchecked Sendable { private func mapProfile( _ sdkProfile: AppStoreConnect_Swift_SDK.Profile, bundleIdId: String - ) -> Domain.Profile { + ) -> ASCKit.Profile { let profileType = sdkProfile.attributes?.profileType.flatMap { - Domain.ProfileType(rawValue: $0.rawValue) + ASCKit.ProfileType(rawValue: $0.rawValue) } ?? .iosAppStore let profileState = sdkProfile.attributes?.profileState.flatMap { - Domain.ProfileState(rawValue: $0.rawValue) + ASCKit.ProfileState(rawValue: $0.rawValue) } ?? .active - return Domain.Profile( + return ASCKit.Profile( id: sdkProfile.id, name: sdkProfile.attributes?.name ?? "", profileType: profileType, diff --git a/Sources/Domain/CodeSigning/Profiles/Profile.swift b/Sources/ASCKit/CodeSigning/Profiles/Profile.swift similarity index 100% rename from Sources/Domain/CodeSigning/Profiles/Profile.swift rename to Sources/ASCKit/CodeSigning/Profiles/Profile.swift diff --git a/Sources/Domain/CodeSigning/Profiles/ProfileRepository.swift b/Sources/ASCKit/CodeSigning/Profiles/ProfileRepository.swift similarity index 100% rename from Sources/Domain/CodeSigning/Profiles/ProfileRepository.swift rename to Sources/ASCKit/CodeSigning/Profiles/ProfileRepository.swift diff --git a/Sources/Domain/GameCenter/GameCenter+RESTRoutes.swift b/Sources/ASCKit/GameCenter/GameCenter+RESTRoutes.swift similarity index 100% rename from Sources/Domain/GameCenter/GameCenter+RESTRoutes.swift rename to Sources/ASCKit/GameCenter/GameCenter+RESTRoutes.swift diff --git a/Sources/Domain/GameCenter/GameCenterAchievement.swift b/Sources/ASCKit/GameCenter/GameCenterAchievement.swift similarity index 100% rename from Sources/Domain/GameCenter/GameCenterAchievement.swift rename to Sources/ASCKit/GameCenter/GameCenterAchievement.swift diff --git a/Sources/Domain/GameCenter/GameCenterDetail.swift b/Sources/ASCKit/GameCenter/GameCenterDetail.swift similarity index 100% rename from Sources/Domain/GameCenter/GameCenterDetail.swift rename to Sources/ASCKit/GameCenter/GameCenterDetail.swift diff --git a/Sources/Domain/GameCenter/GameCenterLeaderboard.swift b/Sources/ASCKit/GameCenter/GameCenterLeaderboard.swift similarity index 100% rename from Sources/Domain/GameCenter/GameCenterLeaderboard.swift rename to Sources/ASCKit/GameCenter/GameCenterLeaderboard.swift diff --git a/Sources/Domain/GameCenter/GameCenterRepository.swift b/Sources/ASCKit/GameCenter/GameCenterRepository.swift similarity index 100% rename from Sources/Domain/GameCenter/GameCenterRepository.swift rename to Sources/ASCKit/GameCenter/GameCenterRepository.swift diff --git a/Sources/Infrastructure/GameCenter/SDKGameCenterRepository.swift b/Sources/ASCKit/GameCenter/Internal/SDKGameCenterRepository.swift similarity index 86% rename from Sources/Infrastructure/GameCenter/SDKGameCenterRepository.swift rename to Sources/ASCKit/GameCenter/Internal/SDKGameCenterRepository.swift index 9b3e5e0f..de9fa1bb 100644 --- a/Sources/Infrastructure/GameCenter/SDKGameCenterRepository.swift +++ b/Sources/ASCKit/GameCenter/Internal/SDKGameCenterRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKGameCenterRepository: GameCenterRepository, @unchecked Sendable { private let client: any APIClient @@ -10,7 +9,7 @@ public struct SDKGameCenterRepository: GameCenterRepository, @unchecked Sendable // MARK: - Detail - public func getDetail(appId: String) async throws -> Domain.GameCenterDetail { + public func getDetail(appId: String) async throws -> ASCKit.GameCenterDetail { let request = APIEndpoint.v1.apps.id(appId).gameCenterDetail.get() let response = try await client.request(request) return mapDetail(response.data, appId: appId) @@ -18,7 +17,7 @@ public struct SDKGameCenterRepository: GameCenterRepository, @unchecked Sendable // MARK: - Achievements - public func listAchievements(gameCenterDetailId: String) async throws -> [Domain.GameCenterAchievement] { + public func listAchievements(gameCenterDetailId: String) async throws -> [ASCKit.GameCenterAchievement] { let request = APIEndpoint.v1.gameCenterDetails.id(gameCenterDetailId).gameCenterAchievements.get() let response = try await client.request(request) return response.data.map { mapAchievement($0, gameCenterDetailId: gameCenterDetailId) } @@ -31,7 +30,7 @@ public struct SDKGameCenterRepository: GameCenterRepository, @unchecked Sendable points: Int, isShowBeforeEarned: Bool, isRepeatable: Bool - ) async throws -> Domain.GameCenterAchievement { + ) async throws -> ASCKit.GameCenterAchievement { let body = GameCenterAchievementCreateRequest(data: .init( type: .gameCenterAchievements, attributes: .init( @@ -55,7 +54,7 @@ public struct SDKGameCenterRepository: GameCenterRepository, @unchecked Sendable // MARK: - Leaderboards - public func listLeaderboards(gameCenterDetailId: String) async throws -> [Domain.GameCenterLeaderboard] { + public func listLeaderboards(gameCenterDetailId: String) async throws -> [ASCKit.GameCenterLeaderboard] { let request = APIEndpoint.v1.gameCenterDetails.id(gameCenterDetailId).gameCenterLeaderboards.get() let response = try await client.request(request) return response.data.map { mapLeaderboard($0, gameCenterDetailId: gameCenterDetailId) } @@ -65,9 +64,9 @@ public struct SDKGameCenterRepository: GameCenterRepository, @unchecked Sendable gameCenterDetailId: String, referenceName: String, vendorIdentifier: String, - scoreSortType: Domain.ScoreSortType, - submissionType: Domain.LeaderboardSubmissionType - ) async throws -> Domain.GameCenterLeaderboard { + scoreSortType: ASCKit.ScoreSortType, + submissionType: ASCKit.LeaderboardSubmissionType + ) async throws -> ASCKit.GameCenterLeaderboard { let body = GameCenterLeaderboardCreateRequest(data: .init( type: .gameCenterLeaderboards, attributes: .init( @@ -91,8 +90,8 @@ public struct SDKGameCenterRepository: GameCenterRepository, @unchecked Sendable // MARK: - Mappers - private func mapDetail(_ sdk: AppStoreConnect_Swift_SDK.GameCenterDetail, appId: String) -> Domain.GameCenterDetail { - Domain.GameCenterDetail( + private func mapDetail(_ sdk: AppStoreConnect_Swift_SDK.GameCenterDetail, appId: String) -> ASCKit.GameCenterDetail { + ASCKit.GameCenterDetail( id: sdk.id, appId: appId, isArcadeEnabled: sdk.attributes?.isArcadeEnabled ?? false @@ -102,8 +101,8 @@ public struct SDKGameCenterRepository: GameCenterRepository, @unchecked Sendable private func mapAchievement( _ sdk: AppStoreConnect_Swift_SDK.GameCenterAchievement, gameCenterDetailId: String - ) -> Domain.GameCenterAchievement { - Domain.GameCenterAchievement( + ) -> ASCKit.GameCenterAchievement { + ASCKit.GameCenterAchievement( id: sdk.id, gameCenterDetailId: gameCenterDetailId, referenceName: sdk.attributes?.referenceName ?? "", @@ -118,8 +117,8 @@ public struct SDKGameCenterRepository: GameCenterRepository, @unchecked Sendable private func mapLeaderboard( _ sdk: AppStoreConnect_Swift_SDK.GameCenterLeaderboard, gameCenterDetailId: String - ) -> Domain.GameCenterLeaderboard { - Domain.GameCenterLeaderboard( + ) -> ASCKit.GameCenterLeaderboard { + ASCKit.GameCenterLeaderboard( id: sdk.id, gameCenterDetailId: gameCenterDetailId, referenceName: sdk.attributes?.referenceName ?? "", @@ -130,28 +129,28 @@ public struct SDKGameCenterRepository: GameCenterRepository, @unchecked Sendable ) } - private func mapScoreSortTypeForCreate(_ type: Domain.ScoreSortType) -> AppStoreConnect_Swift_SDK.GameCenterLeaderboardCreateRequest.Data.Attributes.ScoreSortType { + private func mapScoreSortTypeForCreate(_ type: ASCKit.ScoreSortType) -> AppStoreConnect_Swift_SDK.GameCenterLeaderboardCreateRequest.Data.Attributes.ScoreSortType { switch type { case .asc: return .asc case .desc: return .desc } } - private func mapScoreSortTypeFromSDK(_ type: AppStoreConnect_Swift_SDK.GameCenterLeaderboard.Attributes.ScoreSortType?) -> Domain.ScoreSortType { + private func mapScoreSortTypeFromSDK(_ type: AppStoreConnect_Swift_SDK.GameCenterLeaderboard.Attributes.ScoreSortType?) -> ASCKit.ScoreSortType { switch type { case .asc: return .asc case .desc, .none: return .desc } } - private func mapSubmissionTypeForCreate(_ type: Domain.LeaderboardSubmissionType) -> AppStoreConnect_Swift_SDK.GameCenterLeaderboardCreateRequest.Data.Attributes.SubmissionType { + private func mapSubmissionTypeForCreate(_ type: ASCKit.LeaderboardSubmissionType) -> AppStoreConnect_Swift_SDK.GameCenterLeaderboardCreateRequest.Data.Attributes.SubmissionType { switch type { case .bestScore: return .bestScore case .mostRecentScore: return .mostRecentScore } } - private func mapSubmissionTypeFromSDK(_ type: AppStoreConnect_Swift_SDK.GameCenterLeaderboard.Attributes.SubmissionType?) -> Domain.LeaderboardSubmissionType { + private func mapSubmissionTypeFromSDK(_ type: AppStoreConnect_Swift_SDK.GameCenterLeaderboard.Attributes.SubmissionType?) -> ASCKit.LeaderboardSubmissionType { switch type { case .bestScore, .none: return .bestScore case .mostRecentScore: return .mostRecentScore diff --git a/Sources/Domain/GameCenter/Moderation/GameCenterModerationRepository.swift b/Sources/ASCKit/GameCenter/Moderation/GameCenterModerationRepository.swift similarity index 100% rename from Sources/Domain/GameCenter/Moderation/GameCenterModerationRepository.swift rename to Sources/ASCKit/GameCenter/Moderation/GameCenterModerationRepository.swift diff --git a/Sources/Domain/GameCenter/Moderation/GameCenterPlayer.swift b/Sources/ASCKit/GameCenter/Moderation/GameCenterPlayer.swift similarity index 100% rename from Sources/Domain/GameCenter/Moderation/GameCenterPlayer.swift rename to Sources/ASCKit/GameCenter/Moderation/GameCenterPlayer.swift diff --git a/Sources/Domain/GameCenter/Moderation/GameCenterScoreModeration.swift b/Sources/ASCKit/GameCenter/Moderation/GameCenterScoreModeration.swift similarity index 100% rename from Sources/Domain/GameCenter/Moderation/GameCenterScoreModeration.swift rename to Sources/ASCKit/GameCenter/Moderation/GameCenterScoreModeration.swift diff --git a/Sources/Infrastructure/GameCenter/Moderation/SDKGameCenterModerationRepository.swift b/Sources/ASCKit/GameCenter/Moderation/Internal/SDKGameCenterModerationRepository.swift similarity index 91% rename from Sources/Infrastructure/GameCenter/Moderation/SDKGameCenterModerationRepository.swift rename to Sources/ASCKit/GameCenter/Moderation/Internal/SDKGameCenterModerationRepository.swift index b45fbb54..5621d4a0 100644 --- a/Sources/Infrastructure/GameCenter/Moderation/SDKGameCenterModerationRepository.swift +++ b/Sources/ASCKit/GameCenter/Moderation/Internal/SDKGameCenterModerationRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKGameCenterModerationRepository: GameCenterModerationRepository, @unchecked Sendable { @@ -11,7 +10,7 @@ public struct SDKGameCenterModerationRepository: GameCenterModerationRepository, // MARK: - Score moderations - public func listScoreModerations(leaderboardId: String, blockedOnly: Bool) async throws -> [Domain.GameCenterScoreModeration] { + public func listScoreModerations(leaderboardId: String, blockedOnly: Bool) async throws -> [ASCKit.GameCenterScoreModeration] { let pages = try await client.requestAllPages( APIEndpoint.v2.gameCenterLeaderboards.id(leaderboardId).gameCenterScoreModerations.get( parameters: .init(isExistsBlocked: blockedOnly ? true : nil, limit: 200, include: [.player]) @@ -25,7 +24,7 @@ public struct SDKGameCenterModerationRepository: GameCenterModerationRepository, return pages.flatMap(\.data).map { mapScore($0, leaderboardId: leaderboardId, players: players) } } - public func updateScoreModeration(id: String, isBlocked: Bool) async throws -> Domain.GameCenterScoreModeration { + public func updateScoreModeration(id: String, isBlocked: Bool) async throws -> ASCKit.GameCenterScoreModeration { let body = GameCenterScoreModerationUpdateRequest(data: .init( type: .gameCenterScoreModerations, id: id, attributes: .init(isBlocked: isBlocked) )) @@ -39,7 +38,7 @@ public struct SDKGameCenterModerationRepository: GameCenterModerationRepository, // MARK: - Players - public func listBlockedPlayers(gameCenterDetailId: String) async throws -> [Domain.GameCenterPlayer] { + public func listBlockedPlayers(gameCenterDetailId: String) async throws -> [ASCKit.GameCenterPlayer] { let pages = try await client.requestAllPages( APIEndpoint.v1.gameCenterDetails.id(gameCenterDetailId).blockedPlayers.get(limit: 200), nextCursor: { $0.meta?.paging.nextCursor } @@ -48,7 +47,7 @@ public struct SDKGameCenterModerationRepository: GameCenterModerationRepository, return pages.flatMap(\.data).map { mapPlayer($0, gameCenterDetailId: gameCenterDetailId, defaultBlocked: true) } } - public func updatePlayer(id: String, isBlocked: Bool) async throws -> Domain.GameCenterPlayer { + public func updatePlayer(id: String, isBlocked: Bool) async throws -> ASCKit.GameCenterPlayer { let body = GameCenterDetailPlayerUpdateRequest(data: .init( type: .gameCenterDetailPlayers, id: id, attributes: .init(isBlocked: isBlocked) )) @@ -63,10 +62,10 @@ public struct SDKGameCenterModerationRepository: GameCenterModerationRepository, leaderboardId: String?, players: [String: AppStoreConnect_Swift_SDK.GameCenterDetailPlayer], defaultBlocked: Bool = false - ) -> Domain.GameCenterScoreModeration { + ) -> ASCKit.GameCenterScoreModeration { let playerId = sdk.relationships?.player?.data?.id let player = playerId.flatMap { players[$0] } - return Domain.GameCenterScoreModeration( + return ASCKit.GameCenterScoreModeration( id: sdk.id, leaderboardId: leaderboardId, rank: sdk.attributes?.rank, @@ -86,8 +85,8 @@ public struct SDKGameCenterModerationRepository: GameCenterModerationRepository, _ sdk: AppStoreConnect_Swift_SDK.GameCenterDetailPlayer, gameCenterDetailId: String?, defaultBlocked: Bool - ) -> Domain.GameCenterPlayer { - Domain.GameCenterPlayer( + ) -> ASCKit.GameCenterPlayer { + ASCKit.GameCenterPlayer( id: sdk.id, gameCenterDetailId: gameCenterDetailId, nickname: sdk.attributes?.nickname, diff --git a/Sources/Domain/Iris/AppBundles/AppBundle.swift b/Sources/ASCKit/Iris/AppBundles/AppBundle.swift similarity index 100% rename from Sources/Domain/Iris/AppBundles/AppBundle.swift rename to Sources/ASCKit/Iris/AppBundles/AppBundle.swift diff --git a/Sources/Infrastructure/Iris/AppBundles/IrisCreateAppDocument.swift b/Sources/ASCKit/Iris/AppBundles/Internal/IrisCreateAppDocument.swift similarity index 100% rename from Sources/Infrastructure/Iris/AppBundles/IrisCreateAppDocument.swift rename to Sources/ASCKit/Iris/AppBundles/Internal/IrisCreateAppDocument.swift diff --git a/Sources/Infrastructure/Iris/AppBundles/IrisSDKAppBundleRepository.swift b/Sources/ASCKit/Iris/AppBundles/Internal/IrisSDKAppBundleRepository.swift similarity index 96% rename from Sources/Infrastructure/Iris/AppBundles/IrisSDKAppBundleRepository.swift rename to Sources/ASCKit/Iris/AppBundles/Internal/IrisSDKAppBundleRepository.swift index a19f3ff6..08767896 100644 --- a/Sources/Infrastructure/Iris/AppBundles/IrisSDKAppBundleRepository.swift +++ b/Sources/ASCKit/Iris/AppBundles/Internal/IrisSDKAppBundleRepository.swift @@ -1,11 +1,10 @@ -import Domain import Foundation /// Implements `IrisAppBundleRepository` via the iris private API. public struct IrisSDKAppBundleRepository: IrisAppBundleRepository, @unchecked Sendable { - private let client: IrisClient + private let client: any IrisAPI - public init(client: IrisClient = IrisClient()) { + public init(client: any IrisAPI = IrisClient()) { self.client = client } diff --git a/Sources/Domain/Iris/AppBundles/IrisAppBundleRepository.swift b/Sources/ASCKit/Iris/AppBundles/IrisAppBundleRepository.swift similarity index 100% rename from Sources/Domain/Iris/AppBundles/IrisAppBundleRepository.swift rename to Sources/ASCKit/Iris/AppBundles/IrisAppBundleRepository.swift diff --git a/Sources/Infrastructure/Iris/InAppPurchases/IrisSDKInAppPurchaseStateRepository.swift b/Sources/ASCKit/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseStateRepository.swift similarity index 94% rename from Sources/Infrastructure/Iris/InAppPurchases/IrisSDKInAppPurchaseStateRepository.swift rename to Sources/ASCKit/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseStateRepository.swift index 34b2d799..efed0da0 100644 --- a/Sources/Infrastructure/Iris/InAppPurchases/IrisSDKInAppPurchaseStateRepository.swift +++ b/Sources/ASCKit/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseStateRepository.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Implements `IrisInAppPurchaseStateRepository` against @@ -6,9 +5,9 @@ import Foundation /// `submitWithNextAppStoreVersion` as an attribute on each IAP — the public SDK /// does not, which is why this lives behind the iris cookie surface. public struct IrisSDKInAppPurchaseStateRepository: IrisInAppPurchaseStateRepository, @unchecked Sendable { - private let client: IrisClient + private let client: any IrisAPI - public init(client: IrisClient = IrisClient()) { + public init(client: any IrisAPI = IrisClient()) { self.client = client } diff --git a/Sources/Infrastructure/Iris/InAppPurchases/IrisSDKInAppPurchaseSubmissionRepository.swift b/Sources/ASCKit/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseSubmissionRepository.swift similarity index 96% rename from Sources/Infrastructure/Iris/InAppPurchases/IrisSDKInAppPurchaseSubmissionRepository.swift rename to Sources/ASCKit/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseSubmissionRepository.swift index 51cf1b38..d857e9ea 100644 --- a/Sources/Infrastructure/Iris/InAppPurchases/IrisSDKInAppPurchaseSubmissionRepository.swift +++ b/Sources/ASCKit/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseSubmissionRepository.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Implements `IrisInAppPurchaseSubmissionRepository` via the iris private API. @@ -8,9 +7,9 @@ import Foundation /// `POST /iris/v1/inAppPurchaseSubmissions`. The public ASC SDK's /// `InAppPurchaseSubmissionCreateRequest` lacks an `attributes` field entirely. public struct IrisSDKInAppPurchaseSubmissionRepository: IrisInAppPurchaseSubmissionRepository, @unchecked Sendable { - private let client: IrisClient + private let client: any IrisAPI - public init(client: IrisClient = IrisClient()) { + public init(client: any IrisAPI = IrisClient()) { self.client = client } diff --git a/Sources/Domain/Iris/InAppPurchases/IrisInAppPurchaseStateRepository.swift b/Sources/ASCKit/Iris/InAppPurchases/IrisInAppPurchaseStateRepository.swift similarity index 100% rename from Sources/Domain/Iris/InAppPurchases/IrisInAppPurchaseStateRepository.swift rename to Sources/ASCKit/Iris/InAppPurchases/IrisInAppPurchaseStateRepository.swift diff --git a/Sources/Domain/Iris/InAppPurchases/IrisInAppPurchaseSubmission.swift b/Sources/ASCKit/Iris/InAppPurchases/IrisInAppPurchaseSubmission.swift similarity index 100% rename from Sources/Domain/Iris/InAppPurchases/IrisInAppPurchaseSubmission.swift rename to Sources/ASCKit/Iris/InAppPurchases/IrisInAppPurchaseSubmission.swift diff --git a/Sources/Domain/Iris/InAppPurchases/IrisInAppPurchaseSubmissionRepository.swift b/Sources/ASCKit/Iris/InAppPurchases/IrisInAppPurchaseSubmissionRepository.swift similarity index 100% rename from Sources/Domain/Iris/InAppPurchases/IrisInAppPurchaseSubmissionRepository.swift rename to Sources/ASCKit/Iris/InAppPurchases/IrisInAppPurchaseSubmissionRepository.swift diff --git a/Sources/ASCKit/Iris/Internal/Auth/AppleIDSignIn.swift b/Sources/ASCKit/Iris/Internal/Auth/AppleIDSignIn.swift new file mode 100644 index 00000000..ddf0e70d --- /dev/null +++ b/Sources/ASCKit/Iris/Internal/Auth/AppleIDSignIn.swift @@ -0,0 +1,31 @@ +import Foundation +import Mockable + +/// Apple's identity service (idmsa.apple.com): the SRP sign-in and the two-factor steps. +/// `IdmsaAPIClient` plays it over HTTP. +@Mockable +protocol AppleIDSignIn: Sendable { + func signinInit(accountName: String, A: Data) async throws -> IdmsaAPIClient.SigninInitResponse + func signinComplete( + accountName: String, c: String, m1: Data, m2: Data, + scnt: String, appleIDSessionID: String, + hashcashChallenge: String?, hashcashBits: Int?, + cookies: String + ) async throws -> IdmsaAPIClient.SigninCompleteResult + func fetchAuthOptions(scnt: String, appleIDSessionID: String, cookies: String) async throws -> String + func submitTwoFactorCode( + _ code: String, method: IdmsaAPIClient.TwoFactorMethod, + scnt: String, appleIDSessionID: String, cookies: String + ) async throws -> String + func trust(scnt: String, appleIDSessionID: String, cookies: String) async throws -> String +} + +/// The App Store Connect account a signed-in session belongs to (olympus): its +/// provider, team and email. `OlympusClient` plays it over HTTP. +@Mockable +protocol AppStoreConnectAccounts: Sendable { + func fetchSession(cookies: String) async throws -> OlympusClient.OlympusSession +} + +extension IdmsaAPIClient: AppleIDSignIn {} +extension OlympusClient: AppStoreConnectAccounts {} diff --git a/Sources/Infrastructure/Iris/Auth/CompositeIrisCookieProvider.swift b/Sources/ASCKit/Iris/Internal/Auth/CompositeIrisCookieProvider.swift similarity index 98% rename from Sources/Infrastructure/Iris/Auth/CompositeIrisCookieProvider.swift rename to Sources/ASCKit/Iris/Internal/Auth/CompositeIrisCookieProvider.swift index e07bb009..bbdbdd1d 100644 --- a/Sources/Infrastructure/Iris/Auth/CompositeIrisCookieProvider.swift +++ b/Sources/ASCKit/Iris/Internal/Auth/CompositeIrisCookieProvider.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Tries each provider in order; the first one that successfully resolves wins. diff --git a/Sources/Infrastructure/Iris/Auth/FileIrisSessionRepository.swift b/Sources/ASCKit/Iris/Internal/Auth/FileIrisSessionRepository.swift similarity index 99% rename from Sources/Infrastructure/Iris/Auth/FileIrisSessionRepository.swift rename to Sources/ASCKit/Iris/Internal/Auth/FileIrisSessionRepository.swift index d883f906..1ba190c0 100644 --- a/Sources/Infrastructure/Iris/Auth/FileIrisSessionRepository.swift +++ b/Sources/ASCKit/Iris/Internal/Auth/FileIrisSessionRepository.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Persists `IrisAuthSession` to `~/.asc/iris/session.json` with `0600` permissions. diff --git a/Sources/Infrastructure/Iris/Auth/IdmsaAPIClient.swift b/Sources/ASCKit/Iris/Internal/Auth/IdmsaAPIClient.swift similarity index 99% rename from Sources/Infrastructure/Iris/Auth/IdmsaAPIClient.swift rename to Sources/ASCKit/Iris/Internal/Auth/IdmsaAPIClient.swift index 919266ce..b4b3af21 100644 --- a/Sources/Infrastructure/Iris/Auth/IdmsaAPIClient.swift +++ b/Sources/ASCKit/Iris/Internal/Auth/IdmsaAPIClient.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// HTTP client for `https://idmsa.apple.com/appleauth/auth/...`. Knows nothing about diff --git a/Sources/Infrastructure/Iris/Auth/IrisAuthSDKRepository.swift b/Sources/ASCKit/Iris/Internal/Auth/IrisSDKSignIn.swift similarity index 87% rename from Sources/Infrastructure/Iris/Auth/IrisAuthSDKRepository.swift rename to Sources/ASCKit/Iris/Internal/Auth/IrisSDKSignIn.swift index 0f90d270..31fd96a4 100644 --- a/Sources/Infrastructure/Iris/Auth/IrisAuthSDKRepository.swift +++ b/Sources/ASCKit/Iris/Internal/Auth/IrisSDKSignIn.swift @@ -1,13 +1,13 @@ -import Domain import Foundation /// Drives the full Apple ID SRP login + olympus session lookup, conforming to -/// `Domain.IrisAuthRepository`. Composition root for all the Apple-specific bits: +/// `ASCKit.IrisSignIn`. Composition root for all the Apple-specific bits: /// `AppleSRPClient` for crypto, `IdmsaAPIClient` for `idmsa.apple.com`, `OlympusClient` /// for ASC team metadata. -public struct IrisAuthSDKRepository: IrisAuthRepository, @unchecked Sendable { - private let idmsa: IdmsaAPIClient - private let olympus: OlympusClient +public struct IrisSDKSignIn: IrisSignIn, @unchecked Sendable { + private let idmsa: any AppleIDSignIn + private let olympus: any AppStoreConnectAccounts + private let now: @Sendable () -> Date /// App Store Connect's widget key — long-stable. Apple's web UI fetches this /// dynamically; we hardcode the observed value as a constant. If Apple ever rotates @@ -16,10 +16,20 @@ public struct IrisAuthSDKRepository: IrisAuthRepository, @unchecked Sendable { public init( session: URLSession = .shared, - serviceKey: String = ascServiceKey + serviceKey: String = ascServiceKey, + now: @escaping @Sendable () -> Date = { Date() } ) { - self.idmsa = IdmsaAPIClient(session: session, serviceKey: serviceKey) - self.olympus = OlympusClient(session: session) + self.init( + signIn: IdmsaAPIClient(session: session, serviceKey: serviceKey), + accounts: OlympusClient(session: session), + now: now + ) + } + + init(signIn: any AppleIDSignIn, accounts: any AppStoreConnectAccounts, now: @escaping @Sendable () -> Date) { + self.idmsa = signIn + self.olympus = accounts + self.now = now } public func login(credentials: IrisAuthCredentials) async throws -> IrisAuthSession { @@ -103,7 +113,7 @@ public struct IrisAuthSDKRepository: IrisAuthRepository, @unchecked Sendable { let olympusSession = try await olympus.fetchSession(cookies: cookies) // Best-guess expiry — iris cookies typically last ~30 days. We rebuild on // expiry since iris exposes no refresh endpoint. - let expiresAt = Date().addingTimeInterval(30 * 24 * 60 * 60) + let expiresAt = now().addingTimeInterval(30 * 24 * 60 * 60) return IrisAuthSession( cookies: cookies, scnt: scnt, diff --git a/Sources/Infrastructure/Iris/Auth/OlympusClient.swift b/Sources/ASCKit/Iris/Internal/Auth/OlympusClient.swift similarity index 100% rename from Sources/Infrastructure/Iris/Auth/OlympusClient.swift rename to Sources/ASCKit/Iris/Internal/Auth/OlympusClient.swift diff --git a/Sources/Infrastructure/Iris/Auth/SRP/AppleHashcash.swift b/Sources/ASCKit/Iris/Internal/Auth/SRP/AppleHashcash.swift similarity index 100% rename from Sources/Infrastructure/Iris/Auth/SRP/AppleHashcash.swift rename to Sources/ASCKit/Iris/Internal/Auth/SRP/AppleHashcash.swift diff --git a/Sources/Infrastructure/Iris/Auth/SRP/AppleSRPClient.swift b/Sources/ASCKit/Iris/Internal/Auth/SRP/AppleSRPClient.swift similarity index 100% rename from Sources/Infrastructure/Iris/Auth/SRP/AppleSRPClient.swift rename to Sources/ASCKit/Iris/Internal/Auth/SRP/AppleSRPClient.swift diff --git a/Sources/Infrastructure/Iris/Auth/StoredSRPIrisCookieProvider.swift b/Sources/ASCKit/Iris/Internal/Auth/StoredSRPIrisCookieProvider.swift similarity index 98% rename from Sources/Infrastructure/Iris/Auth/StoredSRPIrisCookieProvider.swift rename to Sources/ASCKit/Iris/Internal/Auth/StoredSRPIrisCookieProvider.swift index 18605357..897a5957 100644 --- a/Sources/Infrastructure/Iris/Auth/StoredSRPIrisCookieProvider.swift +++ b/Sources/ASCKit/Iris/Internal/Auth/StoredSRPIrisCookieProvider.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Surfaces an `IrisAuthSession` previously written by `asc iris auth login` as an diff --git a/Sources/ASCKit/Iris/Internal/BrowserCookieStores.swift b/Sources/ASCKit/Iris/Internal/BrowserCookieStores.swift new file mode 100644 index 00000000..9adef303 --- /dev/null +++ b/Sources/ASCKit/Iris/Internal/BrowserCookieStores.swift @@ -0,0 +1,15 @@ +import Mockable + +/// One cookie a browser holds. +struct BrowserCookie: Equatable, Sendable { + let name: String + let value: String +} + +/// The browsers' cookie stores on this Mac. +@Mockable +protocol BrowserCookieStores: Sendable { + /// For each browser, in the order to try them, the unexpired cookies it holds + /// for any of `domains` (suffix match). A browser that can't be read gives none. + func cookiesPerBrowser(domains: [String]) -> [[BrowserCookie]] +} diff --git a/Sources/ASCKit/Iris/Internal/BrowserIrisCookieProvider.swift b/Sources/ASCKit/Iris/Internal/BrowserIrisCookieProvider.swift new file mode 100644 index 00000000..d6cc1b59 --- /dev/null +++ b/Sources/ASCKit/Iris/Internal/BrowserIrisCookieProvider.swift @@ -0,0 +1,72 @@ +import Foundation + +/// Resolves iris session cookies from the environment or a browser. +/// +/// Resolution order: +/// 1. `ASC_IRIS_COOKIES` environment variable (for CI/CD), when not blank +/// 2. The first browser signed in to App Store Connect (holding `myacinfo`) +public struct BrowserIrisCookieProvider: IrisCookieProvider { + /// `myacinfo` is set on .apple.com; the others (itctx, dqsid, wosid) on appstoreconnect.apple.com. + static let domains = ["apple.com", "appstoreconnect.apple.com"] + /// The cookies the iris API reads. + static let irisCookieNames: Set = [ + "myacinfo", "itctx", "itcdq", "dqsid", "wosid", "woinst", "dssf", "dssid2", "dc", + ] + + private let environment: [String: String] + private let browsers: any BrowserCookieStores + + public init() { + self.init(environment: ProcessInfo.processInfo.environment, browsers: SweetCookieKitStores()) + } + + init(environment: [String: String], browsers: any BrowserCookieStores) { + self.environment = environment + self.browsers = browsers + } + + public func resolveSession() throws -> IrisSession { + IrisSession(cookies: try resolve().cookies) + } + + public func resolveStatus() throws -> IrisStatus { + let (cookies, source) = try resolve() + return IrisStatus(source: source, cookieCount: cookies.components(separatedBy: "; ").count) + } + + private func resolve() throws -> (cookies: String, source: IrisCookieSource) { + if let fromEnvironment = environment["ASC_IRIS_COOKIES"], + !fromEnvironment.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + return (fromEnvironment, .environment) + } + for cookies in browsers.cookiesPerBrowser(domains: Self.domains) { + if let header = Self.irisCookieHeader(from: cookies) { + return (header, .browser) + } + } + throw IrisCookieError.noCookiesFound + } + + /// The iris cookies as a `cookie` header, or `nil` when the browser isn't + /// signed in (no `myacinfo`). A later cookie of the same name wins. + private static func irisCookieHeader(from cookies: [BrowserCookie]) -> String? { + var byName: [String: String] = [:] + for cookie in cookies where irisCookieNames.contains(cookie.name) { + byName[cookie.name] = cookie.value + } + guard byName["myacinfo"] != nil else { return nil } + return byName.sorted { $0.key < $1.key }.map { "\($0.key)=\($0.value)" }.joined(separator: "; ") + } +} + +/// Errors specific to iris cookie resolution. +public enum IrisCookieError: LocalizedError { + case noCookiesFound + + public var errorDescription: String? { + switch self { + case .noCookiesFound: + "No App Store Connect cookies found. Log in to appstoreconnect.apple.com in your browser, or set ASC_IRIS_COOKIES environment variable." + } + } +} diff --git a/Sources/ASCKit/Iris/Internal/IrisAPI.swift b/Sources/ASCKit/Iris/Internal/IrisAPI.swift new file mode 100644 index 00000000..2e6caf70 --- /dev/null +++ b/Sources/ASCKit/Iris/Internal/IrisAPI.swift @@ -0,0 +1,19 @@ +import Foundation +import Mockable + +/// The iris private API (`appstoreconnect.apple.com/iris/v1`), as the iris +/// repositories use it. `IrisClient` plays it over HTTP. +@Mockable +public protocol IrisAPI: Sendable { + func get(path: String, queryItems: [URLQueryItem], cookies: String) async throws -> (Data, HTTPURLResponse) + func post(path: String, body: Data, cookies: String) async throws -> (Data, HTTPURLResponse) + /// Fetch an absolute URL with the session cookies. Callers validate the host first. + func download(absoluteURL: URL, cookies: String) async throws -> (Data, HTTPURLResponse) + func delete(path: String, cookies: String) async throws -> (Data, HTTPURLResponse) +} + +extension IrisAPI { + func get(path: String, cookies: String) async throws -> (Data, HTTPURLResponse) { + try await get(path: path, queryItems: [], cookies: cookies) + } +} diff --git a/Sources/ASCKit/Iris/Internal/IrisRequest.swift b/Sources/ASCKit/Iris/Internal/IrisRequest.swift new file mode 100644 index 00000000..11571248 --- /dev/null +++ b/Sources/ASCKit/Iris/Internal/IrisRequest.swift @@ -0,0 +1,59 @@ +import Foundation + +/// The requests the iris private API accepts: `appstoreconnect.apple.com/iris/v1/`, +/// JSON:API, the session cookies, and the headers the web UI sends. +enum IrisRequest { + static let baseURL = "https://appstoreconnect.apple.com/iris/v1" + static let userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36" + + static func get(path: String, queryItems: [URLQueryItem], cookies: String) -> URLRequest { + var components = URLComponents(string: "\(baseURL)/\(path)")! + if !queryItems.isEmpty { + components.queryItems = queryItems + } + return iris(url: components.url!, method: "GET", cookies: cookies) + } + + static func post(path: String, body: Data, cookies: String) -> URLRequest { + var request = iris(url: URL(string: "\(baseURL)/\(path)")!, method: "POST", cookies: cookies) + request.httpBody = body + return request + } + + static func delete(path: String, cookies: String) -> URLRequest { + iris(url: URL(string: "\(baseURL)/\(path)")!, method: "DELETE", cookies: cookies) + } + + /// An absolute URL (e.g. an Apple-signed attachment) with only the session cookies. + /// Callers validate the host first: this fetches whatever it is given. + static func download(absoluteURL: URL, cookies: String) -> URLRequest { + var request = URLRequest(url: absoluteURL) + request.httpMethod = "GET" + request.setValue(cookies, forHTTPHeaderField: "cookie") + return request + } + + private static func iris(url: URL, method: String, cookies: String) -> URLRequest { + var request = URLRequest(url: url) + request.httpMethod = method + request.setValue("application/vnd.api+json", forHTTPHeaderField: "accept") + request.setValue("application/vnd.api+json", forHTTPHeaderField: "content-type") + request.setValue(cookies, forHTTPHeaderField: "cookie") + request.setValue(userAgent, forHTTPHeaderField: "user-agent") + request.setValue("[asc-ui]", forHTTPHeaderField: "x-csrf-itc") + return request + } +} + +/// What iris's reply means: the body on a 2xx, `IrisAPIError` otherwise. +enum IrisResponse { + static func accepted(data: Data, response: URLResponse) throws -> (Data, HTTPURLResponse) { + guard let http = response as? HTTPURLResponse else { + throw IrisAPIError.invalidResponse + } + guard (200...299).contains(http.statusCode) else { + throw IrisAPIError.httpError(statusCode: http.statusCode, body: String(data: data, encoding: .utf8)) + } + return (data, http) + } +} diff --git a/Sources/ASCKit/Iris/Internal/System/IrisClient.swift b/Sources/ASCKit/Iris/Internal/System/IrisClient.swift new file mode 100644 index 00000000..c703ab99 --- /dev/null +++ b/Sources/ASCKit/Iris/Internal/System/IrisClient.swift @@ -0,0 +1,34 @@ +import Foundation + +/// HTTP client for the iris private API. Only the `URLSession` call lives here; +/// the request is `IrisRequest`'s and what the reply means is `IrisResponse`'s. +public struct IrisClient: IrisAPI { + private let session: URLSession + + public init(session: URLSession = .shared) { + self.session = session + } + + public func get(path: String, queryItems: [URLQueryItem], cookies: String) async throws -> (Data, HTTPURLResponse) { + try await perform(IrisRequest.get(path: path, queryItems: queryItems, cookies: cookies)) + } + + public func post(path: String, body: Data, cookies: String) async throws -> (Data, HTTPURLResponse) { + try await perform(IrisRequest.post(path: path, body: body, cookies: cookies)) + } + + /// Fetch an absolute URL with the session cookies. Callers validate the host first. + public func download(absoluteURL: URL, cookies: String) async throws -> (Data, HTTPURLResponse) { + try await perform(IrisRequest.download(absoluteURL: absoluteURL, cookies: cookies)) + } + + /// Used by the iris-only IAP submission dequeue (`DELETE /iris/v1/inAppPurchaseSubmissions/:id`). + public func delete(path: String, cookies: String) async throws -> (Data, HTTPURLResponse) { + try await perform(IrisRequest.delete(path: path, cookies: cookies)) + } + + private func perform(_ request: URLRequest) async throws -> (Data, HTTPURLResponse) { + let (data, response) = try await session.data(for: request) + return try IrisResponse.accepted(data: data, response: response) + } +} diff --git a/Sources/ASCKit/Iris/Internal/System/SweetCookieKitStores.swift b/Sources/ASCKit/Iris/Internal/System/SweetCookieKitStores.swift new file mode 100644 index 00000000..ae0c2a1f --- /dev/null +++ b/Sources/ASCKit/Iris/Internal/System/SweetCookieKitStores.swift @@ -0,0 +1,16 @@ +import SweetCookieKit + +/// Reads every browser's cookie store through SweetCookieKit. Only the store +/// reads live here; which cookies count is `BrowserIrisCookieProvider`'s. +struct SweetCookieKitStores: BrowserCookieStores { + func cookiesPerBrowser(domains: [String]) -> [[BrowserCookie]] { + let client = BrowserCookieClient() + return Browser.allCases.map { browser in + domains.flatMap { domain -> [BrowserCookie] in + let query = BrowserCookieQuery(domains: [domain], domainMatch: .suffix, includeExpired: false) + let stores = (try? client.records(matching: query, in: browser)) ?? [] + return stores.flatMap { store in store.records.map { BrowserCookie(name: $0.name, value: $0.value) } } + } + } + } +} diff --git a/Sources/ASCKit/Iris/IrisAPIError.swift b/Sources/ASCKit/Iris/IrisAPIError.swift new file mode 100644 index 00000000..8a3e2dbc --- /dev/null +++ b/Sources/ASCKit/Iris/IrisAPIError.swift @@ -0,0 +1,19 @@ +import Foundation + +/// Errors from the iris HTTP layer. +public enum IrisAPIError: LocalizedError { + case invalidResponse + case httpError(statusCode: Int, body: String?) + case decodingError(String) + + public var errorDescription: String? { + switch self { + case .invalidResponse: + "Invalid response from iris API" + case .httpError(let statusCode, let body): + "Iris API error \(statusCode): \(body ?? "no body")" + case .decodingError(let detail): + "Failed to decode iris response: \(detail)" + } + } +} diff --git a/Sources/Domain/Iris/IrisCookieProvider.swift b/Sources/ASCKit/Iris/IrisCookieProvider.swift similarity index 100% rename from Sources/Domain/Iris/IrisCookieProvider.swift rename to Sources/ASCKit/Iris/IrisCookieProvider.swift diff --git a/Sources/Domain/Iris/IrisSession.swift b/Sources/ASCKit/Iris/IrisSession.swift similarity index 100% rename from Sources/Domain/Iris/IrisSession.swift rename to Sources/ASCKit/Iris/IrisSession.swift diff --git a/Sources/Domain/Iris/IrisStatus.swift b/Sources/ASCKit/Iris/IrisStatus.swift similarity index 100% rename from Sources/Domain/Iris/IrisStatus.swift rename to Sources/ASCKit/Iris/IrisStatus.swift diff --git a/Sources/Infrastructure/Iris/ResolutionCenter/IrisSDKResolutionCenterRepository.swift b/Sources/ASCKit/Iris/ResolutionCenter/Internal/IrisSDKResolutionCenterRepository.swift similarity index 94% rename from Sources/Infrastructure/Iris/ResolutionCenter/IrisSDKResolutionCenterRepository.swift rename to Sources/ASCKit/Iris/ResolutionCenter/Internal/IrisSDKResolutionCenterRepository.swift index 25a6db6b..b146f36d 100644 --- a/Sources/Infrastructure/Iris/ResolutionCenter/IrisSDKResolutionCenterRepository.swift +++ b/Sources/ASCKit/Iris/ResolutionCenter/Internal/IrisSDKResolutionCenterRepository.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Implements `IrisResolutionCenterRepository` via the iris private API. @@ -10,16 +9,16 @@ import Foundation /// user-visible operation. The endpoint shapes are undocumented; this mapper /// is the absorption layer if Apple shifts a field. public struct IrisSDKResolutionCenterRepository: IrisResolutionCenterRepository, @unchecked Sendable { - private let client: IrisClient + private let client: any IrisAPI - public init(client: IrisClient = IrisClient()) { + public init(client: any IrisAPI = IrisClient()) { self.client = client } public func getResolution( session: IrisSession, submissionId: String - ) async throws -> Domain.ResolutionCenterDetail { + ) async throws -> ASCKit.ResolutionCenterDetail { let (threadsData, _) = try await client.get( path: "resolutionCenterThreads", queryItems: [URLQueryItem(name: "filter[reviewSubmission]", value: submissionId)], @@ -63,10 +62,10 @@ public struct IrisSDKResolutionCenterRepository: IrisResolutionCenterRepository, .filter { $0.type == "resolutionCenterMessageAttachments" } .map { ($0.id, $0) } ) - let attachments: [Domain.ResolutionCenterAttachment] = messages.data.flatMap { message in + let attachments: [ASCKit.ResolutionCenterAttachment] = messages.data.flatMap { message in (message.relationships?.resolutionCenterMessageAttachments?.data ?? []).compactMap { ref in guard let included = attachmentsById[ref.id] else { return nil } - return Domain.ResolutionCenterAttachment( + return ASCKit.ResolutionCenterAttachment( id: ref.id, messageId: message.id, fileName: included.attributes?.fileName ?? ref.id, @@ -76,14 +75,14 @@ public struct IrisSDKResolutionCenterRepository: IrisResolutionCenterRepository, } } - return Domain.ResolutionCenterDetail( + return ASCKit.ResolutionCenterDetail( id: thread.id, submissionId: submissionId, threadState: thread.attributes?.state, messages: messages.data.map { message in let actorId = message.relationships?.fromActor?.data?.id let actor = actorId.flatMap { actorsById[$0] } - return Domain.ResolutionCenterMessage( + return ASCKit.ResolutionCenterMessage( id: message.id, threadId: thread.id, createdDate: message.attributes?.createdDate.flatMap(Self.parseDate), @@ -94,7 +93,7 @@ public struct IrisSDKResolutionCenterRepository: IrisResolutionCenterRepository, rejectionReasons: rejections.data.flatMap { rejection in let reasons = rejection.attributes?.reasons ?? [] return reasons.enumerated().map { index, reason in - Domain.ReviewRejectionReason( + ASCKit.ReviewRejectionReason( id: reasons.count > 1 ? "\(rejection.id)-\(index)" : rejection.id, section: reason.reasonSection, descriptionText: reason.reasonDescription, @@ -110,7 +109,7 @@ public struct IrisSDKResolutionCenterRepository: IrisResolutionCenterRepository, session: IrisSession, url: String ) async throws -> Data { - guard Domain.ResolutionCenterAttachment.isValidDownloadURL(url), + guard ASCKit.ResolutionCenterAttachment.isValidDownloadURL(url), let downloadURL = URL(string: url) else { throw IrisResolutionCenterError.invalidAttachmentURL(url) } diff --git a/Sources/Domain/Iris/ResolutionCenter/IrisResolutionCenterRepository.swift b/Sources/ASCKit/Iris/ResolutionCenter/IrisResolutionCenterRepository.swift similarity index 100% rename from Sources/Domain/Iris/ResolutionCenter/IrisResolutionCenterRepository.swift rename to Sources/ASCKit/Iris/ResolutionCenter/IrisResolutionCenterRepository.swift diff --git a/Sources/Domain/Iris/ResolutionCenter/ResolutionCenterAttachment.swift b/Sources/ASCKit/Iris/ResolutionCenter/ResolutionCenterAttachment.swift similarity index 100% rename from Sources/Domain/Iris/ResolutionCenter/ResolutionCenterAttachment.swift rename to Sources/ASCKit/Iris/ResolutionCenter/ResolutionCenterAttachment.swift diff --git a/Sources/Domain/Iris/ResolutionCenter/ResolutionCenterDetail+RESTRoutes.swift b/Sources/ASCKit/Iris/ResolutionCenter/ResolutionCenterDetail+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Iris/ResolutionCenter/ResolutionCenterDetail+RESTRoutes.swift rename to Sources/ASCKit/Iris/ResolutionCenter/ResolutionCenterDetail+RESTRoutes.swift diff --git a/Sources/Domain/Iris/ResolutionCenter/ResolutionCenterDetail.swift b/Sources/ASCKit/Iris/ResolutionCenter/ResolutionCenterDetail.swift similarity index 100% rename from Sources/Domain/Iris/ResolutionCenter/ResolutionCenterDetail.swift rename to Sources/ASCKit/Iris/ResolutionCenter/ResolutionCenterDetail.swift diff --git a/Sources/Domain/Iris/ResolutionCenter/ResolutionCenterMessage.swift b/Sources/ASCKit/Iris/ResolutionCenter/ResolutionCenterMessage.swift similarity index 100% rename from Sources/Domain/Iris/ResolutionCenter/ResolutionCenterMessage.swift rename to Sources/ASCKit/Iris/ResolutionCenter/ResolutionCenterMessage.swift diff --git a/Sources/Domain/Iris/ResolutionCenter/ReviewRejectionReason.swift b/Sources/ASCKit/Iris/ResolutionCenter/ReviewRejectionReason.swift similarity index 100% rename from Sources/Domain/Iris/ResolutionCenter/ReviewRejectionReason.swift rename to Sources/ASCKit/Iris/ResolutionCenter/ReviewRejectionReason.swift diff --git a/Sources/Infrastructure/Plugins/GitHubPluginSource.swift b/Sources/ASCKit/Plugins/Internal/GitHubPluginSource.swift similarity index 99% rename from Sources/Infrastructure/Plugins/GitHubPluginSource.swift rename to Sources/ASCKit/Plugins/Internal/GitHubPluginSource.swift index 6c276a3e..f0ed3158 100644 --- a/Sources/Infrastructure/Plugins/GitHubPluginSource.swift +++ b/Sources/ASCKit/Plugins/Internal/GitHubPluginSource.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Fetches available plugins from a `registry.json` hosted in a GitHub repository. diff --git a/Sources/ASCKit/Plugins/Internal/MarketplacePlugins.swift b/Sources/ASCKit/Plugins/Internal/MarketplacePlugins.swift new file mode 100644 index 00000000..3c793a1f --- /dev/null +++ b/Sources/ASCKit/Plugins/Internal/MarketplacePlugins.swift @@ -0,0 +1,153 @@ +import Foundation + +/// Manages installed plugins and the marketplace listings from composable sources. +public struct MarketplacePlugins: Plugins { + private let sources: [any PluginSource] + private let folder: any PluginsFolder + private let downloads: any PluginDownloads + + public init(sources: [any PluginSource] = []) { + self.init(sources: sources, folder: LocalPluginsFolder(), downloads: URLSessionPluginDownloads()) + } + + init(sources: [any PluginSource], folder: any PluginsFolder, downloads: any PluginDownloads) { + self.sources = sources + self.folder = folder + self.downloads = downloads + } + + public func listInstalled() async throws -> [Plugin] { + folder.installed().map { p in + Plugin( + id: p.slug, + name: p.name, + version: p.version ?? "1.0", + description: p.description ?? "", + author: p.author, + repositoryURL: p.repositoryURL, + categories: p.categories ?? [], + isInstalled: true, + slug: p.slug, + uiScripts: p.uiScripts + ) + } + } + + public func listAvailable() async throws -> [Plugin] { + let installedIds = Set(folder.installed().flatMap { p in + [p.slug, p.slug.lowercased(), Self.id(forName: p.name)] + }) + + var all: [Plugin] = [] + for source in sources { + let plugins = try await source.fetchPlugins() + all.append(contentsOf: plugins.map { plugin in + Plugin( + id: plugin.id, + name: plugin.name, + version: plugin.version, + description: plugin.description, + author: plugin.author, + repositoryURL: plugin.repositoryURL, + categories: plugin.categories, + downloadURL: plugin.downloadURL, + isInstalled: installedIds.contains(plugin.id) || installedIds.contains(plugin.id.lowercased()) + ) + }) + } + return all + } + + public func searchAvailable(query: String) async throws -> [Plugin] { + let q = query.lowercased() + return try await listAvailable().filter { + $0.name.lowercased().contains(q) || + $0.description.lowercased().contains(q) || + $0.categories.contains(where: { $0.lowercased().contains(q) }) + } + } + + public func install(name: String) async throws -> Plugin { + let available = try await listAvailable() + guard let entry = available.first(where: { $0.id == name }), + let downloadURL = entry.downloadURL else { + throw PluginMarketError.pluginNotFound(name) + } + let archive = try await downloads.download(from: URL(string: downloadURL)!) + guard try folder.unpack(archive, named: name) else { + throw PluginMarketError.installFailed(name) + } + return Plugin( + id: name, + name: entry.name, + version: entry.version, + description: entry.description, + author: entry.author, + repositoryURL: entry.repositoryURL, + categories: entry.categories, + isInstalled: true, + slug: name + ) + } + + /// Removes the plugin whose folder is `name`, or else whose folder or manifest + /// name, as an id (`"ASC Pro"` → `asc-pro`), is `name` ignoring case. + public func uninstall(name: String) async throws { + let bundles = folder.bundles() + let wanted = name.lowercased() + let match = bundles.first { $0.slug == name } + ?? bundles.first { $0.slug.lowercased() == wanted || $0.manifestName.map(Self.id(forName:)) == wanted } + guard let match else { + throw PluginMarketError.pluginNotFound(name) + } + try folder.remove(slug: match.slug) + } + + public func listOutdated() async throws -> [PluginUpdate] { + let installed = try await listInstalled() + var availableByName: [String: Plugin] = [:] + for plugin in try await listAvailable() { + availableByName[plugin.name] = plugin + } + return installed.compactMap { local in + guard let remote = availableByName[local.name], + remote.version != local.version else { return nil } + return PluginUpdate( + name: local.name, + installedVersion: local.version, + latestVersion: remote.version, + repositoryURL: remote.repositoryURL ?? local.repositoryURL, + downloadURL: remote.downloadURL + ) + } + } + + public func update(name: String) async throws -> Plugin { + let installed = try await listInstalled() + guard let local = installed.first(where: { $0.name == name || $0.slug == name || $0.id == name }) else { + throw PluginMarketError.pluginNotFound(name) + } + guard let remote = try await listAvailable().first(where: { $0.name == local.name }) else { + throw PluginMarketError.pluginNotFound(local.name) + } + try await uninstall(name: local.slug ?? local.id) + return try await install(name: remote.id) + } + + /// A plugin's name as a marketplace id: `"ASC Pro"` → `asc-pro`. + private static func id(forName name: String) -> String { + name.lowercased().replacingOccurrences(of: " ", with: "-") + } +} + +enum PluginMarketError: Error, CustomStringConvertible { + case pluginNotFound(String) + case installFailed(String) + + var description: String { + switch self { + case .pluginNotFound(let name): "Plugin not found: \(name)" + case .installFailed(let name): "Failed to install plugin: \(name)" + } + } +} diff --git a/Sources/ASCKit/Plugins/Internal/PluginsFolder.swift b/Sources/ASCKit/Plugins/Internal/PluginsFolder.swift new file mode 100644 index 00000000..ac10778c --- /dev/null +++ b/Sources/ASCKit/Plugins/Internal/PluginsFolder.swift @@ -0,0 +1,39 @@ +import Foundation +import Mockable + +/// A plugin installed in `~/.asc/plugins` that loads, with what its manifest says. +struct InstalledPlugin: Equatable, Sendable { + let slug: String + let name: String + let uiScripts: [String] + let version: String? + let description: String? + let author: String? + let repositoryURL: String? + let categories: [String]? +} + +/// A `.plugin` bundle in the plugins folder, whether or not it loads. +struct PluginBundle: Equatable, Sendable { + let slug: String + let manifestName: String? +} + +/// The plugins folder, `~/.asc/plugins`. +@Mockable +protocol PluginsFolder: Sendable { + /// The plugins that load, with their manifests. + func installed() -> [InstalledPlugin] + /// Every `.plugin` bundle in the folder. + func bundles() -> [PluginBundle] + /// Unpacks a downloaded plugin archive into the folder; `false` when it doesn't unpack. + func unpack(_ archive: Data, named name: String) throws -> Bool + /// Removes the bundle `.plugin`. + func remove(slug: String) throws +} + +/// Where plugin archives are downloaded from. +@Mockable +protocol PluginDownloads: Sendable { + func download(from url: URL) async throws -> Data +} diff --git a/Sources/ASCKit/Plugins/Internal/System/LocalPluginsFolder.swift b/Sources/ASCKit/Plugins/Internal/System/LocalPluginsFolder.swift new file mode 100644 index 00000000..a42c6928 --- /dev/null +++ b/Sources/ASCKit/Plugins/Internal/System/LocalPluginsFolder.swift @@ -0,0 +1,67 @@ +import ASCPlugin +import Foundation + +/// `~/.asc/plugins` on this Mac. Only the file system, `PluginLoader` and `unzip` +/// calls live here; which plugin matches is `MarketplacePlugins`'s. +struct LocalPluginsFolder: PluginsFolder { + func installed() -> [InstalledPlugin] { + PluginLoader.discover().map { plugin in + let manifest = Self.manifest(in: plugin.directory) + return InstalledPlugin( + slug: plugin.slug, name: plugin.name, uiScripts: plugin.uiScripts, + version: manifest?["version"] as? String, + description: manifest?["description"] as? String, + author: manifest?["author"] as? String, + repositoryURL: manifest?["repositoryURL"] as? String, + categories: manifest?["categories"] as? [String] + ) + } + } + + func bundles() -> [PluginBundle] { + let folder = PluginLoader.pluginsDirectory + let entries = (try? FileManager.default.contentsOfDirectory(atPath: folder.path)) ?? [] + return entries.filter { $0.hasSuffix(".plugin") }.map { entry in + PluginBundle( + slug: (entry as NSString).deletingPathExtension, + manifestName: Self.manifest(in: folder.appendingPathComponent(entry))?["name"] as? String + ) + } + } + + func unpack(_ archive: Data, named name: String) throws -> Bool { + let folder = PluginLoader.pluginsDirectory + try FileManager.default.createDirectory(at: folder, withIntermediateDirectories: true) + let temp = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) + try FileManager.default.createDirectory(at: temp, withIntermediateDirectories: true) + defer { try? FileManager.default.removeItem(at: temp) } + let zip = temp.appendingPathComponent("\(name).zip") + try archive.write(to: zip) + + let unzip = Process() + unzip.executableURL = URL(fileURLWithPath: "/usr/bin/unzip") + unzip.arguments = ["-o", zip.path, "-d", folder.path] + try unzip.run() + unzip.waitUntilExit() + // The next `installed()` re-scans the folder and sees the new bundle. + PluginLoader.invalidateCache() + return unzip.terminationStatus == 0 + } + + func remove(slug: String) throws { + try FileManager.default.removeItem(at: PluginLoader.pluginsDirectory.appendingPathComponent("\(slug).plugin")) + PluginLoader.invalidateCache() + } + + private static func manifest(in directory: URL) -> [String: Any]? { + guard let data = try? Data(contentsOf: directory.appendingPathComponent("manifest.json")) else { return nil } + return try? JSONSerialization.jsonObject(with: data) as? [String: Any] + } +} + +/// Downloads plugin archives with `URLSession`. +struct URLSessionPluginDownloads: PluginDownloads { + func download(from url: URL) async throws -> Data { + try await URLSession.shared.data(from: url).0 + } +} diff --git a/Sources/Domain/Plugins/Plugin.swift b/Sources/ASCKit/Plugins/Plugin.swift similarity index 100% rename from Sources/Domain/Plugins/Plugin.swift rename to Sources/ASCKit/Plugins/Plugin.swift diff --git a/Sources/Domain/Plugins/PluginSource.swift b/Sources/ASCKit/Plugins/PluginSource.swift similarity index 100% rename from Sources/Domain/Plugins/PluginSource.swift rename to Sources/ASCKit/Plugins/PluginSource.swift diff --git a/Sources/Domain/Plugins/PluginUpdate.swift b/Sources/ASCKit/Plugins/PluginUpdate.swift similarity index 96% rename from Sources/Domain/Plugins/PluginUpdate.swift rename to Sources/ASCKit/Plugins/PluginUpdate.swift index ee8fc7bc..76549c8f 100644 --- a/Sources/Domain/Plugins/PluginUpdate.swift +++ b/Sources/ASCKit/Plugins/PluginUpdate.swift @@ -1,6 +1,6 @@ /// An available update for an installed plugin. /// -/// Returned by `PluginRepository.listOutdated()`. Represents the diff between +/// Returned by `Plugins.listOutdated()`. Represents the diff between /// what's installed locally and what the marketplace offers. public struct PluginUpdate: Sendable, Equatable, Identifiable, Codable { public var id: String { name } diff --git a/Sources/Domain/Plugins/PluginRepository.swift b/Sources/ASCKit/Plugins/Plugins.swift similarity index 93% rename from Sources/Domain/Plugins/PluginRepository.swift rename to Sources/ASCKit/Plugins/Plugins.swift index 51d4bc74..2a7d4578 100644 --- a/Sources/Domain/Plugins/PluginRepository.swift +++ b/Sources/ASCKit/Plugins/Plugins.swift @@ -2,7 +2,7 @@ import Mockable /// Manages installed dylib plugins and the plugin marketplace. @Mockable -public protocol PluginRepository: Sendable { +public protocol Plugins: Sendable { func listInstalled() async throws -> [Plugin] func listAvailable() async throws -> [Plugin] func searchAvailable(query: String) async throws -> [Plugin] diff --git a/Sources/Infrastructure/Projects/FileProjectConfigStorage.swift b/Sources/ASCKit/Projects/Internal/FileProjectConfigStorage.swift similarity index 98% rename from Sources/Infrastructure/Projects/FileProjectConfigStorage.swift rename to Sources/ASCKit/Projects/Internal/FileProjectConfigStorage.swift index d75a17c6..c1aad9d4 100644 --- a/Sources/Infrastructure/Projects/FileProjectConfigStorage.swift +++ b/Sources/ASCKit/Projects/Internal/FileProjectConfigStorage.swift @@ -1,4 +1,3 @@ -import Domain import Foundation public struct FileProjectConfigStorage: ProjectConfigStorage { diff --git a/Sources/Domain/Projects/ProjectConfig.swift b/Sources/ASCKit/Projects/ProjectConfig.swift similarity index 100% rename from Sources/Domain/Projects/ProjectConfig.swift rename to Sources/ASCKit/Projects/ProjectConfig.swift diff --git a/Sources/Domain/Projects/ProjectConfigStorage.swift b/Sources/ASCKit/Projects/ProjectConfigStorage.swift similarity index 100% rename from Sources/Domain/Projects/ProjectConfigStorage.swift rename to Sources/ASCKit/Projects/ProjectConfigStorage.swift diff --git a/Sources/Domain/Reports/Analytics/AnalyticsFilter.swift b/Sources/ASCKit/Reports/Analytics/AnalyticsFilter.swift similarity index 100% rename from Sources/Domain/Reports/Analytics/AnalyticsFilter.swift rename to Sources/ASCKit/Reports/Analytics/AnalyticsFilter.swift diff --git a/Sources/Domain/Reports/Analytics/AnalyticsReport.swift b/Sources/ASCKit/Reports/Analytics/AnalyticsReport.swift similarity index 100% rename from Sources/Domain/Reports/Analytics/AnalyticsReport.swift rename to Sources/ASCKit/Reports/Analytics/AnalyticsReport.swift diff --git a/Sources/Domain/Reports/Analytics/AnalyticsReportInstance.swift b/Sources/ASCKit/Reports/Analytics/AnalyticsReportInstance.swift similarity index 100% rename from Sources/Domain/Reports/Analytics/AnalyticsReportInstance.swift rename to Sources/ASCKit/Reports/Analytics/AnalyticsReportInstance.swift diff --git a/Sources/Domain/Reports/Analytics/AnalyticsReportRepository.swift b/Sources/ASCKit/Reports/Analytics/AnalyticsReportRepository.swift similarity index 100% rename from Sources/Domain/Reports/Analytics/AnalyticsReportRepository.swift rename to Sources/ASCKit/Reports/Analytics/AnalyticsReportRepository.swift diff --git a/Sources/Domain/Reports/Analytics/AnalyticsReportRequest.swift b/Sources/ASCKit/Reports/Analytics/AnalyticsReportRequest.swift similarity index 100% rename from Sources/Domain/Reports/Analytics/AnalyticsReportRequest.swift rename to Sources/ASCKit/Reports/Analytics/AnalyticsReportRequest.swift diff --git a/Sources/Domain/Reports/Analytics/AnalyticsReportSegment.swift b/Sources/ASCKit/Reports/Analytics/AnalyticsReportSegment.swift similarity index 100% rename from Sources/Domain/Reports/Analytics/AnalyticsReportSegment.swift rename to Sources/ASCKit/Reports/Analytics/AnalyticsReportSegment.swift diff --git a/Sources/Infrastructure/Reports/Analytics/SDKAnalyticsReportRepository.swift b/Sources/ASCKit/Reports/Analytics/Internal/SDKAnalyticsReportRepository.swift similarity index 84% rename from Sources/Infrastructure/Reports/Analytics/SDKAnalyticsReportRepository.swift rename to Sources/ASCKit/Reports/Analytics/Internal/SDKAnalyticsReportRepository.swift index 1322a85f..38e11fb7 100644 --- a/Sources/Infrastructure/Reports/Analytics/SDKAnalyticsReportRepository.swift +++ b/Sources/ASCKit/Reports/Analytics/Internal/SDKAnalyticsReportRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecked Sendable { @@ -9,7 +8,7 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke self.client = client } - public func createRequest(appId: String, accessType: Domain.AnalyticsAccessType) async throws -> Domain.AnalyticsReportRequest { + public func createRequest(appId: String, accessType: ASCKit.AnalyticsAccessType) async throws -> ASCKit.AnalyticsReportRequest { let sdkAccessType: AnalyticsReportRequestCreateRequest.Data.Attributes.AccessType switch accessType { case .oneTimeSnapshot: sdkAccessType = .oneTimeSnapshot @@ -27,7 +26,7 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke return mapRequest(response.data, appId: appId) } - public func listRequests(appId: String, accessType: Domain.AnalyticsAccessType?) async throws -> [Domain.AnalyticsReportRequest] { + public func listRequests(appId: String, accessType: ASCKit.AnalyticsAccessType?) async throws -> [ASCKit.AnalyticsReportRequest] { let filterAccessType: [APIEndpoint.V1.Apps.WithID.AnalyticsReportRequests.GetParameters.FilterAccessType]? if let accessType { switch accessType { @@ -49,7 +48,7 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke try await client.request(APIEndpoint.v1.analyticsReportRequests.id(id).delete) } - public func listReports(requestId: String, category: Domain.AnalyticsCategory?) async throws -> [Domain.AnalyticsReport] { + public func listReports(requestId: String, category: ASCKit.AnalyticsCategory?) async throws -> [ASCKit.AnalyticsReport] { let filterCategory: [APIEndpoint.V1.AnalyticsReportRequests.WithID.Reports.GetParameters.FilterCategory]? if let category { switch category { @@ -70,7 +69,7 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke return response.data.map { mapReport($0, requestId: requestId) } } - public func listInstances(reportId: String, granularity: Domain.AnalyticsGranularity?) async throws -> [Domain.AnalyticsReportInstance] { + public func listInstances(reportId: String, granularity: ASCKit.AnalyticsGranularity?) async throws -> [ASCKit.AnalyticsReportInstance] { let filterGranularity: [APIEndpoint.V1.AnalyticsReports.WithID.Instances.GetParameters.FilterGranularity]? if let granularity { switch granularity { @@ -89,7 +88,7 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke return response.data.map { mapInstance($0, reportId: reportId) } } - public func listSegments(instanceId: String) async throws -> [Domain.AnalyticsReportSegment] { + public func listSegments(instanceId: String) async throws -> [ASCKit.AnalyticsReportSegment] { let endpoint = APIEndpoint.v1.analyticsReportInstances.id(instanceId).segments.get() let response = try await client.request(endpoint) return response.data.map { mapSegment($0, instanceId: instanceId) } @@ -100,13 +99,13 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke private func mapRequest( _ sdk: AppStoreConnect_Swift_SDK.AnalyticsReportRequest, appId: String - ) -> Domain.AnalyticsReportRequest { - let accessType: Domain.AnalyticsAccessType + ) -> ASCKit.AnalyticsReportRequest { + let accessType: ASCKit.AnalyticsAccessType switch sdk.attributes?.accessType { case .ongoing: accessType = .ongoing default: accessType = .oneTimeSnapshot } - return Domain.AnalyticsReportRequest( + return ASCKit.AnalyticsReportRequest( id: sdk.id, appId: appId, accessType: accessType, @@ -117,8 +116,8 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke private func mapReport( _ sdk: AppStoreConnect_Swift_SDK.AnalyticsReport, requestId: String - ) -> Domain.AnalyticsReport { - Domain.AnalyticsReport( + ) -> ASCKit.AnalyticsReport { + ASCKit.AnalyticsReport( id: sdk.id, requestId: requestId, name: sdk.attributes?.name, @@ -126,7 +125,7 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke ) } - private func mapCategory(_ sdk: AppStoreConnect_Swift_SDK.AnalyticsReport.Attributes.Category) -> Domain.AnalyticsCategory { + private func mapCategory(_ sdk: AppStoreConnect_Swift_SDK.AnalyticsReport.Attributes.Category) -> ASCKit.AnalyticsCategory { switch sdk { case .appUsage: return .appUsage case .appStoreEngagement: return .appStoreEngagement @@ -139,8 +138,8 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke private func mapInstance( _ sdk: AppStoreConnect_Swift_SDK.AnalyticsReportInstance, reportId: String - ) -> Domain.AnalyticsReportInstance { - Domain.AnalyticsReportInstance( + ) -> ASCKit.AnalyticsReportInstance { + ASCKit.AnalyticsReportInstance( id: sdk.id, reportId: reportId, granularity: sdk.attributes?.granularity.map { mapGranularity($0) }, @@ -148,7 +147,7 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke ) } - private func mapGranularity(_ sdk: AppStoreConnect_Swift_SDK.AnalyticsReportInstance.Attributes.Granularity) -> Domain.AnalyticsGranularity { + private func mapGranularity(_ sdk: AppStoreConnect_Swift_SDK.AnalyticsReportInstance.Attributes.Granularity) -> ASCKit.AnalyticsGranularity { switch sdk { case .daily: return .daily case .weekly: return .weekly @@ -159,8 +158,8 @@ public struct SDKAnalyticsReportRepository: AnalyticsReportRepository, @unchecke private func mapSegment( _ sdk: AppStoreConnect_Swift_SDK.AnalyticsReportSegment, instanceId: String - ) -> Domain.AnalyticsReportSegment { - Domain.AnalyticsReportSegment( + ) -> ASCKit.AnalyticsReportSegment { + ASCKit.AnalyticsReportSegment( id: sdk.id, instanceId: instanceId, checksum: sdk.attributes?.checksum, diff --git a/Sources/Domain/Reports/FinanceReportFilter.swift b/Sources/ASCKit/Reports/FinanceReportFilter.swift similarity index 100% rename from Sources/Domain/Reports/FinanceReportFilter.swift rename to Sources/ASCKit/Reports/FinanceReportFilter.swift diff --git a/Sources/Infrastructure/Reports/SDKReportRepository.swift b/Sources/ASCKit/Reports/Internal/SDKReports.swift similarity index 97% rename from Sources/Infrastructure/Reports/SDKReportRepository.swift rename to Sources/ASCKit/Reports/Internal/SDKReports.swift index 2d717ce6..bc24c463 100644 --- a/Sources/Infrastructure/Reports/SDKReportRepository.swift +++ b/Sources/ASCKit/Reports/Internal/SDKReports.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation -public struct SDKReportRepository: ReportRepository, @unchecked Sendable { +public struct SDKReports: Reports, @unchecked Sendable { private let client: any APIClient public init(client: any APIClient) { diff --git a/Sources/Infrastructure/Reports/TSVParser.swift b/Sources/ASCKit/Reports/Internal/TSVParser.swift similarity index 100% rename from Sources/Infrastructure/Reports/TSVParser.swift rename to Sources/ASCKit/Reports/Internal/TSVParser.swift diff --git a/Sources/Domain/Reports/ReportRepository.swift b/Sources/ASCKit/Reports/Reports.swift similarity index 91% rename from Sources/Domain/Reports/ReportRepository.swift rename to Sources/ASCKit/Reports/Reports.swift index 2b47dce4..053a8ab2 100644 --- a/Sources/Domain/Reports/ReportRepository.swift +++ b/Sources/ASCKit/Reports/Reports.swift @@ -1,7 +1,7 @@ import Mockable @Mockable -public protocol ReportRepository: Sendable { +public protocol Reports: Sendable { func downloadSalesReport( vendorNumber: String, reportType: SalesReportType, diff --git a/Sources/Domain/Reports/SalesReportFilter.swift b/Sources/ASCKit/Reports/SalesReportFilter.swift similarity index 100% rename from Sources/Domain/Reports/SalesReportFilter.swift rename to Sources/ASCKit/Reports/SalesReportFilter.swift diff --git a/Sources/Domain/Screenshots/AppShotTemplate.swift b/Sources/ASCKit/Screenshots/AppShotTemplate.swift similarity index 100% rename from Sources/Domain/Screenshots/AppShotTemplate.swift rename to Sources/ASCKit/Screenshots/AppShotTemplate.swift diff --git a/Sources/Domain/Screenshots/AppShotsConfig.swift b/Sources/ASCKit/Screenshots/AppShotsConfig.swift similarity index 100% rename from Sources/Domain/Screenshots/AppShotsConfig.swift rename to Sources/ASCKit/Screenshots/AppShotsConfig.swift diff --git a/Sources/Domain/Screenshots/AppShotsConfigStorage.swift b/Sources/ASCKit/Screenshots/AppShotsConfigStorage.swift similarity index 100% rename from Sources/Domain/Screenshots/AppShotsConfigStorage.swift rename to Sources/ASCKit/Screenshots/AppShotsConfigStorage.swift diff --git a/Sources/Domain/Screenshots/Gallery/AppShot.swift b/Sources/ASCKit/Screenshots/Gallery/AppShot.swift similarity index 100% rename from Sources/Domain/Screenshots/Gallery/AppShot.swift rename to Sources/ASCKit/Screenshots/Gallery/AppShot.swift diff --git a/Sources/Domain/Screenshots/Gallery/Gallery.swift b/Sources/ASCKit/Screenshots/Gallery/Gallery.swift similarity index 100% rename from Sources/Domain/Screenshots/Gallery/Gallery.swift rename to Sources/ASCKit/Screenshots/Gallery/Gallery.swift diff --git a/Sources/Domain/Screenshots/Gallery/GalleryHTMLRenderer.swift b/Sources/ASCKit/Screenshots/Gallery/GalleryHTMLRenderer.swift similarity index 100% rename from Sources/Domain/Screenshots/Gallery/GalleryHTMLRenderer.swift rename to Sources/ASCKit/Screenshots/Gallery/GalleryHTMLRenderer.swift diff --git a/Sources/Domain/Screenshots/Gallery/GalleryPalette.swift b/Sources/ASCKit/Screenshots/Gallery/GalleryPalette.swift similarity index 100% rename from Sources/Domain/Screenshots/Gallery/GalleryPalette.swift rename to Sources/ASCKit/Screenshots/Gallery/GalleryPalette.swift diff --git a/Sources/Domain/Screenshots/Gallery/GalleryTemplate.swift b/Sources/ASCKit/Screenshots/Gallery/GalleryTemplate.swift similarity index 100% rename from Sources/Domain/Screenshots/Gallery/GalleryTemplate.swift rename to Sources/ASCKit/Screenshots/Gallery/GalleryTemplate.swift diff --git a/Sources/Domain/Screenshots/Gallery/GalleryTemplateRepository.swift b/Sources/ASCKit/Screenshots/Gallery/GalleryTemplateRepository.swift similarity index 100% rename from Sources/Domain/Screenshots/Gallery/GalleryTemplateRepository.swift rename to Sources/ASCKit/Screenshots/Gallery/GalleryTemplateRepository.swift diff --git a/Sources/Domain/Screenshots/Gallery/HTMLComposer.swift b/Sources/ASCKit/Screenshots/Gallery/HTMLComposer.swift similarity index 100% rename from Sources/Domain/Screenshots/Gallery/HTMLComposer.swift rename to Sources/ASCKit/Screenshots/Gallery/HTMLComposer.swift diff --git a/Sources/Domain/Screenshots/Gallery/Resources/keyframes.mustache b/Sources/ASCKit/Screenshots/Gallery/Resources/keyframes.mustache similarity index 100% rename from Sources/Domain/Screenshots/Gallery/Resources/keyframes.mustache rename to Sources/ASCKit/Screenshots/Gallery/Resources/keyframes.mustache diff --git a/Sources/Domain/Screenshots/Gallery/Resources/page-wrapper.mustache b/Sources/ASCKit/Screenshots/Gallery/Resources/page-wrapper.mustache similarity index 100% rename from Sources/Domain/Screenshots/Gallery/Resources/page-wrapper.mustache rename to Sources/ASCKit/Screenshots/Gallery/Resources/page-wrapper.mustache diff --git a/Sources/Domain/Screenshots/Gallery/Resources/preview-page.mustache b/Sources/ASCKit/Screenshots/Gallery/Resources/preview-page.mustache similarity index 100% rename from Sources/Domain/Screenshots/Gallery/Resources/preview-page.mustache rename to Sources/ASCKit/Screenshots/Gallery/Resources/preview-page.mustache diff --git a/Sources/Domain/Screenshots/Gallery/Resources/preview-screen.mustache b/Sources/ASCKit/Screenshots/Gallery/Resources/preview-screen.mustache similarity index 100% rename from Sources/Domain/Screenshots/Gallery/Resources/preview-screen.mustache rename to Sources/ASCKit/Screenshots/Gallery/Resources/preview-screen.mustache diff --git a/Sources/Domain/Screenshots/Gallery/Resources/screen.mustache b/Sources/ASCKit/Screenshots/Gallery/Resources/screen.mustache similarity index 100% rename from Sources/Domain/Screenshots/Gallery/Resources/screen.mustache rename to Sources/ASCKit/Screenshots/Gallery/Resources/screen.mustache diff --git a/Sources/Domain/Screenshots/Gallery/Resources/theme-vars.mustache b/Sources/ASCKit/Screenshots/Gallery/Resources/theme-vars.mustache similarity index 100% rename from Sources/Domain/Screenshots/Gallery/Resources/theme-vars.mustache rename to Sources/ASCKit/Screenshots/Gallery/Resources/theme-vars.mustache diff --git a/Sources/Domain/Screenshots/Gallery/Resources/wireframe.mustache b/Sources/ASCKit/Screenshots/Gallery/Resources/wireframe.mustache similarity index 100% rename from Sources/Domain/Screenshots/Gallery/Resources/wireframe.mustache rename to Sources/ASCKit/Screenshots/Gallery/Resources/wireframe.mustache diff --git a/Sources/Domain/Screenshots/Gallery/ScreenLayout.swift b/Sources/ASCKit/Screenshots/Gallery/ScreenLayout.swift similarity index 100% rename from Sources/Domain/Screenshots/Gallery/ScreenLayout.swift rename to Sources/ASCKit/Screenshots/Gallery/ScreenLayout.swift diff --git a/Sources/Domain/Screenshots/HTMLRenderer.swift b/Sources/ASCKit/Screenshots/HTMLRenderer.swift similarity index 100% rename from Sources/Domain/Screenshots/HTMLRenderer.swift rename to Sources/ASCKit/Screenshots/HTMLRenderer.swift diff --git a/Sources/Infrastructure/ScreenshotPlans/AggregateGalleryTemplateRepository.swift b/Sources/ASCKit/Screenshots/Internal/AggregateGalleryTemplateRepository.swift similarity index 98% rename from Sources/Infrastructure/ScreenshotPlans/AggregateGalleryTemplateRepository.swift rename to Sources/ASCKit/Screenshots/Internal/AggregateGalleryTemplateRepository.swift index 736d1ff2..990b93f3 100644 --- a/Sources/Infrastructure/ScreenshotPlans/AggregateGalleryTemplateRepository.swift +++ b/Sources/ASCKit/Screenshots/Internal/AggregateGalleryTemplateRepository.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Aggregates gallery templates from all registered providers. diff --git a/Sources/Infrastructure/ScreenshotPlans/AggregateTemplateRepository.swift b/Sources/ASCKit/Screenshots/Internal/AggregateTemplateRepository.swift similarity index 98% rename from Sources/Infrastructure/ScreenshotPlans/AggregateTemplateRepository.swift rename to Sources/ASCKit/Screenshots/Internal/AggregateTemplateRepository.swift index eeff8c0a..5f91762d 100644 --- a/Sources/Infrastructure/ScreenshotPlans/AggregateTemplateRepository.swift +++ b/Sources/ASCKit/Screenshots/Internal/AggregateTemplateRepository.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Aggregates templates from all registered `TemplateProvider`s. diff --git a/Sources/Infrastructure/ScreenshotPlans/AggregateThemeRepository.swift b/Sources/ASCKit/Screenshots/Internal/AggregateThemes.swift similarity index 91% rename from Sources/Infrastructure/ScreenshotPlans/AggregateThemeRepository.swift rename to Sources/ASCKit/Screenshots/Internal/AggregateThemes.swift index c3465252..480a46e8 100644 --- a/Sources/Infrastructure/ScreenshotPlans/AggregateThemeRepository.swift +++ b/Sources/ASCKit/Screenshots/Internal/AggregateThemes.swift @@ -1,4 +1,3 @@ -import Domain import Foundation /// Aggregates themes from all registered `ThemeProvider`s. @@ -6,10 +5,10 @@ import Foundation /// The platform ships with no built-in themes. Plugins register /// providers to supply their own themes with their own AI solutions. /// -/// Use `AggregateThemeRepository.shared` as the global registry. -public final actor AggregateThemeRepository: ThemeRepository { +/// Use `AggregateThemes.shared` as the global registry. +public final actor AggregateThemes: Themes { /// Global shared instance — plugins register providers here. - public static let shared = AggregateThemeRepository() + public static let shared = AggregateThemes() private var providers: [any ThemeProvider] = [] diff --git a/Sources/Infrastructure/ScreenshotPlans/FileAppShotsConfigStorage.swift b/Sources/ASCKit/Screenshots/Internal/FileAppShotsConfigStorage.swift similarity index 98% rename from Sources/Infrastructure/ScreenshotPlans/FileAppShotsConfigStorage.swift rename to Sources/ASCKit/Screenshots/Internal/FileAppShotsConfigStorage.swift index 13ad4909..abaed014 100644 --- a/Sources/Infrastructure/ScreenshotPlans/FileAppShotsConfigStorage.swift +++ b/Sources/ASCKit/Screenshots/Internal/FileAppShotsConfigStorage.swift @@ -1,4 +1,3 @@ -import Domain import Foundation public struct FileAppShotsConfigStorage: AppShotsConfigStorage { diff --git a/Sources/ASCKit/Screenshots/Internal/LocalImages.swift b/Sources/ASCKit/Screenshots/Internal/LocalImages.swift new file mode 100644 index 00000000..9e4a4ca1 --- /dev/null +++ b/Sources/ASCKit/Screenshots/Internal/LocalImages.swift @@ -0,0 +1,56 @@ +import Foundation + +/// The local images a composed screenshot page points at, inlined as data URLs +/// so a renderer that loads the page from a string can still draw them. +struct LocalImages { + let workingDirectory: String + /// The bytes of the file at a path, or `nil` when there is none. + let contents: (String) -> Data? + + /// `html` with every local `src="….png|jpg|jpeg|gif|webp"` replaced by its data URL. + /// Remote images, data URLs and images that can't be found stay as they are. + func inline(into html: String) -> String { + let pattern = #"src="([^"]+\.(?:png|jpg|jpeg|gif|webp))""# + guard let regex = try? NSRegularExpression(pattern: pattern) else { return html } + let page = html as NSString + var result = html + // In reverse, so each replacement leaves the earlier ranges where they were. + for match in regex.matches(in: html, range: NSRange(location: 0, length: page.length)).reversed() { + let src = page.substring(with: match.range(at: 1)) + guard let (path, data) = file(for: src) else { continue } + let dataURL = "data:\(Self.mimeType(of: path));base64,\(data.base64EncodedString())" + result = (result as NSString).replacingCharacters(in: match.range(at: 0), with: "src=\"\(dataURL)\"") + } + return result + } + + /// The file a `src` names and its bytes, or `nil` for a data URL, a remote + /// image or a file that isn't there. + private func file(for src: String) -> (path: String, data: Data)? { + if src.hasPrefix("data:") { return nil } + if src.hasPrefix("http") { + // The web server's file URL points back at a file under the working directory. + guard src.contains("/api/files/read?path="), + let path = URLComponents(string: src)?.queryItems?.first(where: { $0.name == "path" })?.value + else { return nil } + let local = workingDirectory + "/" + path + return contents(local).map { (local, $0) } + } + let candidates = [ + src.hasPrefix("/") ? src : workingDirectory + "/" + src, + workingDirectory + "/.asc/app-shots/" + src, + ] + for candidate in candidates { + if let data = contents(candidate) { return (candidate, data) } + } + return nil + } + + private static func mimeType(of path: String) -> String { + switch (path as NSString).pathExtension.lowercased() { + case "png": "image/png" + case "jpg", "jpeg": "image/jpeg" + case let ext: "image/\(ext)" + } + } +} diff --git a/Sources/ASCKit/Screenshots/Internal/System/WebKitHTMLRenderer.swift b/Sources/ASCKit/Screenshots/Internal/System/WebKitHTMLRenderer.swift new file mode 100644 index 00000000..83a58231 --- /dev/null +++ b/Sources/ASCKit/Screenshots/Internal/System/WebKitHTMLRenderer.swift @@ -0,0 +1,82 @@ +#if canImport(WebKit) +import AppKit +import Foundation +import WebKit + +/// Renders HTML to PNG using WKWebView snapshot on macOS. Only the WebKit +/// calls live here; which images to inline is `LocalImages`'. +public final class WebKitHTMLRenderer: HTMLRenderer, @unchecked Sendable { + + public init() {} + + public func render(html: String, width: Int, height: Int) async throws -> Data { + try await renderOnMain(html: html, width: width, height: height) + } + + @MainActor + private func renderOnMain(html: String, width: Int, height: Int) async throws -> Data { + let config = WKWebViewConfiguration() + let webView = WKWebView(frame: NSRect(x: 0, y: 0, width: width, height: height), configuration: config) + + // Inline local images as data URLs so they render in loadHTMLString + let resolvedHTML = LocalImages( + workingDirectory: FileManager.default.currentDirectoryPath, + contents: { FileManager.default.contents(atPath: $0) } + ).inline(into: html) + webView.loadHTMLString(resolvedHTML, baseURL: nil) + + // Wait for navigation + try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in + let delegate = NavigationDelegate(continuation: continuation) + webView.navigationDelegate = delegate + objc_setAssociatedObject(webView, "navDelegate", delegate, .OBJC_ASSOCIATION_RETAIN) + } + + // Brief pause for CSS layout (images are already inlined as data URLs) + try await Task.sleep(for: .milliseconds(100)) + + let snapshotConfig = WKSnapshotConfiguration() + snapshotConfig.snapshotWidth = NSNumber(value: width) + + let image = try await webView.takeSnapshot(configuration: snapshotConfig) + + guard let tiffData = image.tiffRepresentation, + let bitmap = NSBitmapImageRep(data: tiffData), + let pngData = bitmap.representation(using: .png, properties: [:]) else { + throw HTMLRendererError.snapshotFailed + } + + return pngData + } +} + +private final class NavigationDelegate: NSObject, WKNavigationDelegate { + private var continuation: CheckedContinuation? + + init(continuation: CheckedContinuation) { + self.continuation = continuation + } + + func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { + continuation?.resume() + continuation = nil + } + + func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { + continuation?.resume(throwing: error) + continuation = nil + } + + func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { + continuation?.resume(throwing: error) + continuation = nil + } +} + +enum HTMLRendererError: Error, CustomStringConvertible { + case snapshotFailed + var description: String { + switch self { case .snapshotFailed: "Failed to capture PNG snapshot from rendered HTML" } + } +} +#endif diff --git a/Sources/Domain/Screenshots/ScreenTheme.swift b/Sources/ASCKit/Screenshots/ScreenTheme.swift similarity index 99% rename from Sources/Domain/Screenshots/ScreenTheme.swift rename to Sources/ASCKit/Screenshots/ScreenTheme.swift index 16388fca..7e1c693a 100644 --- a/Sources/Domain/Screenshots/ScreenTheme.swift +++ b/Sources/ASCKit/Screenshots/ScreenTheme.swift @@ -166,7 +166,7 @@ public struct ThemeAIHints: Sendable, Equatable, Codable { } } -// MARK: - ThemeProvider & ThemeRepository +// MARK: - ThemeProvider & Themes /// A provider that supplies visual themes. /// @@ -215,7 +215,7 @@ public enum ThemeDesignError: Error, CustomStringConvertible { /// Repository for querying visual themes across all providers. @Mockable -public protocol ThemeRepository: Sendable { +public protocol Themes: Sendable { /// List all themes from all providers. func listThemes() async throws -> [ScreenTheme] diff --git a/Sources/Domain/Screenshots/ScreenshotPlans+RESTRoutes.swift b/Sources/ASCKit/Screenshots/ScreenshotPlans+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Screenshots/ScreenshotPlans+RESTRoutes.swift rename to Sources/ASCKit/Screenshots/ScreenshotPlans+RESTRoutes.swift diff --git a/Sources/Domain/Screenshots/TemplateRepository.swift b/Sources/ASCKit/Screenshots/TemplateRepository.swift similarity index 100% rename from Sources/Domain/Screenshots/TemplateRepository.swift rename to Sources/ASCKit/Screenshots/TemplateRepository.swift diff --git a/Sources/Domain/Screenshots/ThemeDesign.swift b/Sources/ASCKit/Screenshots/ThemeDesign.swift similarity index 100% rename from Sources/Domain/Screenshots/ThemeDesign.swift rename to Sources/ASCKit/Screenshots/ThemeDesign.swift diff --git a/Sources/Domain/Screenshots/ThemeDesignApplier.swift b/Sources/ASCKit/Screenshots/ThemeDesignApplier.swift similarity index 100% rename from Sources/Domain/Screenshots/ThemeDesignApplier.swift rename to Sources/ASCKit/Screenshots/ThemeDesignApplier.swift diff --git a/Sources/Domain/Screenshots/ThemedPage.swift b/Sources/ASCKit/Screenshots/ThemedPage.swift similarity index 100% rename from Sources/Domain/Screenshots/ThemedPage.swift rename to Sources/ASCKit/Screenshots/ThemedPage.swift diff --git a/Sources/Domain/Shared/APIError.swift b/Sources/ASCKit/Shared/APIError.swift similarity index 100% rename from Sources/Domain/Shared/APIError.swift rename to Sources/ASCKit/Shared/APIError.swift diff --git a/Sources/Domain/Shared/APIRoot.swift b/Sources/ASCKit/Shared/APIRoot.swift similarity index 100% rename from Sources/Domain/Shared/APIRoot.swift rename to Sources/ASCKit/Shared/APIRoot.swift diff --git a/Sources/Domain/Shared/Affordance.swift b/Sources/ASCKit/Shared/Affordance.swift similarity index 100% rename from Sources/Domain/Shared/Affordance.swift rename to Sources/ASCKit/Shared/Affordance.swift diff --git a/Sources/Domain/Shared/AffordanceProviding.swift b/Sources/ASCKit/Shared/AffordanceProviding.swift similarity index 100% rename from Sources/Domain/Shared/AffordanceProviding.swift rename to Sources/ASCKit/Shared/AffordanceProviding.swift diff --git a/Sources/Domain/Shared/AffordanceRegistry.swift b/Sources/ASCKit/Shared/AffordanceRegistry.swift similarity index 100% rename from Sources/Domain/Shared/AffordanceRegistry.swift rename to Sources/ASCKit/Shared/AffordanceRegistry.swift diff --git a/Sources/Domain/Shared/ImageAsset.swift b/Sources/ASCKit/Shared/ImageAsset.swift similarity index 100% rename from Sources/Domain/Shared/ImageAsset.swift rename to Sources/ASCKit/Shared/ImageAsset.swift diff --git a/Sources/Infrastructure/Client/APIClient.swift b/Sources/ASCKit/Shared/Internal/APIClient.swift similarity index 100% rename from Sources/Infrastructure/Client/APIClient.swift rename to Sources/ASCKit/Shared/Internal/APIClient.swift diff --git a/Sources/Infrastructure/Client/ClientFactory.swift b/Sources/ASCKit/Shared/Internal/ClientFactory.swift similarity index 97% rename from Sources/Infrastructure/Client/ClientFactory.swift rename to Sources/ASCKit/Shared/Internal/ClientFactory.swift index 024eb9b5..4f85d6b6 100644 --- a/Sources/Infrastructure/Client/ClientFactory.swift +++ b/Sources/ASCKit/Shared/Internal/ClientFactory.swift @@ -1,5 +1,4 @@ import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct ClientFactory: Sendable { @@ -266,9 +265,9 @@ public struct ClientFactory: Sendable { return SDKAppClipRepository(client: provider) } - public func makeReportRepository(authProvider: any AuthProvider) throws -> any ReportRepository { + public func makeReports(authProvider: any AuthProvider) throws -> any Reports { let provider = try makeProvider(authProvider: authProvider) - return SDKReportRepository(client: provider) + return SDKReports(client: provider) } public func makeAnalyticsReportRepository(authProvider: any AuthProvider) throws -> any AnalyticsReportRepository { @@ -328,16 +327,16 @@ public struct ClientFactory: Sendable { // MARK: - Simulators (no ASC auth needed — local xcrun simctl) - public func makeSimulatorRepository() -> any SimulatorRepository { - SimctlSimulatorRepository() + public func makeSimulators() -> any Simulators { + SimctlSimulators() } // SimulatorInteractionRepository moved to ASCPro (pro feature) // MARK: - Skills (no ASC auth needed — subprocess + local filesystem) - public func makeSkillRepository() -> any SkillRepository { - ProcessSkillRepository() + public func makeSkills() -> any Skills { + ProcessSkills() } public func makeSkillConfigStorage() -> any SkillConfigStorage { @@ -346,8 +345,8 @@ public struct ClientFactory: Sendable { // MARK: - Plugins (no ASC auth needed — local filesystem + GitHub registry) - public func makePluginRepository() -> any PluginRepository { - PluginMarketRepository(sources: [ + public func makePlugins() -> any Plugins { + MarketplacePlugins(sources: [ GitHubPluginSource(owner: "tddworks", repo: "asc-registry"), ]) } diff --git a/Sources/Infrastructure/Client/DataExtensions.swift b/Sources/ASCKit/Shared/Internal/DataExtensions.swift similarity index 100% rename from Sources/Infrastructure/Client/DataExtensions.swift rename to Sources/ASCKit/Shared/Internal/DataExtensions.swift diff --git a/Sources/Infrastructure/Shared/HTTPPerforming.swift b/Sources/ASCKit/Shared/Internal/HTTPPerforming.swift similarity index 100% rename from Sources/Infrastructure/Shared/HTTPPerforming.swift rename to Sources/ASCKit/Shared/Internal/HTTPPerforming.swift diff --git a/Sources/Infrastructure/Shared/SDKFilter.swift b/Sources/ASCKit/Shared/Internal/SDKFilter.swift similarity index 100% rename from Sources/Infrastructure/Shared/SDKFilter.swift rename to Sources/ASCKit/Shared/Internal/SDKFilter.swift diff --git a/Sources/Infrastructure/Shared/UploadOperationsExecutor.swift b/Sources/ASCKit/Shared/Internal/UploadOperationsExecutor.swift similarity index 99% rename from Sources/Infrastructure/Shared/UploadOperationsExecutor.swift rename to Sources/ASCKit/Shared/Internal/UploadOperationsExecutor.swift index 1de551f1..683c340d 100644 --- a/Sources/Infrastructure/Shared/UploadOperationsExecutor.swift +++ b/Sources/ASCKit/Shared/Internal/UploadOperationsExecutor.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation /// Sends a file's bytes to the upload URLs App Store Connect hands out when an asset is diff --git a/Sources/Domain/Shared/OfferCodeEnvironment.swift b/Sources/ASCKit/Shared/OfferCodeEnvironment.swift similarity index 100% rename from Sources/Domain/Shared/OfferCodeEnvironment.swift rename to Sources/ASCKit/Shared/OfferCodeEnvironment.swift diff --git a/Sources/Domain/Shared/OfferCodePriceInput.swift b/Sources/ASCKit/Shared/OfferCodePriceInput.swift similarity index 100% rename from Sources/Domain/Shared/OfferCodePriceInput.swift rename to Sources/ASCKit/Shared/OfferCodePriceInput.swift diff --git a/Sources/Domain/Shared/OutputFormat.swift b/Sources/ASCKit/Shared/OutputFormat.swift similarity index 100% rename from Sources/Domain/Shared/OutputFormat.swift rename to Sources/ASCKit/Shared/OutputFormat.swift diff --git a/Sources/Domain/Shared/PaginatedResponse.swift b/Sources/ASCKit/Shared/PaginatedResponse.swift similarity index 100% rename from Sources/Domain/Shared/PaginatedResponse.swift rename to Sources/ASCKit/Shared/PaginatedResponse.swift diff --git a/Sources/Domain/Shared/Presentable.swift b/Sources/ASCKit/Shared/Presentable.swift similarity index 100% rename from Sources/Domain/Shared/Presentable.swift rename to Sources/ASCKit/Shared/Presentable.swift diff --git a/Sources/Domain/Shared/RESTPathResolver.swift b/Sources/ASCKit/Shared/RESTPathResolver.swift similarity index 100% rename from Sources/Domain/Shared/RESTPathResolver.swift rename to Sources/ASCKit/Shared/RESTPathResolver.swift diff --git a/Sources/Infrastructure/Simulators/SimctlSimulatorRepository.swift b/Sources/ASCKit/Simulators/Internal/SimctlSimulators.swift similarity index 96% rename from Sources/Infrastructure/Simulators/SimctlSimulatorRepository.swift rename to Sources/ASCKit/Simulators/Internal/SimctlSimulators.swift index 85cf8bf1..8381f9c2 100644 --- a/Sources/Infrastructure/Simulators/SimctlSimulatorRepository.swift +++ b/Sources/ASCKit/Simulators/Internal/SimctlSimulators.swift @@ -1,7 +1,6 @@ -import Domain import Foundation -public struct SimctlSimulatorRepository: SimulatorRepository, @unchecked Sendable { +public struct SimctlSimulators: Simulators, @unchecked Sendable { private let shellRunner: ShellRunner public init(shellRunner: ShellRunner = SystemShellRunner()) { diff --git a/Sources/Domain/Simulators/Simulator.swift b/Sources/ASCKit/Simulators/Simulator.swift similarity index 100% rename from Sources/Domain/Simulators/Simulator.swift rename to Sources/ASCKit/Simulators/Simulator.swift diff --git a/Sources/Domain/Simulators/SimulatorState.swift b/Sources/ASCKit/Simulators/SimulatorState.swift similarity index 100% rename from Sources/Domain/Simulators/SimulatorState.swift rename to Sources/ASCKit/Simulators/SimulatorState.swift diff --git a/Sources/Domain/Simulators/SimulatorRepository.swift b/Sources/ASCKit/Simulators/Simulators.swift similarity index 89% rename from Sources/Domain/Simulators/SimulatorRepository.swift rename to Sources/ASCKit/Simulators/Simulators.swift index 2c8d55ad..0b263afd 100644 --- a/Sources/Domain/Simulators/SimulatorRepository.swift +++ b/Sources/ASCKit/Simulators/Simulators.swift @@ -8,7 +8,7 @@ public enum SimulatorFilter: Sendable, Equatable { } @Mockable -public protocol SimulatorRepository: Sendable { +public protocol Simulators: Sendable { func listSimulators(filter: SimulatorFilter) async throws -> [Simulator] func bootSimulator(udid: String) async throws func shutdownSimulator(udid: String) async throws diff --git a/Sources/Infrastructure/Skills/FileSkillConfigStorage.swift b/Sources/ASCKit/Skills/Internal/FileSkillConfigStorage.swift similarity index 98% rename from Sources/Infrastructure/Skills/FileSkillConfigStorage.swift rename to Sources/ASCKit/Skills/Internal/FileSkillConfigStorage.swift index 244183c2..4747b623 100644 --- a/Sources/Infrastructure/Skills/FileSkillConfigStorage.swift +++ b/Sources/ASCKit/Skills/Internal/FileSkillConfigStorage.swift @@ -1,4 +1,3 @@ -import Domain import Foundation public struct FileSkillConfigStorage: SkillConfigStorage { diff --git a/Sources/Infrastructure/Skills/ProcessSkillRepository.swift b/Sources/ASCKit/Skills/Internal/ProcessSkills.swift similarity index 96% rename from Sources/Infrastructure/Skills/ProcessSkillRepository.swift rename to Sources/ASCKit/Skills/Internal/ProcessSkills.swift index d88c395e..d862eb32 100644 --- a/Sources/Infrastructure/Skills/ProcessSkillRepository.swift +++ b/Sources/ASCKit/Skills/Internal/ProcessSkills.swift @@ -1,11 +1,10 @@ -import Domain import Foundation /// Manages skills by shelling out to the `skills` CLI or `npx`. /// /// Strategy A: Find `skills` binary on PATH (skip if inside current git repo). /// Strategy B: Fallback to `npx --yes skills ...`. -public struct ProcessSkillRepository: SkillRepository { +public struct ProcessSkills: Skills { private static let repoSlug = "tddworks/asc-cli-skills" private let runner: any ShellRunner diff --git a/Sources/ASCKit/Skills/Internal/ShellCommand.swift b/Sources/ASCKit/Skills/Internal/ShellCommand.swift new file mode 100644 index 00000000..4228737d --- /dev/null +++ b/Sources/ASCKit/Skills/Internal/ShellCommand.swift @@ -0,0 +1,29 @@ +import Foundation + +/// One shell command as `SystemShellRunner` runs it: how it is launched, +/// which environment it sees, and what its exit means. The process itself +/// lives in `System/SystemShellRunner.swift`. +struct ShellCommand: Equatable, Sendable { + let command: String + let arguments: [String] + let environment: [String: String]? + + /// Run through `/usr/bin/env`, so the command is found on the `PATH`. + var executable: URL { URL(fileURLWithPath: "/usr/bin/env") } + + var argv: [String] { [command] + arguments } + + /// The given variables on top of `inherited`, or `nil` to inherit it unchanged. + func environment(inheriting inherited: [String: String]) -> [String: String]? { + guard let environment else { return nil } + return inherited.merging(environment) { _, given in given } + } + + /// The trimmed standard output, or `executionFailed` with the exit code and stderr. + func output(exitCode: Int32, stdout: Data, stderr: Data) throws -> String { + guard exitCode == 0 else { + throw ShellRunnerError.executionFailed(exitCode: exitCode, stderr: String(data: stderr, encoding: .utf8) ?? "") + } + return String(data: stdout, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" + } +} diff --git a/Sources/ASCKit/Skills/Internal/ShellRunner.swift b/Sources/ASCKit/Skills/Internal/ShellRunner.swift new file mode 100644 index 00000000..0c9e6eb4 --- /dev/null +++ b/Sources/ASCKit/Skills/Internal/ShellRunner.swift @@ -0,0 +1,20 @@ +import Foundation + +/// Abstraction for executing shell commands, enabling testability. +public protocol ShellRunner: Sendable { + func run(command: String, arguments: [String], environment: [String: String]?) async throws -> String +} + +public enum ShellRunnerError: Error, LocalizedError { + case commandNotFound + case executionFailed(exitCode: Int32, stderr: String) + + public var errorDescription: String? { + switch self { + case .commandNotFound: + return "Command not found" + case .executionFailed(let code, let stderr): + return "Command exited with code \(code): \(stderr)" + } + } +} diff --git a/Sources/ASCKit/Skills/Internal/System/SystemShellRunner.swift b/Sources/ASCKit/Skills/Internal/System/SystemShellRunner.swift new file mode 100644 index 00000000..8197b381 --- /dev/null +++ b/Sources/ASCKit/Skills/Internal/System/SystemShellRunner.swift @@ -0,0 +1,47 @@ +import Foundation + +/// Runs shell commands as real processes. Only the `Process` and pipe calls +/// live here; what to launch and what the exit means is `ShellCommand`'s. +public struct SystemShellRunner: ShellRunner { + public init() {} + + public func run(command: String, arguments: [String], environment: [String: String]?) async throws -> String { + let shell = ShellCommand(command: command, arguments: arguments, environment: environment) + let process = Process() + process.executableURL = shell.executable + process.arguments = shell.argv + process.currentDirectoryURL = FileManager.default.homeDirectoryForCurrentUser + if let env = shell.environment(inheriting: ProcessInfo.processInfo.environment) { + process.environment = env + } + + // Close stdin so the child process cannot block waiting for input. + process.standardInput = FileHandle.nullDevice + let stdoutPipe = Pipe() + process.standardOutput = stdoutPipe + let stderrPipe = Pipe() + process.standardError = stderrPipe + + try process.run() + + // Forward stderr to the terminal in real time (spinners, banners) while + // also collecting it for the error if the process fails. + var stderrData = Data() + let stderrQueue = DispatchQueue(label: "shell-runner-stderr") + stderrQueue.async { + let handle = stderrPipe.fileHandleForReading + while true { + let chunk = handle.availableData + if chunk.isEmpty { break } + FileHandle.standardError.write(chunk) + stderrData.append(chunk) + } + } + + let outputData = stdoutPipe.fileHandleForReading.readDataToEndOfFile() + stderrQueue.sync {} // wait for stderr forwarding to finish + process.waitUntilExit() + + return try shell.output(exitCode: process.terminationStatus, stdout: outputData, stderr: stderrData) + } +} diff --git a/Sources/Domain/Skills/Skill.swift b/Sources/ASCKit/Skills/Skill.swift similarity index 100% rename from Sources/Domain/Skills/Skill.swift rename to Sources/ASCKit/Skills/Skill.swift diff --git a/Sources/Domain/Skills/SkillCheckResult.swift b/Sources/ASCKit/Skills/SkillCheckResult.swift similarity index 100% rename from Sources/Domain/Skills/SkillCheckResult.swift rename to Sources/ASCKit/Skills/SkillCheckResult.swift diff --git a/Sources/Domain/Skills/SkillConfig.swift b/Sources/ASCKit/Skills/SkillConfig.swift similarity index 100% rename from Sources/Domain/Skills/SkillConfig.swift rename to Sources/ASCKit/Skills/SkillConfig.swift diff --git a/Sources/Domain/Skills/SkillConfigStorage.swift b/Sources/ASCKit/Skills/SkillConfigStorage.swift similarity index 100% rename from Sources/Domain/Skills/SkillConfigStorage.swift rename to Sources/ASCKit/Skills/SkillConfigStorage.swift diff --git a/Sources/Domain/Skills/SkillRepository.swift b/Sources/ASCKit/Skills/Skills.swift similarity index 92% rename from Sources/Domain/Skills/SkillRepository.swift rename to Sources/ASCKit/Skills/Skills.swift index a35718a7..25914a16 100644 --- a/Sources/Domain/Skills/SkillRepository.swift +++ b/Sources/ASCKit/Skills/Skills.swift @@ -2,7 +2,7 @@ import Mockable /// Manages skill installation, updates, and discovery via the skills CLI. @Mockable -public protocol SkillRepository: Sendable { +public protocol Skills: Sendable { /// List available skills from the repository. func listAvailable() async throws -> String diff --git a/Sources/Infrastructure/Submissions/OpenAPISubmissionRepository.swift b/Sources/ASCKit/Submissions/Internal/OpenAPISubmissionRepository.swift similarity index 66% rename from Sources/Infrastructure/Submissions/OpenAPISubmissionRepository.swift rename to Sources/ASCKit/Submissions/Internal/OpenAPISubmissionRepository.swift index 7c40f054..8873025e 100644 --- a/Sources/Infrastructure/Submissions/OpenAPISubmissionRepository.swift +++ b/Sources/ASCKit/Submissions/Internal/OpenAPISubmissionRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Sendable { private let client: any APIClient @@ -8,61 +7,7 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send self.client = client } - public func submitVersion(versionId: String) async throws -> Domain.ReviewSubmission { - // Step 1: Fetch the version to extract appId and platform - let versionReq = APIEndpoint.v1.appStoreVersions.id(versionId).get( - parameters: .init(include: [.app]) - ) - let versionResp = try await client.request(versionReq) - guard - let appId = versionResp.data.relationships?.app?.data?.id, - let sdkPlatform = versionResp.data.attributes?.platform, - let platform = Domain.AppStorePlatform(rawValue: sdkPlatform.rawValue) - else { - throw APIError.unknown("Failed to extract appId and platform from version \(versionId)") - } - - // Step 2: Check for an existing open submission (UNRESOLVED_ISSUES or READY_FOR_REVIEW) - let filterPlatform = APIEndpoint.V1.ReviewSubmissions.GetParameters.FilterPlatform(rawValue: sdkPlatform.rawValue) - let listReq = APIEndpoint.v1.reviewSubmissions.get(parameters: .init( - filterPlatform: filterPlatform.map { [$0] }, - filterState: [.unresolvedIssues, .readyForReview], - filterApp: [appId] - )) - let listResp = try await client.request(listReq) - if let existing = listResp.data.first { - // A refused submit leaves its draft open and empty, so it may not contain this version yet. - let items = try await listSubmissionItems(submissionId: existing.id) - if !items.contains(where: { $0.linkedResourceId == versionId }) { - _ = try await addItem(submissionId: existing.id, target: .appStoreVersion(versionId)) - } - return try await patchSubmitted(id: existing.id, appId: appId, platform: platform) - } - - // Step 3: Create new review submission - let submissionResp = try await explainingRefusal { - try await client.request(APIEndpoint.v1.reviewSubmissions.post( - ReviewSubmissionCreateRequest( - data: .init( - type: .reviewSubmissions, - attributes: .init(platform: sdkPlatform), - relationships: .init( - app: .init(data: .init(type: .apps, id: appId)) - ) - ) - ) - )) - } - let submissionId = submissionResp.data.id - - // Step 4: Add the version as a review submission item - _ = try await addItem(submissionId: submissionId, target: .appStoreVersion(versionId)) - - // Step 5: Submit for review - return try await patchSubmitted(id: submissionId, appId: appId, platform: platform) - } - - public func createSubmission(appId: String, platform: Domain.AppStorePlatform) async throws -> Domain.ReviewSubmission { + public func createSubmission(appId: String, platform: ASCKit.AppStorePlatform) async throws -> ASCKit.ReviewSubmission { guard let sdkPlatform = AppStoreConnect_Swift_SDK.Platform(rawValue: platform.rawValue) else { throw APIError.unknown("Unsupported review submission platform \(platform.rawValue)") } @@ -74,17 +19,19 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send if let open = listResp.data.first { return mapListedSubmission(open, appId: appId) } - let created = try await client.request(APIEndpoint.v1.reviewSubmissions.post( - ReviewSubmissionCreateRequest(data: .init( - type: .reviewSubmissions, - attributes: .init(platform: sdkPlatform), - relationships: .init(app: .init(data: .init(type: .apps, id: appId))) + let created = try await explainingRefusal { + try await client.request(APIEndpoint.v1.reviewSubmissions.post( + ReviewSubmissionCreateRequest(data: .init( + type: .reviewSubmissions, + attributes: .init(platform: sdkPlatform), + relationships: .init(app: .init(data: .init(type: .apps, id: appId))) + )) )) - )) + } return mapListedSubmission(created.data, appId: appId) } - public func addItem(submissionId: String, target: Domain.ReviewItemTarget) async throws -> Domain.ReviewSubmissionItem { + public func addItem(submissionId: String, target: ASCKit.ReviewItemTarget) async throws -> ASCKit.ReviewSubmissionItem { var relationships = ReviewSubmissionItemCreateRequest.Data.Relationships( reviewSubmission: .init(data: .init(type: .reviewSubmissions, id: submissionId)) ) @@ -105,7 +52,7 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send } // Apple's create response omits the relationship, so the target supplies it. let item = mapSubmissionItem(response.data, submissionId: submissionId) - return Domain.ReviewSubmissionItem( + return ASCKit.ReviewSubmissionItem( id: item.id, submissionId: submissionId, state: item.state, linkedResourceId: target.id, linkedResourceType: target.linkedResource ) @@ -115,7 +62,7 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send try await client.request(APIEndpoint.v1.reviewSubmissionItems.id(itemId).delete) } - public func submit(submissionId: String) async throws -> Domain.ReviewSubmission { + public func submit(submissionId: String) async throws -> ASCKit.ReviewSubmission { _ = try await explainingRefusal { try await client.request(APIEndpoint.v1.reviewSubmissions.id(submissionId).patch( ReviewSubmissionUpdateRequest(data: .init( @@ -127,7 +74,7 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send return try await getSubmission(id: submissionId) } - public func getSubmission(id: String) async throws -> Domain.ReviewSubmission { + public func getSubmission(id: String) async throws -> ASCKit.ReviewSubmission { let request = APIEndpoint.v1.reviewSubmissions.id(id).get(parameters: .init( include: [.app] )) @@ -136,7 +83,7 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send return mapListedSubmission(response.data, appId: appId) } - public func listSubmissionItems(submissionId: String) async throws -> [Domain.ReviewSubmissionItem] { + public func listSubmissionItems(submissionId: String) async throws -> [ASCKit.ReviewSubmissionItem] { // `include` makes Apple return each item's relationship linkage, which the mapper // reads to report what the item points at. let request = APIEndpoint.v1.reviewSubmissions.id(submissionId).items.get(parameters: .init( @@ -155,15 +102,15 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send private func mapSubmissionItem( _ sdkItem: AppStoreConnect_Swift_SDK.ReviewSubmissionItem, submissionId: String - ) -> Domain.ReviewSubmissionItem { + ) -> ASCKit.ReviewSubmissionItem { let state = sdkItem.attributes?.state.flatMap { - Domain.ReviewSubmissionItemState(rawValue: $0.rawValue) + ASCKit.ReviewSubmissionItemState(rawValue: $0.rawValue) } ?? .readyForReview // Apple attaches exactly one related resource per item, expressed as // separate optional relationships. Probe the well-known kinds in priority // order — appStoreVersion first since it's by far the common case. - let (linkedId, linkedType): (String?, Domain.ReviewSubmissionItemLinkedResource?) = { + let (linkedId, linkedType): (String?, ASCKit.ReviewSubmissionItemLinkedResource?) = { if let id = sdkItem.relationships?.appStoreVersion?.data?.id { return (id, .appStoreVersion) } if let id = sdkItem.relationships?.appCustomProductPageVersion?.data?.id { return (id, .appCustomProductPageVersion) } if let id = sdkItem.relationships?.appStoreVersionExperiment?.data?.id { return (id, .appStoreVersionExperiment) } @@ -181,7 +128,7 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send return (nil, nil) }() - return Domain.ReviewSubmissionItem( + return ASCKit.ReviewSubmissionItem( id: sdkItem.id, submissionId: submissionId, state: state, @@ -192,9 +139,9 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send public func listSubmissions( appId: String, - states: [Domain.ReviewSubmissionState]?, + states: [ASCKit.ReviewSubmissionState]?, limit: Int? - ) async throws -> [Domain.ReviewSubmission] { + ) async throws -> [ASCKit.ReviewSubmission] { let filterState = states?.compactMap { APIEndpoint.V1.ReviewSubmissions.GetParameters.FilterState(rawValue: $0.rawValue) } @@ -210,14 +157,14 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send private func mapListedSubmission( _ sdkSubmission: AppStoreConnect_Swift_SDK.ReviewSubmission, appId: String - ) -> Domain.ReviewSubmission { + ) -> ASCKit.ReviewSubmission { let platform = sdkSubmission.attributes?.platform.flatMap { - Domain.AppStorePlatform(rawValue: $0.rawValue) + ASCKit.AppStorePlatform(rawValue: $0.rawValue) } ?? .iOS let state = sdkSubmission.attributes?.state.flatMap { - Domain.ReviewSubmissionState(rawValue: $0.rawValue) + ASCKit.ReviewSubmissionState(rawValue: $0.rawValue) } ?? .readyForReview - return Domain.ReviewSubmission( + return ASCKit.ReviewSubmission( id: sdkSubmission.id, appId: appId, platform: platform, @@ -226,33 +173,15 @@ public struct OpenAPISubmissionRepository: SubmissionRepository, @unchecked Send ) } - private func patchSubmitted( - id: String, - appId: String, - platform: Domain.AppStorePlatform - ) async throws -> Domain.ReviewSubmission { - let submitReq = APIEndpoint.v1.reviewSubmissions.id(id).patch( - ReviewSubmissionUpdateRequest( - data: .init( - type: .reviewSubmissions, - id: id, - attributes: .init(isSubmitted: true) - ) - ) - ) - let finalResp = try await explainingRefusal { try await client.request(submitReq) } - return mapSubmission(finalResp.data, appId: appId, platform: platform) - } - private func mapSubmission( _ sdkSubmission: AppStoreConnect_Swift_SDK.ReviewSubmission, appId: String, - platform: Domain.AppStorePlatform - ) -> Domain.ReviewSubmission { + platform: ASCKit.AppStorePlatform + ) -> ASCKit.ReviewSubmission { let state = sdkSubmission.attributes?.state.flatMap { - Domain.ReviewSubmissionState(rawValue: $0.rawValue) + ASCKit.ReviewSubmissionState(rawValue: $0.rawValue) } ?? .readyForReview - return Domain.ReviewSubmission( + return ASCKit.ReviewSubmission( id: sdkSubmission.id, appId: appId, platform: platform, diff --git a/Sources/Domain/Submissions/ReviewItemTarget.swift b/Sources/ASCKit/Submissions/ReviewItemTarget.swift similarity index 100% rename from Sources/Domain/Submissions/ReviewItemTarget.swift rename to Sources/ASCKit/Submissions/ReviewItemTarget.swift diff --git a/Sources/Domain/Submissions/ReviewSubmission+RESTRoutes.swift b/Sources/ASCKit/Submissions/ReviewSubmission+RESTRoutes.swift similarity index 100% rename from Sources/Domain/Submissions/ReviewSubmission+RESTRoutes.swift rename to Sources/ASCKit/Submissions/ReviewSubmission+RESTRoutes.swift diff --git a/Sources/Domain/Submissions/ReviewSubmission.swift b/Sources/ASCKit/Submissions/ReviewSubmission.swift similarity index 100% rename from Sources/Domain/Submissions/ReviewSubmission.swift rename to Sources/ASCKit/Submissions/ReviewSubmission.swift diff --git a/Sources/Domain/Submissions/ReviewSubmissionError.swift b/Sources/ASCKit/Submissions/ReviewSubmissionError.swift similarity index 63% rename from Sources/Domain/Submissions/ReviewSubmissionError.swift rename to Sources/ASCKit/Submissions/ReviewSubmissionError.swift index e9ee3fec..b7385773 100644 --- a/Sources/Domain/Submissions/ReviewSubmissionError.swift +++ b/Sources/ASCKit/Submissions/ReviewSubmissionError.swift @@ -5,12 +5,17 @@ import Foundation /// which its headline message only points at. public enum ReviewSubmissionError: Error, Equatable, Sendable, CustomStringConvertible, LocalizedError { case refused(message: String, reasons: [String]) + /// The version can't go to review in its current state (only an editable one can). + case versionNotEditable(versionString: String, state: AppStoreVersionState) public var description: String { switch self { case .refused(let message, let reasons): (["Apple refused the review submission: \(message)"] + reasons.map { " - \($0)" }) .joined(separator: "\n") + case .versionNotEditable(let versionString, let state): + "Version \(versionString) can't go to review while it is \(state.displayName). " + + "Only a version being prepared for submission, or one that was rejected, can." } } diff --git a/Sources/Domain/Submissions/ReviewSubmissionItem.swift b/Sources/ASCKit/Submissions/ReviewSubmissionItem.swift similarity index 100% rename from Sources/Domain/Submissions/ReviewSubmissionItem.swift rename to Sources/ASCKit/Submissions/ReviewSubmissionItem.swift diff --git a/Sources/Domain/Submissions/ReviewSubmissionItemState.swift b/Sources/ASCKit/Submissions/ReviewSubmissionItemState.swift similarity index 100% rename from Sources/Domain/Submissions/ReviewSubmissionItemState.swift rename to Sources/ASCKit/Submissions/ReviewSubmissionItemState.swift diff --git a/Sources/Domain/Submissions/ReviewSubmissionState.swift b/Sources/ASCKit/Submissions/ReviewSubmissionState.swift similarity index 100% rename from Sources/Domain/Submissions/ReviewSubmissionState.swift rename to Sources/ASCKit/Submissions/ReviewSubmissionState.swift diff --git a/Sources/Domain/Submissions/SubmissionPlan.swift b/Sources/ASCKit/Submissions/SubmissionPlan.swift similarity index 100% rename from Sources/Domain/Submissions/SubmissionPlan.swift rename to Sources/ASCKit/Submissions/SubmissionPlan.swift diff --git a/Sources/Domain/Submissions/SubmissionRepository.swift b/Sources/ASCKit/Submissions/SubmissionRepository.swift similarity index 91% rename from Sources/Domain/Submissions/SubmissionRepository.swift rename to Sources/ASCKit/Submissions/SubmissionRepository.swift index 61401aeb..e69a772a 100644 --- a/Sources/Domain/Submissions/SubmissionRepository.swift +++ b/Sources/ASCKit/Submissions/SubmissionRepository.swift @@ -2,7 +2,6 @@ import Mockable @Mockable public protocol SubmissionRepository: Sendable { - func submitVersion(versionId: String) async throws -> ReviewSubmission func listSubmissions(appId: String, states: [ReviewSubmissionState]?, limit: Int?) async throws -> [ReviewSubmission] func getSubmission(id: String) async throws -> ReviewSubmission func listSubmissionItems(submissionId: String) async throws -> [ReviewSubmissionItem] diff --git a/Sources/Infrastructure/Territories/SDKTerritoryRepository.swift b/Sources/ASCKit/Territories/Internal/SDKTerritoryRepository.swift similarity index 78% rename from Sources/Infrastructure/Territories/SDKTerritoryRepository.swift rename to Sources/ASCKit/Territories/Internal/SDKTerritoryRepository.swift index 696b4287..376fb5e9 100644 --- a/Sources/Infrastructure/Territories/SDKTerritoryRepository.swift +++ b/Sources/ASCKit/Territories/Internal/SDKTerritoryRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKTerritoryRepository: TerritoryRepository, @unchecked Sendable { private let client: any APIClient @@ -8,14 +7,14 @@ public struct SDKTerritoryRepository: TerritoryRepository, @unchecked Sendable { self.client = client } - public func listTerritories() async throws -> [Domain.Territory] { + public func listTerritories() async throws -> [ASCKit.Territory] { let request = APIEndpoint.v1.territories.get( fieldsTerritories: [.currency], limit: 200 ) let response = try await client.request(request) return response.data.map { sdk in - Domain.Territory(id: sdk.id, currency: sdk.attributes?.currency) + ASCKit.Territory(id: sdk.id, currency: sdk.attributes?.currency) } } } diff --git a/Sources/Domain/Territories/Territory.swift b/Sources/ASCKit/Territories/Territory.swift similarity index 100% rename from Sources/Domain/Territories/Territory.swift rename to Sources/ASCKit/Territories/Territory.swift diff --git a/Sources/Domain/Territories/TerritoryRepository.swift b/Sources/ASCKit/Territories/TerritoryRepository.swift similarity index 100% rename from Sources/Domain/Territories/TerritoryRepository.swift rename to Sources/ASCKit/Territories/TerritoryRepository.swift diff --git a/Sources/Infrastructure/Users/SDKUserRepository.swift b/Sources/ASCKit/Users/Internal/SDKUserRepository.swift similarity index 84% rename from Sources/Infrastructure/Users/SDKUserRepository.swift rename to Sources/ASCKit/Users/Internal/SDKUserRepository.swift index 2ca1edd2..62a7def4 100644 --- a/Sources/Infrastructure/Users/SDKUserRepository.swift +++ b/Sources/ASCKit/Users/Internal/SDKUserRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation public struct SDKUserRepository: UserRepository, @unchecked Sendable { @@ -9,7 +8,7 @@ public struct SDKUserRepository: UserRepository, @unchecked Sendable { self.client = client } - public func listUsers(role: Domain.UserRole?) async throws -> [Domain.TeamMember] { + public func listUsers(role: ASCKit.UserRole?) async throws -> [ASCKit.TeamMember] { let filterRole = role.flatMap { APIEndpoint.V1.Users.GetParameters.FilterRoles(rawValue: $0.rawValue) } @@ -23,7 +22,7 @@ public struct SDKUserRepository: UserRepository, @unchecked Sendable { return pages.flatMap(\.data).map(mapTeamMember) } - public func updateUser(id: String, roles: [Domain.UserRole]) async throws -> Domain.TeamMember { + public func updateUser(id: String, roles: [ASCKit.UserRole]) async throws -> ASCKit.TeamMember { let sdkRoles = roles.compactMap { AppStoreConnect_Swift_SDK.UserRole(rawValue: $0.rawValue) } let body = UserUpdateRequest(data: .init( type: .users, @@ -38,7 +37,7 @@ public struct SDKUserRepository: UserRepository, @unchecked Sendable { try await client.request(APIEndpoint.v1.users.id(id).delete) } - public func listUserInvitations(role: Domain.UserRole?) async throws -> [Domain.UserInvitationRecord] { + public func listUserInvitations(role: ASCKit.UserRole?) async throws -> [ASCKit.UserInvitationRecord] { let filterRole = role.flatMap { APIEndpoint.V1.UserInvitations.GetParameters.FilterRoles(rawValue: $0.rawValue) } @@ -53,9 +52,9 @@ public struct SDKUserRepository: UserRepository, @unchecked Sendable { email: String, firstName: String, lastName: String, - roles: [Domain.UserRole], + roles: [ASCKit.UserRole], allAppsVisible: Bool - ) async throws -> Domain.UserInvitationRecord { + ) async throws -> ASCKit.UserInvitationRecord { let sdkRoles = roles.compactMap { AppStoreConnect_Swift_SDK.UserRole(rawValue: $0.rawValue) } let body = UserInvitationCreateRequest(data: .init( type: .userInvitations, @@ -77,11 +76,11 @@ public struct SDKUserRepository: UserRepository, @unchecked Sendable { // MARK: - Mappers - private func mapTeamMember(_ sdk: AppStoreConnect_Swift_SDK.User) -> Domain.TeamMember { + private func mapTeamMember(_ sdk: AppStoreConnect_Swift_SDK.User) -> ASCKit.TeamMember { let roles = (sdk.attributes?.roles ?? []).compactMap { - Domain.UserRole(rawValue: $0.rawValue) + ASCKit.UserRole(rawValue: $0.rawValue) } - return Domain.TeamMember( + return ASCKit.TeamMember( id: sdk.id, username: sdk.attributes?.username ?? "", firstName: sdk.attributes?.firstName ?? "", @@ -92,11 +91,11 @@ public struct SDKUserRepository: UserRepository, @unchecked Sendable { ) } - private func mapInvitation(_ sdk: AppStoreConnect_Swift_SDK.UserInvitation) -> Domain.UserInvitationRecord { + private func mapInvitation(_ sdk: AppStoreConnect_Swift_SDK.UserInvitation) -> ASCKit.UserInvitationRecord { let roles = (sdk.attributes?.roles ?? []).compactMap { - Domain.UserRole(rawValue: $0.rawValue) + ASCKit.UserRole(rawValue: $0.rawValue) } - return Domain.UserInvitationRecord( + return ASCKit.UserInvitationRecord( id: sdk.id, email: sdk.attributes?.email ?? "", firstName: sdk.attributes?.firstName ?? "", diff --git a/Sources/Domain/Users/TeamMember.swift b/Sources/ASCKit/Users/TeamMember.swift similarity index 100% rename from Sources/Domain/Users/TeamMember.swift rename to Sources/ASCKit/Users/TeamMember.swift diff --git a/Sources/Domain/Users/UserInvitationRecord.swift b/Sources/ASCKit/Users/UserInvitationRecord.swift similarity index 100% rename from Sources/Domain/Users/UserInvitationRecord.swift rename to Sources/ASCKit/Users/UserInvitationRecord.swift diff --git a/Sources/Domain/Users/UserRepository.swift b/Sources/ASCKit/Users/UserRepository.swift similarity index 100% rename from Sources/Domain/Users/UserRepository.swift rename to Sources/ASCKit/Users/UserRepository.swift diff --git a/Sources/Domain/Users/UserRole.swift b/Sources/ASCKit/Users/UserRole.swift similarity index 100% rename from Sources/Domain/Users/UserRole.swift rename to Sources/ASCKit/Users/UserRole.swift diff --git a/Sources/Infrastructure/Web/ASCWebServer.swift b/Sources/ASCKit/Web/ASCWebServer.swift similarity index 99% rename from Sources/Infrastructure/Web/ASCWebServer.swift rename to Sources/ASCKit/Web/ASCWebServer.swift index 298c155e..f3194835 100644 --- a/Sources/Infrastructure/Web/ASCWebServer.swift +++ b/Sources/ASCKit/Web/ASCWebServer.swift @@ -4,7 +4,6 @@ import HummingbirdTLS import HummingbirdWebSocket import NIOCore import NIOSSL -import Domain import ASCPlugin /// Hummingbird-based API server for ASC web apps. diff --git a/Sources/Infrastructure/Web/CORSMiddleware.swift b/Sources/ASCKit/Web/CORSMiddleware.swift similarity index 100% rename from Sources/Infrastructure/Web/CORSMiddleware.swift rename to Sources/ASCKit/Web/CORSMiddleware.swift diff --git a/Sources/Infrastructure/Web/SelfSignedCert.swift b/Sources/ASCKit/Web/SelfSignedCert.swift similarity index 100% rename from Sources/Infrastructure/Web/SelfSignedCert.swift rename to Sources/ASCKit/Web/SelfSignedCert.swift diff --git a/Sources/Infrastructure/XcodeCloud/SDKXcodeCloudBuildRunRepository.swift b/Sources/ASCKit/XcodeCloud/Internal/SDKXcodeCloudBuildRunRepository.swift similarity index 99% rename from Sources/Infrastructure/XcodeCloud/SDKXcodeCloudBuildRunRepository.swift rename to Sources/ASCKit/XcodeCloud/Internal/SDKXcodeCloudBuildRunRepository.swift index f7cd9f03..7033ec92 100644 --- a/Sources/Infrastructure/XcodeCloud/SDKXcodeCloudBuildRunRepository.swift +++ b/Sources/ASCKit/XcodeCloud/Internal/SDKXcodeCloudBuildRunRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKXcodeCloudBuildRunRepository: XcodeCloudBuildRunRepository, @unchecked Sendable { private let client: any APIClient diff --git a/Sources/Infrastructure/XcodeCloud/SDKXcodeCloudProductRepository.swift b/Sources/ASCKit/XcodeCloud/Internal/SDKXcodeCloudProductRepository.swift similarity index 98% rename from Sources/Infrastructure/XcodeCloud/SDKXcodeCloudProductRepository.swift rename to Sources/ASCKit/XcodeCloud/Internal/SDKXcodeCloudProductRepository.swift index 5b8557fe..58448e90 100644 --- a/Sources/Infrastructure/XcodeCloud/SDKXcodeCloudProductRepository.swift +++ b/Sources/ASCKit/XcodeCloud/Internal/SDKXcodeCloudProductRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKXcodeCloudProductRepository: XcodeCloudProductRepository, @unchecked Sendable { private let client: any APIClient diff --git a/Sources/Infrastructure/XcodeCloud/SDKXcodeCloudWorkflowRepository.swift b/Sources/ASCKit/XcodeCloud/Internal/SDKXcodeCloudWorkflowRepository.swift similarity index 98% rename from Sources/Infrastructure/XcodeCloud/SDKXcodeCloudWorkflowRepository.swift rename to Sources/ASCKit/XcodeCloud/Internal/SDKXcodeCloudWorkflowRepository.swift index 2a71be15..93fa21dd 100644 --- a/Sources/Infrastructure/XcodeCloud/SDKXcodeCloudWorkflowRepository.swift +++ b/Sources/ASCKit/XcodeCloud/Internal/SDKXcodeCloudWorkflowRepository.swift @@ -1,5 +1,4 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain public struct SDKXcodeCloudWorkflowRepository: XcodeCloudWorkflowRepository, @unchecked Sendable { private let client: any APIClient diff --git a/Sources/Domain/XcodeCloud/XcodeCloud+RESTRoutes.swift b/Sources/ASCKit/XcodeCloud/XcodeCloud+RESTRoutes.swift similarity index 100% rename from Sources/Domain/XcodeCloud/XcodeCloud+RESTRoutes.swift rename to Sources/ASCKit/XcodeCloud/XcodeCloud+RESTRoutes.swift diff --git a/Sources/Domain/XcodeCloud/XcodeCloudBuildRun.swift b/Sources/ASCKit/XcodeCloud/XcodeCloudBuildRun.swift similarity index 100% rename from Sources/Domain/XcodeCloud/XcodeCloudBuildRun.swift rename to Sources/ASCKit/XcodeCloud/XcodeCloudBuildRun.swift diff --git a/Sources/Domain/XcodeCloud/XcodeCloudBuildRunRepository.swift b/Sources/ASCKit/XcodeCloud/XcodeCloudBuildRunRepository.swift similarity index 100% rename from Sources/Domain/XcodeCloud/XcodeCloudBuildRunRepository.swift rename to Sources/ASCKit/XcodeCloud/XcodeCloudBuildRunRepository.swift diff --git a/Sources/Domain/XcodeCloud/XcodeCloudProduct.swift b/Sources/ASCKit/XcodeCloud/XcodeCloudProduct.swift similarity index 100% rename from Sources/Domain/XcodeCloud/XcodeCloudProduct.swift rename to Sources/ASCKit/XcodeCloud/XcodeCloudProduct.swift diff --git a/Sources/Domain/XcodeCloud/XcodeCloudProductRepository.swift b/Sources/ASCKit/XcodeCloud/XcodeCloudProductRepository.swift similarity index 100% rename from Sources/Domain/XcodeCloud/XcodeCloudProductRepository.swift rename to Sources/ASCKit/XcodeCloud/XcodeCloudProductRepository.swift diff --git a/Sources/Domain/XcodeCloud/XcodeCloudWorkflow.swift b/Sources/ASCKit/XcodeCloud/XcodeCloudWorkflow.swift similarity index 100% rename from Sources/Domain/XcodeCloud/XcodeCloudWorkflow.swift rename to Sources/ASCKit/XcodeCloud/XcodeCloudWorkflow.swift diff --git a/Sources/Domain/XcodeCloud/XcodeCloudWorkflowRepository.swift b/Sources/ASCKit/XcodeCloud/XcodeCloudWorkflowRepository.swift similarity index 100% rename from Sources/Domain/XcodeCloud/XcodeCloudWorkflowRepository.swift rename to Sources/ASCKit/XcodeCloud/XcodeCloudWorkflowRepository.swift diff --git a/Sources/Infrastructure/Iris/BrowserIrisCookieProvider.swift b/Sources/Infrastructure/Iris/BrowserIrisCookieProvider.swift deleted file mode 100644 index 16f72db3..00000000 --- a/Sources/Infrastructure/Iris/BrowserIrisCookieProvider.swift +++ /dev/null @@ -1,100 +0,0 @@ -import Domain -import Foundation -import SweetCookieKit - -/// Resolves iris session cookies from browser cookie stores or environment. -/// -/// Resolution order: -/// 1. `ASC_IRIS_COOKIES` environment variable (for CI/CD) -/// 2. Browser cookies from Chrome/Safari/Firefox (via SweetCookieKit) -public struct BrowserIrisCookieProvider: IrisCookieProvider { - public init() {} - - public func resolveSession() throws -> IrisSession { - let (cookies, _) = try resolve() - return IrisSession(cookies: cookies) - } - - public func resolveStatus() throws -> IrisStatus { - let (cookies, source) = try resolve() - let count = cookies.components(separatedBy: "; ").count - return IrisStatus(source: source, cookieCount: count) - } - - private func resolve() throws -> (String, IrisCookieSource) { - // 1. Check environment variable - if let envCookies = ProcessInfo.processInfo.environment["ASC_IRIS_COOKIES"], - !envCookies.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty - { - return (envCookies, .environment) - } - - // 2. Try extracting from browser cookies - if let browserCookies = fetchFromBrowser() { - return (browserCookies, .browser) - } - - throw IrisCookieError.noCookiesFound - } - - private func fetchFromBrowser() -> String? { - let cookieClient = BrowserCookieClient() - - // myacinfo is set on .apple.com (parent domain) - // other cookies (itctx, dqsid, wosid) are on appstoreconnect.apple.com - let queries: [BrowserCookieQuery] = [ - BrowserCookieQuery( - domains: ["apple.com"], - domainMatch: .suffix, - includeExpired: false - ), - BrowserCookieQuery( - domains: ["appstoreconnect.apple.com"], - domainMatch: .suffix, - includeExpired: false - ), - ] - - // Cookie names relevant for iris API - let wantedNames: Set = [ - "myacinfo", "itctx", "itcdq", "dqsid", "wosid", "woinst", - "dssf", "dssid2", "dc", - ] - - for browser in Browser.allCases { - var cookieMap: [String: String] = [:] - - for query in queries { - do { - let storeRecords = try cookieClient.records(matching: query, in: browser) - for storeRecord in storeRecords { - for record in storeRecord.records where wantedNames.contains(record.name) { - cookieMap[record.name] = record.value - } - } - } catch { - continue - } - } - - // myacinfo is the essential auth cookie - if cookieMap["myacinfo"] != nil { - let cookieString = cookieMap.map { "\($0.key)=\($0.value)" }.joined(separator: "; ") - return cookieString - } - } - return nil - } -} - -/// Errors specific to iris cookie resolution. -public enum IrisCookieError: LocalizedError { - case noCookiesFound - - public var errorDescription: String? { - switch self { - case .noCookiesFound: - "No App Store Connect cookies found. Log in to appstoreconnect.apple.com in your browser, or set ASC_IRIS_COOKIES environment variable." - } - } -} diff --git a/Sources/Infrastructure/Iris/IrisClient.swift b/Sources/Infrastructure/Iris/IrisClient.swift deleted file mode 100644 index eb744388..00000000 --- a/Sources/Infrastructure/Iris/IrisClient.swift +++ /dev/null @@ -1,116 +0,0 @@ -import Domain -import Foundation - -/// Generic HTTP client for the iris private API. -/// -/// Handles cookie injection, required headers, and JSON:API -/// request/response encoding for `appstoreconnect.apple.com/iris/v1/`. -public struct IrisClient: Sendable { - private static let baseURL = "https://appstoreconnect.apple.com/iris/v1" - - private let session: URLSession - - public init(session: URLSession = .shared) { - self.session = session - } - - /// Perform a GET request against the iris API. - public func get( - path: String, - queryItems: [URLQueryItem] = [], - cookies: String - ) async throws -> (Data, HTTPURLResponse) { - var components = URLComponents(string: "\(Self.baseURL)/\(path)")! - if !queryItems.isEmpty { - components.queryItems = queryItems - } - var request = URLRequest(url: components.url!) - request.httpMethod = "GET" - applyHeaders(to: &request, cookies: cookies) - return try await perform(request) - } - - /// Perform a POST request against the iris API. - public func post( - path: String, - body: Data, - cookies: String - ) async throws -> (Data, HTTPURLResponse) { - let url = URL(string: "\(Self.baseURL)/\(path)")! - var request = URLRequest(url: url) - request.httpMethod = "POST" - request.httpBody = body - applyHeaders(to: &request, cookies: cookies) - return try await perform(request) - } - - /// Fetch an absolute URL (e.g. an Apple-signed attachment URL) with the - /// session cookies attached. Callers validate the host before calling — - /// this method fetches whatever it is given. - public func download( - absoluteURL: URL, - cookies: String - ) async throws -> (Data, HTTPURLResponse) { - var request = URLRequest(url: absoluteURL) - request.httpMethod = "GET" - request.setValue(cookies, forHTTPHeaderField: "cookie") - return try await perform(request) - } - - /// Perform a DELETE request against the iris API. Used by the iris-only - /// IAP submission dequeue (`DELETE /iris/v1/inAppPurchaseSubmissions/:id`), - /// which the public ASC SDK can't call (different auth surface). - public func delete( - path: String, - cookies: String - ) async throws -> (Data, HTTPURLResponse) { - let url = URL(string: "\(Self.baseURL)/\(path)")! - var request = URLRequest(url: url) - request.httpMethod = "DELETE" - applyHeaders(to: &request, cookies: cookies) - return try await perform(request) - } - - private func applyHeaders(to request: inout URLRequest, cookies: String) { - request.setValue("application/vnd.api+json", forHTTPHeaderField: "accept") - request.setValue("application/vnd.api+json", forHTTPHeaderField: "content-type") - request.setValue(cookies, forHTTPHeaderField: "cookie") - request.setValue( - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36", - forHTTPHeaderField: "user-agent" - ) - request.setValue("[asc-ui]", forHTTPHeaderField: "x-csrf-itc") - } - - private func perform(_ request: URLRequest) async throws -> (Data, HTTPURLResponse) { - let (data, response) = try await session.data(for: request) - guard let httpResponse = response as? HTTPURLResponse else { - throw IrisAPIError.invalidResponse - } - guard (200...299).contains(httpResponse.statusCode) else { - throw IrisAPIError.httpError( - statusCode: httpResponse.statusCode, - body: String(data: data, encoding: .utf8) - ) - } - return (data, httpResponse) - } -} - -/// Errors from the iris HTTP layer. -public enum IrisAPIError: LocalizedError { - case invalidResponse - case httpError(statusCode: Int, body: String?) - case decodingError(String) - - public var errorDescription: String? { - switch self { - case .invalidResponse: - "Invalid response from iris API" - case .httpError(let statusCode, let body): - "Iris API error \(statusCode): \(body ?? "no body")" - case .decodingError(let detail): - "Failed to decode iris response: \(detail)" - } - } -} diff --git a/Sources/Infrastructure/Plugins/PluginMarketRepository.swift b/Sources/Infrastructure/Plugins/PluginMarketRepository.swift deleted file mode 100644 index b8093b2b..00000000 --- a/Sources/Infrastructure/Plugins/PluginMarketRepository.swift +++ /dev/null @@ -1,211 +0,0 @@ -import Domain -import Foundation -import ASCPlugin - -/// Manages installed dylib plugins and fetches marketplace listings from composable sources. -public struct PluginMarketRepository: PluginRepository { - private let sources: [any PluginSource] - - public init(sources: [any PluginSource] = []) { - self.sources = sources - } - - public func listInstalled() async throws -> [Plugin] { - let loaded = PluginLoader.discover() - return loaded.map { p in - let manifest = readManifest(at: p.directory) - return Plugin( - id: p.slug, - name: p.name, - version: manifest?["version"] as? String ?? "1.0", - description: manifest?["description"] as? String ?? "", - author: manifest?["author"] as? String, - repositoryURL: manifest?["repositoryURL"] as? String, - categories: manifest?["categories"] as? [String] ?? [], - isInstalled: true, - slug: p.slug, - uiScripts: p.uiScripts - ) - } - } - - public func listAvailable() async throws -> [Plugin] { - let installed = PluginLoader.discover() - let installedIds = Set( - installed.flatMap { p in - [p.slug, p.slug.lowercased(), p.name.lowercased().replacingOccurrences(of: " ", with: "-")] - } - ) - - var all: [Plugin] = [] - for source in sources { - let plugins = try await source.fetchPlugins() - all.append(contentsOf: plugins.map { plugin in - let matched = installedIds.contains(plugin.id) || installedIds.contains(plugin.id.lowercased()) - return Plugin( - id: plugin.id, - name: plugin.name, - version: plugin.version, - description: plugin.description, - author: plugin.author, - repositoryURL: plugin.repositoryURL, - categories: plugin.categories, - downloadURL: plugin.downloadURL, - isInstalled: matched - ) - }) - } - return all - } - - public func searchAvailable(query: String) async throws -> [Plugin] { - let all = try await listAvailable() - let q = query.lowercased() - return all.filter { - $0.name.lowercased().contains(q) || - $0.description.lowercased().contains(q) || - $0.categories.contains(where: { $0.lowercased().contains(q) }) - } - } - - public func install(name: String) async throws -> Plugin { - let available = try await listAvailable() - guard let entry = available.first(where: { $0.id == name }), - let downloadURL = entry.downloadURL else { - throw PluginMarketError.pluginNotFound(name) - } - - let pluginsDir = PluginLoader.pluginsDirectory - try FileManager.default.createDirectory(at: pluginsDir, withIntermediateDirectories: true) - - let zipURL = URL(string: downloadURL)! - let (zipData, _) = try await URLSession.shared.data(from: zipURL) - - let tempDir = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString) - try FileManager.default.createDirectory(at: tempDir, withIntermediateDirectories: true) - let zipPath = tempDir.appendingPathComponent("\(name).zip") - try zipData.write(to: zipPath) - - let process = Process() - process.executableURL = URL(fileURLWithPath: "/usr/bin/unzip") - process.arguments = ["-o", zipPath.path, "-d", pluginsDir.path] - try process.run() - process.waitUntilExit() - - try? FileManager.default.removeItem(at: tempDir) - - guard process.terminationStatus == 0 else { - throw PluginMarketError.installFailed(name) - } - - // Drop the in-memory plugin cache so the next `listInstalled()` - // re-scans `~/.asc/plugins` and includes the new bundle. - PluginLoader.invalidateCache() - - return Plugin( - id: name, - name: entry.name, - version: entry.version, - description: entry.description, - author: entry.author, - repositoryURL: entry.repositoryURL, - categories: entry.categories, - isInstalled: true, - slug: name - ) - } - - public func uninstall(name: String) async throws { - let pluginsDir = PluginLoader.pluginsDirectory - // Try exact match first (slug like "ASCPro"), then scan for matching plugin - let exactPath = pluginsDir.appendingPathComponent("\(name).plugin") - if FileManager.default.fileExists(atPath: exactPath.path) { - try FileManager.default.removeItem(at: exactPath) - // Drop the in-memory plugin cache so the next `listInstalled()` - // re-scans the disk and excludes this entry. Without this the - // REST list endpoint keeps returning the just-deleted plugin. - PluginLoader.invalidateCache() - return - } - // Scan installed plugins — match by slug or name-derived id - let nameLower = name.lowercased() - let fm = FileManager.default - guard let entries = try? fm.contentsOfDirectory(atPath: pluginsDir.path) else { - throw PluginMarketError.pluginNotFound(name) - } - for entry in entries where entry.hasSuffix(".plugin") { - let slug = (entry as NSString).deletingPathExtension - let slugLower = slug.lowercased() - // Match: exact slug, lowercased slug, or name-derived id (e.g. "asc-pro" matches "ASC Pro") - let manifestURL = pluginsDir.appendingPathComponent(entry).appendingPathComponent("manifest.json") - let manifestName = (try? Data(contentsOf: manifestURL)) - .flatMap { try? JSONSerialization.jsonObject(with: $0) as? [String: Any] } - .flatMap { $0["name"] as? String } - let nameId = manifestName?.lowercased().replacingOccurrences(of: " ", with: "-") - - if slugLower == nameLower || nameId == nameLower { - try fm.removeItem(at: pluginsDir.appendingPathComponent(entry)) - PluginLoader.invalidateCache() - return - } - } - throw PluginMarketError.pluginNotFound(name) - } - - public func listOutdated() async throws -> [PluginUpdate] { - let installed = try await listInstalled() - let available = try await listAvailable() - var availableByName: [String: Plugin] = [:] - for plugin in available { - availableByName[plugin.name] = plugin - } - return installed.compactMap { local in - guard let remote = availableByName[local.name], - remote.version != local.version else { return nil } - return PluginUpdate( - name: local.name, - installedVersion: local.version, - latestVersion: remote.version, - repositoryURL: remote.repositoryURL ?? local.repositoryURL, - downloadURL: remote.downloadURL - ) - } - } - - public func update(name: String) async throws -> Plugin { - // Find the marketplace entry that matches the installed plugin's name or id. - let installed = try await listInstalled() - guard let local = installed.first(where: { $0.name == name || $0.slug == name || $0.id == name }) else { - throw PluginMarketError.pluginNotFound(name) - } - let available = try await listAvailable() - guard let remote = available.first(where: { $0.name == local.name }) else { - throw PluginMarketError.pluginNotFound(local.name) - } - try await uninstall(name: local.slug ?? local.id) - return try await install(name: remote.id) - } - - // MARK: - Private - - private func readManifest(at directory: URL) -> [String: Any]? { - let manifestURL = directory.appendingPathComponent("manifest.json") - guard let data = try? Data(contentsOf: manifestURL), - let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else { - return nil - } - return json - } -} - -enum PluginMarketError: Error, CustomStringConvertible { - case pluginNotFound(String) - case installFailed(String) - - var description: String { - switch self { - case .pluginNotFound(let name): "Plugin not found: \(name)" - case .installFailed(let name): "Failed to install plugin: \(name)" - } - } -} diff --git a/Sources/Infrastructure/ScreenshotPlans/WebKitHTMLRenderer.swift b/Sources/Infrastructure/ScreenshotPlans/WebKitHTMLRenderer.swift deleted file mode 100644 index d3c13337..00000000 --- a/Sources/Infrastructure/ScreenshotPlans/WebKitHTMLRenderer.swift +++ /dev/null @@ -1,129 +0,0 @@ -#if canImport(WebKit) -import AppKit -import Domain -import Foundation -import WebKit - -/// Renders HTML to PNG using WKWebView snapshot on macOS. -public final class WebKitHTMLRenderer: HTMLRenderer, @unchecked Sendable { - - public init() {} - - public func render(html: String, width: Int, height: Int) async throws -> Data { - try await renderOnMain(html: html, width: width, height: height) - } - - @MainActor - private func renderOnMain(html: String, width: Int, height: Int) async throws -> Data { - let config = WKWebViewConfiguration() - let webView = WKWebView(frame: NSRect(x: 0, y: 0, width: width, height: height), configuration: config) - - // Inline local images as data URLs so they render in loadHTMLString - let cwd = FileManager.default.currentDirectoryPath - let resolvedHTML = Self.inlineLocalImages(html, cwd: cwd) - webView.loadHTMLString(resolvedHTML, baseURL: nil) - - // Wait for navigation - try await withCheckedThrowingContinuation { (continuation: CheckedContinuation) in - let delegate = NavigationDelegate(continuation: continuation) - webView.navigationDelegate = delegate - objc_setAssociatedObject(webView, "navDelegate", delegate, .OBJC_ASSOCIATION_RETAIN) - } - - // Brief pause for CSS layout (images are already inlined as data URLs) - try await Task.sleep(for: .milliseconds(100)) - - let snapshotConfig = WKSnapshotConfiguration() - snapshotConfig.snapshotWidth = NSNumber(value: width) - - let image = try await webView.takeSnapshot(configuration: snapshotConfig) - - guard let tiffData = image.tiffRepresentation, - let bitmap = NSBitmapImageRep(data: tiffData), - let pngData = bitmap.representation(using: .png, properties: [:]) else { - throw HTMLRendererError.snapshotFailed - } - - return pngData - } - - /// Replace local image src paths with inline base64 data URLs. - private static func inlineLocalImages(_ html: String, cwd: String) -> String { - // Match src=".png" or src=".jpg" etc. - let pattern = #"src="([^"]+\.(?:png|jpg|jpeg|gif|webp))""# - guard let regex = try? NSRegularExpression(pattern: pattern) else { return html } - let nsHTML = html as NSString - var result = html - let matches = regex.matches(in: html, range: NSRange(location: 0, length: nsHTML.length)) - - // Process in reverse so replacements don't shift ranges - for match in matches.reversed() { - let pathRange = match.range(at: 1) - let path = nsHTML.substring(with: pathRange) - - // Skip data URIs - if path.hasPrefix("data:") { continue } - // Rewrite /api/files/read URLs back to local paths - if path.hasPrefix("http"), path.contains("/api/files/read?path=") { - if let urlComps = URLComponents(string: path), - let localPath = urlComps.queryItems?.first(where: { $0.name == "path" })?.value, - let data = FileManager.default.contents(atPath: cwd + "/" + localPath) { - let ext = (localPath as NSString).pathExtension.lowercased() - let mime = ext == "png" ? "image/png" : ext == "jpg" || ext == "jpeg" ? "image/jpeg" : "image/\(ext)" - let dataURL = "data:\(mime);base64,\(data.base64EncodedString())" - let fullRange = match.range(at: 0) - result = (result as NSString).replacingCharacters(in: fullRange, with: "src=\"\(dataURL)\"") - } - continue - } - if path.hasPrefix("http") { continue } - - // Resolve relative to cwd — try direct path then .asc/app-shots/ prefix - let candidates = [ - path.hasPrefix("/") ? path : cwd + "/" + path, - cwd + "/.asc/app-shots/" + path, - ] - guard let fullPath = candidates.first(where: { FileManager.default.fileExists(atPath: $0) }), - let data = FileManager.default.contents(atPath: fullPath) else { continue } - - let ext = (path as NSString).pathExtension.lowercased() - let mime = ext == "png" ? "image/png" : ext == "jpg" || ext == "jpeg" ? "image/jpeg" : "image/\(ext)" - let dataURL = "data:\(mime);base64,\(data.base64EncodedString())" - - let fullRange = match.range(at: 0) - result = (result as NSString).replacingCharacters(in: fullRange, with: "src=\"\(dataURL)\"") - } - return result - } -} - -private final class NavigationDelegate: NSObject, WKNavigationDelegate { - private var continuation: CheckedContinuation? - - init(continuation: CheckedContinuation) { - self.continuation = continuation - } - - func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { - continuation?.resume() - continuation = nil - } - - func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { - continuation?.resume(throwing: error) - continuation = nil - } - - func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { - continuation?.resume(throwing: error) - continuation = nil - } -} - -enum HTMLRendererError: Error, CustomStringConvertible { - case snapshotFailed - var description: String { - switch self { case .snapshotFailed: "Failed to capture PNG snapshot from rendered HTML" } - } -} -#endif diff --git a/Sources/Infrastructure/Skills/ShellRunner.swift b/Sources/Infrastructure/Skills/ShellRunner.swift deleted file mode 100644 index bf30faec..00000000 --- a/Sources/Infrastructure/Skills/ShellRunner.swift +++ /dev/null @@ -1,76 +0,0 @@ -import Foundation - -/// Abstraction for executing shell commands, enabling testability. -public protocol ShellRunner: Sendable { - func run(command: String, arguments: [String], environment: [String: String]?) async throws -> String -} - -public enum ShellRunnerError: Error, LocalizedError { - case commandNotFound - case executionFailed(exitCode: Int32, stderr: String) - - public var errorDescription: String? { - switch self { - case .commandNotFound: - return "Command not found" - case .executionFailed(let code, let stderr): - return "Command exited with code \(code): \(stderr)" - } - } -} - -/// Runs shell commands via `/usr/bin/env` for real process execution. -public struct SystemShellRunner: ShellRunner { - public init() {} - - public func run(command: String, arguments: [String], environment: [String: String]?) async throws -> String { - let process = Process() - process.executableURL = URL(fileURLWithPath: "/usr/bin/env") - process.arguments = [command] + arguments - process.currentDirectoryURL = FileManager.default.homeDirectoryForCurrentUser - - if let environment { - var env = ProcessInfo.processInfo.environment - for (key, value) in environment { - env[key] = value - } - process.environment = env - } - - // Close stdin so the child process cannot block waiting for input. - process.standardInput = FileHandle.nullDevice - let stdoutPipe = Pipe() - process.standardOutput = stdoutPipe - // Stream stderr directly to the terminal so the user sees progress - // (spinners, banners) in real time. Capture it only for error reporting. - let stderrPipe = Pipe() - process.standardError = stderrPipe - - try process.run() - - // Forward stderr to the terminal in real time while also collecting it - // for error reporting if the process fails. - var stderrData = Data() - let stderrQueue = DispatchQueue(label: "shell-runner-stderr") - stderrQueue.async { - let handle = stderrPipe.fileHandleForReading - while true { - let chunk = handle.availableData - if chunk.isEmpty { break } - FileHandle.standardError.write(chunk) - stderrData.append(chunk) - } - } - - let outputData = stdoutPipe.fileHandleForReading.readDataToEndOfFile() - stderrQueue.sync {} // wait for stderr forwarding to finish - process.waitUntilExit() - - guard process.terminationStatus == 0 else { - let stderr = String(data: stderrData, encoding: .utf8) ?? "" - throw ShellRunnerError.executionFailed(exitCode: process.terminationStatus, stderr: stderr) - } - - return String(data: outputData, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "" - } -} diff --git a/Tests/ASCCommandTests/Commands/AgeRating/AgeRatingGetTests.swift b/Tests/ASCCommandTests/Commands/AgeRating/AgeRatingGetTests.swift index 8d6106aa..5a0066d1 100644 --- a/Tests/ASCCommandTests/Commands/AgeRating/AgeRatingGetTests.swift +++ b/Tests/ASCCommandTests/Commands/AgeRating/AgeRatingGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AgeRatingGetTests { diff --git a/Tests/ASCCommandTests/Commands/AgeRating/AgeRatingUpdateTests.swift b/Tests/ASCCommandTests/Commands/AgeRating/AgeRatingUpdateTests.swift index a0413dcc..214a6274 100644 --- a/Tests/ASCCommandTests/Commands/AgeRating/AgeRatingUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/AgeRating/AgeRatingUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AgeRatingUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/AnalyticsReports/AnalyticsReportsTests.swift b/Tests/ASCCommandTests/Commands/AnalyticsReports/AnalyticsReportsTests.swift index b45f609c..135a1172 100644 --- a/Tests/ASCCommandTests/Commands/AnalyticsReports/AnalyticsReportsTests.swift +++ b/Tests/ASCCommandTests/Commands/AnalyticsReports/AnalyticsReportsTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AnalyticsReportsRequestTests { diff --git a/Tests/ASCCommandTests/Commands/AppCategories/AppCategoriesListTests.swift b/Tests/ASCCommandTests/Commands/AppCategories/AppCategoriesListTests.swift index 2550b55d..94a71d5f 100644 --- a/Tests/ASCCommandTests/Commands/AppCategories/AppCategoriesListTests.swift +++ b/Tests/ASCCommandTests/Commands/AppCategories/AppCategoriesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppCategoriesListTests { diff --git a/Tests/ASCCommandTests/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsTests.swift b/Tests/ASCCommandTests/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsTests.swift index e1019fe2..32594968 100644 --- a/Tests/ASCCommandTests/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsTests.swift +++ b/Tests/ASCCommandTests/Commands/AppClipExperienceLocalizations/AppClipExperienceLocalizationsTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppClipExperienceLocalizationsListTests { diff --git a/Tests/ASCCommandTests/Commands/AppClipExperiences/AppClipExperiencesTests.swift b/Tests/ASCCommandTests/Commands/AppClipExperiences/AppClipExperiencesTests.swift index 8b6a89d1..496ddb74 100644 --- a/Tests/ASCCommandTests/Commands/AppClipExperiences/AppClipExperiencesTests.swift +++ b/Tests/ASCCommandTests/Commands/AppClipExperiences/AppClipExperiencesTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppClipExperiencesListTests { diff --git a/Tests/ASCCommandTests/Commands/AppClips/AppClipsListTests.swift b/Tests/ASCCommandTests/Commands/AppClips/AppClipsListTests.swift index 329abf18..9aa60653 100644 --- a/Tests/ASCCommandTests/Commands/AppClips/AppClipsListTests.swift +++ b/Tests/ASCCommandTests/Commands/AppClips/AppClipsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppClipsListTests { diff --git a/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsCreateTests.swift b/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsCreateTests.swift index d866f051..95d0a5bb 100644 --- a/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppInfoLocalizationsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsDeleteTests.swift b/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsDeleteTests.swift index c84f17e2..fb5d31d8 100644 --- a/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppInfoLocalizationsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsListTests.swift b/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsListTests.swift index 9936efae..dc5be0b2 100644 --- a/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsListTests.swift +++ b/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppInfoLocalizationsListTests { diff --git a/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsUpdateTests.swift b/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsUpdateTests.swift index 0706bc0a..163c3760 100644 --- a/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/AppInfoLocalizations/AppInfoLocalizationsUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppInfoLocalizationsUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/AppInfos/AppInfosListTests.swift b/Tests/ASCCommandTests/Commands/AppInfos/AppInfosListTests.swift index 0cdf7c52..58333c84 100644 --- a/Tests/ASCCommandTests/Commands/AppInfos/AppInfosListTests.swift +++ b/Tests/ASCCommandTests/Commands/AppInfos/AppInfosListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppInfosListTests { diff --git a/Tests/ASCCommandTests/Commands/AppInfos/AppInfosUpdateTests.swift b/Tests/ASCCommandTests/Commands/AppInfos/AppInfosUpdateTests.swift index 1f051b3e..1de87ebe 100644 --- a/Tests/ASCCommandTests/Commands/AppInfos/AppInfosUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/AppInfos/AppInfosUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppInfosUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/AppPreviewSets/AppPreviewSetsCommandTests.swift b/Tests/ASCCommandTests/Commands/AppPreviewSets/AppPreviewSetsCommandTests.swift index 300360fe..43677f8e 100644 --- a/Tests/ASCCommandTests/Commands/AppPreviewSets/AppPreviewSetsCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/AppPreviewSets/AppPreviewSetsCommandTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppPreviewSetsCommandTests { diff --git a/Tests/ASCCommandTests/Commands/AppPreviews/AppPreviewsCommandTests.swift b/Tests/ASCCommandTests/Commands/AppPreviews/AppPreviewsCommandTests.swift index e2f02838..870a21fa 100644 --- a/Tests/ASCCommandTests/Commands/AppPreviews/AppPreviewsCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/AppPreviews/AppPreviewsCommandTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppPreviewsCommandTests { diff --git a/Tests/ASCCommandTests/Commands/AppShots/AppShotsConfigTests.swift b/Tests/ASCCommandTests/Commands/AppShots/AppShotsConfigTests.swift index be36611a..b67e6a21 100644 --- a/Tests/ASCCommandTests/Commands/AppShots/AppShotsConfigTests.swift +++ b/Tests/ASCCommandTests/Commands/AppShots/AppShotsConfigTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppShotsConfigCommandTests { @@ -20,7 +20,7 @@ struct AppShotsConfigCommandTests { @Test func `config shows file key when no flags given`() async throws { let mockStorage = MockAppShotsConfigStorage() - given(mockStorage).load().willReturn(Domain.AppShotsConfig(geminiApiKey: "AIzaSyBUwwho8MWw9gsPDAuIp")) + given(mockStorage).load().willReturn(ASCKit.AppShotsConfig(geminiApiKey: "AIzaSyBUwwho8MWw9gsPDAuIp")) var cmd = try AppShotsConfig.parse([]) let output = try await cmd.execute(storage: mockStorage) @@ -58,7 +58,7 @@ struct AppShotsGenerateKeyResolutionTests { @Test func `resolveApiKey falls back to config file`() throws { let mockStorage = MockAppShotsConfigStorage() - given(mockStorage).load().willReturn(Domain.AppShotsConfig(geminiApiKey: "stored-key")) + given(mockStorage).load().willReturn(ASCKit.AppShotsConfig(geminiApiKey: "stored-key")) let key = try resolveGeminiApiKey(nil, configStorage: mockStorage) #expect(key == "stored-key") } diff --git a/Tests/ASCCommandTests/Commands/AppShots/AppShotsExportTests.swift b/Tests/ASCCommandTests/Commands/AppShots/AppShotsExportTests.swift index 02684bdc..7dd88645 100644 --- a/Tests/ASCCommandTests/Commands/AppShots/AppShotsExportTests.swift +++ b/Tests/ASCCommandTests/Commands/AppShots/AppShotsExportTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("AppShotsExport") struct AppShotsExportTests { diff --git a/Tests/ASCCommandTests/Commands/AppShots/AppShotsGalleryTemplatesTests.swift b/Tests/ASCCommandTests/Commands/AppShots/AppShotsGalleryTemplatesTests.swift index 0bd44578..a1fc83b2 100644 --- a/Tests/ASCCommandTests/Commands/AppShots/AppShotsGalleryTemplatesTests.swift +++ b/Tests/ASCCommandTests/Commands/AppShots/AppShotsGalleryTemplatesTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("AppShotsGalleryTemplates") struct AppShotsGalleryTemplatesTests { diff --git a/Tests/ASCCommandTests/Commands/AppShots/AppShotsGenerateTests.swift b/Tests/ASCCommandTests/Commands/AppShots/AppShotsGenerateTests.swift index d68d84fd..20ccf2cd 100644 --- a/Tests/ASCCommandTests/Commands/AppShots/AppShotsGenerateTests.swift +++ b/Tests/ASCCommandTests/Commands/AppShots/AppShotsGenerateTests.swift @@ -1,7 +1,7 @@ import Foundation import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppShotsGenerateTests { diff --git a/Tests/ASCCommandTests/Commands/AppShots/AppShotsTemplatesTests.swift b/Tests/ASCCommandTests/Commands/AppShots/AppShotsTemplatesTests.swift index 4ffcf068..4e95dd0c 100644 --- a/Tests/ASCCommandTests/Commands/AppShots/AppShotsTemplatesTests.swift +++ b/Tests/ASCCommandTests/Commands/AppShots/AppShotsTemplatesTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("AppShotsTemplates") struct AppShotsTemplatesTests { diff --git a/Tests/ASCCommandTests/Commands/AppShots/AppShotsThemesTests.swift b/Tests/ASCCommandTests/Commands/AppShots/AppShotsThemesTests.swift index cc73d551..572fc2fb 100644 --- a/Tests/ASCCommandTests/Commands/AppShots/AppShotsThemesTests.swift +++ b/Tests/ASCCommandTests/Commands/AppShots/AppShotsThemesTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("AppShotsThemes") struct AppShotsThemesTests { @@ -28,7 +28,7 @@ struct AppShotsThemesTests { // MARK: - List @Test func `list themes returns all themes with affordances`() async throws { - let mockRepo = MockThemeRepository() + let mockRepo = MockThemes() given(mockRepo).listThemes().willReturn([ makeTheme(id: "space", name: "Space"), makeTheme(id: "neon", name: "Neon"), @@ -43,7 +43,7 @@ struct AppShotsThemesTests { } @Test func `list themes table format shows name and icon`() async throws { - let mockRepo = MockThemeRepository() + let mockRepo = MockThemes() given(mockRepo).listThemes().willReturn([ makeTheme(id: "space", name: "Space"), ]) @@ -56,7 +56,7 @@ struct AppShotsThemesTests { // MARK: - Get @Test func `get theme returns specific theme with AI hints`() async throws { - let mockRepo = MockThemeRepository() + let mockRepo = MockThemes() given(mockRepo).getTheme(id: .value("space")).willReturn(makeTheme()) let cmd = try AppShotsThemesGet.parse(["--id", "space", "--pretty"]) @@ -68,7 +68,7 @@ struct AppShotsThemesTests { } @Test func `get theme returns error when not found`() async throws { - let mockRepo = MockThemeRepository() + let mockRepo = MockThemes() given(mockRepo).getTheme(id: .value("nonexistent")).willReturn(nil) let cmd = try AppShotsThemesGet.parse(["--id", "nonexistent"]) @@ -81,7 +81,7 @@ struct AppShotsThemesTests { } @Test func `get theme with context flag outputs buildContext string`() async throws { - let mockRepo = MockThemeRepository() + let mockRepo = MockThemes() given(mockRepo).getTheme(id: .value("space")).willReturn(makeTheme()) let cmd = try AppShotsThemesGet.parse(["--id", "space", "--context"]) @@ -94,7 +94,7 @@ struct AppShotsThemesTests { // MARK: - Apply @Test func `apply renders template then composes with theme`() async throws { - let mockThemeRepo = MockThemeRepository() + let mockThemeRepo = MockThemes() given(mockThemeRepo).compose(themeId: .value("space"), html: .any, canvasWidth: .any, canvasHeight: .any) .willReturn("
themed output
") @@ -114,7 +114,7 @@ struct AppShotsThemesTests { } @Test func `apply with preview image renders HTML to PNG and writes file`() async throws { - let mockThemeRepo = MockThemeRepository() + let mockThemeRepo = MockThemes() given(mockThemeRepo).compose(themeId: .value("space"), html: .any, canvasWidth: .any, canvasHeight: .any) .willReturn("
themed output
") @@ -147,7 +147,7 @@ struct AppShotsThemesTests { } @Test func `apply defaults to html output when no preview flag`() async throws { - let mockThemeRepo = MockThemeRepository() + let mockThemeRepo = MockThemes() given(mockThemeRepo).compose(themeId: .value("space"), html: .any, canvasWidth: .any, canvasHeight: .any) .willReturn("
themed
") @@ -168,7 +168,7 @@ struct AppShotsThemesTests { // MARK: - Design (separate subcommand) @Test func `design outputs ThemeDesign JSON from AI`() async throws { - let mockThemeRepo = MockThemeRepository() + let mockThemeRepo = MockThemes() let design = ThemeDesign( palette: GalleryPalette(id: "space", name: "Space", background: "linear-gradient(135deg, #0f172a, #7c3aed)", @@ -218,7 +218,7 @@ struct AppShotsThemesTests { } @Test func `apply fails when template not found`() async throws { - let mockThemeRepo = MockThemeRepository() + let mockThemeRepo = MockThemes() let mockTemplateRepo = MockTemplateRepository() given(mockTemplateRepo).getTemplate(id: .value("nope")).willReturn(nil) diff --git a/Tests/ASCCommandTests/Commands/AppWall/AppWallSubmitTests.swift b/Tests/ASCCommandTests/Commands/AppWall/AppWallSubmitTests.swift index 744aebd8..61a8733c 100644 --- a/Tests/ASCCommandTests/Commands/AppWall/AppWallSubmitTests.swift +++ b/Tests/ASCCommandTests/Commands/AppWall/AppWallSubmitTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("AppWallSubmit") struct AppWallSubmitTests { @Test func `submit with all flags returns PR details`() async throws { - let mockRepo = MockAppWallRepository() + let mockRepo = MockAppWall() given(mockRepo).submit(app: .any).willReturn( AppWallSubmission( prNumber: 42, @@ -32,7 +32,7 @@ struct AppWallSubmitTests { } @Test func `submit with just app-id works`() async throws { - let mockRepo = MockAppWallRepository() + let mockRepo = MockAppWall() given(mockRepo).submit(app: .any).willReturn( AppWallSubmission( prNumber: 20, @@ -51,7 +51,7 @@ struct AppWallSubmitTests { } @Test func `submit with app-id and developer works`() async throws { - let mockRepo = MockAppWallRepository() + let mockRepo = MockAppWall() given(mockRepo).submit(app: .any).willReturn( AppWallSubmission( prNumber: 15, @@ -71,7 +71,7 @@ struct AppWallSubmitTests { } @Test func `submit without any app source throws validation error`() async throws { - let mockRepo = MockAppWallRepository() + let mockRepo = MockAppWall() var cmd = try AppWallSubmit.parse([ "--developer", "tddworks", @@ -84,7 +84,7 @@ struct AppWallSubmitTests { } @Test func `submit with specific app URLs passes apps array`() async throws { - let mockRepo = MockAppWallRepository() + let mockRepo = MockAppWall() given(mockRepo).submit(app: .any).willReturn( AppWallSubmission( prNumber: 10, @@ -105,7 +105,7 @@ struct AppWallSubmitTests { } @Test func `submit with developer-id alone works`() async throws { - let mockRepo = MockAppWallRepository() + let mockRepo = MockAppWall() given(mockRepo).submit(app: .any).willReturn( AppWallSubmission( prNumber: 7, diff --git a/Tests/ASCCommandTests/Commands/Apps/AppPricingCommandsTests.swift b/Tests/ASCCommandTests/Commands/Apps/AppPricingCommandsTests.swift index 2f221fed..a6ec193d 100644 --- a/Tests/ASCCommandTests/Commands/Apps/AppPricingCommandsTests.swift +++ b/Tests/ASCCommandTests/Commands/Apps/AppPricingCommandsTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppPricingCommandsTests { diff --git a/Tests/ASCCommandTests/Commands/Apps/AppsListTests.swift b/Tests/ASCCommandTests/Commands/Apps/AppsListTests.swift index e4893d76..7ccf36b8 100644 --- a/Tests/ASCCommandTests/Commands/Apps/AppsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Apps/AppsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppsListTests { diff --git a/Tests/ASCCommandTests/Commands/Apps/AppsUpdateTests.swift b/Tests/ASCCommandTests/Commands/Apps/AppsUpdateTests.swift index b32e5e5b..1d8e3bd5 100644 --- a/Tests/ASCCommandTests/Commands/Apps/AppsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/Apps/AppsUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppsUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/Apps/Availability/AppAvailabilityCreateTests.swift b/Tests/ASCCommandTests/Commands/Apps/Availability/AppAvailabilityCreateTests.swift index 4a1767d6..ae5a6edd 100644 --- a/Tests/ASCCommandTests/Commands/Apps/Availability/AppAvailabilityCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/Apps/Availability/AppAvailabilityCreateTests.swift @@ -2,7 +2,7 @@ import ArgumentParser import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppAvailabilityCreateTests { diff --git a/Tests/ASCCommandTests/Commands/Apps/Availability/AppAvailabilityGetTests.swift b/Tests/ASCCommandTests/Commands/Apps/Availability/AppAvailabilityGetTests.swift index d48f6162..0e22be16 100644 --- a/Tests/ASCCommandTests/Commands/Apps/Availability/AppAvailabilityGetTests.swift +++ b/Tests/ASCCommandTests/Commands/Apps/Availability/AppAvailabilityGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppAvailabilityGetTests { diff --git a/Tests/ASCCommandTests/Commands/AssetLibrary/AssetImagesCommandTests.swift b/Tests/ASCCommandTests/Commands/AssetLibrary/AssetImagesCommandTests.swift index 0200f800..69081862 100644 --- a/Tests/ASCCommandTests/Commands/AssetLibrary/AssetImagesCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/AssetLibrary/AssetImagesCommandTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AssetImagesCommandTests { diff --git a/Tests/ASCCommandTests/Commands/AssetLibrary/AssetLibraryCommandTests.swift b/Tests/ASCCommandTests/Commands/AssetLibrary/AssetLibraryCommandTests.swift index 8cfb9dbc..f4a87166 100644 --- a/Tests/ASCCommandTests/Commands/AssetLibrary/AssetLibraryCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/AssetLibrary/AssetLibraryCommandTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AssetLibraryCommandTests { diff --git a/Tests/ASCCommandTests/Commands/AssetLibrary/AssetPlacementsCommandTests.swift b/Tests/ASCCommandTests/Commands/AssetLibrary/AssetPlacementsCommandTests.swift index cf9456ca..ca6ce0f7 100644 --- a/Tests/ASCCommandTests/Commands/AssetLibrary/AssetPlacementsCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/AssetLibrary/AssetPlacementsCommandTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AssetPlacementsCommandTests { diff --git a/Tests/ASCCommandTests/Commands/AssetLibrary/AssetVideosCommandTests.swift b/Tests/ASCCommandTests/Commands/AssetLibrary/AssetVideosCommandTests.swift index 8f715bdf..5537ff7e 100644 --- a/Tests/ASCCommandTests/Commands/AssetLibrary/AssetVideosCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/AssetLibrary/AssetVideosCommandTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AssetVideosCommandTests { diff --git a/Tests/ASCCommandTests/Commands/Auth/AuthCheckTests.swift b/Tests/ASCCommandTests/Commands/Auth/AuthCheckTests.swift index ff6379ed..0837d45e 100644 --- a/Tests/ASCCommandTests/Commands/Auth/AuthCheckTests.swift +++ b/Tests/ASCCommandTests/Commands/Auth/AuthCheckTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AuthCheckTests { diff --git a/Tests/ASCCommandTests/Commands/Auth/AuthListTests.swift b/Tests/ASCCommandTests/Commands/Auth/AuthListTests.swift index 0610c1ba..b0351226 100644 --- a/Tests/ASCCommandTests/Commands/Auth/AuthListTests.swift +++ b/Tests/ASCCommandTests/Commands/Auth/AuthListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AuthListTests { diff --git a/Tests/ASCCommandTests/Commands/Auth/AuthLoginTests.swift b/Tests/ASCCommandTests/Commands/Auth/AuthLoginTests.swift index f74e052e..f7d1c4a1 100644 --- a/Tests/ASCCommandTests/Commands/Auth/AuthLoginTests.swift +++ b/Tests/ASCCommandTests/Commands/Auth/AuthLoginTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AuthLoginTests { diff --git a/Tests/ASCCommandTests/Commands/Auth/AuthLogoutTests.swift b/Tests/ASCCommandTests/Commands/Auth/AuthLogoutTests.swift index b047788d..e9f68ed6 100644 --- a/Tests/ASCCommandTests/Commands/Auth/AuthLogoutTests.swift +++ b/Tests/ASCCommandTests/Commands/Auth/AuthLogoutTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AuthLogoutTests { diff --git a/Tests/ASCCommandTests/Commands/Auth/AuthUpdateTests.swift b/Tests/ASCCommandTests/Commands/Auth/AuthUpdateTests.swift index a4b6177b..5d71e103 100644 --- a/Tests/ASCCommandTests/Commands/Auth/AuthUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/Auth/AuthUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AuthUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/Auth/AuthUseTests.swift b/Tests/ASCCommandTests/Commands/Auth/AuthUseTests.swift index 01c19e81..1c65dbc7 100644 --- a/Tests/ASCCommandTests/Commands/Auth/AuthUseTests.swift +++ b/Tests/ASCCommandTests/Commands/Auth/AuthUseTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AuthUseTests { diff --git a/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsCreateTests.swift b/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsCreateTests.swift index a38a460b..3fce3490 100644 --- a/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaAppLocalizationsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsDeleteTests.swift b/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsDeleteTests.swift index 72f535e8..480b3423 100644 --- a/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaAppLocalizationsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsGetTests.swift b/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsGetTests.swift index 8fbae49d..f814dfd9 100644 --- a/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsGetTests.swift +++ b/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaAppLocalizationsGetTests { diff --git a/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsListTests.swift b/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsListTests.swift index 3da761fa..4ef0a425 100644 --- a/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsListTests.swift +++ b/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaAppLocalizationsListTests { diff --git a/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsUpdateTests.swift b/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsUpdateTests.swift index 7055d5cc..d1409006 100644 --- a/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/BetaAppLocalizations/BetaAppLocalizationsUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaAppLocalizationsUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewDetailGetTests.swift b/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewDetailGetTests.swift index 829f2901..a92edd95 100644 --- a/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewDetailGetTests.swift +++ b/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewDetailGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaReviewDetailGetTests { diff --git a/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewDetailUpdateTests.swift b/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewDetailUpdateTests.swift index 1c74bf89..d57f9766 100644 --- a/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewDetailUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewDetailUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaReviewDetailUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsCreateTests.swift b/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsCreateTests.swift index 6493c92f..75838909 100644 --- a/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaReviewSubmissionsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsGetTests.swift b/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsGetTests.swift index c6c8fd75..9931a98b 100644 --- a/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsGetTests.swift +++ b/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaReviewSubmissionsGetTests { diff --git a/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsListTests.swift b/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsListTests.swift index 94eafdde..b2095e1b 100644 --- a/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsListTests.swift +++ b/Tests/ASCCommandTests/Commands/BetaReview/BetaReviewSubmissionsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaReviewSubmissionsListTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsAddBetaGroupTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsAddBetaGroupTests.swift index 4b355bb4..7c4f6734 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsAddBetaGroupTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsAddBetaGroupTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsAddBetaGroupTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsArchiveTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsArchiveTests.swift index 16d6c320..ff0f61be 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsArchiveTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsArchiveTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsArchiveTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsListTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsListTests.swift index e47bdbfc..63d6c040 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsListTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsNextNumberTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsNextNumberTests.swift index 2abae943..61c5e214 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsNextNumberTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsNextNumberTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsNextNumberTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsRemoveBetaGroupTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsRemoveBetaGroupTests.swift index c2b504b0..0c41dde4 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsRemoveBetaGroupTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsRemoveBetaGroupTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsRemoveBetaGroupTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsSetEncryptionComplianceTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsSetEncryptionComplianceTests.swift index 6a419097..b5048e98 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsSetEncryptionComplianceTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsSetEncryptionComplianceTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsSetEncryptionComplianceTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsUpdateBetaNotesTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsUpdateBetaNotesTests.swift index f78fe4a4..502ae79c 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsUpdateBetaNotesTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsUpdateBetaNotesTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsUpdateBetaNotesTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsUploadTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsUploadTests.swift index e4684779..3a82d6e6 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsUploadTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsUploadTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsUploadCommandTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsDeleteTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsDeleteTests.swift index 806bd988..3d4cb535 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsUploadsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsGetTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsGetTests.swift index fb24d496..319be93f 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsGetTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsUploadsGetTests { diff --git a/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsListTests.swift b/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsListTests.swift index cf330fae..027aa14e 100644 --- a/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Builds/BuildsUploadsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BuildsUploadsListTests { diff --git a/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsCreateTests.swift b/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsCreateTests.swift index 11254ae8..3619f308 100644 --- a/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BundleIDsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsDeleteTests.swift b/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsDeleteTests.swift index 4da92d4f..3ff0e1f2 100644 --- a/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BundleIDsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsListTests.swift b/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsListTests.swift index 55de0bc3..f6a25afe 100644 --- a/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsListTests.swift +++ b/Tests/ASCCommandTests/Commands/BundleIDs/BundleIDsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BundleIDsListTests { diff --git a/Tests/ASCCommandTests/Commands/Certificates/CertificatesCreateTests.swift b/Tests/ASCCommandTests/Commands/Certificates/CertificatesCreateTests.swift index c1abff4d..34749c12 100644 --- a/Tests/ASCCommandTests/Commands/Certificates/CertificatesCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/Certificates/CertificatesCreateTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct CertificatesCreateTests { diff --git a/Tests/ASCCommandTests/Commands/Certificates/CertificatesListTests.swift b/Tests/ASCCommandTests/Commands/Certificates/CertificatesListTests.swift index 8246d62b..be75c3b2 100644 --- a/Tests/ASCCommandTests/Commands/Certificates/CertificatesListTests.swift +++ b/Tests/ASCCommandTests/Commands/Certificates/CertificatesListTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct CertificatesListTests { diff --git a/Tests/ASCCommandTests/Commands/Certificates/CertificatesRevokeTests.swift b/Tests/ASCCommandTests/Commands/Certificates/CertificatesRevokeTests.swift index d643b9dd..f52c49f1 100644 --- a/Tests/ASCCommandTests/Commands/Certificates/CertificatesRevokeTests.swift +++ b/Tests/ASCCommandTests/Commands/Certificates/CertificatesRevokeTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct CertificatesRevokeTests { diff --git a/Tests/ASCCommandTests/Commands/Devices/DevicesListTests.swift b/Tests/ASCCommandTests/Commands/Devices/DevicesListTests.swift index a44a1946..6dffd7d1 100644 --- a/Tests/ASCCommandTests/Commands/Devices/DevicesListTests.swift +++ b/Tests/ASCCommandTests/Commands/Devices/DevicesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct DevicesListTests { diff --git a/Tests/ASCCommandTests/Commands/Devices/DevicesRegisterTests.swift b/Tests/ASCCommandTests/Commands/Devices/DevicesRegisterTests.swift index f0345955..9645faec 100644 --- a/Tests/ASCCommandTests/Commands/Devices/DevicesRegisterTests.swift +++ b/Tests/ASCCommandTests/Commands/Devices/DevicesRegisterTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct DevicesRegisterTests { diff --git a/Tests/ASCCommandTests/Commands/Experiments/ExperimentTreatmentLocalizationsTests.swift b/Tests/ASCCommandTests/Commands/Experiments/ExperimentTreatmentLocalizationsTests.swift index 53d803c0..d556f95b 100644 --- a/Tests/ASCCommandTests/Commands/Experiments/ExperimentTreatmentLocalizationsTests.swift +++ b/Tests/ASCCommandTests/Commands/Experiments/ExperimentTreatmentLocalizationsTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ExperimentTreatmentLocalizationsTests { diff --git a/Tests/ASCCommandTests/Commands/Experiments/ExperimentTreatmentsTests.swift b/Tests/ASCCommandTests/Commands/Experiments/ExperimentTreatmentsTests.swift index 42af10c1..f8d83609 100644 --- a/Tests/ASCCommandTests/Commands/Experiments/ExperimentTreatmentsTests.swift +++ b/Tests/ASCCommandTests/Commands/Experiments/ExperimentTreatmentsTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit private func makeTreatment(id: String = "trt-1", experimentId: String = "exp-1", appIconName: String? = "AppIcon-Blue") -> ExperimentTreatment { ExperimentTreatment(id: id, experimentId: experimentId, name: "Blue icon", appIconName: appIconName) diff --git a/Tests/ASCCommandTests/Commands/Experiments/ExperimentsTests.swift b/Tests/ASCCommandTests/Commands/Experiments/ExperimentsTests.swift index 39e4990d..36b7af0c 100644 --- a/Tests/ASCCommandTests/Commands/Experiments/ExperimentsTests.swift +++ b/Tests/ASCCommandTests/Commands/Experiments/ExperimentsTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit private func makeExperiment( id: String = "exp-1", diff --git a/Tests/ASCCommandTests/Commands/GameCenter/GameCenterCommandTests.swift b/Tests/ASCCommandTests/Commands/GameCenter/GameCenterCommandTests.swift index 4f83005f..b8f61eec 100644 --- a/Tests/ASCCommandTests/Commands/GameCenter/GameCenterCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/GameCenter/GameCenterCommandTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct GameCenterDetailGetTests { diff --git a/Tests/ASCCommandTests/Commands/GameCenter/GameCenterModerationCommandTests.swift b/Tests/ASCCommandTests/Commands/GameCenter/GameCenterModerationCommandTests.swift index c4f4314a..43547749 100644 --- a/Tests/ASCCommandTests/Commands/GameCenter/GameCenterModerationCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/GameCenter/GameCenterModerationCommandTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit private func makeScore( id: String = "mod-1", diff --git a/Tests/ASCCommandTests/Commands/IAP/Availability/IAPAvailabilityCreateTests.swift b/Tests/ASCCommandTests/Commands/IAP/Availability/IAPAvailabilityCreateTests.swift index ae527cf1..3b2ba4bd 100644 --- a/Tests/ASCCommandTests/Commands/IAP/Availability/IAPAvailabilityCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/Availability/IAPAvailabilityCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPAvailabilityCreateTests { diff --git a/Tests/ASCCommandTests/Commands/IAP/Availability/IAPAvailabilityGetTests.swift b/Tests/ASCCommandTests/Commands/IAP/Availability/IAPAvailabilityGetTests.swift index b9136932..2efff7e9 100644 --- a/Tests/ASCCommandTests/Commands/IAP/Availability/IAPAvailabilityGetTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/Availability/IAPAvailabilityGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPAvailabilityGetTests { diff --git a/Tests/ASCCommandTests/Commands/IAP/IAPCreateTests.swift b/Tests/ASCCommandTests/Commands/IAP/IAPCreateTests.swift index 2a56d46e..269b0f41 100644 --- a/Tests/ASCCommandTests/Commands/IAP/IAPCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/IAPCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPCreateTests { diff --git a/Tests/ASCCommandTests/Commands/IAP/IAPDeleteTests.swift b/Tests/ASCCommandTests/Commands/IAP/IAPDeleteTests.swift index 4e46f7f2..8c8ba91e 100644 --- a/Tests/ASCCommandTests/Commands/IAP/IAPDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/IAPDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/IAP/IAPListTests.swift b/Tests/ASCCommandTests/Commands/IAP/IAPListTests.swift index 56df0a4b..f25c2e9c 100644 --- a/Tests/ASCCommandTests/Commands/IAP/IAPListTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/IAPListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPListTests { diff --git a/Tests/ASCCommandTests/Commands/IAP/IAPPricePointsListTests.swift b/Tests/ASCCommandTests/Commands/IAP/IAPPricePointsListTests.swift index 4380fedd..4845da4a 100644 --- a/Tests/ASCCommandTests/Commands/IAP/IAPPricePointsListTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/IAPPricePointsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPPricePointsListTests { diff --git a/Tests/ASCCommandTests/Commands/IAP/IAPPricesSetTests.swift b/Tests/ASCCommandTests/Commands/IAP/IAPPricesSetTests.swift index 15f8e8df..7e157f99 100644 --- a/Tests/ASCCommandTests/Commands/IAP/IAPPricesSetTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/IAPPricesSetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPPricesSetTests { diff --git a/Tests/ASCCommandTests/Commands/IAP/IAPSubmitTests.swift b/Tests/ASCCommandTests/Commands/IAP/IAPSubmitTests.swift index f496e7a7..7dfebcfc 100644 --- a/Tests/ASCCommandTests/Commands/IAP/IAPSubmitTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/IAPSubmitTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPSubmitTests { diff --git a/Tests/ASCCommandTests/Commands/IAP/IAPUnsubmitTests.swift b/Tests/ASCCommandTests/Commands/IAP/IAPUnsubmitTests.swift index bbc6c757..576bb817 100644 --- a/Tests/ASCCommandTests/Commands/IAP/IAPUnsubmitTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/IAPUnsubmitTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPUnsubmitTests { diff --git a/Tests/ASCCommandTests/Commands/IAP/IAPUpdateTests.swift b/Tests/ASCCommandTests/Commands/IAP/IAPUpdateTests.swift index 3fbc13a8..331bcfee 100644 --- a/Tests/ASCCommandTests/Commands/IAP/IAPUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/IAPUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/IAP/IAPVersionsListTests.swift b/Tests/ASCCommandTests/Commands/IAP/IAPVersionsListTests.swift index 73905651..404eed9c 100644 --- a/Tests/ASCCommandTests/Commands/IAP/IAPVersionsListTests.swift +++ b/Tests/ASCCommandTests/Commands/IAP/IAPVersionsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPVersionsListTests { diff --git a/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsCreateTests.swift b/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsCreateTests.swift index b9aaf9a4..78cf2184 100644 --- a/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPLocalizationsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsDeleteTests.swift b/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsDeleteTests.swift index 4731ac51..2ddac85d 100644 --- a/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPLocalizationsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsListTests.swift b/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsListTests.swift index d28717e7..11996b31 100644 --- a/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsListTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPLocalizationsListTests { diff --git a/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsUpdateTests.swift b/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsUpdateTests.swift index 503da2ff..b274b043 100644 --- a/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPLocalizations/IAPLocalizationsUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPLocalizationsUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesCreateTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesCreateTests.swift index 96b396c4..5c640a2c 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodeCustomCodesCreateTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesListTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesListTests.swift index 5fd155a1..42c3cf96 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesListTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodeCustomCodesListTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesUpdateTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesUpdateTests.swift index 643efd42..366bcfb1 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodeCustomCodes/IAPOfferCodeCustomCodesUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodeCustomCodesUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesCreateTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesCreateTests.swift index 2a642880..08b63954 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodeOneTimeCodesCreateTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesListTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesListTests.swift index da6d4326..336c6377 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesListTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodeOneTimeCodesListTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesUpdateTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesUpdateTests.swift index 1ad5ed7c..ea3b1aef 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodeOneTimeCodesUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesValuesTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesValuesTests.swift index 308f9046..ab26cae1 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesValuesTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodeOneTimeCodes/IAPOfferCodeOneTimeCodesValuesTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodeOneTimeCodesValuesTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesCreateTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesCreateTests.swift index b1e24b66..0d6dd60c 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodesCreateTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesListTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesListTests.swift index 91e42bdd..477af90c 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesListTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodesListTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesPricesListTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesPricesListTests.swift index 68a15e53..3fbc9502 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesPricesListTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesPricesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodesPricesListTests { diff --git a/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesUpdateTests.swift b/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesUpdateTests.swift index e00f180e..47662ac7 100644 --- a/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPOfferCodes/IAPOfferCodesUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPOfferCodesUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/IAPReviewScreenshot/IAPReviewScreenshotTests.swift b/Tests/ASCCommandTests/Commands/IAPReviewScreenshot/IAPReviewScreenshotTests.swift index d07be577..5f29bd32 100644 --- a/Tests/ASCCommandTests/Commands/IAPReviewScreenshot/IAPReviewScreenshotTests.swift +++ b/Tests/ASCCommandTests/Commands/IAPReviewScreenshot/IAPReviewScreenshotTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IAPReviewScreenshotGetTests { diff --git a/Tests/ASCCommandTests/Commands/Init/InitCommandTests.swift b/Tests/ASCCommandTests/Commands/Init/InitCommandTests.swift index 6ec221d3..849a2751 100644 --- a/Tests/ASCCommandTests/Commands/Init/InitCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/Init/InitCommandTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct InitCommandTests { diff --git a/Tests/ASCCommandTests/Commands/Iris/InAppPurchases/IrisIAPSubmissionsCreateTests.swift b/Tests/ASCCommandTests/Commands/Iris/InAppPurchases/IrisIAPSubmissionsCreateTests.swift index 47daf6bc..62b78be2 100644 --- a/Tests/ASCCommandTests/Commands/Iris/InAppPurchases/IrisIAPSubmissionsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/Iris/InAppPurchases/IrisIAPSubmissionsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IrisIAPSubmissionsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/Iris/InAppPurchases/IrisIAPSubmissionsDeleteTests.swift b/Tests/ASCCommandTests/Commands/Iris/InAppPurchases/IrisIAPSubmissionsDeleteTests.swift index c9dc9c0a..cfdb264f 100644 --- a/Tests/ASCCommandTests/Commands/Iris/InAppPurchases/IrisIAPSubmissionsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/Iris/InAppPurchases/IrisIAPSubmissionsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IrisIAPSubmissionsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/Iris/IrisAppsCreateTests.swift b/Tests/ASCCommandTests/Commands/Iris/IrisAppsCreateTests.swift index c924aa06..19fe6279 100644 --- a/Tests/ASCCommandTests/Commands/Iris/IrisAppsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/Iris/IrisAppsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IrisAppsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/Iris/IrisAppsListTests.swift b/Tests/ASCCommandTests/Commands/Iris/IrisAppsListTests.swift index d9131441..ec62f445 100644 --- a/Tests/ASCCommandTests/Commands/Iris/IrisAppsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Iris/IrisAppsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IrisAppsListTests { diff --git a/Tests/ASCCommandTests/Commands/Iris/IrisStatusTests.swift b/Tests/ASCCommandTests/Commands/Iris/IrisStatusTests.swift index d86a3193..e2e266b5 100644 --- a/Tests/ASCCommandTests/Commands/Iris/IrisStatusTests.swift +++ b/Tests/ASCCommandTests/Commands/Iris/IrisStatusTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IrisStatusTests { @@ -9,7 +9,7 @@ struct IrisStatusTests { @Test func `status shows source and cookie count with affordances`() async throws { let mockCookieProvider = MockIrisCookieProvider() given(mockCookieProvider).resolveStatus().willReturn( - Domain.IrisStatus(source: .browser, cookieCount: 5) + ASCKit.IrisStatus(source: .browser, cookieCount: 5) ) let cmd = try ASCCommand.IrisStatus.parse(["--pretty"]) @@ -35,7 +35,7 @@ struct IrisStatusTests { @Test func `status shows environment source`() async throws { let mockCookieProvider = MockIrisCookieProvider() given(mockCookieProvider).resolveStatus().willReturn( - Domain.IrisStatus(source: .environment, cookieCount: 3) + ASCKit.IrisStatus(source: .environment, cookieCount: 3) ) let cmd = try ASCCommand.IrisStatus.parse(["--pretty"]) diff --git a/Tests/ASCCommandTests/Commands/Iris/ResolutionCenter/IrisResolutionCenterGetTests.swift b/Tests/ASCCommandTests/Commands/Iris/ResolutionCenter/IrisResolutionCenterGetTests.swift index b6286a87..145e81a2 100644 --- a/Tests/ASCCommandTests/Commands/Iris/ResolutionCenter/IrisResolutionCenterGetTests.swift +++ b/Tests/ASCCommandTests/Commands/Iris/ResolutionCenter/IrisResolutionCenterGetTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct IrisResolutionCenterGetTests { diff --git a/Tests/ASCCommandTests/Commands/Performance/DiagnosticLogsListTests.swift b/Tests/ASCCommandTests/Commands/Performance/DiagnosticLogsListTests.swift index eebdde78..b6daa6cf 100644 --- a/Tests/ASCCommandTests/Commands/Performance/DiagnosticLogsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Performance/DiagnosticLogsListTests.swift @@ -1,6 +1,6 @@ import Testing import Mockable -@testable import Domain +@testable import ASCKit @testable import ASCCommand @Suite diff --git a/Tests/ASCCommandTests/Commands/Performance/DiagnosticsListTests.swift b/Tests/ASCCommandTests/Commands/Performance/DiagnosticsListTests.swift index 474e20ff..8848daba 100644 --- a/Tests/ASCCommandTests/Commands/Performance/DiagnosticsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Performance/DiagnosticsListTests.swift @@ -1,6 +1,6 @@ import Testing import Mockable -@testable import Domain +@testable import ASCKit @testable import ASCCommand @Suite diff --git a/Tests/ASCCommandTests/Commands/Performance/PerfMetricsListTests.swift b/Tests/ASCCommandTests/Commands/Performance/PerfMetricsListTests.swift index ebb07abc..7dbae9c2 100644 --- a/Tests/ASCCommandTests/Commands/Performance/PerfMetricsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Performance/PerfMetricsListTests.swift @@ -1,6 +1,6 @@ import Testing import Mockable -@testable import Domain +@testable import ASCKit @testable import ASCCommand @Suite diff --git a/Tests/ASCCommandTests/Commands/Performance/PerfOverviewGetTests.swift b/Tests/ASCCommandTests/Commands/Performance/PerfOverviewGetTests.swift index 70838f7b..cf37d73b 100644 --- a/Tests/ASCCommandTests/Commands/Performance/PerfOverviewGetTests.swift +++ b/Tests/ASCCommandTests/Commands/Performance/PerfOverviewGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct PerfOverviewGetTests { diff --git a/Tests/ASCCommandTests/Commands/Plugins/PluginsListTests.swift b/Tests/ASCCommandTests/Commands/Plugins/PluginsListTests.swift index 81403960..b9bb3bc9 100644 --- a/Tests/ASCCommandTests/Commands/Plugins/PluginsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Plugins/PluginsListTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("PluginsList — list installed dylib plugins") struct PluginsListTests { @Test func `list shows installed plugins with affordances`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).listInstalled().willReturn([ Plugin(id: "asc-pro", name: "ASC Pro", version: "1.0", description: "Simulator streaming", author: "tddworks", @@ -23,7 +23,7 @@ struct PluginsListTests { } @Test func `list shows empty data when no plugins installed`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).listInstalled().willReturn([]) let cmd = try PluginsList.parse(["--pretty"]) diff --git a/Tests/ASCCommandTests/Commands/Plugins/PluginsMarketTests.swift b/Tests/ASCCommandTests/Commands/Plugins/PluginsMarketTests.swift index 5fdabc26..787abe9d 100644 --- a/Tests/ASCCommandTests/Commands/Plugins/PluginsMarketTests.swift +++ b/Tests/ASCCommandTests/Commands/Plugins/PluginsMarketTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("PluginsMarket — browse and search marketplace") struct PluginsMarketTests { @Test func `market list shows available plugins with install affordance`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).listAvailable().willReturn([ Plugin( id: "asc-pro", name: "ASC Pro", version: "1.0", @@ -28,7 +28,7 @@ struct PluginsMarketTests { } @Test func `market search filters by query`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).searchAvailable(query: .value("sim")).willReturn([ Plugin(id: "asc-pro", name: "ASC Pro", version: "1.0", description: "Simulator streaming", @@ -43,7 +43,7 @@ struct PluginsMarketTests { } @Test func `market list shows uninstall affordance for installed plugins`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).listAvailable().willReturn([ Plugin(id: "asc-pro", name: "ASC Pro", version: "1.0", description: "Pro features", diff --git a/Tests/ASCCommandTests/Commands/Plugins/PluginsUpdateTests.swift b/Tests/ASCCommandTests/Commands/Plugins/PluginsUpdateTests.swift index 9de57daf..b2d56abd 100644 --- a/Tests/ASCCommandTests/Commands/Plugins/PluginsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/Plugins/PluginsUpdateTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("PluginsUpdate — apply an update to one plugin") struct PluginsUpdateTests { @Test func `updated plugin is returned with the new version and installed affordances`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).update(name: .value("Hello")).willReturn( Plugin( id: "Hello.plugin", diff --git a/Tests/ASCCommandTests/Commands/Plugins/PluginsUpdatesTests.swift b/Tests/ASCCommandTests/Commands/Plugins/PluginsUpdatesTests.swift index 83e29e36..178a5bcf 100644 --- a/Tests/ASCCommandTests/Commands/Plugins/PluginsUpdatesTests.swift +++ b/Tests/ASCCommandTests/Commands/Plugins/PluginsUpdatesTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("PluginsUpdates — list outdated plugins") struct PluginsUpdatesTests { @Test func `outdated plugins are listed with installed and latest versions plus update affordance`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).listOutdated().willReturn([ PluginUpdate( name: "Hello", @@ -37,7 +37,7 @@ struct PluginsUpdatesTests { } @Test func `no outdated plugins returns empty data array`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).listOutdated().willReturn([]) let cmd = try PluginsUpdates.parse(["--pretty"]) let output = try await cmd.execute(repo: mockRepo) diff --git a/Tests/ASCCommandTests/Commands/Profiles/ProfilesCreateTests.swift b/Tests/ASCCommandTests/Commands/Profiles/ProfilesCreateTests.swift index 6f1b6789..da4df370 100644 --- a/Tests/ASCCommandTests/Commands/Profiles/ProfilesCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/Profiles/ProfilesCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ProfilesCreateTests { diff --git a/Tests/ASCCommandTests/Commands/Profiles/ProfilesDeleteTests.swift b/Tests/ASCCommandTests/Commands/Profiles/ProfilesDeleteTests.swift index bf4b9fe9..fe868107 100644 --- a/Tests/ASCCommandTests/Commands/Profiles/ProfilesDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/Profiles/ProfilesDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ProfilesDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/Profiles/ProfilesListTests.swift b/Tests/ASCCommandTests/Commands/Profiles/ProfilesListTests.swift index 96eea62a..5869d84b 100644 --- a/Tests/ASCCommandTests/Commands/Profiles/ProfilesListTests.swift +++ b/Tests/ASCCommandTests/Commands/Profiles/ProfilesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ProfilesListTests { diff --git a/Tests/ASCCommandTests/Commands/PromotedPurchases/PromotedPurchasesTests.swift b/Tests/ASCCommandTests/Commands/PromotedPurchases/PromotedPurchasesTests.swift index c20fd58b..31875536 100644 --- a/Tests/ASCCommandTests/Commands/PromotedPurchases/PromotedPurchasesTests.swift +++ b/Tests/ASCCommandTests/Commands/PromotedPurchases/PromotedPurchasesTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit private func makePromoted(id: String = "pp-1", appId: String = "app-1") -> PromotedPurchase { PromotedPurchase(id: id, appId: appId, isVisibleForAllUsers: true, isEnabled: true, diff --git a/Tests/ASCCommandTests/Commands/Reports/FinanceReportsDownloadTests.swift b/Tests/ASCCommandTests/Commands/Reports/FinanceReportsDownloadTests.swift index 1807b6e6..19554a69 100644 --- a/Tests/ASCCommandTests/Commands/Reports/FinanceReportsDownloadTests.swift +++ b/Tests/ASCCommandTests/Commands/Reports/FinanceReportsDownloadTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct FinanceReportsDownloadTests { @Test func `downloads finance report and outputs JSON with row data`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() given(mockRepo).downloadFinanceReport( vendorNumber: .any, reportType: .any, @@ -40,7 +40,7 @@ struct FinanceReportsDownloadTests { } @Test func `resolves vendor number from storage when not provided`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() let mockStorage = MockAuthStorage() let accounts = [ConnectAccount(name: "work", keyID: "KEY1", issuerID: "ISS1", isActive: true, vendorNumber: "88012345")] given(mockStorage).loadAll().willReturn(accounts) @@ -65,7 +65,7 @@ struct FinanceReportsDownloadTests { } @Test func `throws when vendor number missing from both flag and storage`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() let mockStorage = MockAuthStorage() given(mockStorage).loadAll().willReturn([]) @@ -81,7 +81,7 @@ struct FinanceReportsDownloadTests { } @Test func `table output includes row values`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() given(mockRepo).downloadFinanceReport( vendorNumber: .any, reportType: .any, diff --git a/Tests/ASCCommandTests/Commands/Reports/SalesReportsDownloadTests.swift b/Tests/ASCCommandTests/Commands/Reports/SalesReportsDownloadTests.swift index 758418a8..1c565019 100644 --- a/Tests/ASCCommandTests/Commands/Reports/SalesReportsDownloadTests.swift +++ b/Tests/ASCCommandTests/Commands/Reports/SalesReportsDownloadTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SalesReportsDownloadTests { @Test func `downloads sales report and outputs JSON with row data`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() given(mockRepo).downloadSalesReport( vendorNumber: .any, reportType: .any, @@ -42,7 +42,7 @@ struct SalesReportsDownloadTests { } @Test func `downloads sales report with report date`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() given(mockRepo).downloadSalesReport( vendorNumber: .any, reportType: .any, @@ -78,7 +78,7 @@ struct SalesReportsDownloadTests { } @Test func `table output includes row values`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() given(mockRepo).downloadSalesReport( vendorNumber: .any, reportType: .any, @@ -105,7 +105,7 @@ struct SalesReportsDownloadTests { } @Test func `resolves vendor number from storage when not provided`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() let mockStorage = MockAuthStorage() let accounts = [ConnectAccount(name: "work", keyID: "KEY1", issuerID: "ISS1", isActive: true, vendorNumber: "88012345")] given(mockStorage).loadAll().willReturn(accounts) @@ -132,7 +132,7 @@ struct SalesReportsDownloadTests { } @Test func `explicit vendor number overrides stored value`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() let mockStorage = MockAuthStorage() let accounts = [ConnectAccount(name: "work", keyID: "KEY1", issuerID: "ISS1", isActive: true, vendorNumber: "stored")] given(mockStorage).loadAll().willReturn(accounts) @@ -160,7 +160,7 @@ struct SalesReportsDownloadTests { } @Test func `throws when vendor number missing from both flag and storage`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() let mockStorage = MockAuthStorage() given(mockStorage).loadAll().willReturn([]) @@ -176,7 +176,7 @@ struct SalesReportsDownloadTests { } @Test func `forwards --version flag to repository as filterVersion`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() given(mockRepo).downloadSalesReport( vendorNumber: .any, reportType: .any, @@ -202,7 +202,7 @@ struct SalesReportsDownloadTests { } @Test func `handles empty report`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() given(mockRepo).downloadSalesReport( vendorNumber: .any, reportType: .any, diff --git a/Tests/ASCCommandTests/Commands/Reports/SalesReportsSummaryTests.swift b/Tests/ASCCommandTests/Commands/Reports/SalesReportsSummaryTests.swift index ae399e3a..4dfffbbf 100644 --- a/Tests/ASCCommandTests/Commands/Reports/SalesReportsSummaryTests.swift +++ b/Tests/ASCCommandTests/Commands/Reports/SalesReportsSummaryTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SalesReportsSummaryTests { @Test func `aggregates 6 days into a summary with per-currency proceeds`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() let storage = MockAuthStorage() given(storage).loadAll().willReturn([ ConnectAccount(name: "test", keyID: "K", issuerID: "I", isActive: true, vendorNumber: "123") @@ -86,7 +86,7 @@ struct SalesReportsSummaryTests { } @Test func `single day window emits days=1`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() let storage = MockAuthStorage() given(storage).loadAll().willReturn([ ConnectAccount(name: "test", keyID: "K", issuerID: "I", isActive: true, vendorNumber: "123") @@ -109,7 +109,7 @@ struct SalesReportsSummaryTests { } @Test func `--from after --to rejects with validation error`() async throws { - let mockRepo = MockReportRepository() + let mockRepo = MockReports() let storage = MockAuthStorage() given(storage).loadAll().willReturn([ ConnectAccount(name: "test", keyID: "K", issuerID: "I", isActive: true, vendorNumber: "123") diff --git a/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionItemsListTests.swift b/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionItemsListTests.swift index 499e4ac5..724d5be6 100644 --- a/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionItemsListTests.swift +++ b/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionItemsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ReviewSubmissionItemsListTests { diff --git a/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsBuildTests.swift b/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsBuildTests.swift index 7eb50601..225c48d9 100644 --- a/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsBuildTests.swift +++ b/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsBuildTests.swift @@ -2,7 +2,7 @@ import ArgumentParser import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ReviewSubmissionsBuildTests { diff --git a/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsGetTests.swift b/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsGetTests.swift index d45979d6..bb425283 100644 --- a/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsGetTests.swift +++ b/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ReviewSubmissionsGetTests { diff --git a/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsListTests.swift b/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsListTests.swift index 77ef1dae..c10eeae1 100644 --- a/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsListTests.swift +++ b/Tests/ASCCommandTests/Commands/ReviewSubmissions/ReviewSubmissionsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ReviewSubmissionsListTests { diff --git a/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesCreateTests.swift b/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesCreateTests.swift index 5df3d230..5a7741a3 100644 --- a/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ReviewResponsesCreateTests { diff --git a/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesDeleteTests.swift b/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesDeleteTests.swift index e2fd0499..ec282997 100644 --- a/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ReviewResponsesDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesGetTests.swift b/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesGetTests.swift index d51bf8a2..c56b27e6 100644 --- a/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesGetTests.swift +++ b/Tests/ASCCommandTests/Commands/Reviews/ReviewResponsesGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ReviewResponsesGetTests { diff --git a/Tests/ASCCommandTests/Commands/Reviews/ReviewsGetTests.swift b/Tests/ASCCommandTests/Commands/Reviews/ReviewsGetTests.swift index 6b97544d..33aa6c0d 100644 --- a/Tests/ASCCommandTests/Commands/Reviews/ReviewsGetTests.swift +++ b/Tests/ASCCommandTests/Commands/Reviews/ReviewsGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ReviewsGetTests { diff --git a/Tests/ASCCommandTests/Commands/Reviews/ReviewsListTests.swift b/Tests/ASCCommandTests/Commands/Reviews/ReviewsListTests.swift index 0640ffd4..9d51393e 100644 --- a/Tests/ASCCommandTests/Commands/Reviews/ReviewsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Reviews/ReviewsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ReviewsListTests { diff --git a/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsCreateTests.swift b/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsCreateTests.swift index d1b2bbf7..8a47b3cd 100644 --- a/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotSetsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsDeleteTests.swift b/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsDeleteTests.swift index 5306673e..d4cd73da 100644 --- a/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotSetsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsListTests.swift b/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsListTests.swift index 0e54246c..43011dd4 100644 --- a/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsListTests.swift +++ b/Tests/ASCCommandTests/Commands/ScreenshotSets/ScreenshotSetsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotSetsListTests { diff --git a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotImportFilesTests.swift b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotImportFilesTests.swift index 875426bd..f40af509 100644 --- a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotImportFilesTests.swift +++ b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotImportFilesTests.swift @@ -4,7 +4,7 @@ import ImageIO import Testing import UniformTypeIdentifiers @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotImportFilesTests { diff --git a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsDeleteTests.swift b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsDeleteTests.swift index a40f4f8a..740287fe 100644 --- a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsImportTests.swift b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsImportTests.swift index c04c88a5..a4b1b384 100644 --- a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsImportTests.swift +++ b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsImportTests.swift @@ -2,7 +2,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotsImportTests { diff --git a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsImportToLibraryTests.swift b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsImportToLibraryTests.swift index 185a8f1a..7091ff23 100644 --- a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsImportToLibraryTests.swift +++ b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsImportToLibraryTests.swift @@ -3,7 +3,7 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotsImportToLibraryTests { diff --git a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsListTests.swift b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsListTests.swift index 7e776abe..2541a799 100644 --- a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotsListTests { diff --git a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsUploadTests.swift b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsUploadTests.swift index 32e44382..24242c7c 100644 --- a/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsUploadTests.swift +++ b/Tests/ASCCommandTests/Commands/Screenshots/ScreenshotsUploadTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotsUploadTests { diff --git a/Tests/ASCCommandTests/Commands/Simulators/SimulatorsBootTests.swift b/Tests/ASCCommandTests/Commands/Simulators/SimulatorsBootTests.swift index 72f825d2..37bd5625 100644 --- a/Tests/ASCCommandTests/Commands/Simulators/SimulatorsBootTests.swift +++ b/Tests/ASCCommandTests/Commands/Simulators/SimulatorsBootTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SimulatorsBootTests { @Test func `boot simulator returns success message with udid`() async throws { - let mockRepo = MockSimulatorRepository() + let mockRepo = MockSimulators() given(mockRepo).bootSimulator(udid: .value("ABCD-1234")).willReturn(()) let cmd = try SimulatorsBoot.parse(["--udid", "ABCD-1234"]) diff --git a/Tests/ASCCommandTests/Commands/Simulators/SimulatorsListTests.swift b/Tests/ASCCommandTests/Commands/Simulators/SimulatorsListTests.swift index b73fbfb5..f653038a 100644 --- a/Tests/ASCCommandTests/Commands/Simulators/SimulatorsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Simulators/SimulatorsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SimulatorsListTests { @@ -11,7 +11,7 @@ struct SimulatorsListTests { } @Test func `listed simulators show id name state runtime and affordances`() async throws { - let mockRepo = MockSimulatorRepository() + let mockRepo = MockSimulators() given(mockRepo).listSimulators(filter: .any).willReturn([ Simulator( id: "ABCD-1234", @@ -45,7 +45,7 @@ struct SimulatorsListTests { } @Test func `booted simulator shows shutdown affordances`() async throws { - let mockRepo = MockSimulatorRepository() + let mockRepo = MockSimulators() given(mockRepo).listSimulators(filter: .any).willReturn([ Simulator( id: "EFGH-5678", @@ -79,7 +79,7 @@ struct SimulatorsListTests { } @Test func `booted filter passes correct filter to repository`() async throws { - let mockRepo = MockSimulatorRepository() + let mockRepo = MockSimulators() given(mockRepo).listSimulators(filter: .value(.booted)).willReturn([]) let cmd = try SimulatorsList.parse(["--booted", "--pretty"]) @@ -95,7 +95,7 @@ struct SimulatorsListTests { } @Test func `table output includes all row fields`() async throws { - let mockRepo = MockSimulatorRepository() + let mockRepo = MockSimulators() given(mockRepo).listSimulators(filter: .any).willReturn([ Simulator( id: "sim-1", @@ -115,7 +115,7 @@ struct SimulatorsListTests { } @Test func `default filter is available not booted`() async throws { - let mockRepo = MockSimulatorRepository() + let mockRepo = MockSimulators() given(mockRepo).listSimulators(filter: .value(.available)).willReturn([]) let cmd = try SimulatorsList.parse(["--pretty"]) @@ -125,7 +125,7 @@ struct SimulatorsListTests { } @Test func `markdown output works`() async throws { - let mockRepo = MockSimulatorRepository() + let mockRepo = MockSimulators() given(mockRepo).listSimulators(filter: .any).willReturn([ Simulator(id: "s-1", name: "iPhone 16", state: SimulatorState.booted, runtime: "com.apple.CoreSimulator.SimRuntime.iOS-18-2"), ]) diff --git a/Tests/ASCCommandTests/Commands/Simulators/SimulatorsShutdownTests.swift b/Tests/ASCCommandTests/Commands/Simulators/SimulatorsShutdownTests.swift index 70ff069a..729dbbdb 100644 --- a/Tests/ASCCommandTests/Commands/Simulators/SimulatorsShutdownTests.swift +++ b/Tests/ASCCommandTests/Commands/Simulators/SimulatorsShutdownTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SimulatorsShutdownTests { @Test func `shutdown simulator returns success message with udid`() async throws { - let mockRepo = MockSimulatorRepository() + let mockRepo = MockSimulators() given(mockRepo).shutdownSimulator(udid: .value("ABCD-1234")).willReturn(()) let cmd = try SimulatorsShutdown.parse(["--udid", "ABCD-1234"]) diff --git a/Tests/ASCCommandTests/Commands/Skills/SkillUpdateCheckerTests.swift b/Tests/ASCCommandTests/Commands/Skills/SkillUpdateCheckerTests.swift index 71f6d485..b7038d35 100644 --- a/Tests/ASCCommandTests/Commands/Skills/SkillUpdateCheckerTests.swift +++ b/Tests/ASCCommandTests/Commands/Skills/SkillUpdateCheckerTests.swift @@ -2,13 +2,13 @@ import Foundation import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("SkillUpdateChecker") struct SkillUpdateCheckerTests { @Test func `skips check when ASC_SKIP_SKILL_CHECK is true`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() let mockStorage = MockSkillConfigStorage() await SkillUpdateChecker.checkIfNeeded( @@ -22,7 +22,7 @@ struct SkillUpdateCheckerTests { } @Test func `skips check in CI environment`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() let mockStorage = MockSkillConfigStorage() await SkillUpdateChecker.checkIfNeeded( @@ -35,7 +35,7 @@ struct SkillUpdateCheckerTests { } @Test func `skips check when last check was less than 24h ago`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() let mockStorage = MockSkillConfigStorage() let recentCheck = Date().addingTimeInterval(-3600) // 1 hour ago given(mockStorage).load().willReturn(SkillConfig(skillsCheckedAt: recentCheck)) @@ -50,7 +50,7 @@ struct SkillUpdateCheckerTests { } @Test func `runs check when last check was more than 24h ago`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() let mockStorage = MockSkillConfigStorage() let oldCheck = Date().addingTimeInterval(-25 * 3600) // 25 hours ago given(mockStorage).load().willReturn(SkillConfig(skillsCheckedAt: oldCheck)) @@ -67,7 +67,7 @@ struct SkillUpdateCheckerTests { } @Test func `runs check when no previous check exists`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() let mockStorage = MockSkillConfigStorage() given(mockStorage).load().willReturn(nil) given(mockRepo).check().willReturn(.upToDate) @@ -83,7 +83,7 @@ struct SkillUpdateCheckerTests { } @Test func `does not persist timestamp when result is unavailable`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() let mockStorage = MockSkillConfigStorage() given(mockStorage).load().willReturn(nil) given(mockRepo).check().willReturn(.unavailable) @@ -98,7 +98,7 @@ struct SkillUpdateCheckerTests { } @Test func `persists timestamp when result is up to date`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() let mockStorage = MockSkillConfigStorage() given(mockStorage).load().willReturn(nil) given(mockRepo).check().willReturn(.upToDate) diff --git a/Tests/ASCCommandTests/Commands/Skills/SkillsCheckTests.swift b/Tests/ASCCommandTests/Commands/Skills/SkillsCheckTests.swift index 078003b3..44cb9bca 100644 --- a/Tests/ASCCommandTests/Commands/Skills/SkillsCheckTests.swift +++ b/Tests/ASCCommandTests/Commands/Skills/SkillsCheckTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("SkillsCheck") struct SkillsCheckTests { @Test func `check shows up to date message`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() let mockStorage = MockSkillConfigStorage() given(mockRepo).check().willReturn(.upToDate) given(mockStorage).load().willReturn(nil) @@ -20,7 +20,7 @@ struct SkillsCheckTests { } @Test func `check shows updates available message`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() let mockStorage = MockSkillConfigStorage() given(mockRepo).check().willReturn(.updatesAvailable) given(mockStorage).load().willReturn(nil) @@ -33,7 +33,7 @@ struct SkillsCheckTests { } @Test func `check shows unavailable message`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() let mockStorage = MockSkillConfigStorage() given(mockRepo).check().willReturn(.unavailable) given(mockStorage).load().willReturn(nil) diff --git a/Tests/ASCCommandTests/Commands/Skills/SkillsInstallTests.swift b/Tests/ASCCommandTests/Commands/Skills/SkillsInstallTests.swift index 01d54bbc..77044d81 100644 --- a/Tests/ASCCommandTests/Commands/Skills/SkillsInstallTests.swift +++ b/Tests/ASCCommandTests/Commands/Skills/SkillsInstallTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("SkillsInstall") struct SkillsInstallTests { @Test func `install specific skill by name`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() given(mockRepo).install(name: .value("asc-cli")).willReturn("Installed asc-cli") let cmd = try SkillsInstall.parse(["--name", "asc-cli"]) @@ -17,7 +17,7 @@ struct SkillsInstallTests { } @Test func `install all skills when --all flag is used`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() given(mockRepo).installAll().willReturn("Installed 5 skills") let cmd = try SkillsInstall.parse(["--all"]) @@ -27,7 +27,7 @@ struct SkillsInstallTests { } @Test func `install all skills when no flags provided`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() given(mockRepo).installAll().willReturn("Installed all skills") let cmd = try SkillsInstall.parse([]) diff --git a/Tests/ASCCommandTests/Commands/Skills/SkillsInstalledTests.swift b/Tests/ASCCommandTests/Commands/Skills/SkillsInstalledTests.swift index e2a29a98..8a1281ba 100644 --- a/Tests/ASCCommandTests/Commands/Skills/SkillsInstalledTests.swift +++ b/Tests/ASCCommandTests/Commands/Skills/SkillsInstalledTests.swift @@ -1,7 +1,7 @@ import Foundation import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("SkillsInstalled") struct SkillsInstalledTests { diff --git a/Tests/ASCCommandTests/Commands/Skills/SkillsListTests.swift b/Tests/ASCCommandTests/Commands/Skills/SkillsListTests.swift index 0cff4328..46945489 100644 --- a/Tests/ASCCommandTests/Commands/Skills/SkillsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Skills/SkillsListTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("SkillsList") struct SkillsListTests { @Test func `list shows available skills from repo`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() given(mockRepo).listAvailable().willReturn("asc-cli\nasc-auth\nasc-testflight") let cmd = try SkillsList.parse([]) diff --git a/Tests/ASCCommandTests/Commands/Skills/SkillsUninstallTests.swift b/Tests/ASCCommandTests/Commands/Skills/SkillsUninstallTests.swift index a41ae893..5a7fcf03 100644 --- a/Tests/ASCCommandTests/Commands/Skills/SkillsUninstallTests.swift +++ b/Tests/ASCCommandTests/Commands/Skills/SkillsUninstallTests.swift @@ -1,7 +1,7 @@ import Foundation import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("SkillsUninstall") struct SkillsUninstallTests { diff --git a/Tests/ASCCommandTests/Commands/Skills/SkillsUpdateTests.swift b/Tests/ASCCommandTests/Commands/Skills/SkillsUpdateTests.swift index 01d36d06..3fb31601 100644 --- a/Tests/ASCCommandTests/Commands/Skills/SkillsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/Skills/SkillsUpdateTests.swift @@ -1,13 +1,13 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite("SkillsUpdate") struct SkillsUpdateTests { @Test func `update returns output from skills CLI`() async throws { - let mockRepo = MockSkillRepository() + let mockRepo = MockSkills() given(mockRepo).update().willReturn("Updated 3 skills") let cmd = try SkillsUpdate.parse([]) diff --git a/Tests/ASCCommandTests/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsTests.swift index 64254319..4e1f6ab1 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionGroupLocalizations/SubscriptionGroupLocalizationsTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionGroupLocalizationsListTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupVersionsListTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupVersionsListTests.swift index 06fc3f2b..f4d7e419 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupVersionsListTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupVersionsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionGroupVersionsListTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsCreateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsCreateTests.swift index bce2e10c..e46cc6aa 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionGroupsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsDeleteTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsDeleteTests.swift index ee4b7bf6..1bc668a7 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionGroupsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsListTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsListTests.swift index 83f29603..d40fbae2 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsListTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionGroupsListTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsUpdateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsUpdateTests.swift index 9af3c626..91dc3de4 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionGroups/SubscriptionGroupsUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionGroupsUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsCreateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsCreateTests.swift index ab0afde3..8254467a 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionLocalizationsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsDeleteTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsDeleteTests.swift index a88c01b7..34bd2216 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionLocalizationsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsListTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsListTests.swift index 8f9df28d..dc583b09 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsListTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionLocalizationsListTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsUpdateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsUpdateTests.swift index fd17ffe5..764694fc 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionLocalizations/SubscriptionLocalizationsUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionLocalizationsUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesCreateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesCreateTests.swift index d6b4eabf..cd10dc09 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodeCustomCodesCreateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesListTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesListTests.swift index 568771dd..f5c08f5a 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesListTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodeCustomCodesListTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesUpdateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesUpdateTests.swift index 266e2ceb..07bd864e 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeCustomCodes/SubscriptionOfferCodeCustomCodesUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodeCustomCodesUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesCreateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesCreateTests.swift index c1f3f231..81be6fe6 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodeOneTimeCodesCreateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesListTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesListTests.swift index 26e32704..d1fdcf3b 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesListTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodeOneTimeCodesListTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesUpdateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesUpdateTests.swift index a34d6632..16c636f4 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodeOneTimeCodesUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesValuesTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesValuesTests.swift index 7dca9ca6..7875201b 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesValuesTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodeOneTimeCodes/SubscriptionOfferCodeOneTimeCodesValuesTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodeOneTimeCodesValuesTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesCreateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesCreateTests.swift index 58f5405e..910f1691 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodesCreateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesListTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesListTests.swift index 44385c5c..ff6b2661 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesListTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodesListTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesPricesListTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesPricesListTests.swift index a0e942e3..7a37bbb1 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesPricesListTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesPricesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodesPricesListTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesUpdateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesUpdateTests.swift index 63ab3e31..afb739ac 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOfferCodes/SubscriptionOfferCodesUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodesUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersCreateTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersCreateTests.swift index 41e7055a..93779d7c 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOffersCreateTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersDeleteTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersDeleteTests.swift index 7ef25d5c..5477e489 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOffersDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersListTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersListTests.swift index 39eff0dd..4a4b6bbc 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersListTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionOffers/SubscriptionOffersListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOffersListTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersTests.swift index 905a7b63..adeeb93a 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionPromotionalOffers/SubscriptionPromotionalOffersTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionPromotionalOffersListTests { diff --git a/Tests/ASCCommandTests/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotTests.swift b/Tests/ASCCommandTests/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotTests.swift index f3ec2f1c..016472cb 100644 --- a/Tests/ASCCommandTests/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotTests.swift +++ b/Tests/ASCCommandTests/Commands/SubscriptionReviewScreenshot/SubscriptionReviewScreenshotTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionReviewScreenshotGetTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/Availability/SubscriptionAvailabilityCreateTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/Availability/SubscriptionAvailabilityCreateTests.swift index a71e2841..3a460f40 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/Availability/SubscriptionAvailabilityCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/Availability/SubscriptionAvailabilityCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionAvailabilityCreateTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/Availability/SubscriptionAvailabilityGetTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/Availability/SubscriptionAvailabilityGetTests.swift index 3ae2d7e0..c27f2eaa 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/Availability/SubscriptionAvailabilityGetTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/Availability/SubscriptionAvailabilityGetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionAvailabilityGetTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionPricePointsListTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionPricePointsListTests.swift index 7219553f..8a2370fe 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionPricePointsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionPricePointsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionPricePointsListTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionPricesSetTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionPricesSetTests.swift index 89162e37..e368b8e3 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionPricesSetTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionPricesSetTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionPricesSetTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionVersionsListTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionVersionsListTests.swift index 8f747cdc..d0e8102d 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionVersionsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionVersionsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionVersionsListTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsCreateTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsCreateTests.swift index c8c6dfab..d0fb0578 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsDeleteTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsDeleteTests.swift index 07c02c90..1616c709 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsDeleteTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsDeleteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionsDeleteTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsListTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsListTests.swift index 03da906f..3127ea7d 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionsListTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsSubmitTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsSubmitTests.swift index b90881b9..2759e6d3 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsSubmitTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsSubmitTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionsSubmitTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsUnsubmitTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsUnsubmitTests.swift index f80930dc..3788a161 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsUnsubmitTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsUnsubmitTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionsUnsubmitTests { diff --git a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsUpdateTests.swift b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsUpdateTests.swift index 6b505367..c3de583d 100644 --- a/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/Subscriptions/SubscriptionsUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionsUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/Territories/TerritoriesListTests.swift b/Tests/ASCCommandTests/Commands/Territories/TerritoriesListTests.swift index 615037c9..34a15bc4 100644 --- a/Tests/ASCCommandTests/Commands/Territories/TerritoriesListTests.swift +++ b/Tests/ASCCommandTests/Commands/Territories/TerritoriesListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct TerritoriesListTests { diff --git a/Tests/ASCCommandTests/Commands/TestFlight/TestFlightCommandTests.swift b/Tests/ASCCommandTests/Commands/TestFlight/TestFlightCommandTests.swift index c0f903f0..466030f9 100644 --- a/Tests/ASCCommandTests/Commands/TestFlight/TestFlightCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/TestFlight/TestFlightCommandTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct BetaGroupsListTests { diff --git a/Tests/ASCCommandTests/Commands/Users/UserInvitationsCancelTests.swift b/Tests/ASCCommandTests/Commands/Users/UserInvitationsCancelTests.swift index a3dece56..11bc2d2c 100644 --- a/Tests/ASCCommandTests/Commands/Users/UserInvitationsCancelTests.swift +++ b/Tests/ASCCommandTests/Commands/Users/UserInvitationsCancelTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct UserInvitationsCancelTests { diff --git a/Tests/ASCCommandTests/Commands/Users/UserInvitationsInviteTests.swift b/Tests/ASCCommandTests/Commands/Users/UserInvitationsInviteTests.swift index 62f15f13..bf1ae4ce 100644 --- a/Tests/ASCCommandTests/Commands/Users/UserInvitationsInviteTests.swift +++ b/Tests/ASCCommandTests/Commands/Users/UserInvitationsInviteTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct UserInvitationsInviteTests { diff --git a/Tests/ASCCommandTests/Commands/Users/UserInvitationsListTests.swift b/Tests/ASCCommandTests/Commands/Users/UserInvitationsListTests.swift index 30cd2670..c7760b94 100644 --- a/Tests/ASCCommandTests/Commands/Users/UserInvitationsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Users/UserInvitationsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct UserInvitationsListTests { diff --git a/Tests/ASCCommandTests/Commands/Users/UsersListTests.swift b/Tests/ASCCommandTests/Commands/Users/UsersListTests.swift index fdb724dd..e7e0cab5 100644 --- a/Tests/ASCCommandTests/Commands/Users/UsersListTests.swift +++ b/Tests/ASCCommandTests/Commands/Users/UsersListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct UsersListTests { diff --git a/Tests/ASCCommandTests/Commands/Users/UsersRemoveTests.swift b/Tests/ASCCommandTests/Commands/Users/UsersRemoveTests.swift index 31ae6f75..75205cda 100644 --- a/Tests/ASCCommandTests/Commands/Users/UsersRemoveTests.swift +++ b/Tests/ASCCommandTests/Commands/Users/UsersRemoveTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct UsersRemoveTests { diff --git a/Tests/ASCCommandTests/Commands/Users/UsersUpdateTests.swift b/Tests/ASCCommandTests/Commands/Users/UsersUpdateTests.swift index d648b16c..8cb5b3b6 100644 --- a/Tests/ASCCommandTests/Commands/Users/UsersUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/Users/UsersUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct UsersUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsCreateTests.swift b/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsCreateTests.swift index c90a9b87..03fa82ba 100644 --- a/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct VersionLocalizationsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsListTests.swift b/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsListTests.swift index 9e5290f6..7aa63d3b 100644 --- a/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsListTests.swift +++ b/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct VersionLocalizationsListTests { diff --git a/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsUpdateTests.swift b/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsUpdateTests.swift index 77469467..568f6ffa 100644 --- a/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/VersionLocalizations/VersionLocalizationsUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct VersionLocalizationsUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/VersionReviewDetail/VersionReviewDetailTests.swift b/Tests/ASCCommandTests/Commands/VersionReviewDetail/VersionReviewDetailTests.swift index 5256ce00..539cfc2c 100644 --- a/Tests/ASCCommandTests/Commands/VersionReviewDetail/VersionReviewDetailTests.swift +++ b/Tests/ASCCommandTests/Commands/VersionReviewDetail/VersionReviewDetailTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct VersionReviewDetailGetTests { diff --git a/Tests/ASCCommandTests/Commands/Versions/VersionsCheckReadinessTests.swift b/Tests/ASCCommandTests/Commands/Versions/VersionsCheckReadinessTests.swift index 3e96dd46..4a233b77 100644 --- a/Tests/ASCCommandTests/Commands/Versions/VersionsCheckReadinessTests.swift +++ b/Tests/ASCCommandTests/Commands/Versions/VersionsCheckReadinessTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct VersionsCheckReadinessTests { diff --git a/Tests/ASCCommandTests/Commands/Versions/VersionsCreateTests.swift b/Tests/ASCCommandTests/Commands/Versions/VersionsCreateTests.swift index e69303de..8157c33b 100644 --- a/Tests/ASCCommandTests/Commands/Versions/VersionsCreateTests.swift +++ b/Tests/ASCCommandTests/Commands/Versions/VersionsCreateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct VersionsCreateTests { diff --git a/Tests/ASCCommandTests/Commands/Versions/VersionsListTests.swift b/Tests/ASCCommandTests/Commands/Versions/VersionsListTests.swift index 48f7ec9b..9cad6ee8 100644 --- a/Tests/ASCCommandTests/Commands/Versions/VersionsListTests.swift +++ b/Tests/ASCCommandTests/Commands/Versions/VersionsListTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct VersionsListTests { diff --git a/Tests/ASCCommandTests/Commands/Versions/VersionsSetBuildTests.swift b/Tests/ASCCommandTests/Commands/Versions/VersionsSetBuildTests.swift index 2a2d47f1..3cdef952 100644 --- a/Tests/ASCCommandTests/Commands/Versions/VersionsSetBuildTests.swift +++ b/Tests/ASCCommandTests/Commands/Versions/VersionsSetBuildTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct VersionsSetBuildTests { diff --git a/Tests/ASCCommandTests/Commands/Versions/VersionsSubmitTests.swift b/Tests/ASCCommandTests/Commands/Versions/VersionsSubmitTests.swift index 4361bfb8..4a832701 100644 --- a/Tests/ASCCommandTests/Commands/Versions/VersionsSubmitTests.swift +++ b/Tests/ASCCommandTests/Commands/Versions/VersionsSubmitTests.swift @@ -1,24 +1,26 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct VersionsSubmitTests { - @Test func `submitted version returns submission in waitingForReview state`() async throws { - let mockRepo = MockSubmissionRepository() - given(mockRepo).submitVersion(versionId: .any).willReturn( - ReviewSubmission( - id: "sub-1", - appId: "app-42", - platform: .iOS, - state: .waitingForReview - ) - ) + private func draftThenSubmitted() -> MockSubmissionRepository { + let submissions = MockSubmissionRepository() + given(submissions).createSubmission(appId: .value("app-1"), platform: .value(.iOS)) + .willReturn(ReviewSubmission(id: "sub-1", appId: "app-1", platform: .iOS, state: .readyForReview)) + given(submissions).listSubmissionItems(submissionId: .value("sub-1")).willReturn([]) + given(submissions).addItem(submissionId: .value("sub-1"), target: .value(.appStoreVersion("v-1"))) + .willReturn(ReviewSubmissionItem(id: "item-1", submissionId: "sub-1", state: .readyForReview, linkedResourceId: "v-1")) + given(submissions).submit(submissionId: .value("sub-1")) + .willReturn(ReviewSubmission(id: "sub-1", appId: "app-1", platform: .iOS, state: .waitingForReview)) + return submissions + } + @Test func `should show the submission waiting for review after submitting a version`() async throws { let cmd = try VersionsSubmit.parse(["--version-id", "v-1", "--pretty"]) - let output = try await cmd.execute(repo: mockRepo) + let output = try await cmd.execute(versionRepo: appVersionRepo(), submissionRepo: draftThenSubmitted()) #expect(output == """ { @@ -27,9 +29,9 @@ struct VersionsSubmitTests { "affordances" : { "getSubmission" : "asc review-submissions get --submission-id sub-1", "listItems" : "asc review-submissions items list --submission-id sub-1", - "listVersions" : "asc versions list --app-id app-42" + "listVersions" : "asc versions list --app-id app-1" }, - "appId" : "app-42", + "appId" : "app-1", "id" : "sub-1", "platform" : "IOS", "state" : "WAITING_FOR_REVIEW" @@ -39,6 +41,18 @@ struct VersionsSubmitTests { """) } + @Test func `should refuse to submit a version that is already on sale`() async throws { + let versions = MockVersionRepository() + given(versions).getVersion(id: .value("v-1")).willReturn( + AppStoreVersion(id: "v-1", appId: "app-1", versionString: "1.0", platform: .iOS, state: .readyForSale) + ) + let cmd = try VersionsSubmit.parse(["--version-id", "v-1"]) + + await #expect(throws: ReviewSubmissionError.versionNotEditable(versionString: "1.0", state: .readyForSale)) { + try await cmd.execute(versionRepo: versions, submissionRepo: MockSubmissionRepository()) + } + } + // MARK: - --with-products private func planner(iapRepo: MockInAppPurchaseRepository, versionRepo: MockProductVersionRepository) -> SubmissionPlanner { diff --git a/Tests/ASCCommandTests/Commands/Versions/VersionsUpdateTests.swift b/Tests/ASCCommandTests/Commands/Versions/VersionsUpdateTests.swift index ca646732..7c68e20d 100644 --- a/Tests/ASCCommandTests/Commands/Versions/VersionsUpdateTests.swift +++ b/Tests/ASCCommandTests/Commands/Versions/VersionsUpdateTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct VersionsUpdateTests { diff --git a/Tests/ASCCommandTests/Commands/Web/AppShotsControllerTests.swift b/Tests/ASCCommandTests/Commands/Web/AppShotsControllerTests.swift index c4b31a4c..d5712331 100644 --- a/Tests/ASCCommandTests/Commands/Web/AppShotsControllerTests.swift +++ b/Tests/ASCCommandTests/Commands/Web/AppShotsControllerTests.swift @@ -2,7 +2,7 @@ import Foundation import Testing import Mockable @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppShotsControllerTests { @@ -25,7 +25,7 @@ struct AppShotsControllerTests { // MARK: - Themes list @Test func `themes list returns data with _links`() async throws { - let mockRepo = MockThemeRepository() + let mockRepo = MockThemes() given(mockRepo).listThemes().willReturn([ makeTheme(id: "neon", name: "Neon"), ]) diff --git a/Tests/ASCCommandTests/Commands/Web/AppsControllerTests.swift b/Tests/ASCCommandTests/Commands/Web/AppsControllerTests.swift index 68edd16c..c05dfca8 100644 --- a/Tests/ASCCommandTests/Commands/Web/AppsControllerTests.swift +++ b/Tests/ASCCommandTests/Commands/Web/AppsControllerTests.swift @@ -2,7 +2,7 @@ import Foundation import Testing import Mockable @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AppsControllerTests { diff --git a/Tests/ASCCommandTests/Commands/Web/AssetLibraryControllerTests.swift b/Tests/ASCCommandTests/Commands/Web/AssetLibraryControllerTests.swift index 3cf10a8f..50fcab03 100644 --- a/Tests/ASCCommandTests/Commands/Web/AssetLibraryControllerTests.swift +++ b/Tests/ASCCommandTests/Commands/Web/AssetLibraryControllerTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct AssetLibraryControllerTests { diff --git a/Tests/ASCCommandTests/Commands/Web/Controllers/AgeRatingRoutesTests.swift b/Tests/ASCCommandTests/Commands/Web/Controllers/AgeRatingRoutesTests.swift index 08da0161..2df17a33 100644 --- a/Tests/ASCCommandTests/Commands/Web/Controllers/AgeRatingRoutesTests.swift +++ b/Tests/ASCCommandTests/Commands/Web/Controllers/AgeRatingRoutesTests.swift @@ -6,8 +6,7 @@ import Mockable import NIOCore import Testing @testable import ASCCommand -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct AgeRatingRoutesTests { diff --git a/Tests/ASCCommandTests/Commands/Web/Controllers/AuthRoutesTests.swift b/Tests/ASCCommandTests/Commands/Web/Controllers/AuthRoutesTests.swift index 33c81e2d..23bdd431 100644 --- a/Tests/ASCCommandTests/Commands/Web/Controllers/AuthRoutesTests.swift +++ b/Tests/ASCCommandTests/Commands/Web/Controllers/AuthRoutesTests.swift @@ -6,8 +6,7 @@ import Mockable import NIOCore import Testing @testable import ASCCommand -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct AuthRoutesTests { diff --git a/Tests/ASCCommandTests/Commands/Web/Controllers/CustomProductPagePlacementRoutesTests.swift b/Tests/ASCCommandTests/Commands/Web/Controllers/CustomProductPagePlacementRoutesTests.swift index b426834e..94b296d8 100644 --- a/Tests/ASCCommandTests/Commands/Web/Controllers/CustomProductPagePlacementRoutesTests.swift +++ b/Tests/ASCCommandTests/Commands/Web/Controllers/CustomProductPagePlacementRoutesTests.swift @@ -5,8 +5,7 @@ import Mockable import NIOCore import Testing @testable import ASCCommand -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct CustomProductPagePlacementRoutesTests { diff --git a/Tests/ASCCommandTests/Commands/Web/Controllers/ScreenshotDeleteRoutesTests.swift b/Tests/ASCCommandTests/Commands/Web/Controllers/ScreenshotDeleteRoutesTests.swift index 5478780c..8077d8da 100644 --- a/Tests/ASCCommandTests/Commands/Web/Controllers/ScreenshotDeleteRoutesTests.swift +++ b/Tests/ASCCommandTests/Commands/Web/Controllers/ScreenshotDeleteRoutesTests.swift @@ -4,8 +4,7 @@ import HummingbirdWebSocket import Mockable import Testing @testable import ASCCommand -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct ScreenshotDeleteRoutesTests { diff --git a/Tests/ASCCommandTests/Commands/Web/Controllers/VersionSubmissionRoutesTests.swift b/Tests/ASCCommandTests/Commands/Web/Controllers/VersionSubmissionRoutesTests.swift new file mode 100644 index 00000000..a77bd532 --- /dev/null +++ b/Tests/ASCCommandTests/Commands/Web/Controllers/VersionSubmissionRoutesTests.swift @@ -0,0 +1,63 @@ +import Foundation +import Hummingbird +import HummingbirdTesting +import HummingbirdWebSocket +import Mockable +import NIOCore +import Testing +@testable import ASCCommand +@testable import ASCKit + +@Suite +struct VersionSubmissionRoutesTests { + private func versions(_ state: AppStoreVersionState) -> MockVersionRepository { + let versions = MockVersionRepository() + given(versions).getVersion(id: .value("v-1")).willReturn( + AppStoreVersion(id: "v-1", appId: "app-1", versionString: "1.0", platform: .iOS, state: state) + ) + return versions + } + + private func submissions() -> MockSubmissionRepository { + let submissions = MockSubmissionRepository() + given(submissions).createSubmission(appId: .value("app-1"), platform: .value(.iOS)) + .willReturn(ReviewSubmission(id: "sub-1", appId: "app-1", platform: .iOS, state: .readyForReview)) + given(submissions).listSubmissionItems(submissionId: .value("sub-1")).willReturn([]) + given(submissions).addItem(submissionId: .value("sub-1"), target: .value(.appStoreVersion("v-1"))) + .willReturn(ReviewSubmissionItem(id: "item-1", submissionId: "sub-1", state: .readyForReview, linkedResourceId: "v-1")) + given(submissions).submit(submissionId: .value("sub-1")) + .willReturn(ReviewSubmission(id: "sub-1", appId: "app-1", platform: .iOS, state: .waitingForReview)) + return submissions + } + + private func post(versions: MockVersionRepository, submissions: MockSubmissionRepository) async throws -> String { + let router = Router(context: BasicWebSocketRequestContext.self) + let planner = SubmissionPlanner( + iapRepo: MockInAppPurchaseRepository(), groupRepo: MockSubscriptionGroupRepository(), + subscriptionRepo: MockSubscriptionRepository(), productVersionRepo: MockProductVersionRepository() + ) + VersionSubmissionController(submissionRepo: submissions, versionRepo: versions, planner: planner) + .addRoutes(to: router.group("/api/v1")) + return try await Application(router: router).test(.router) { client in + try await client.execute(uri: "/api/v1/versions/v-1/submit", method: .post) { String(buffer: $0.body) } + } + } + + @Test func `should answer with the submission waiting for review after submitting a version over REST`() async throws { + let response = try await post(versions: versions(.prepareForSubmission), submissions: submissions()) + + let json = try #require(try JSONSerialization.jsonObject(with: Data(response.utf8)) as? [String: Any]) + let submission = try #require(json["data"] as? [String: Any] ?? (json["data"] as? [[String: Any]])?.first) + #expect(submission["id"] as? String == "sub-1") + #expect(submission["state"] as? String == "WAITING_FOR_REVIEW") + } + + @Test func `should send nothing to Apple when the version is already on sale`() async throws { + let submissions = MockSubmissionRepository() + + let response = try await post(versions: versions(.readyForSale), submissions: submissions) + + #expect(response.contains("Version 1.0 can't go to review while it is Ready for Sale.")) + verify(submissions).createSubmission(appId: .any, platform: .any).called(0) + } +} diff --git a/Tests/ASCCommandTests/Commands/Web/GameCenterControllerTests.swift b/Tests/ASCCommandTests/Commands/Web/GameCenterControllerTests.swift index 217ab1df..bd8d5f42 100644 --- a/Tests/ASCCommandTests/Commands/Web/GameCenterControllerTests.swift +++ b/Tests/ASCCommandTests/Commands/Web/GameCenterControllerTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct GameCenterControllerTests { diff --git a/Tests/ASCCommandTests/Commands/Web/RESTRoutesTests.swift b/Tests/ASCCommandTests/Commands/Web/RESTRoutesTests.swift index 094d6a1b..bd75fa24 100644 --- a/Tests/ASCCommandTests/Commands/Web/RESTRoutesTests.swift +++ b/Tests/ASCCommandTests/Commands/Web/RESTRoutesTests.swift @@ -2,7 +2,7 @@ import Foundation import Testing import Mockable @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct RESTRoutesTests { @@ -46,7 +46,7 @@ struct RESTRoutesTests { } @Test func `plugins updates list returns outdated entries with apply links`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).listOutdated().willReturn([ PluginUpdate(name: "Hello", installedVersion: "1.0.0", latestVersion: "1.2.0"), ]) @@ -58,7 +58,7 @@ struct RESTRoutesTests { } @Test func `plugins update returns the freshly installed plugin`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).update(name: .value("Hello")).willReturn( Plugin(id: "Hello.plugin", name: "Hello", version: "1.2.0", isInstalled: true, slug: "Hello.plugin") ) @@ -69,7 +69,7 @@ struct RESTRoutesTests { } @Test func `plugins install returns the installed plugin in data wrapper`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).install(name: .any).willReturn( Plugin(id: "Hello.plugin", name: "Hello", version: "1.0", author: "me", isInstalled: true, slug: "Hello.plugin") ) @@ -81,7 +81,7 @@ struct RESTRoutesTests { } @Test func `plugins market search returns filtered list under data wrapper`() async throws { - let mockRepo = MockPluginRepository() + let mockRepo = MockPlugins() given(mockRepo).searchAvailable(query: .value("hello")).willReturn([ Plugin(id: "Hello.plugin", name: "Hello", version: "1.0", author: "me"), ]) @@ -200,7 +200,7 @@ struct RESTRoutesTests { // MARK: - Simulators @Test func `simulators list returns JSON with _links`() async throws { - let mockRepo = MockSimulatorRepository() + let mockRepo = MockSimulators() given(mockRepo).listSimulators(filter: .any).willReturn([ Simulator(id: "ABC-123", name: "iPhone 15", state: .booted, runtime: "iOS 17.0"), ]) @@ -287,7 +287,7 @@ struct RESTRoutesTests { } @Test func `themes list returns data wrapper`() async throws { - let mockRepo = MockThemeRepository() + let mockRepo = MockThemes() given(mockRepo).listThemes().willReturn([]) let output = try await AppShotsThemesList.parse(["--pretty"]).execute(repo: mockRepo, affordanceMode: .rest) #expect(output.contains("\"data\"")) diff --git a/Tests/ASCCommandTests/Commands/Web/SubscriptionsControllerTests.swift b/Tests/ASCCommandTests/Commands/Web/SubscriptionsControllerTests.swift index 498ebb05..1481b692 100644 --- a/Tests/ASCCommandTests/Commands/Web/SubscriptionsControllerTests.swift +++ b/Tests/ASCCommandTests/Commands/Web/SubscriptionsControllerTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionsControllerTests { diff --git a/Tests/ASCCommandTests/Commands/WinBackOffers/WinBackOffersTests.swift b/Tests/ASCCommandTests/Commands/WinBackOffers/WinBackOffersTests.swift index 2a16538e..0058c866 100644 --- a/Tests/ASCCommandTests/Commands/WinBackOffers/WinBackOffersTests.swift +++ b/Tests/ASCCommandTests/Commands/WinBackOffers/WinBackOffersTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit private func makeOffer(id: String = "wb-1", subscriptionId: String = "sub-1") -> WinBackOffer { WinBackOffer( diff --git a/Tests/ASCCommandTests/Commands/XcodeCloud/XcodeCloudCommandTests.swift b/Tests/ASCCommandTests/Commands/XcodeCloud/XcodeCloudCommandTests.swift index 22f23229..b3721ac9 100644 --- a/Tests/ASCCommandTests/Commands/XcodeCloud/XcodeCloudCommandTests.swift +++ b/Tests/ASCCommandTests/Commands/XcodeCloud/XcodeCloudCommandTests.swift @@ -1,7 +1,7 @@ import Mockable import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct XcodeCloudProductsListTests { diff --git a/Tests/ASCCommandTests/CompositionRootTests.swift b/Tests/ASCCommandTests/CompositionRootTests.swift new file mode 100644 index 00000000..ceb3129a --- /dev/null +++ b/Tests/ASCCommandTests/CompositionRootTests.swift @@ -0,0 +1,52 @@ +import Foundation +import Testing + +/// The fence around each concept's `Internal/`: only the composition root +/// (`ClientProvider.swift`) may name an implementation; every command and +/// route asks it for the concept's public protocol instead. +/// See docs/features/concept-folders/design.md §3. +@Suite +struct CompositionRootTests { + @Test func `should build every concept's Internal implementation only in the composition root`() throws { + let root = URL(fileURLWithPath: #filePath) + .deletingLastPathComponent() // ASCCommandTests + .deletingLastPathComponent() // Tests + .deletingLastPathComponent() // repo root + let internalTypes = try Self.internalTypeNames(in: root.appendingPathComponent("Sources/ASCKit")) + let commands = root.appendingPathComponent("Sources/ASCCommand") + + var leaks: [String] = [] + for file in try Self.swiftFiles(in: commands) where file.lastPathComponent != "ClientProvider.swift" { + let code = try String(contentsOf: file, encoding: .utf8) + .split(separator: "\n", omittingEmptySubsequences: false) + .filter { !$0.trimmingCharacters(in: .whitespaces).hasPrefix("//") } + .joined(separator: "\n") + let identifiers = Set(code.split { !($0.isLetter || $0.isNumber || $0 == "_") }.map(String.init)) + for name in internalTypes.intersection(identifiers) { + leaks.append("\(file.path.replacingOccurrences(of: commands.path + "/", with: "")): \(name)") + } + } + + #expect(leaks.sorted() == []) + } + + private static func internalTypeNames(in kit: URL) throws -> Set { + var names: Set = [] + let declaration = try NSRegularExpression( + pattern: "^(?:public |open )?(?:final )?(?:struct|class|enum|actor) ([A-Z][A-Za-z0-9_]*)", + options: .anchorsMatchLines + ) + for file in try swiftFiles(in: kit) where file.pathComponents.contains("Internal") { + let code = try String(contentsOf: file, encoding: .utf8) + for match in declaration.matches(in: code, range: NSRange(code.startIndex..., in: code)) { + if let range = Range(match.range(at: 1), in: code) { names.insert(String(code[range])) } + } + } + return names + } + + private static func swiftFiles(in directory: URL) throws -> [URL] { + let walker = FileManager.default.enumerator(at: directory, includingPropertiesForKeys: nil) + return (walker?.allObjects as? [URL] ?? []).filter { $0.pathExtension == "swift" } + } +} diff --git a/Tests/ASCCommandTests/OutputFormatterTests.swift b/Tests/ASCCommandTests/OutputFormatterTests.swift index 7d1df823..41629ada 100644 --- a/Tests/ASCCommandTests/OutputFormatterTests.swift +++ b/Tests/ASCCommandTests/OutputFormatterTests.swift @@ -1,7 +1,7 @@ import Foundation import Testing @testable import ASCCommand -@testable import Domain +@testable import ASCKit @Suite struct OutputFormatterTests { diff --git a/Tests/DomainTests/AppWall/AppWallEntryTests.swift b/Tests/ASCKitTests/AppWall/AppWallEntryTests.swift similarity index 99% rename from Tests/DomainTests/AppWall/AppWallEntryTests.swift rename to Tests/ASCKitTests/AppWall/AppWallEntryTests.swift index 43c659eb..58f6997e 100644 --- a/Tests/DomainTests/AppWall/AppWallEntryTests.swift +++ b/Tests/ASCKitTests/AppWall/AppWallEntryTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("AppWallApp") struct AppWallAppTests { diff --git a/Tests/DomainTests/AppWall/AppWallErrorTests.swift b/Tests/ASCKitTests/AppWall/AppWallErrorTests.swift similarity index 98% rename from Tests/DomainTests/AppWall/AppWallErrorTests.swift rename to Tests/ASCKitTests/AppWall/AppWallErrorTests.swift index 8cd38f98..fd48bb4f 100644 --- a/Tests/DomainTests/AppWall/AppWallErrorTests.swift +++ b/Tests/ASCKitTests/AppWall/AppWallErrorTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite("AppWallError — error descriptions") struct AppWallErrorTests { diff --git a/Tests/InfrastructureTests/AppWall/GitHubAppWallRepositoryTests.swift b/Tests/ASCKitTests/AppWall/Internal/GitHubAppWallTests.swift similarity index 97% rename from Tests/InfrastructureTests/AppWall/GitHubAppWallRepositoryTests.swift rename to Tests/ASCKitTests/AppWall/Internal/GitHubAppWallTests.swift index 8a8e0f8a..a6c7cf6e 100644 --- a/Tests/InfrastructureTests/AppWall/GitHubAppWallRepositoryTests.swift +++ b/Tests/ASCKitTests/AppWall/Internal/GitHubAppWallTests.swift @@ -1,10 +1,9 @@ import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite -struct GitHubAppWallRepositoryTests { +struct GitHubAppWallTests { // MARK: - Happy Path @@ -123,7 +122,7 @@ struct GitHubAppWallRepositoryTests { ) let noopSleep: @Sendable (Duration) async throws -> Void = { _ in } - let repo = GitHubAppWallRepository( + let repo = GitHubAppWall( token: "test-token", httpClient: stub, upstreamOwner: "tddworks", @@ -144,9 +143,9 @@ struct GitHubAppWallRepositoryTests { // MARK: - Helpers - private func makeRepo(stub: SequencedStubHTTPClient) -> GitHubAppWallRepository { + private func makeRepo(stub: SequencedStubHTTPClient) -> GitHubAppWall { let noopSleep: @Sendable (Duration) async throws -> Void = { _ in } - return GitHubAppWallRepository( + return GitHubAppWall( token: "test-token", httpClient: stub, upstreamOwner: "tddworks", diff --git a/Tests/DomainTests/Apps/AffordancesTests.swift b/Tests/ASCKitTests/Apps/AffordancesTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AffordancesTests.swift rename to Tests/ASCKitTests/Apps/AffordancesTests.swift index 6bb9d6d4..f9ac113a 100644 --- a/Tests/DomainTests/Apps/AffordancesTests.swift +++ b/Tests/ASCKitTests/Apps/AffordancesTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct AffordancesTests { diff --git a/Tests/DomainTests/Apps/AppClips/AppClipTests.swift b/Tests/ASCKitTests/Apps/AppClips/AppClipTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AppClips/AppClipTests.swift rename to Tests/ASCKitTests/Apps/AppClips/AppClipTests.swift index 00e644c0..374c5e06 100644 --- a/Tests/DomainTests/Apps/AppClips/AppClipTests.swift +++ b/Tests/ASCKitTests/Apps/AppClips/AppClipTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppClipTests { diff --git a/Tests/InfrastructureTests/Apps/AppClips/SDKAppClipRepositoryTests.swift b/Tests/ASCKitTests/Apps/AppClips/Internal/SDKAppClipRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/AppClips/SDKAppClipRepositoryTests.swift rename to Tests/ASCKitTests/Apps/AppClips/Internal/SDKAppClipRepositoryTests.swift index 55890e85..65905689 100644 --- a/Tests/InfrastructureTests/Apps/AppClips/SDKAppClipRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/AppClips/Internal/SDKAppClipRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKAppClipRepositoryListAppClipsTests { diff --git a/Tests/DomainTests/Apps/AppIconTests.swift b/Tests/ASCKitTests/Apps/AppIconTests.swift similarity index 98% rename from Tests/DomainTests/Apps/AppIconTests.swift rename to Tests/ASCKitTests/Apps/AppIconTests.swift index 4ed0835f..44d63937 100644 --- a/Tests/DomainTests/Apps/AppIconTests.swift +++ b/Tests/ASCKitTests/Apps/AppIconTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppIconTests { diff --git a/Tests/DomainTests/Apps/AppInfos/AgeRatingDeclarationTests.swift b/Tests/ASCKitTests/Apps/AppInfos/AgeRatingDeclarationTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AppInfos/AgeRatingDeclarationTests.swift rename to Tests/ASCKitTests/Apps/AppInfos/AgeRatingDeclarationTests.swift index 7dc48030..87ea2e52 100644 --- a/Tests/DomainTests/Apps/AppInfos/AgeRatingDeclarationTests.swift +++ b/Tests/ASCKitTests/Apps/AppInfos/AgeRatingDeclarationTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct AgeRatingDeclarationTests { diff --git a/Tests/DomainTests/Apps/AppInfos/AppCategoryTests.swift b/Tests/ASCKitTests/Apps/AppInfos/AppCategoryTests.swift similarity index 98% rename from Tests/DomainTests/Apps/AppInfos/AppCategoryTests.swift rename to Tests/ASCKitTests/Apps/AppInfos/AppCategoryTests.swift index c6c09193..a028d1e5 100644 --- a/Tests/DomainTests/Apps/AppInfos/AppCategoryTests.swift +++ b/Tests/ASCKitTests/Apps/AppInfos/AppCategoryTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppCategoryTests { diff --git a/Tests/DomainTests/Apps/AppInfos/AppInfoLocalizationTests.swift b/Tests/ASCKitTests/Apps/AppInfos/AppInfoLocalizationTests.swift similarity index 98% rename from Tests/DomainTests/Apps/AppInfos/AppInfoLocalizationTests.swift rename to Tests/ASCKitTests/Apps/AppInfos/AppInfoLocalizationTests.swift index cef7b582..5018bcea 100644 --- a/Tests/DomainTests/Apps/AppInfos/AppInfoLocalizationTests.swift +++ b/Tests/ASCKitTests/Apps/AppInfos/AppInfoLocalizationTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppInfoLocalizationTests { diff --git a/Tests/DomainTests/Apps/AppInfos/AppInfoTests.swift b/Tests/ASCKitTests/Apps/AppInfos/AppInfoTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AppInfos/AppInfoTests.swift rename to Tests/ASCKitTests/Apps/AppInfos/AppInfoTests.swift index c3c5fa0d..35e4fb9d 100644 --- a/Tests/DomainTests/Apps/AppInfos/AppInfoTests.swift +++ b/Tests/ASCKitTests/Apps/AppInfos/AppInfoTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppInfoTests { diff --git a/Tests/InfrastructureTests/Apps/AppInfos/SDKAgeRatingDeclarationRepositoryTests.swift b/Tests/ASCKitTests/Apps/AppInfos/Internal/SDKAgeRatingDeclarationRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/AppInfos/SDKAgeRatingDeclarationRepositoryTests.swift rename to Tests/ASCKitTests/Apps/AppInfos/Internal/SDKAgeRatingDeclarationRepositoryTests.swift index f80a6196..2d230ccc 100644 --- a/Tests/InfrastructureTests/Apps/AppInfos/SDKAgeRatingDeclarationRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/AppInfos/Internal/SDKAgeRatingDeclarationRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKAgeRatingDeclarationRepositoryTests { @@ -161,7 +160,7 @@ struct SDKAgeRatingDeclarationRepositoryTests { links: .init(this: "") )) - var update = Domain.AgeRatingDeclarationUpdate() + var update = ASCKit.AgeRatingDeclarationUpdate() update.isAdvertising = false update.violenceRealistic = .frequentOrIntense @@ -217,7 +216,7 @@ struct SDKAgeRatingDeclarationRepositoryTests { data: AgeRatingDeclaration(type: .ageRatingDeclarations, id: "decl-1"), links: .init(this: "") )) - var update = Domain.AgeRatingDeclarationUpdate() + var update = ASCKit.AgeRatingDeclarationUpdate() update.isSocialMedia = false update.isSocialMediaAgeRestricted = true update.developerAgeRatingInfoUrl = "https://example.com/age" diff --git a/Tests/InfrastructureTests/Apps/AppInfos/SDKAppCategoryRepositoryTests.swift b/Tests/ASCKitTests/Apps/AppInfos/Internal/SDKAppCategoryRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/AppInfos/SDKAppCategoryRepositoryTests.swift rename to Tests/ASCKitTests/Apps/AppInfos/Internal/SDKAppCategoryRepositoryTests.swift index 2bce4e03..2cab012b 100644 --- a/Tests/InfrastructureTests/Apps/AppInfos/SDKAppCategoryRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/AppInfos/Internal/SDKAppCategoryRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKAppCategoryRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/AppInfos/SDKAppInfoRepositoryTests.swift b/Tests/ASCKitTests/Apps/AppInfos/Internal/SDKAppInfoRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/AppInfos/SDKAppInfoRepositoryTests.swift rename to Tests/ASCKitTests/Apps/AppInfos/Internal/SDKAppInfoRepositoryTests.swift index 43157da0..865b82f5 100644 --- a/Tests/InfrastructureTests/Apps/AppInfos/SDKAppInfoRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/AppInfos/Internal/SDKAppInfoRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKAppInfoRepositoryTests { diff --git a/Tests/DomainTests/Apps/AppRepositoryTests.swift b/Tests/ASCKitTests/Apps/AppRepositoryTests.swift similarity index 98% rename from Tests/DomainTests/Apps/AppRepositoryTests.swift rename to Tests/ASCKitTests/Apps/AppRepositoryTests.swift index c20f7f99..de043659 100644 --- a/Tests/DomainTests/Apps/AppRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/AppRepositoryTests.swift @@ -1,6 +1,6 @@ import Mockable import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppRepositoryTests { diff --git a/Tests/DomainTests/Apps/AppTests.swift b/Tests/ASCKitTests/Apps/AppTests.swift similarity index 98% rename from Tests/DomainTests/Apps/AppTests.swift rename to Tests/ASCKitTests/Apps/AppTests.swift index 97f18a61..1cd4aeeb 100644 --- a/Tests/DomainTests/Apps/AppTests.swift +++ b/Tests/ASCKitTests/Apps/AppTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppTests { diff --git a/Tests/DomainTests/Apps/AssetLibrary/AppAssetLibraryTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/AppAssetLibraryTests.swift similarity index 98% rename from Tests/DomainTests/Apps/AssetLibrary/AppAssetLibraryTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/AppAssetLibraryTests.swift index eb44d649..10afcc4e 100644 --- a/Tests/DomainTests/Apps/AssetLibrary/AppAssetLibraryTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/AppAssetLibraryTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppAssetLibraryTests { diff --git a/Tests/InfrastructureTests/Apps/AssetLibrary/Images/SDKLibraryImageRepositoryTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Images/Internal/SDKLibraryImageRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/AssetLibrary/Images/SDKLibraryImageRepositoryTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Images/Internal/SDKLibraryImageRepositoryTests.swift index fbb9d2cf..d5f0a446 100644 --- a/Tests/InfrastructureTests/Apps/AssetLibrary/Images/SDKLibraryImageRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Images/Internal/SDKLibraryImageRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKLibraryImageRepositoryTests { diff --git a/Tests/DomainTests/Apps/AssetLibrary/Images/LibraryAssetStateTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Images/LibraryAssetStateTests.swift similarity index 98% rename from Tests/DomainTests/Apps/AssetLibrary/Images/LibraryAssetStateTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Images/LibraryAssetStateTests.swift index b50f485e..738549c7 100644 --- a/Tests/DomainTests/Apps/AssetLibrary/Images/LibraryAssetStateTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Images/LibraryAssetStateTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct LibraryAssetStateTests { diff --git a/Tests/DomainTests/Apps/AssetLibrary/Images/LibraryImageTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Images/LibraryImageTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AssetLibrary/Images/LibraryImageTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Images/LibraryImageTests.swift index e16ead98..aa55450c 100644 --- a/Tests/DomainTests/Apps/AssetLibrary/Images/LibraryImageTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Images/LibraryImageTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct LibraryImageTests { diff --git a/Tests/DomainTests/Apps/AssetLibrary/Import/ScreenshotImportExecuteTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Import/ScreenshotImportExecuteTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AssetLibrary/Import/ScreenshotImportExecuteTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Import/ScreenshotImportExecuteTests.swift index 22cfee59..fdb7bfc1 100644 --- a/Tests/DomainTests/Apps/AssetLibrary/Import/ScreenshotImportExecuteTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Import/ScreenshotImportExecuteTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotImportExecuteTests { diff --git a/Tests/DomainTests/Apps/AssetLibrary/Import/ScreenshotImportGroupResultTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Import/ScreenshotImportGroupResultTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AssetLibrary/Import/ScreenshotImportGroupResultTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Import/ScreenshotImportGroupResultTests.swift index 7f3b0789..3904d13b 100644 --- a/Tests/DomainTests/Apps/AssetLibrary/Import/ScreenshotImportGroupResultTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Import/ScreenshotImportGroupResultTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotImportGroupResultTests { diff --git a/Tests/DomainTests/Apps/AssetLibrary/Import/ScreenshotImportPlanTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Import/ScreenshotImportPlanTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AssetLibrary/Import/ScreenshotImportPlanTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Import/ScreenshotImportPlanTests.swift index 07266d58..badad3f9 100644 --- a/Tests/DomainTests/Apps/AssetLibrary/Import/ScreenshotImportPlanTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Import/ScreenshotImportPlanTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotImportPlanTests { diff --git a/Tests/InfrastructureTests/Apps/AssetLibrary/SDKAssetLibraryRepositoryTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Internal/SDKAssetLibraryRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/AssetLibrary/SDKAssetLibraryRepositoryTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Internal/SDKAssetLibraryRepositoryTests.swift index 1211a3b8..2d8e4fcc 100644 --- a/Tests/InfrastructureTests/Apps/AssetLibrary/SDKAssetLibraryRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Internal/SDKAssetLibraryRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKAssetLibraryRepositoryTests { @@ -18,7 +17,7 @@ struct SDKAssetLibraryRepositoryTests { let library = try await SDKAssetLibraryRepository(client: stub).getAssetLibrary(appId: "app-42") - #expect(library == Domain.AppAssetLibrary(id: "lib-1", appId: "app-42")) + #expect(library == ASCKit.AppAssetLibrary(id: "lib-1", appId: "app-42")) #expect(stub.lastPath == "/v1/apps/app-42/assetLibrary") } diff --git a/Tests/DomainTests/Apps/AssetLibrary/Placements/AssetPlacementTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Placements/AssetPlacementTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AssetLibrary/Placements/AssetPlacementTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Placements/AssetPlacementTests.swift index da982142..fa1e242c 100644 --- a/Tests/DomainTests/Apps/AssetLibrary/Placements/AssetPlacementTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Placements/AssetPlacementTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AssetPlacementTests { diff --git a/Tests/InfrastructureTests/Apps/AssetLibrary/Placements/SDKAssetPlacementRepositoryTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Placements/Internal/SDKAssetPlacementRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/AssetLibrary/Placements/SDKAssetPlacementRepositoryTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Placements/Internal/SDKAssetPlacementRepositoryTests.swift index 2fc0f8b7..e2211512 100644 --- a/Tests/InfrastructureTests/Apps/AssetLibrary/Placements/SDKAssetPlacementRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Placements/Internal/SDKAssetPlacementRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKAssetPlacementRepositoryTests { diff --git a/Tests/DomainTests/Apps/AssetLibrary/RefData/AssetPlacementGroupTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/RefData/AssetPlacementGroupTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AssetLibrary/RefData/AssetPlacementGroupTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/RefData/AssetPlacementGroupTests.swift index 212392a8..0f9c3263 100644 --- a/Tests/DomainTests/Apps/AssetLibrary/RefData/AssetPlacementGroupTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/RefData/AssetPlacementGroupTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AssetPlacementGroupTests { diff --git a/Tests/InfrastructureTests/Apps/AssetLibrary/Videos/SDKLibraryVideoRepositoryTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Videos/Internal/SDKLibraryVideoRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/AssetLibrary/Videos/SDKLibraryVideoRepositoryTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Videos/Internal/SDKLibraryVideoRepositoryTests.swift index 5e83c21a..545c2da3 100644 --- a/Tests/InfrastructureTests/Apps/AssetLibrary/Videos/SDKLibraryVideoRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Videos/Internal/SDKLibraryVideoRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK -import Domain import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKLibraryVideoRepositoryTests { diff --git a/Tests/DomainTests/Apps/AssetLibrary/Videos/LibraryVideoTests.swift b/Tests/ASCKitTests/Apps/AssetLibrary/Videos/LibraryVideoTests.swift similarity index 99% rename from Tests/DomainTests/Apps/AssetLibrary/Videos/LibraryVideoTests.swift rename to Tests/ASCKitTests/Apps/AssetLibrary/Videos/LibraryVideoTests.swift index af345805..cca38c72 100644 --- a/Tests/DomainTests/Apps/AssetLibrary/Videos/LibraryVideoTests.swift +++ b/Tests/ASCKitTests/Apps/AssetLibrary/Videos/LibraryVideoTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct LibraryVideoTests { diff --git a/Tests/DomainTests/Apps/Availability/AppAvailabilityTests.swift b/Tests/ASCKitTests/Apps/Availability/AppAvailabilityTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Availability/AppAvailabilityTests.swift rename to Tests/ASCKitTests/Apps/Availability/AppAvailabilityTests.swift index ab06aed2..4502f8ee 100644 --- a/Tests/DomainTests/Apps/Availability/AppAvailabilityTests.swift +++ b/Tests/ASCKitTests/Apps/Availability/AppAvailabilityTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppAvailabilityTests { diff --git a/Tests/DomainTests/Apps/Availability/AppTerritoryAvailabilityTests.swift b/Tests/ASCKitTests/Apps/Availability/AppTerritoryAvailabilityTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Availability/AppTerritoryAvailabilityTests.swift rename to Tests/ASCKitTests/Apps/Availability/AppTerritoryAvailabilityTests.swift index e3cf3f91..0fd1ff39 100644 --- a/Tests/DomainTests/Apps/Availability/AppTerritoryAvailabilityTests.swift +++ b/Tests/ASCKitTests/Apps/Availability/AppTerritoryAvailabilityTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppTerritoryAvailabilityTests { diff --git a/Tests/InfrastructureTests/Apps/Availability/SDKAppAvailabilityRepositoryTests.swift b/Tests/ASCKitTests/Apps/Availability/Internal/SDKAppAvailabilityRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Availability/SDKAppAvailabilityRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Availability/Internal/SDKAppAvailabilityRepositoryTests.swift index 3b58cc53..a4ceeab2 100644 --- a/Tests/InfrastructureTests/Apps/Availability/SDKAppAvailabilityRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Availability/Internal/SDKAppAvailabilityRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKAppAvailabilityRepositoryTests { diff --git a/Tests/DomainTests/Apps/Builds/BetaBuildLocalizationTests.swift b/Tests/ASCKitTests/Apps/Builds/BetaBuildLocalizationTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Builds/BetaBuildLocalizationTests.swift rename to Tests/ASCKitTests/Apps/Builds/BetaBuildLocalizationTests.swift index 269d372b..c399e6c3 100644 --- a/Tests/DomainTests/Apps/Builds/BetaBuildLocalizationTests.swift +++ b/Tests/ASCKitTests/Apps/Builds/BetaBuildLocalizationTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct BetaBuildLocalizationTests { diff --git a/Tests/DomainTests/Apps/Builds/BuildTests.swift b/Tests/ASCKitTests/Apps/Builds/BuildTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Builds/BuildTests.swift rename to Tests/ASCKitTests/Apps/Builds/BuildTests.swift index 9d224ad1..6aaaf74a 100644 --- a/Tests/DomainTests/Apps/Builds/BuildTests.swift +++ b/Tests/ASCKitTests/Apps/Builds/BuildTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct BuildTests { diff --git a/Tests/DomainTests/Apps/Builds/BuildUploadTests.swift b/Tests/ASCKitTests/Apps/Builds/BuildUploadTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Builds/BuildUploadTests.swift rename to Tests/ASCKitTests/Apps/Builds/BuildUploadTests.swift index a31a69c6..112e4e43 100644 --- a/Tests/DomainTests/Apps/Builds/BuildUploadTests.swift +++ b/Tests/ASCKitTests/Apps/Builds/BuildUploadTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct BuildUploadTests { diff --git a/Tests/InfrastructureTests/Apps/Builds/SDKBetaBuildLocalizationRepositoryTests.swift b/Tests/ASCKitTests/Apps/Builds/Internal/SDKBetaBuildLocalizationRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Builds/SDKBetaBuildLocalizationRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Builds/Internal/SDKBetaBuildLocalizationRepositoryTests.swift index 86a10e5b..7cd1ff9e 100644 --- a/Tests/InfrastructureTests/Apps/Builds/SDKBetaBuildLocalizationRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Builds/Internal/SDKBetaBuildLocalizationRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKBetaBuildLocalizationRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Builds/SDKBuildRepositoryTests.swift b/Tests/ASCKitTests/Apps/Builds/Internal/SDKBuildRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Builds/SDKBuildRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Builds/Internal/SDKBuildRepositoryTests.swift index 9c9a9d3a..94668e72 100644 --- a/Tests/InfrastructureTests/Apps/Builds/SDKBuildRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Builds/Internal/SDKBuildRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKBuildRepositoryTests { @@ -78,7 +77,7 @@ struct SDKBuildRepositoryTests { } @Test func `listBuilds maps all processing states`() async throws { - let cases: [(AppStoreConnect_Swift_SDK.Build.Attributes.ProcessingState, Domain.Build.ProcessingState)] = [ + let cases: [(AppStoreConnect_Swift_SDK.Build.Attributes.ProcessingState, ASCKit.Build.ProcessingState)] = [ (.processing, .processing), (.failed, .failed), (.invalid, .invalid), diff --git a/Tests/InfrastructureTests/Apps/Builds/SDKBuildUploadRepositoryTests.swift b/Tests/ASCKitTests/Apps/Builds/Internal/SDKBuildUploadRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Builds/SDKBuildUploadRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Builds/Internal/SDKBuildUploadRepositoryTests.swift index 8fd20364..610c343a 100644 --- a/Tests/InfrastructureTests/Apps/Builds/SDKBuildUploadRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Builds/Internal/SDKBuildUploadRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKBuildUploadRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Builds/SDKBuildUploadRepositoryUploadTests.swift b/Tests/ASCKitTests/Apps/Builds/Internal/SDKBuildUploadRepositoryUploadTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Builds/SDKBuildUploadRepositoryUploadTests.swift rename to Tests/ASCKitTests/Apps/Builds/Internal/SDKBuildUploadRepositoryUploadTests.swift index 998c2807..587e9a71 100644 --- a/Tests/InfrastructureTests/Apps/Builds/SDKBuildUploadRepositoryUploadTests.swift +++ b/Tests/ASCKitTests/Apps/Builds/Internal/SDKBuildUploadRepositoryUploadTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKBuildUploadRepositoryUploadTests { diff --git a/Tests/DomainTests/Apps/Builds/NextBuildNumberTests.swift b/Tests/ASCKitTests/Apps/Builds/NextBuildNumberTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Builds/NextBuildNumberTests.swift rename to Tests/ASCKitTests/Apps/Builds/NextBuildNumberTests.swift index 313b137f..ce375ab8 100644 --- a/Tests/DomainTests/Apps/Builds/NextBuildNumberTests.swift +++ b/Tests/ASCKitTests/Apps/Builds/NextBuildNumberTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct NextBuildNumberTests { diff --git a/Tests/DomainTests/Apps/Builds/XcodeBuild/ArchiveExportTests.swift b/Tests/ASCKitTests/Apps/Builds/XcodeBuild/ArchiveExportTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Builds/XcodeBuild/ArchiveExportTests.swift rename to Tests/ASCKitTests/Apps/Builds/XcodeBuild/ArchiveExportTests.swift index 64d3fd62..1df37598 100644 --- a/Tests/DomainTests/Apps/Builds/XcodeBuild/ArchiveExportTests.swift +++ b/Tests/ASCKitTests/Apps/Builds/XcodeBuild/ArchiveExportTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ArchiveExportTests { diff --git a/Tests/InfrastructureTests/Apps/Builds/XcodeBuild/ProcessXcodeBuildRunnerTests.swift b/Tests/ASCKitTests/Apps/Builds/XcodeBuild/Internal/ProcessXcodeBuildRunnerTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Builds/XcodeBuild/ProcessXcodeBuildRunnerTests.swift rename to Tests/ASCKitTests/Apps/Builds/XcodeBuild/Internal/ProcessXcodeBuildRunnerTests.swift index 88ea9a34..b50c9f5d 100644 --- a/Tests/InfrastructureTests/Apps/Builds/XcodeBuild/ProcessXcodeBuildRunnerTests.swift +++ b/Tests/ASCKitTests/Apps/Builds/XcodeBuild/Internal/ProcessXcodeBuildRunnerTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite("ProcessXcodeBuildRunner") struct ProcessXcodeBuildRunnerTests { diff --git a/Tests/DomainTests/Apps/Experiments/AppStoreVersionExperimentTests.swift b/Tests/ASCKitTests/Apps/Experiments/AppStoreVersionExperimentTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Experiments/AppStoreVersionExperimentTests.swift rename to Tests/ASCKitTests/Apps/Experiments/AppStoreVersionExperimentTests.swift index 21b73eb9..cf344b6c 100644 --- a/Tests/DomainTests/Apps/Experiments/AppStoreVersionExperimentTests.swift +++ b/Tests/ASCKitTests/Apps/Experiments/AppStoreVersionExperimentTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppStoreVersionExperimentTests { diff --git a/Tests/DomainTests/Apps/Experiments/ExperimentTreatmentLocalizationTests.swift b/Tests/ASCKitTests/Apps/Experiments/ExperimentTreatmentLocalizationTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Experiments/ExperimentTreatmentLocalizationTests.swift rename to Tests/ASCKitTests/Apps/Experiments/ExperimentTreatmentLocalizationTests.swift index aa60483f..f8ad5518 100644 --- a/Tests/DomainTests/Apps/Experiments/ExperimentTreatmentLocalizationTests.swift +++ b/Tests/ASCKitTests/Apps/Experiments/ExperimentTreatmentLocalizationTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ExperimentTreatmentLocalizationTests { diff --git a/Tests/DomainTests/Apps/Experiments/ExperimentTreatmentTests.swift b/Tests/ASCKitTests/Apps/Experiments/ExperimentTreatmentTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Experiments/ExperimentTreatmentTests.swift rename to Tests/ASCKitTests/Apps/Experiments/ExperimentTreatmentTests.swift index 1afd928c..f8d5694a 100644 --- a/Tests/DomainTests/Apps/Experiments/ExperimentTreatmentTests.swift +++ b/Tests/ASCKitTests/Apps/Experiments/ExperimentTreatmentTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ExperimentTreatmentTests { diff --git a/Tests/InfrastructureTests/Apps/Experiments/SDKExperimentRepositoryTests.swift b/Tests/ASCKitTests/Apps/Experiments/Internal/SDKExperimentRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Experiments/SDKExperimentRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Experiments/Internal/SDKExperimentRepositoryTests.swift index 380a4961..ec4638fa 100644 --- a/Tests/InfrastructureTests/Apps/Experiments/SDKExperimentRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Experiments/Internal/SDKExperimentRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKExperimentRepositoryTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/Availability/InAppPurchaseAvailabilityTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/Availability/InAppPurchaseAvailabilityTests.swift similarity index 98% rename from Tests/DomainTests/Apps/InAppPurchases/Availability/InAppPurchaseAvailabilityTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/Availability/InAppPurchaseAvailabilityTests.swift index 810f307a..3e79e7ea 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/Availability/InAppPurchaseAvailabilityTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/Availability/InAppPurchaseAvailabilityTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchaseAvailabilityTests { diff --git a/Tests/InfrastructureTests/Apps/InAppPurchases/Availability/SDKInAppPurchaseAvailabilityRepositoryTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/Availability/Internal/SDKInAppPurchaseAvailabilityRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/InAppPurchases/Availability/SDKInAppPurchaseAvailabilityRepositoryTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/Availability/Internal/SDKInAppPurchaseAvailabilityRepositoryTests.swift index ee3cab5d..653ecfd7 100644 --- a/Tests/InfrastructureTests/Apps/InAppPurchases/Availability/SDKInAppPurchaseAvailabilityRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/Availability/Internal/SDKInAppPurchaseAvailabilityRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKInAppPurchaseAvailabilityRepositoryTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/InAppPurchasePricePointTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchasePricePointTests.swift similarity index 98% rename from Tests/DomainTests/Apps/InAppPurchases/InAppPurchasePricePointTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchasePricePointTests.swift index a3ba37df..37fb6125 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/InAppPurchasePricePointTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchasePricePointTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchasePricePointTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/InAppPurchasePriceScheduleTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchasePriceScheduleTests.swift similarity index 99% rename from Tests/DomainTests/Apps/InAppPurchases/InAppPurchasePriceScheduleTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchasePriceScheduleTests.swift index 47a077cb..57c40382 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/InAppPurchasePriceScheduleTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchasePriceScheduleTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchasePriceScheduleTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/InAppPurchaseSubmissionTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchaseSubmissionTests.swift similarity index 97% rename from Tests/DomainTests/Apps/InAppPurchases/InAppPurchaseSubmissionTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchaseSubmissionTests.swift index 62827386..ac3e1299 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/InAppPurchaseSubmissionTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchaseSubmissionTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchaseSubmissionTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/InAppPurchaseTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchaseTests.swift similarity index 99% rename from Tests/DomainTests/Apps/InAppPurchases/InAppPurchaseTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchaseTests.swift index 332eaba0..8dd798a7 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/InAppPurchaseTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/InAppPurchaseTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchaseTests { diff --git a/Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchaseLocalizationRepositoryTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchaseLocalizationRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchaseLocalizationRepositoryTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchaseLocalizationRepositoryTests.swift index 0ef6c6b1..355b0a79 100644 --- a/Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchaseLocalizationRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchaseLocalizationRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKInAppPurchaseLocalizationRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchasePriceRepositoryTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchasePriceRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchasePriceRepositoryTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchasePriceRepositoryTests.swift index 77fb32fb..26fe82ab 100644 --- a/Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchasePriceRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchasePriceRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKInAppPurchasePriceRepositoryTests { @@ -274,9 +273,9 @@ struct SDKInAppPurchasePriceRepositoryTests { let result = try await repo.getPriceSchedule(iapId: "iap-7") // territoryPrices contains USA (manual + equalized) deduped + JPN (equalized). - let prices: [Domain.TerritoryPrice] = result?.territoryPrices ?? [] + let prices: [ASCKit.TerritoryPrice] = result?.territoryPrices ?? [] #expect(prices.count == 2) - var byTerritory: [String: Domain.TerritoryPrice] = [:] + var byTerritory: [String: ASCKit.TerritoryPrice] = [:] for entry in prices { byTerritory[entry.territory.id] = entry } #expect(byTerritory["USA"]?.customerPrice == "9.99") #expect(byTerritory["USA"]?.territory.currency == "USD") diff --git a/Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchaseRepositoryTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchaseRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchaseRepositoryTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchaseRepositoryTests.swift index 4cab2919..bd30a09f 100644 --- a/Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchaseRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchaseRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKInAppPurchaseRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchaseSubmissionRepositoryTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchaseSubmissionRepositoryTests.swift similarity index 94% rename from Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchaseSubmissionRepositoryTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchaseSubmissionRepositoryTests.swift index 5c2a67ed..4ba02e66 100644 --- a/Tests/InfrastructureTests/Apps/InAppPurchases/SDKInAppPurchaseSubmissionRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/Internal/SDKInAppPurchaseSubmissionRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKInAppPurchaseSubmissionRepositoryTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeCustomCodeTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeCustomCodeTests.swift similarity index 98% rename from Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeCustomCodeTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeCustomCodeTests.swift index 01882393..47197231 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeCustomCodeTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeCustomCodeTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchaseOfferCodeCustomCodeTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeOneTimeUseCodeTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeOneTimeUseCodeTests.swift similarity index 99% rename from Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeOneTimeUseCodeTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeOneTimeUseCodeTests.swift index 5e851118..20b393e1 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeOneTimeUseCodeTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeOneTimeUseCodeTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchaseOfferCodeOneTimeUseCodeTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodePriceTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodePriceTests.swift similarity index 99% rename from Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodePriceTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodePriceTests.swift index 73d33648..410dc5bd 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodePriceTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodePriceTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchaseOfferCodePriceTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeTests.swift similarity index 99% rename from Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeTests.swift index 7c94a980..d2dedb07 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/InAppPurchaseOfferCodeTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchaseOfferCodeTests { diff --git a/Tests/InfrastructureTests/Apps/InAppPurchases/OfferCodes/SDKInAppPurchaseOfferCodeRepositoryTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/Internal/SDKInAppPurchaseOfferCodeRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/InAppPurchases/OfferCodes/SDKInAppPurchaseOfferCodeRepositoryTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/Internal/SDKInAppPurchaseOfferCodeRepositoryTests.swift index ac018148..c736d59a 100644 --- a/Tests/InfrastructureTests/Apps/InAppPurchases/OfferCodes/SDKInAppPurchaseOfferCodeRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/OfferCodes/Internal/SDKInAppPurchaseOfferCodeRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKInAppPurchaseOfferCodeRepositoryTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/Review/InAppPurchaseReviewCodableTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/Review/InAppPurchaseReviewCodableTests.swift similarity index 98% rename from Tests/DomainTests/Apps/InAppPurchases/Review/InAppPurchaseReviewCodableTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/Review/InAppPurchaseReviewCodableTests.swift index b4a5cc10..0aef0257 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/Review/InAppPurchaseReviewCodableTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/Review/InAppPurchaseReviewCodableTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchaseReviewCodableTests { diff --git a/Tests/DomainTests/Apps/InAppPurchases/Review/InAppPurchaseReviewScreenshotTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/Review/InAppPurchaseReviewScreenshotTests.swift similarity index 99% rename from Tests/DomainTests/Apps/InAppPurchases/Review/InAppPurchaseReviewScreenshotTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/Review/InAppPurchaseReviewScreenshotTests.swift index ffccefd0..862f3e11 100644 --- a/Tests/DomainTests/Apps/InAppPurchases/Review/InAppPurchaseReviewScreenshotTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/Review/InAppPurchaseReviewScreenshotTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct InAppPurchaseReviewScreenshotTests { diff --git a/Tests/InfrastructureTests/Apps/InAppPurchases/Review/SDKInAppPurchaseReviewRepositoryTests.swift b/Tests/ASCKitTests/Apps/InAppPurchases/Review/Internal/SDKInAppPurchaseReviewRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/InAppPurchases/Review/SDKInAppPurchaseReviewRepositoryTests.swift rename to Tests/ASCKitTests/Apps/InAppPurchases/Review/Internal/SDKInAppPurchaseReviewRepositoryTests.swift index ec93c7ed..4ceb6ace 100644 --- a/Tests/InfrastructureTests/Apps/InAppPurchases/Review/SDKInAppPurchaseReviewRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/InAppPurchases/Review/Internal/SDKInAppPurchaseReviewRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKInAppPurchaseReviewRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/SDKAppRepositoryTests.swift b/Tests/ASCKitTests/Apps/Internal/SDKAppRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/SDKAppRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Internal/SDKAppRepositoryTests.swift index f3af84ea..8022e9bc 100644 --- a/Tests/InfrastructureTests/Apps/SDKAppRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Internal/SDKAppRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKAppRepositoryTests { diff --git a/Tests/DomainTests/Apps/Performance/DiagnosticLogEntryTests.swift b/Tests/ASCKitTests/Apps/Performance/DiagnosticLogEntryTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Performance/DiagnosticLogEntryTests.swift rename to Tests/ASCKitTests/Apps/Performance/DiagnosticLogEntryTests.swift index 0b9ddbf1..daff8966 100644 --- a/Tests/DomainTests/Apps/Performance/DiagnosticLogEntryTests.swift +++ b/Tests/ASCKitTests/Apps/Performance/DiagnosticLogEntryTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("DiagnosticLogEntry") struct DiagnosticLogEntryTests { diff --git a/Tests/DomainTests/Apps/Performance/DiagnosticSignatureInfoTests.swift b/Tests/ASCKitTests/Apps/Performance/DiagnosticSignatureInfoTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Performance/DiagnosticSignatureInfoTests.swift rename to Tests/ASCKitTests/Apps/Performance/DiagnosticSignatureInfoTests.swift index 045fe4ee..40d95448 100644 --- a/Tests/DomainTests/Apps/Performance/DiagnosticSignatureInfoTests.swift +++ b/Tests/ASCKitTests/Apps/Performance/DiagnosticSignatureInfoTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("DiagnosticSignatureInfo") struct DiagnosticSignatureInfoTests { diff --git a/Tests/InfrastructureTests/Apps/Performance/SDKDiagnosticsRepositoryTests.swift b/Tests/ASCKitTests/Apps/Performance/Internal/SDKDiagnosticsRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Performance/SDKDiagnosticsRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Performance/Internal/SDKDiagnosticsRepositoryTests.swift index 730fa25d..e4d3e03b 100644 --- a/Tests/InfrastructureTests/Apps/Performance/SDKDiagnosticsRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Performance/Internal/SDKDiagnosticsRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKDiagnosticsRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Performance/SDKPerfMetricsRepositoryTests.swift b/Tests/ASCKitTests/Apps/Performance/Internal/SDKPerfMetricsRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Performance/SDKPerfMetricsRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Performance/Internal/SDKPerfMetricsRepositoryTests.swift index bb5c3db4..a1c544d0 100644 --- a/Tests/InfrastructureTests/Apps/Performance/SDKPerfMetricsRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Performance/Internal/SDKPerfMetricsRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKPerfMetricsRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Performance/SDKPerfOverviewRepositoryTests.swift b/Tests/ASCKitTests/Apps/Performance/Internal/SDKPerfOverviewRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Performance/SDKPerfOverviewRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Performance/Internal/SDKPerfOverviewRepositoryTests.swift index 0721328f..42a96011 100644 --- a/Tests/InfrastructureTests/Apps/Performance/SDKPerfOverviewRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Performance/Internal/SDKPerfOverviewRepositoryTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKPerfOverviewRepositoryTests { diff --git a/Tests/DomainTests/Apps/Performance/PerfPowerMetricTests.swift b/Tests/ASCKitTests/Apps/Performance/PerfPowerMetricTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Performance/PerfPowerMetricTests.swift rename to Tests/ASCKitTests/Apps/Performance/PerfPowerMetricTests.swift index 99625774..73d1c1c8 100644 --- a/Tests/DomainTests/Apps/Performance/PerfPowerMetricTests.swift +++ b/Tests/ASCKitTests/Apps/Performance/PerfPowerMetricTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("PerformanceMetric") struct PerformanceMetricTests { diff --git a/Tests/DomainTests/Apps/Performance/PerformanceOverviewTests.swift b/Tests/ASCKitTests/Apps/Performance/PerformanceOverviewTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Performance/PerformanceOverviewTests.swift rename to Tests/ASCKitTests/Apps/Performance/PerformanceOverviewTests.swift index 84e55281..7e1e8bd1 100644 --- a/Tests/DomainTests/Apps/Performance/PerformanceOverviewTests.swift +++ b/Tests/ASCKitTests/Apps/Performance/PerformanceOverviewTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("PerformanceOverview") struct PerformanceOverviewTests { diff --git a/Tests/DomainTests/Apps/Pricing/AppPricingTests.swift b/Tests/ASCKitTests/Apps/Pricing/AppPricingTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Pricing/AppPricingTests.swift rename to Tests/ASCKitTests/Apps/Pricing/AppPricingTests.swift index 242066a3..0ea9c927 100644 --- a/Tests/DomainTests/Apps/Pricing/AppPricingTests.swift +++ b/Tests/ASCKitTests/Apps/Pricing/AppPricingTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppPricingTests { diff --git a/Tests/InfrastructureTests/Apps/Pricing/SDKPricingRepositoryTests.swift b/Tests/ASCKitTests/Apps/Pricing/Internal/SDKPricingRepositoryTests.swift similarity index 95% rename from Tests/InfrastructureTests/Apps/Pricing/SDKPricingRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Pricing/Internal/SDKPricingRepositoryTests.swift index 8ada941a..3437e746 100644 --- a/Tests/InfrastructureTests/Apps/Pricing/SDKPricingRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Pricing/Internal/SDKPricingRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKPricingRepositoryTests { @@ -58,7 +57,7 @@ private final class ThrowingStubAPIClient: APIClient, @unchecked Sendable { let points = try await repo.listPricePoints(appId: "app-1", territory: "USA") #expect(points.count == 250) - #expect(points.last == Domain.AppPricePoint(id: "pp-249", appId: "app-1", territory: "USA", + #expect(points.last == ASCKit.AppPricePoint(id: "pp-249", appId: "app-1", territory: "USA", customerPrice: "249.99", proceeds: "249.50")) let query = Dictionary(uniqueKeysWithValues: (stub.requests.first?.query ?? []).map { ($0.0, $0.1 ?? "") }) #expect(stub.requests.first?.path == "/v1/apps/app-1/appPricePoints") @@ -74,7 +73,7 @@ private final class ThrowingStubAPIClient: APIClient, @unchecked Sendable { let repo = SDKPricingRepository(client: stub) let schedule = try await repo.setPriceSchedule(appId: "app-1", baseTerritory: "USA", pricePointId: "pp-9") - #expect(schedule == Domain.AppPriceSchedule(id: "sched-1", appId: "app-1", baseTerritory: "USA")) + #expect(schedule == ASCKit.AppPriceSchedule(id: "sched-1", appId: "app-1", baseTerritory: "USA")) let post = stub.requests.first { $0.method == "POST" } #expect(post?.path == "/v1/appPriceSchedules") #expect(post?.body == #"{"data":{"relationships":{"app":{"data":{"id":"app-1","type":"apps"}},"baseTerritory":{"data":{"id":"USA","type":"territories"}},"manualPrices":{"data":[{"id":"${local-app-price-1}","type":"appPrices"}]}},"type":"appPriceSchedules"},"included":[{"id":"${local-app-price-1}","relationships":{"appPricePoint":{"data":{"id":"pp-9","type":"appPricePoints"}}},"type":"appPrices"}]}"#) diff --git a/Tests/InfrastructureTests/Apps/ProductVersions/SDKProductVersionRepositoryTests.swift b/Tests/ASCKitTests/Apps/ProductVersions/Internal/SDKProductVersionRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/ProductVersions/SDKProductVersionRepositoryTests.swift rename to Tests/ASCKitTests/Apps/ProductVersions/Internal/SDKProductVersionRepositoryTests.swift index 62238c7f..2862958f 100644 --- a/Tests/InfrastructureTests/Apps/ProductVersions/SDKProductVersionRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/ProductVersions/Internal/SDKProductVersionRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKProductVersionRepositoryTests { diff --git a/Tests/DomainTests/Apps/ProductVersions/ProductVersionTests.swift b/Tests/ASCKitTests/Apps/ProductVersions/ProductVersionTests.swift similarity index 99% rename from Tests/DomainTests/Apps/ProductVersions/ProductVersionTests.swift rename to Tests/ASCKitTests/Apps/ProductVersions/ProductVersionTests.swift index e405613a..d3f2a2df 100644 --- a/Tests/DomainTests/Apps/ProductVersions/ProductVersionTests.swift +++ b/Tests/ASCKitTests/Apps/ProductVersions/ProductVersionTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct ProductVersionTests { diff --git a/Tests/InfrastructureTests/Apps/PromotedPurchases/SDKPromotedPurchaseRepositoryTests.swift b/Tests/ASCKitTests/Apps/PromotedPurchases/Internal/SDKPromotedPurchaseRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/PromotedPurchases/SDKPromotedPurchaseRepositoryTests.swift rename to Tests/ASCKitTests/Apps/PromotedPurchases/Internal/SDKPromotedPurchaseRepositoryTests.swift index 899c74ab..ad3204c3 100644 --- a/Tests/InfrastructureTests/Apps/PromotedPurchases/SDKPromotedPurchaseRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/PromotedPurchases/Internal/SDKPromotedPurchaseRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKPromotedPurchaseRepositoryTests { diff --git a/Tests/DomainTests/Apps/PromotedPurchases/PromotedPurchaseCodableTests.swift b/Tests/ASCKitTests/Apps/PromotedPurchases/PromotedPurchaseCodableTests.swift similarity index 98% rename from Tests/DomainTests/Apps/PromotedPurchases/PromotedPurchaseCodableTests.swift rename to Tests/ASCKitTests/Apps/PromotedPurchases/PromotedPurchaseCodableTests.swift index 6c971940..2cafcef1 100644 --- a/Tests/DomainTests/Apps/PromotedPurchases/PromotedPurchaseCodableTests.swift +++ b/Tests/ASCKitTests/Apps/PromotedPurchases/PromotedPurchaseCodableTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct PromotedPurchaseCodableTests { diff --git a/Tests/DomainTests/Apps/PromotedPurchases/PromotedPurchaseTests.swift b/Tests/ASCKitTests/Apps/PromotedPurchases/PromotedPurchaseTests.swift similarity index 99% rename from Tests/DomainTests/Apps/PromotedPurchases/PromotedPurchaseTests.swift rename to Tests/ASCKitTests/Apps/PromotedPurchases/PromotedPurchaseTests.swift index 8b6d6129..ea234915 100644 --- a/Tests/DomainTests/Apps/PromotedPurchases/PromotedPurchaseTests.swift +++ b/Tests/ASCKitTests/Apps/PromotedPurchases/PromotedPurchaseTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct PromotedPurchaseTests { diff --git a/Tests/DomainTests/Apps/Reviews/CustomerReviewResponseTests.swift b/Tests/ASCKitTests/Apps/Reviews/CustomerReviewResponseTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Reviews/CustomerReviewResponseTests.swift rename to Tests/ASCKitTests/Apps/Reviews/CustomerReviewResponseTests.swift index d2cb9ebc..cf267e39 100644 --- a/Tests/DomainTests/Apps/Reviews/CustomerReviewResponseTests.swift +++ b/Tests/ASCKitTests/Apps/Reviews/CustomerReviewResponseTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct CustomerReviewResponseTests { diff --git a/Tests/DomainTests/Apps/Reviews/CustomerReviewTests.swift b/Tests/ASCKitTests/Apps/Reviews/CustomerReviewTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Reviews/CustomerReviewTests.swift rename to Tests/ASCKitTests/Apps/Reviews/CustomerReviewTests.swift index e266b374..5bbe0913 100644 --- a/Tests/DomainTests/Apps/Reviews/CustomerReviewTests.swift +++ b/Tests/ASCKitTests/Apps/Reviews/CustomerReviewTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct CustomerReviewTests { diff --git a/Tests/InfrastructureTests/Apps/Reviews/SDKCustomerReviewRepositoryTests.swift b/Tests/ASCKitTests/Apps/Reviews/Internal/SDKCustomerReviewRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Reviews/SDKCustomerReviewRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Reviews/Internal/SDKCustomerReviewRepositoryTests.swift index a93711ef..a51f5060 100644 --- a/Tests/InfrastructureTests/Apps/Reviews/SDKCustomerReviewRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Reviews/Internal/SDKCustomerReviewRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKCustomerReviewRepositoryListReviewsTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/Availability/SDKSubscriptionAvailabilityRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Availability/Internal/SDKSubscriptionAvailabilityRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Subscriptions/Availability/SDKSubscriptionAvailabilityRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Availability/Internal/SDKSubscriptionAvailabilityRepositoryTests.swift index 0f748b56..a5b21311 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/Availability/SDKSubscriptionAvailabilityRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Availability/Internal/SDKSubscriptionAvailabilityRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionAvailabilityRepositoryTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/Availability/SubscriptionAvailabilityTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Availability/SubscriptionAvailabilityTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/Availability/SubscriptionAvailabilityTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Availability/SubscriptionAvailabilityTests.swift index cff391fa..8053f5cd 100644 --- a/Tests/DomainTests/Apps/Subscriptions/Availability/SubscriptionAvailabilityTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Availability/SubscriptionAvailabilityTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionAvailabilityTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionGroupLocalizationRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionGroupLocalizationRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionGroupLocalizationRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionGroupLocalizationRepositoryTests.swift index e003ae15..b3bb5fee 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionGroupLocalizationRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionGroupLocalizationRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionGroupLocalizationRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionGroupRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionGroupRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionGroupRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionGroupRepositoryTests.swift index ccbe63cf..ee273830 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionGroupRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionGroupRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionGroupRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionLocalizationRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionLocalizationRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionLocalizationRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionLocalizationRepositoryTests.swift index 99928146..d8aed37a 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionLocalizationRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionLocalizationRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionLocalizationRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionPriceRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionPriceRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionPriceRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionPriceRepositoryTests.swift index b2578b38..e4937871 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionPriceRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionPriceRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionPriceRepositoryTests { @@ -197,9 +196,9 @@ struct SDKSubscriptionPriceRepositoryTests { let repo = SDKSubscriptionPriceRepository(client: stub) let result = try await repo.getPriceSchedule(subscriptionId: "sub-7") - let prices: [Domain.TerritoryPrice] = result?.territoryPrices ?? [] + let prices: [ASCKit.TerritoryPrice] = result?.territoryPrices ?? [] #expect(prices.count == 2) - var byTerritory: [String: Domain.TerritoryPrice] = [:] + var byTerritory: [String: ASCKit.TerritoryPrice] = [:] for entry in prices { byTerritory[entry.territory.id] = entry } #expect(byTerritory["USA"]?.customerPrice == "5.99") #expect(byTerritory["USA"]?.territory.currency == "USD") diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionPromotionalOfferRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionPromotionalOfferRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionPromotionalOfferRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionPromotionalOfferRepositoryTests.swift index 69c5cbb6..bb36a0b4 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionPromotionalOfferRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionPromotionalOfferRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionPromotionalOfferRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionRepositoryTests.swift index 78d038b1..45691cbe 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionSubmissionRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionSubmissionRepositoryTests.swift similarity index 95% rename from Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionSubmissionRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionSubmissionRepositoryTests.swift index de865dcd..d55f34ea 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/SDKSubscriptionSubmissionRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKSubscriptionSubmissionRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionSubmissionRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/SDKWinBackOfferRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKWinBackOfferRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Subscriptions/SDKWinBackOfferRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKWinBackOfferRepositoryTests.swift index 3a9a8b7c..c90a8e84 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/SDKWinBackOfferRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Internal/SDKWinBackOfferRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKWinBackOfferRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/IntroductoryOffers/SDKSubscriptionIntroductoryOfferRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/IntroductoryOffers/Internal/SDKSubscriptionIntroductoryOfferRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Subscriptions/IntroductoryOffers/SDKSubscriptionIntroductoryOfferRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/IntroductoryOffers/Internal/SDKSubscriptionIntroductoryOfferRepositoryTests.swift index e5c5d8ed..902d91fd 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/IntroductoryOffers/SDKSubscriptionIntroductoryOfferRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/IntroductoryOffers/Internal/SDKSubscriptionIntroductoryOfferRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionIntroductoryOfferRepositoryTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOfferTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOfferTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOfferTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOfferTests.swift index 8d511ff0..8ef6f9aa 100644 --- a/Tests/DomainTests/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOfferTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/IntroductoryOffers/SubscriptionIntroductoryOfferTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionIntroductoryOfferTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/OfferCodes/SDKSubscriptionOfferCodeRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/Internal/SDKSubscriptionOfferCodeRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Subscriptions/OfferCodes/SDKSubscriptionOfferCodeRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/Internal/SDKSubscriptionOfferCodeRepositoryTests.swift index 990db551..8f578b35 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/OfferCodes/SDKSubscriptionOfferCodeRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/Internal/SDKSubscriptionOfferCodeRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionOfferCodeRepositoryTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeCustomCodeTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeCustomCodeTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeCustomCodeTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeCustomCodeTests.swift index 5b4eb53d..8832593a 100644 --- a/Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeCustomCodeTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeCustomCodeTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodeCustomCodeTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeOneTimeUseCodeTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeOneTimeUseCodeTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeOneTimeUseCodeTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeOneTimeUseCodeTests.swift index 83fd00a7..3edee6ca 100644 --- a/Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeOneTimeUseCodeTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeOneTimeUseCodeTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodeOneTimeUseCodeTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodePriceTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodePriceTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodePriceTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodePriceTests.swift index fdd27b27..4fd87ad8 100644 --- a/Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodePriceTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodePriceTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodePriceTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeTests.swift index 01af0559..20e40448 100644 --- a/Tests/DomainTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/OfferCodes/SubscriptionOfferCodeTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionOfferCodeTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/Review/SDKSubscriptionReviewRepositoryTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Review/Internal/SDKSubscriptionReviewRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Subscriptions/Review/SDKSubscriptionReviewRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Review/Internal/SDKSubscriptionReviewRepositoryTests.swift index 7cfed78a..2073bdf4 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/Review/SDKSubscriptionReviewRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Review/Internal/SDKSubscriptionReviewRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubscriptionReviewRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Subscriptions/Review/SDKSubscriptionReviewRepositoryUploadTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Review/Internal/SDKSubscriptionReviewRepositoryUploadTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Subscriptions/Review/SDKSubscriptionReviewRepositoryUploadTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Review/Internal/SDKSubscriptionReviewRepositoryUploadTests.swift index 7f8bb171..2f4c2ecf 100644 --- a/Tests/InfrastructureTests/Apps/Subscriptions/Review/SDKSubscriptionReviewRepositoryUploadTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Review/Internal/SDKSubscriptionReviewRepositoryUploadTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKSubscriptionReviewRepositoryUploadTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/Review/SubscriptionPromotionalImageTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Review/SubscriptionPromotionalImageTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Subscriptions/Review/SubscriptionPromotionalImageTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Review/SubscriptionPromotionalImageTests.swift index e75cd944..4f5b474b 100644 --- a/Tests/DomainTests/Apps/Subscriptions/Review/SubscriptionPromotionalImageTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Review/SubscriptionPromotionalImageTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionPromotionalImageTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/Review/SubscriptionReviewCodableTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Review/SubscriptionReviewCodableTests.swift similarity index 97% rename from Tests/DomainTests/Apps/Subscriptions/Review/SubscriptionReviewCodableTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Review/SubscriptionReviewCodableTests.swift index 0031b3f6..1e793557 100644 --- a/Tests/DomainTests/Apps/Subscriptions/Review/SubscriptionReviewCodableTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Review/SubscriptionReviewCodableTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionReviewCodableTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/Review/SubscriptionReviewScreenshotTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/Review/SubscriptionReviewScreenshotTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/Review/SubscriptionReviewScreenshotTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/Review/SubscriptionReviewScreenshotTests.swift index fa2c2f41..e83d0def 100644 --- a/Tests/DomainTests/Apps/Subscriptions/Review/SubscriptionReviewScreenshotTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/Review/SubscriptionReviewScreenshotTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionReviewScreenshotTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/SubscriptionGroupLocalizationCodableTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionGroupLocalizationCodableTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/SubscriptionGroupLocalizationCodableTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/SubscriptionGroupLocalizationCodableTests.swift index 4cd39a9c..f49b3ec0 100644 --- a/Tests/DomainTests/Apps/Subscriptions/SubscriptionGroupLocalizationCodableTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionGroupLocalizationCodableTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionGroupLocalizationCodableTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/SubscriptionGroupLocalizationTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionGroupLocalizationTests.swift similarity index 97% rename from Tests/DomainTests/Apps/Subscriptions/SubscriptionGroupLocalizationTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/SubscriptionGroupLocalizationTests.swift index 3a09f46c..366273f7 100644 --- a/Tests/DomainTests/Apps/Subscriptions/SubscriptionGroupLocalizationTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionGroupLocalizationTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionGroupLocalizationTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/SubscriptionPriceCodableTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPriceCodableTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/SubscriptionPriceCodableTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPriceCodableTests.swift index 87217d7b..9bb80a94 100644 --- a/Tests/DomainTests/Apps/Subscriptions/SubscriptionPriceCodableTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPriceCodableTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionPriceCodableTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/SubscriptionPricePointTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPricePointTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/SubscriptionPricePointTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPricePointTests.swift index 5fc1f9d8..e6ede642 100644 --- a/Tests/DomainTests/Apps/Subscriptions/SubscriptionPricePointTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPricePointTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionPricePointTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/SubscriptionPriceScheduleTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPriceScheduleTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Subscriptions/SubscriptionPriceScheduleTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPriceScheduleTests.swift index 6436f6ae..7e0bfaae 100644 --- a/Tests/DomainTests/Apps/Subscriptions/SubscriptionPriceScheduleTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPriceScheduleTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionPriceScheduleTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/SubscriptionPromotionalOfferCodableTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPromotionalOfferCodableTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/SubscriptionPromotionalOfferCodableTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPromotionalOfferCodableTests.swift index 6c8557c4..e177f406 100644 --- a/Tests/DomainTests/Apps/Subscriptions/SubscriptionPromotionalOfferCodableTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPromotionalOfferCodableTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionPromotionalOfferCodableTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/SubscriptionPromotionalOfferTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPromotionalOfferTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/SubscriptionPromotionalOfferTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPromotionalOfferTests.swift index ee7f8bef..1519b17c 100644 --- a/Tests/DomainTests/Apps/Subscriptions/SubscriptionPromotionalOfferTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionPromotionalOfferTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionPromotionalOfferTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/SubscriptionSubmissionTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionSubmissionTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/SubscriptionSubmissionTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/SubscriptionSubmissionTests.swift index 9bd51fe8..aa1204dc 100644 --- a/Tests/DomainTests/Apps/Subscriptions/SubscriptionSubmissionTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionSubmissionTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionSubmissionTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/SubscriptionTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Subscriptions/SubscriptionTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/SubscriptionTests.swift index d9eb8709..16247a2d 100644 --- a/Tests/DomainTests/Apps/Subscriptions/SubscriptionTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/SubscriptionTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubscriptionTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/WinBackOfferCodableTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/WinBackOfferCodableTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/WinBackOfferCodableTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/WinBackOfferCodableTests.swift index dbcd9580..0e409c45 100644 --- a/Tests/DomainTests/Apps/Subscriptions/WinBackOfferCodableTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/WinBackOfferCodableTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct WinBackOfferCodableTests { diff --git a/Tests/DomainTests/Apps/Subscriptions/WinBackOfferTests.swift b/Tests/ASCKitTests/Apps/Subscriptions/WinBackOfferTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Subscriptions/WinBackOfferTests.swift rename to Tests/ASCKitTests/Apps/Subscriptions/WinBackOfferTests.swift index ce3658db..d1259916 100644 --- a/Tests/DomainTests/Apps/Subscriptions/WinBackOfferTests.swift +++ b/Tests/ASCKitTests/Apps/Subscriptions/WinBackOfferTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct WinBackOfferTests { diff --git a/Tests/DomainTests/Apps/TestFlight/BetaAppLocalizationTests.swift b/Tests/ASCKitTests/Apps/TestFlight/BetaAppLocalizationTests.swift similarity index 99% rename from Tests/DomainTests/Apps/TestFlight/BetaAppLocalizationTests.swift rename to Tests/ASCKitTests/Apps/TestFlight/BetaAppLocalizationTests.swift index cfe8957c..beced922 100644 --- a/Tests/DomainTests/Apps/TestFlight/BetaAppLocalizationTests.swift +++ b/Tests/ASCKitTests/Apps/TestFlight/BetaAppLocalizationTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct BetaAppLocalizationTests { diff --git a/Tests/DomainTests/Apps/TestFlight/BetaAppReviewDetailTests.swift b/Tests/ASCKitTests/Apps/TestFlight/BetaAppReviewDetailTests.swift similarity index 99% rename from Tests/DomainTests/Apps/TestFlight/BetaAppReviewDetailTests.swift rename to Tests/ASCKitTests/Apps/TestFlight/BetaAppReviewDetailTests.swift index 48e4f550..312629ca 100644 --- a/Tests/DomainTests/Apps/TestFlight/BetaAppReviewDetailTests.swift +++ b/Tests/ASCKitTests/Apps/TestFlight/BetaAppReviewDetailTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct BetaAppReviewDetailTests { diff --git a/Tests/DomainTests/Apps/TestFlight/BetaAppReviewSubmissionTests.swift b/Tests/ASCKitTests/Apps/TestFlight/BetaAppReviewSubmissionTests.swift similarity index 99% rename from Tests/DomainTests/Apps/TestFlight/BetaAppReviewSubmissionTests.swift rename to Tests/ASCKitTests/Apps/TestFlight/BetaAppReviewSubmissionTests.swift index 50b3b810..1a401ef0 100644 --- a/Tests/DomainTests/Apps/TestFlight/BetaAppReviewSubmissionTests.swift +++ b/Tests/ASCKitTests/Apps/TestFlight/BetaAppReviewSubmissionTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct BetaAppReviewSubmissionTests { diff --git a/Tests/DomainTests/Apps/TestFlight/BetaGroupTests.swift b/Tests/ASCKitTests/Apps/TestFlight/BetaGroupTests.swift similarity index 97% rename from Tests/DomainTests/Apps/TestFlight/BetaGroupTests.swift rename to Tests/ASCKitTests/Apps/TestFlight/BetaGroupTests.swift index a10b27be..98c9231f 100644 --- a/Tests/DomainTests/Apps/TestFlight/BetaGroupTests.swift +++ b/Tests/ASCKitTests/Apps/TestFlight/BetaGroupTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct BetaGroupTests { diff --git a/Tests/DomainTests/Apps/TestFlight/BetaTesterTests.swift b/Tests/ASCKitTests/Apps/TestFlight/BetaTesterTests.swift similarity index 99% rename from Tests/DomainTests/Apps/TestFlight/BetaTesterTests.swift rename to Tests/ASCKitTests/Apps/TestFlight/BetaTesterTests.swift index 1318612d..af2b16ee 100644 --- a/Tests/DomainTests/Apps/TestFlight/BetaTesterTests.swift +++ b/Tests/ASCKitTests/Apps/TestFlight/BetaTesterTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct BetaTesterTests { diff --git a/Tests/InfrastructureTests/Apps/TestFlight/SDKBetaAppLocalizationRepositoryTests.swift b/Tests/ASCKitTests/Apps/TestFlight/Internal/SDKBetaAppLocalizationRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/TestFlight/SDKBetaAppLocalizationRepositoryTests.swift rename to Tests/ASCKitTests/Apps/TestFlight/Internal/SDKBetaAppLocalizationRepositoryTests.swift index 96ecc539..7c811c32 100644 --- a/Tests/InfrastructureTests/Apps/TestFlight/SDKBetaAppLocalizationRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/TestFlight/Internal/SDKBetaAppLocalizationRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKBetaAppLocalizationRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/TestFlight/SDKBetaAppReviewRepositoryTests.swift b/Tests/ASCKitTests/Apps/TestFlight/Internal/SDKBetaAppReviewRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/TestFlight/SDKBetaAppReviewRepositoryTests.swift rename to Tests/ASCKitTests/Apps/TestFlight/Internal/SDKBetaAppReviewRepositoryTests.swift index 806e42ce..7a84e8de 100644 --- a/Tests/InfrastructureTests/Apps/TestFlight/SDKBetaAppReviewRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/TestFlight/Internal/SDKBetaAppReviewRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKBetaAppReviewRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/TestFlight/SDKTestFlightRepositoryTests.swift b/Tests/ASCKitTests/Apps/TestFlight/Internal/SDKTestFlightRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/TestFlight/SDKTestFlightRepositoryTests.swift rename to Tests/ASCKitTests/Apps/TestFlight/Internal/SDKTestFlightRepositoryTests.swift index 68633216..49561f10 100644 --- a/Tests/InfrastructureTests/Apps/TestFlight/SDKTestFlightRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/TestFlight/Internal/SDKTestFlightRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKTestFlightRepositoryTests { @@ -71,7 +70,7 @@ struct SDKTestFlightRepositoryTests { } @Test func `listBetaTesters maps inviteType email and publicLink`() async throws { - let cases: [(BetaInviteType, Domain.BetaTester.InviteType)] = [ + let cases: [(BetaInviteType, ASCKit.BetaTester.InviteType)] = [ (.email, .email), (.publicLink, .publicLink), ] diff --git a/Tests/DomainTests/Apps/Versions/AppStoreReviewDetailTests.swift b/Tests/ASCKitTests/Apps/Versions/AppStoreReviewDetailTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/AppStoreReviewDetailTests.swift rename to Tests/ASCKitTests/Apps/Versions/AppStoreReviewDetailTests.swift index e5372143..8a95a9af 100644 --- a/Tests/DomainTests/Apps/Versions/AppStoreReviewDetailTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/AppStoreReviewDetailTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppStoreReviewDetailTests { diff --git a/Tests/DomainTests/Apps/Versions/AppStoreVersionStateTests.swift b/Tests/ASCKitTests/Apps/Versions/AppStoreVersionStateTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/AppStoreVersionStateTests.swift rename to Tests/ASCKitTests/Apps/Versions/AppStoreVersionStateTests.swift index 8a81fc06..4d3a8986 100644 --- a/Tests/DomainTests/Apps/Versions/AppStoreVersionStateTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/AppStoreVersionStateTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppStoreVersionStateTests { diff --git a/Tests/ASCKitTests/Apps/Versions/AppStoreVersionSubmitForReviewTests.swift b/Tests/ASCKitTests/Apps/Versions/AppStoreVersionSubmitForReviewTests.swift new file mode 100644 index 00000000..49069c2e --- /dev/null +++ b/Tests/ASCKitTests/Apps/Versions/AppStoreVersionSubmitForReviewTests.swift @@ -0,0 +1,75 @@ +import Mockable +import Testing +@testable import ASCKit + +@Suite +struct AppStoreVersionSubmitForReviewTests { + private func version(_ state: AppStoreVersionState) -> AppStoreVersion { + AppStoreVersion(id: "v-1", appId: "app-1", versionString: "1.0", platform: .iOS, state: state) + } + + private let draft = ReviewSubmission(id: "sub-1", appId: "app-1", platform: .iOS, state: .readyForReview) + private let submitted = ReviewSubmission(id: "sub-1", appId: "app-1", platform: .iOS, state: .waitingForReview) + + private func submissions(draftHolds items: [ReviewSubmissionItem]) -> MockSubmissionRepository { + let submissions = MockSubmissionRepository() + given(submissions).createSubmission(appId: .value("app-1"), platform: .value(.iOS)).willReturn(draft) + given(submissions).listSubmissionItems(submissionId: .value("sub-1")).willReturn(items) + given(submissions).addItem(submissionId: .value("sub-1"), target: .value(.appStoreVersion("v-1"))) + .willReturn(ReviewSubmissionItem(id: "item-new", submissionId: "sub-1", state: .readyForReview, linkedResourceId: "v-1")) + given(submissions).submit(submissionId: .value("sub-1")).willReturn(submitted) + return submissions + } + + @Test func `should send an editable version to review in its app's open draft for its platform`() async throws { + let submissions = submissions(draftHolds: []) + + let submission = try await version(.prepareForSubmission).submitForReview(to: submissions) + + #expect(submission == submitted) + verify(submissions).addItem(submissionId: .value("sub-1"), target: .value(.appStoreVersion("v-1"))).called(1) + } + + @Test func `should send a rejected version back to review`() async throws { + let submission = try await version(.rejected).submitForReview(to: submissions(draftHolds: [])) + + #expect(submission == submitted) + } + + @Test func `should not add the version again when its draft already holds it`() async throws { + let submissions = submissions(draftHolds: [ + ReviewSubmissionItem(id: "item-1", submissionId: "sub-1", state: .readyForReview, linkedResourceId: "v-1"), + ]) + + let submission = try await version(.prepareForSubmission).submitForReview(to: submissions) + + #expect(submission == submitted) + verify(submissions).addItem(submissionId: .any, target: .any).called(0) + } + + @Test func `should add the version when its draft holds only other items`() async throws { + let submissions = submissions(draftHolds: [ + ReviewSubmissionItem(id: "item-1", submissionId: "sub-1", state: .readyForReview, linkedResourceId: "iap-v-1"), + ]) + + _ = try await version(.prepareForSubmission).submitForReview(to: submissions) + + verify(submissions).addItem(submissionId: .value("sub-1"), target: .value(.appStoreVersion("v-1"))).called(1) + } + + @Test func `should refuse to send a version to review when it can no longer be edited`() async { + let submissions = MockSubmissionRepository() + + await #expect(throws: ReviewSubmissionError.versionNotEditable(versionString: "1.0", state: .readyForSale)) { + try await version(.readyForSale).submitForReview(to: submissions) + } + verify(submissions).createSubmission(appId: .any, platform: .any).called(0) + } + + @Test func `should say why a version can't go to review and which ones can`() { + let error = ReviewSubmissionError.versionNotEditable(versionString: "1.0", state: .readyForSale) + + #expect(error.description + == "Version 1.0 can't go to review while it is Ready for Sale. Only a version being prepared for submission, or one that was rejected, can.") + } +} diff --git a/Tests/DomainTests/Apps/Versions/AppStoreVersionTests.swift b/Tests/ASCKitTests/Apps/Versions/AppStoreVersionTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/AppStoreVersionTests.swift rename to Tests/ASCKitTests/Apps/Versions/AppStoreVersionTests.swift index b6f37cef..31e0b278 100644 --- a/Tests/DomainTests/Apps/Versions/AppStoreVersionTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/AppStoreVersionTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppStoreVersionTests { diff --git a/Tests/InfrastructureTests/Apps/Versions/SDKReviewDetailRepositoryTests.swift b/Tests/ASCKitTests/Apps/Versions/Internal/SDKReviewDetailRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Versions/SDKReviewDetailRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Versions/Internal/SDKReviewDetailRepositoryTests.swift index e3442fcc..c0bdd9c5 100644 --- a/Tests/InfrastructureTests/Apps/Versions/SDKReviewDetailRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Internal/SDKReviewDetailRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKReviewDetailRepositoryTests { @@ -103,7 +102,7 @@ struct SDKReviewDetailRepositoryTests { links: .init(this: "") ) let repo = SDKReviewDetailRepository(client: stub) - let update = Domain.ReviewDetailUpdate( + let update = ASCKit.ReviewDetailUpdate( contactFirstName: "Jane", contactLastName: "Smith", contactPhone: "+1-555-0101", @@ -156,7 +155,7 @@ struct SDKReviewDetailRepositoryTests { links: .init(this: "") )) let repo = SDKReviewDetailRepository(client: stub) - let update = Domain.ReviewDetailUpdate( + let update = ASCKit.ReviewDetailUpdate( contactFirstName: "New", contactPhone: "+1-555-9999", contactEmail: "new@example.com", diff --git a/Tests/InfrastructureTests/Apps/Versions/SDKVersionRepositoryCreateTests.swift b/Tests/ASCKitTests/Apps/Versions/Internal/SDKVersionRepositoryCreateTests.swift similarity index 97% rename from Tests/InfrastructureTests/Apps/Versions/SDKVersionRepositoryCreateTests.swift rename to Tests/ASCKitTests/Apps/Versions/Internal/SDKVersionRepositoryCreateTests.swift index cd865817..c2d11d84 100644 --- a/Tests/InfrastructureTests/Apps/Versions/SDKVersionRepositoryCreateTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Internal/SDKVersionRepositoryCreateTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKVersionRepositoryCreateTests { diff --git a/Tests/InfrastructureTests/Apps/Versions/SDKVersionRepositoryTests.swift b/Tests/ASCKitTests/Apps/Versions/Internal/SDKVersionRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Versions/SDKVersionRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Versions/Internal/SDKVersionRepositoryTests.swift index 07019ba7..b51fb16d 100644 --- a/Tests/InfrastructureTests/Apps/Versions/SDKVersionRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Internal/SDKVersionRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKVersionRepositoryTests { diff --git a/Tests/DomainTests/Apps/Versions/Localizations/AppStoreVersionLocalizationTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/AppStoreVersionLocalizationTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/Localizations/AppStoreVersionLocalizationTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/AppStoreVersionLocalizationTests.swift index 6095081c..e002dae7 100644 --- a/Tests/DomainTests/Apps/Versions/Localizations/AppStoreVersionLocalizationTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/AppStoreVersionLocalizationTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppStoreVersionLocalizationTests { diff --git a/Tests/InfrastructureTests/Apps/Versions/Localizations/SDKLocalizationRepositoryTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/Internal/SDKLocalizationRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Versions/Localizations/SDKLocalizationRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/Internal/SDKLocalizationRepositoryTests.swift index 9803a951..a2902b3a 100644 --- a/Tests/InfrastructureTests/Apps/Versions/Localizations/SDKLocalizationRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/Internal/SDKLocalizationRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKLocalizationRepositoryTests { diff --git a/Tests/DomainTests/Apps/Versions/Localizations/PreviewSets/AppPreviewSetTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/AppPreviewSetTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/Localizations/PreviewSets/AppPreviewSetTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/AppPreviewSetTests.swift index fad504cf..d76cb332 100644 --- a/Tests/DomainTests/Apps/Versions/Localizations/PreviewSets/AppPreviewSetTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/AppPreviewSetTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppPreviewSetTests { diff --git a/Tests/DomainTests/Apps/Versions/Localizations/PreviewSets/AppPreviews/AppPreviewTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/AppPreviews/AppPreviewTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/Localizations/PreviewSets/AppPreviews/AppPreviewTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/AppPreviews/AppPreviewTests.swift index 6ffef6db..62545912 100644 --- a/Tests/DomainTests/Apps/Versions/Localizations/PreviewSets/AppPreviews/AppPreviewTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/AppPreviews/AppPreviewTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppPreviewTests { diff --git a/Tests/InfrastructureTests/Apps/Versions/Localizations/PreviewSets/OpenAPIPreviewRepositoryTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/Internal/OpenAPIPreviewRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Apps/Versions/Localizations/PreviewSets/OpenAPIPreviewRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/Internal/OpenAPIPreviewRepositoryTests.swift index 6ed77ad5..9e108932 100644 --- a/Tests/InfrastructureTests/Apps/Versions/Localizations/PreviewSets/OpenAPIPreviewRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/Internal/OpenAPIPreviewRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct OpenAPIPreviewRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Versions/Localizations/PreviewSets/OpenAPIPreviewRepositoryUploadTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/Internal/OpenAPIPreviewRepositoryUploadTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Versions/Localizations/PreviewSets/OpenAPIPreviewRepositoryUploadTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/Internal/OpenAPIPreviewRepositoryUploadTests.swift index 90215850..afc88c2b 100644 --- a/Tests/InfrastructureTests/Apps/Versions/Localizations/PreviewSets/OpenAPIPreviewRepositoryUploadTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/PreviewSets/Internal/OpenAPIPreviewRepositoryUploadTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct OpenAPIPreviewRepositoryUploadTests { diff --git a/Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/AppScreenshotSetTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/AppScreenshotSetTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/AppScreenshotSetTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/AppScreenshotSetTests.swift index d7fe3561..c1311fa4 100644 --- a/Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/AppScreenshotSetTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/AppScreenshotSetTests.swift @@ -1,7 +1,7 @@ import Foundation import Mockable import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppScreenshotSetTests { diff --git a/Tests/InfrastructureTests/Apps/Versions/Localizations/ScreenshotSets/SDKScreenshotRepositoryCreateTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Internal/SDKScreenshotRepositoryCreateTests.swift similarity index 97% rename from Tests/InfrastructureTests/Apps/Versions/Localizations/ScreenshotSets/SDKScreenshotRepositoryCreateTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Internal/SDKScreenshotRepositoryCreateTests.swift index 933e6c0f..ee38ffab 100644 --- a/Tests/InfrastructureTests/Apps/Versions/Localizations/ScreenshotSets/SDKScreenshotRepositoryCreateTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Internal/SDKScreenshotRepositoryCreateTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKScreenshotRepositoryCreateTests { diff --git a/Tests/InfrastructureTests/Apps/Versions/Localizations/ScreenshotSets/SDKScreenshotRepositoryTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Internal/SDKScreenshotRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Versions/Localizations/ScreenshotSets/SDKScreenshotRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Internal/SDKScreenshotRepositoryTests.swift index 9cc5130e..aa3a05ed 100644 --- a/Tests/InfrastructureTests/Apps/Versions/Localizations/ScreenshotSets/SDKScreenshotRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Internal/SDKScreenshotRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKScreenshotRepositoryTests { diff --git a/Tests/InfrastructureTests/Apps/Versions/Localizations/ScreenshotSets/SDKScreenshotRepositoryUploadTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Internal/SDKScreenshotRepositoryUploadTests.swift similarity index 98% rename from Tests/InfrastructureTests/Apps/Versions/Localizations/ScreenshotSets/SDKScreenshotRepositoryUploadTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Internal/SDKScreenshotRepositoryUploadTests.swift index a2b3f6cf..319eb08b 100644 --- a/Tests/InfrastructureTests/Apps/Versions/Localizations/ScreenshotSets/SDKScreenshotRepositoryUploadTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Internal/SDKScreenshotRepositoryUploadTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKScreenshotRepositoryUploadTests { diff --git a/Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotDisplayTypeTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotDisplayTypeTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotDisplayTypeTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotDisplayTypeTests.swift index b47b961f..8be7dc6d 100644 --- a/Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotDisplayTypeTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotDisplayTypeTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotDisplayTypeTests { diff --git a/Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotRepositoryTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotRepositoryTests.swift similarity index 98% rename from Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotRepositoryTests.swift index f2facc65..4dd1d93c 100644 --- a/Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/ScreenshotRepositoryTests.swift @@ -1,6 +1,6 @@ import Mockable import Testing -@testable import Domain +@testable import ASCKit @Suite struct ScreenshotRepositoryTests { diff --git a/Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/Screenshots/AppScreenshotTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Screenshots/AppScreenshotTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/Screenshots/AppScreenshotTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Screenshots/AppScreenshotTests.swift index f45bbce5..a1446745 100644 --- a/Tests/DomainTests/Apps/Versions/Localizations/ScreenshotSets/Screenshots/AppScreenshotTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/ScreenshotSets/Screenshots/AppScreenshotTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppScreenshotTests { diff --git a/Tests/DomainTests/Apps/Versions/Localizations/VersionLocalizationRepositoryTests.swift b/Tests/ASCKitTests/Apps/Versions/Localizations/VersionLocalizationRepositoryTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/Localizations/VersionLocalizationRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Versions/Localizations/VersionLocalizationRepositoryTests.swift index 1c011992..546026d6 100644 --- a/Tests/DomainTests/Apps/Versions/Localizations/VersionLocalizationRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/Localizations/VersionLocalizationRepositoryTests.swift @@ -1,6 +1,6 @@ import Mockable import Testing -@testable import Domain +@testable import ASCKit @Suite struct VersionLocalizationRepositoryTests { diff --git a/Tests/DomainTests/Apps/Versions/VersionReadinessTests.swift b/Tests/ASCKitTests/Apps/Versions/VersionReadinessTests.swift similarity index 99% rename from Tests/DomainTests/Apps/Versions/VersionReadinessTests.swift rename to Tests/ASCKitTests/Apps/Versions/VersionReadinessTests.swift index 4ff26e9e..43f7584d 100644 --- a/Tests/DomainTests/Apps/Versions/VersionReadinessTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/VersionReadinessTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct VersionReadinessTests { diff --git a/Tests/DomainTests/Apps/Versions/VersionRepositoryTests.swift b/Tests/ASCKitTests/Apps/Versions/VersionRepositoryTests.swift similarity index 97% rename from Tests/DomainTests/Apps/Versions/VersionRepositoryTests.swift rename to Tests/ASCKitTests/Apps/Versions/VersionRepositoryTests.swift index 0c76ac1f..fd888344 100644 --- a/Tests/DomainTests/Apps/Versions/VersionRepositoryTests.swift +++ b/Tests/ASCKitTests/Apps/Versions/VersionRepositoryTests.swift @@ -1,6 +1,6 @@ import Mockable import Testing -@testable import Domain +@testable import ASCKit @Suite struct VersionRepositoryTests { diff --git a/Tests/DomainTests/Auth/AccountEntryTests.swift b/Tests/ASCKitTests/Auth/AccountEntryTests.swift similarity index 99% rename from Tests/DomainTests/Auth/AccountEntryTests.swift rename to Tests/ASCKitTests/Auth/AccountEntryTests.swift index 70888928..b784b8f5 100644 --- a/Tests/DomainTests/Auth/AccountEntryTests.swift +++ b/Tests/ASCKitTests/Auth/AccountEntryTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ConnectAccountTests { diff --git a/Tests/DomainTests/Auth/AuthCredentialsTests.swift b/Tests/ASCKitTests/Auth/AuthCredentialsTests.swift similarity index 99% rename from Tests/DomainTests/Auth/AuthCredentialsTests.swift rename to Tests/ASCKitTests/Auth/AuthCredentialsTests.swift index f8fe61b6..44e13d4d 100644 --- a/Tests/DomainTests/Auth/AuthCredentialsTests.swift +++ b/Tests/ASCKitTests/Auth/AuthCredentialsTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AuthCredentialsTests { diff --git a/Tests/DomainTests/Auth/AuthStatusTests.swift b/Tests/ASCKitTests/Auth/AuthStatusTests.swift similarity index 99% rename from Tests/DomainTests/Auth/AuthStatusTests.swift rename to Tests/ASCKitTests/Auth/AuthStatusTests.swift index f6dfdcff..48b0c061 100644 --- a/Tests/DomainTests/Auth/AuthStatusTests.swift +++ b/Tests/ASCKitTests/Auth/AuthStatusTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AuthStatusTests { diff --git a/Tests/InfrastructureTests/Auth/CompositeAuthProviderTests.swift b/Tests/ASCKitTests/Auth/Internal/CompositeAuthProviderTests.swift similarity index 96% rename from Tests/InfrastructureTests/Auth/CompositeAuthProviderTests.swift rename to Tests/ASCKitTests/Auth/Internal/CompositeAuthProviderTests.swift index c3e93c5e..bb3e187c 100644 --- a/Tests/InfrastructureTests/Auth/CompositeAuthProviderTests.swift +++ b/Tests/ASCKitTests/Auth/Internal/CompositeAuthProviderTests.swift @@ -1,7 +1,6 @@ import Mockable import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct CompositeAuthProviderTests { diff --git a/Tests/InfrastructureTests/Auth/EnvironmentAuthProviderTests.swift b/Tests/ASCKitTests/Auth/Internal/EnvironmentAuthProviderTests.swift similarity index 98% rename from Tests/InfrastructureTests/Auth/EnvironmentAuthProviderTests.swift rename to Tests/ASCKitTests/Auth/Internal/EnvironmentAuthProviderTests.swift index 53c62f48..5837cd7b 100644 --- a/Tests/InfrastructureTests/Auth/EnvironmentAuthProviderTests.swift +++ b/Tests/ASCKitTests/Auth/Internal/EnvironmentAuthProviderTests.swift @@ -1,6 +1,5 @@ import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct EnvironmentAuthProviderTests { diff --git a/Tests/InfrastructureTests/Auth/FileAuthProviderTests.swift b/Tests/ASCKitTests/Auth/Internal/FileAuthProviderTests.swift similarity index 97% rename from Tests/InfrastructureTests/Auth/FileAuthProviderTests.swift rename to Tests/ASCKitTests/Auth/Internal/FileAuthProviderTests.swift index 192a19d9..49033b8f 100644 --- a/Tests/InfrastructureTests/Auth/FileAuthProviderTests.swift +++ b/Tests/ASCKitTests/Auth/Internal/FileAuthProviderTests.swift @@ -1,7 +1,6 @@ import Mockable import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite("FileAuthProvider — resolves credentials from storage") struct FileAuthProviderTests { diff --git a/Tests/InfrastructureTests/Auth/FileAuthStorageMultiAccountTests.swift b/Tests/ASCKitTests/Auth/Internal/FileAuthStorageMultiAccountTests.swift similarity index 99% rename from Tests/InfrastructureTests/Auth/FileAuthStorageMultiAccountTests.swift rename to Tests/ASCKitTests/Auth/Internal/FileAuthStorageMultiAccountTests.swift index 2fc89c52..2fb198e5 100644 --- a/Tests/InfrastructureTests/Auth/FileAuthStorageMultiAccountTests.swift +++ b/Tests/ASCKitTests/Auth/Internal/FileAuthStorageMultiAccountTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct FileAuthStorageMultiAccountTests { diff --git a/Tests/InfrastructureTests/Auth/FileAuthStorageTests.swift b/Tests/ASCKitTests/Auth/Internal/FileAuthStorageTests.swift similarity index 97% rename from Tests/InfrastructureTests/Auth/FileAuthStorageTests.swift rename to Tests/ASCKitTests/Auth/Internal/FileAuthStorageTests.swift index 27117064..59ffd3bd 100644 --- a/Tests/InfrastructureTests/Auth/FileAuthStorageTests.swift +++ b/Tests/ASCKitTests/Auth/Internal/FileAuthStorageTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct FileAuthStorageTests { diff --git a/Tests/DomainTests/Auth/Iris/IrisAuthSummaryTests.swift b/Tests/ASCKitTests/Auth/Iris/IrisAuthSummaryTests.swift similarity index 99% rename from Tests/DomainTests/Auth/Iris/IrisAuthSummaryTests.swift rename to Tests/ASCKitTests/Auth/Iris/IrisAuthSummaryTests.swift index a6b7714a..42c35ac3 100644 --- a/Tests/DomainTests/Auth/Iris/IrisAuthSummaryTests.swift +++ b/Tests/ASCKitTests/Auth/Iris/IrisAuthSummaryTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct IrisAuthSummaryTests { diff --git a/Tests/DomainTests/Auth/Iris/IrisAuthTypesTests.swift b/Tests/ASCKitTests/Auth/Iris/IrisAuthTypesTests.swift similarity index 99% rename from Tests/DomainTests/Auth/Iris/IrisAuthTypesTests.swift rename to Tests/ASCKitTests/Auth/Iris/IrisAuthTypesTests.swift index b2c2ae00..8798ff3d 100644 --- a/Tests/DomainTests/Auth/Iris/IrisAuthTypesTests.swift +++ b/Tests/ASCKitTests/Auth/Iris/IrisAuthTypesTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct IrisAuthTypesTests { diff --git a/Tests/DomainTests/CodeSigning/BundleIDTests.swift b/Tests/ASCKitTests/CodeSigning/BundleIDTests.swift similarity index 98% rename from Tests/DomainTests/CodeSigning/BundleIDTests.swift rename to Tests/ASCKitTests/CodeSigning/BundleIDTests.swift index 092239b8..2c8ab179 100644 --- a/Tests/DomainTests/CodeSigning/BundleIDTests.swift +++ b/Tests/ASCKitTests/CodeSigning/BundleIDTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct BundleIDTests { diff --git a/Tests/DomainTests/CodeSigning/CertificateTests.swift b/Tests/ASCKitTests/CodeSigning/CertificateTests.swift similarity index 98% rename from Tests/DomainTests/CodeSigning/CertificateTests.swift rename to Tests/ASCKitTests/CodeSigning/CertificateTests.swift index ae7b6172..3319abc3 100644 --- a/Tests/DomainTests/CodeSigning/CertificateTests.swift +++ b/Tests/ASCKitTests/CodeSigning/CertificateTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct CertificateTests { diff --git a/Tests/DomainTests/CodeSigning/DeviceTests.swift b/Tests/ASCKitTests/CodeSigning/DeviceTests.swift similarity index 98% rename from Tests/DomainTests/CodeSigning/DeviceTests.swift rename to Tests/ASCKitTests/CodeSigning/DeviceTests.swift index 45581a04..de67af93 100644 --- a/Tests/DomainTests/CodeSigning/DeviceTests.swift +++ b/Tests/ASCKitTests/CodeSigning/DeviceTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct DeviceTests { diff --git a/Tests/InfrastructureTests/CodeSigning/SDKBundleIDRepositoryTests.swift b/Tests/ASCKitTests/CodeSigning/Internal/SDKBundleIDRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/CodeSigning/SDKBundleIDRepositoryTests.swift rename to Tests/ASCKitTests/CodeSigning/Internal/SDKBundleIDRepositoryTests.swift index 405d0c4c..be0cb830 100644 --- a/Tests/InfrastructureTests/CodeSigning/SDKBundleIDRepositoryTests.swift +++ b/Tests/ASCKitTests/CodeSigning/Internal/SDKBundleIDRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKBundleIDRepositoryTests { diff --git a/Tests/InfrastructureTests/CodeSigning/SDKCertificateRepositoryTests.swift b/Tests/ASCKitTests/CodeSigning/Internal/SDKCertificateRepositoryTests.swift similarity index 97% rename from Tests/InfrastructureTests/CodeSigning/SDKCertificateRepositoryTests.swift rename to Tests/ASCKitTests/CodeSigning/Internal/SDKCertificateRepositoryTests.swift index f2e91d9e..7a7d0a48 100644 --- a/Tests/InfrastructureTests/CodeSigning/SDKCertificateRepositoryTests.swift +++ b/Tests/ASCKitTests/CodeSigning/Internal/SDKCertificateRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKCertificateRepositoryTests { diff --git a/Tests/InfrastructureTests/CodeSigning/SDKDeviceRepositoryTests.swift b/Tests/ASCKitTests/CodeSigning/Internal/SDKDeviceRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/CodeSigning/SDKDeviceRepositoryTests.swift rename to Tests/ASCKitTests/CodeSigning/Internal/SDKDeviceRepositoryTests.swift index 6b5842f0..67b1bf93 100644 --- a/Tests/InfrastructureTests/CodeSigning/SDKDeviceRepositoryTests.swift +++ b/Tests/ASCKitTests/CodeSigning/Internal/SDKDeviceRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKDeviceRepositoryTests { diff --git a/Tests/InfrastructureTests/CodeSigning/SDKProfileRepositoryTests.swift b/Tests/ASCKitTests/CodeSigning/Internal/SDKProfileRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/CodeSigning/SDKProfileRepositoryTests.swift rename to Tests/ASCKitTests/CodeSigning/Internal/SDKProfileRepositoryTests.swift index d27e3a37..d7d837b0 100644 --- a/Tests/InfrastructureTests/CodeSigning/SDKProfileRepositoryTests.swift +++ b/Tests/ASCKitTests/CodeSigning/Internal/SDKProfileRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKProfileRepositoryTests { diff --git a/Tests/DomainTests/CodeSigning/ProfileTests.swift b/Tests/ASCKitTests/CodeSigning/ProfileTests.swift similarity index 97% rename from Tests/DomainTests/CodeSigning/ProfileTests.swift rename to Tests/ASCKitTests/CodeSigning/ProfileTests.swift index a436af49..7728285b 100644 --- a/Tests/DomainTests/CodeSigning/ProfileTests.swift +++ b/Tests/ASCKitTests/CodeSigning/ProfileTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct ProfileTests { diff --git a/Tests/DomainTests/GameCenter/GameCenterTests.swift b/Tests/ASCKitTests/GameCenter/GameCenterTests.swift similarity index 99% rename from Tests/DomainTests/GameCenter/GameCenterTests.swift rename to Tests/ASCKitTests/GameCenter/GameCenterTests.swift index 86d57eb4..51c20fbe 100644 --- a/Tests/DomainTests/GameCenter/GameCenterTests.swift +++ b/Tests/ASCKitTests/GameCenter/GameCenterTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit // MARK: - GameCenterDetail diff --git a/Tests/InfrastructureTests/GameCenter/SDKGameCenterRepositoryTests.swift b/Tests/ASCKitTests/GameCenter/Internal/SDKGameCenterRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/GameCenter/SDKGameCenterRepositoryTests.swift rename to Tests/ASCKitTests/GameCenter/Internal/SDKGameCenterRepositoryTests.swift index a30d03e3..55ca398f 100644 --- a/Tests/InfrastructureTests/GameCenter/SDKGameCenterRepositoryTests.swift +++ b/Tests/ASCKitTests/GameCenter/Internal/SDKGameCenterRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKGameCenterRepositoryTests { diff --git a/Tests/DomainTests/GameCenter/Moderation/GameCenterModerationTests.swift b/Tests/ASCKitTests/GameCenter/Moderation/GameCenterModerationTests.swift similarity index 99% rename from Tests/DomainTests/GameCenter/Moderation/GameCenterModerationTests.swift rename to Tests/ASCKitTests/GameCenter/Moderation/GameCenterModerationTests.swift index 4b1c61c7..2e60bd6c 100644 --- a/Tests/DomainTests/GameCenter/Moderation/GameCenterModerationTests.swift +++ b/Tests/ASCKitTests/GameCenter/Moderation/GameCenterModerationTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit // MARK: - GameCenterScoreModeration diff --git a/Tests/InfrastructureTests/GameCenter/Moderation/SDKGameCenterModerationRepositoryTests.swift b/Tests/ASCKitTests/GameCenter/Moderation/Internal/SDKGameCenterModerationRepositoryTests.swift similarity index 97% rename from Tests/InfrastructureTests/GameCenter/Moderation/SDKGameCenterModerationRepositoryTests.swift rename to Tests/ASCKitTests/GameCenter/Moderation/Internal/SDKGameCenterModerationRepositoryTests.swift index 108b4126..f843468d 100644 --- a/Tests/InfrastructureTests/GameCenter/Moderation/SDKGameCenterModerationRepositoryTests.swift +++ b/Tests/ASCKitTests/GameCenter/Moderation/Internal/SDKGameCenterModerationRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKGameCenterModerationRepositoryTests { @@ -42,7 +41,7 @@ struct SDKGameCenterModerationRepositoryTests { let result = try await repo.listScoreModerations(leaderboardId: "lb-42", blockedOnly: false) #expect(result == [ - Domain.GameCenterScoreModeration( + ASCKit.GameCenterScoreModeration( id: "mod-1", leaderboardId: "lb-42", rank: "1", @@ -77,7 +76,7 @@ struct SDKGameCenterModerationRepositoryTests { let result = try await repo.listScoreModerations(leaderboardId: "lb-42", blockedOnly: true) #expect(result == [ - Domain.GameCenterScoreModeration( + ASCKit.GameCenterScoreModeration( id: "mod-1", leaderboardId: "lb-42", rank: nil, score: nil, submittedDate: nil, isBlocked: true, isPreReleased: false, context: nil, challengeIds: [], playerId: "player-1", playerNickname: nil, isPlayerBlocked: nil @@ -120,7 +119,7 @@ struct SDKGameCenterModerationRepositoryTests { let repo = SDKGameCenterModerationRepository(client: stub) let result = try await repo.updateScoreModeration(id: "mod-1", isBlocked: true) - #expect(result == Domain.GameCenterScoreModeration( + #expect(result == ASCKit.GameCenterScoreModeration( id: "mod-1", leaderboardId: nil, rank: "3", score: "1200", submittedDate: nil, isBlocked: true, isPreReleased: false, context: nil, challengeIds: [], playerId: "player-1", playerNickname: nil, isPlayerBlocked: nil @@ -159,7 +158,7 @@ struct SDKGameCenterModerationRepositoryTests { let result = try await repo.listBlockedPlayers(gameCenterDetailId: "gc-42") #expect(result == [ - Domain.GameCenterPlayer( + ASCKit.GameCenterPlayer( id: "player-1", gameCenterDetailId: "gc-42", nickname: "Player One", bundleId: "com.example.game", isBlocked: true ), @@ -213,7 +212,7 @@ struct SDKGameCenterModerationRepositoryTests { let repo = SDKGameCenterModerationRepository(client: stub) let result = try await repo.updatePlayer(id: "player-1", isBlocked: false) - #expect(result == Domain.GameCenterPlayer( + #expect(result == ASCKit.GameCenterPlayer( id: "player-1", gameCenterDetailId: nil, nickname: "Player One", bundleId: "com.example.game", isBlocked: false )) diff --git a/Tests/DomainTests/Iris/AppBundles/AppBundleTests.swift b/Tests/ASCKitTests/Iris/AppBundles/AppBundleTests.swift similarity index 99% rename from Tests/DomainTests/Iris/AppBundles/AppBundleTests.swift rename to Tests/ASCKitTests/Iris/AppBundles/AppBundleTests.swift index 1dd684ce..8aa33062 100644 --- a/Tests/DomainTests/Iris/AppBundles/AppBundleTests.swift +++ b/Tests/ASCKitTests/Iris/AppBundles/AppBundleTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppBundleTests { diff --git a/Tests/ASCKitTests/Iris/AppBundles/Internal/IrisSDKAppBundleRepositoryTests.swift b/Tests/ASCKitTests/Iris/AppBundles/Internal/IrisSDKAppBundleRepositoryTests.swift new file mode 100644 index 00000000..9dbf63cd --- /dev/null +++ b/Tests/ASCKitTests/Iris/AppBundles/Internal/IrisSDKAppBundleRepositoryTests.swift @@ -0,0 +1,68 @@ +import Foundation +import Mockable +import Testing +@testable import ASCKit + +@Suite +struct IrisSDKAppBundleRepositoryTests { + private let session = IrisSession(cookies: "myacinfo=a") + + private func reply(_ status: Int, _ body: String) -> (Data, HTTPURLResponse) { + let url = URL(string: "https://appstoreconnect.apple.com/iris/v1")! + return (Data(body.utf8), HTTPURLResponse(url: url, statusCode: status, httpVersion: nil, headerFields: nil)!) + } + + @Test func `should list every app bundle with its versions included`() async throws { + let iris = MockIrisAPI() + given(iris).get( + path: .value("appBundles"), + queryItems: .value([URLQueryItem(name: "include", value: "appBundleVersions"), URLQueryItem(name: "limit", value: "300")]), + cookies: .value("myacinfo=a") + ).willReturn(reply(200, #""" + {"data":[ + {"id":"b1","type":"apps","attributes":{"name":"Bakery","bundleId":"com.example.bakery","sku":"BAKE","primaryLocale":"en-GB","platformNames":["IOS"]}}, + {"id":"b2","type":"apps","attributes":{}} + ]} + """#)) + + let bundles = try await IrisSDKAppBundleRepository(client: iris).listAppBundles(session: session) + + #expect(bundles == [ + AppBundle(id: "b1", name: "Bakery", bundleId: "com.example.bakery", sku: "BAKE", primaryLocale: "en-GB", platforms: ["IOS"]), + AppBundle(id: "b2", name: "", bundleId: "", sku: "", primaryLocale: "en-US", platforms: []), + ]) + } + + @Test func `should name a created app as asked when iris leaves the name out`() async throws { + let iris = MockIrisAPI() + given(iris).post(path: .value("apps"), body: .any, cookies: .value("myacinfo=a")).willReturn(reply(201, #""" + {"data":{"id":"new","type":"apps","attributes":{"bundleId":"com.example.new","sku":"NEW","primaryLocale":"en-US","platformNames":["IOS"]}}} + """#)) + + let bundle = try await IrisSDKAppBundleRepository(client: iris).createApp( + session: session, name: "New App", bundleId: "com.example.new", sku: "NEW", + primaryLocale: "en-US", platforms: ["IOS"], versionString: "1.0" + ) + + #expect(bundle == AppBundle(id: "new", name: "New App", bundleId: "com.example.new", sku: "NEW", primaryLocale: "en-US", platforms: ["IOS"])) + } + + @Test func `should fail with iris's status when it refuses to create the app`() async { + let iris = MockIrisAPI() + given(iris).post(path: .any, body: .any, cookies: .any) + .willThrow(IrisAPIError.httpError(statusCode: 409, body: "bundle id taken")) + + do { + _ = try await IrisSDKAppBundleRepository(client: iris).createApp( + session: session, name: "Dup", bundleId: "com.example.dup", sku: "DUP", + primaryLocale: "en-US", platforms: ["IOS"], versionString: "1.0" + ) + Issue.record("expected iris to refuse") + } catch IrisAPIError.httpError(let statusCode, let body) { + #expect(statusCode == 409) + #expect(body == "bundle id taken") + } catch { + Issue.record("unexpected error \(error)") + } + } +} diff --git a/Tests/InfrastructureTests/Iris/InAppPurchases/IrisSDKInAppPurchaseStateRepositoryTests.swift b/Tests/ASCKitTests/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseStateRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Iris/InAppPurchases/IrisSDKInAppPurchaseStateRepositoryTests.swift rename to Tests/ASCKitTests/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseStateRepositoryTests.swift index 87b08073..9a926291 100644 --- a/Tests/InfrastructureTests/Iris/InAppPurchases/IrisSDKInAppPurchaseStateRepositoryTests.swift +++ b/Tests/ASCKitTests/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseStateRepositoryTests.swift @@ -1,7 +1,6 @@ -import Domain import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit /// Private URLProtocol subclass — see `IrisSDKInAppPurchaseSubmissionRepositoryTests` /// for why we don't share `URLProtocolStub` between iris suites. diff --git a/Tests/InfrastructureTests/Iris/InAppPurchases/IrisSDKInAppPurchaseSubmissionRepositoryTests.swift b/Tests/ASCKitTests/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseSubmissionRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Iris/InAppPurchases/IrisSDKInAppPurchaseSubmissionRepositoryTests.swift rename to Tests/ASCKitTests/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseSubmissionRepositoryTests.swift index 26c11c6f..5efff7d5 100644 --- a/Tests/InfrastructureTests/Iris/InAppPurchases/IrisSDKInAppPurchaseSubmissionRepositoryTests.swift +++ b/Tests/ASCKitTests/Iris/InAppPurchases/Internal/IrisSDKInAppPurchaseSubmissionRepositoryTests.swift @@ -1,7 +1,6 @@ -import Domain import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit private func collectBody(from request: URLRequest) -> Data? { if let body = request.httpBody { return body } diff --git a/Tests/DomainTests/Iris/InAppPurchases/IrisInAppPurchaseSubmissionTests.swift b/Tests/ASCKitTests/Iris/InAppPurchases/IrisInAppPurchaseSubmissionTests.swift similarity index 98% rename from Tests/DomainTests/Iris/InAppPurchases/IrisInAppPurchaseSubmissionTests.swift rename to Tests/ASCKitTests/Iris/InAppPurchases/IrisInAppPurchaseSubmissionTests.swift index 564e0c19..355e396e 100644 --- a/Tests/DomainTests/Iris/InAppPurchases/IrisInAppPurchaseSubmissionTests.swift +++ b/Tests/ASCKitTests/Iris/InAppPurchases/IrisInAppPurchaseSubmissionTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct IrisInAppPurchaseSubmissionTests { diff --git a/Tests/InfrastructureTests/Iris/Auth/CompositeIrisCookieProviderTests.swift b/Tests/ASCKitTests/Iris/Internal/Auth/CompositeIrisCookieProviderTests.swift similarity index 98% rename from Tests/InfrastructureTests/Iris/Auth/CompositeIrisCookieProviderTests.swift rename to Tests/ASCKitTests/Iris/Internal/Auth/CompositeIrisCookieProviderTests.swift index 046b87f1..054a9226 100644 --- a/Tests/InfrastructureTests/Iris/Auth/CompositeIrisCookieProviderTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/Auth/CompositeIrisCookieProviderTests.swift @@ -1,8 +1,7 @@ -import Domain import Foundation import Mockable import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct CompositeIrisCookieProviderTests { diff --git a/Tests/InfrastructureTests/Iris/Auth/FileIrisSessionRepositoryTests.swift b/Tests/ASCKitTests/Iris/Internal/Auth/FileIrisSessionRepositoryTests.swift similarity index 97% rename from Tests/InfrastructureTests/Iris/Auth/FileIrisSessionRepositoryTests.swift rename to Tests/ASCKitTests/Iris/Internal/Auth/FileIrisSessionRepositoryTests.swift index 493a6acc..0e40d370 100644 --- a/Tests/InfrastructureTests/Iris/Auth/FileIrisSessionRepositoryTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/Auth/FileIrisSessionRepositoryTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct FileIrisSessionRepositoryTests { diff --git a/Tests/InfrastructureTests/Iris/Auth/IdmsaAPIClientTests.swift b/Tests/ASCKitTests/Iris/Internal/Auth/IdmsaAPIClientTests.swift similarity index 99% rename from Tests/InfrastructureTests/Iris/Auth/IdmsaAPIClientTests.swift rename to Tests/ASCKitTests/Iris/Internal/Auth/IdmsaAPIClientTests.swift index 2cd93ca8..afc9ae81 100644 --- a/Tests/InfrastructureTests/Iris/Auth/IdmsaAPIClientTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/Auth/IdmsaAPIClientTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit final class CapturedBody: @unchecked Sendable { private let lock = NSLock() diff --git a/Tests/ASCKitTests/Iris/Internal/Auth/IrisSDKSignInTests.swift b/Tests/ASCKitTests/Iris/Internal/Auth/IrisSDKSignInTests.swift new file mode 100644 index 00000000..b88fdb39 --- /dev/null +++ b/Tests/ASCKitTests/Iris/Internal/Auth/IrisSDKSignInTests.swift @@ -0,0 +1,112 @@ +import Foundation +import Mockable +import Testing +@testable import ASCKit + +@Suite +struct IrisSDKSignInTests { + private let now = Date(timeIntervalSince1970: 1_800_000_000) + private let credentials = IrisAuthCredentials(appleId: "dev@example.com", password: "secret") + private let trustedDevice = TwoFactorChallenge(method: .trustedDevice, maskedDestination: "Trusted devices", codeLength: 6) + + private var pending: PendingTwoFactorState { + PendingTwoFactorState( + credentials: credentials, scnt: "scnt-1", serviceKey: IrisSDKSignIn.ascServiceKey, + appleIDSessionID: "session-1", twoFactorCookieBag: "aasp=1", challenge: trustedDevice + ) + } + + private func signInStartedByApple() -> MockAppleIDSignIn { + let signIn = MockAppleIDSignIn() + given(signIn).signinInit(accountName: .any, A: .any).willReturn(IdmsaAPIClient.SigninInitResponse( + iteration: 1000, salt: Data(repeating: 7, count: 16), b: Data(repeating: 9, count: 256), c: "c-1", + protocolType: .s2k, scnt: "scnt-0", appleIDSessionID: "session-1", + hashcashChallenge: nil, hashcashBits: nil, cookies: "aasp=1" + )) + return signIn + } + + private func accounts(email: String, teamId: String?) -> MockAppStoreConnectAccounts { + let accounts = MockAppStoreConnectAccounts() + given(accounts).fetchSession(cookies: .any) + .willReturn(OlympusClient.OlympusSession(providerID: 42, teamId: teamId, userEmail: email)) + return accounts + } + + @Test func `should ask for a code from a trusted device when Apple wants two-factor`() async throws { + let signIn = signInStartedByApple() + given(signIn).signinComplete( + accountName: .any, c: .any, m1: .any, m2: .any, scnt: .any, appleIDSessionID: .any, + hashcashChallenge: .any, hashcashBits: .any, cookies: .any + ).willReturn(.twoFactorRequired(scnt: "scnt-2fa", appleIDSessionID: "session-1", cookies: "aasp=1; dslang=GB")) + let repo = IrisSDKSignIn(signIn: signIn, accounts: accounts(email: "", teamId: nil), now: { now }) + + do { + _ = try await repo.login(credentials: credentials) + Issue.record("expected two-factor to be required") + } catch IrisAuthError.twoFactorRequired(let state) { + #expect(state == PendingTwoFactorState( + credentials: credentials, scnt: "scnt-2fa", serviceKey: IrisSDKSignIn.ascServiceKey, + appleIDSessionID: "session-1", twoFactorCookieBag: "aasp=1; dslang=GB", challenge: trustedDevice + )) + } + } + + @Test func `should sign in for thirty days when Apple needs no second factor`() async throws { + let signIn = signInStartedByApple() + given(signIn).signinComplete( + accountName: .any, c: .any, m1: .any, m2: .any, scnt: .any, appleIDSessionID: .any, + hashcashChallenge: .any, hashcashBits: .any, cookies: .any + ).willReturn(.success(scnt: "scnt-ok", cookies: "myacinfo=a")) + let repo = IrisSDKSignIn(signIn: signIn, accounts: accounts(email: "team@example.com", teamId: "TEAM1"), now: { now }) + + let session = try await repo.login(credentials: credentials) + + #expect(session == IrisAuthSession( + cookies: "myacinfo=a", scnt: "scnt-ok", serviceKey: IrisSDKSignIn.ascServiceKey, + appleIDSessionID: "session-1", providerID: 42, teamId: "TEAM1", userEmail: "team@example.com", + expiresAt: now.addingTimeInterval(30 * 24 * 60 * 60) + )) + } + + @Test func `should sign in with the team olympus names after a correct code`() async throws { + let signIn = MockAppleIDSignIn() + given(signIn).fetchAuthOptions(scnt: .any, appleIDSessionID: .any, cookies: .any).willReturn("aasp=1") + given(signIn).submitTwoFactorCode(.any, method: .any, scnt: .any, appleIDSessionID: .any, cookies: .any).willReturn("aasp=1; verified=1") + given(signIn).trust(scnt: .any, appleIDSessionID: .any, cookies: .any).willReturn("myacinfo=a; trusted=1") + let repo = IrisSDKSignIn(signIn: signIn, accounts: accounts(email: "team@example.com", teamId: "TEAM1"), now: { now }) + + let session = try await repo.submitTwoFactorCode("123456", pending: pending) + + #expect(session == IrisAuthSession( + cookies: "myacinfo=a; trusted=1", scnt: "scnt-1", serviceKey: IrisSDKSignIn.ascServiceKey, + appleIDSessionID: "session-1", providerID: 42, teamId: "TEAM1", userEmail: "team@example.com", + expiresAt: now.addingTimeInterval(30 * 24 * 60 * 60) + )) + } + + @Test func `should name the session after the Apple ID when olympus gives no email`() async throws { + let signIn = MockAppleIDSignIn() + given(signIn).fetchAuthOptions(scnt: .any, appleIDSessionID: .any, cookies: .any).willReturn("aasp=1") + given(signIn).submitTwoFactorCode(.any, method: .any, scnt: .any, appleIDSessionID: .any, cookies: .any).willReturn("aasp=1") + given(signIn).trust(scnt: .any, appleIDSessionID: .any, cookies: .any).willReturn("myacinfo=a") + let repo = IrisSDKSignIn(signIn: signIn, accounts: accounts(email: "", teamId: nil), now: { now }) + + let session = try await repo.submitTwoFactorCode("123456", pending: pending) + + #expect(session.userEmail == "dev@example.com") + #expect(session.teamId == nil) + } + + @Test func `should not sign in when Apple rejects the code`() async { + let signIn = MockAppleIDSignIn() + given(signIn).fetchAuthOptions(scnt: .any, appleIDSessionID: .any, cookies: .any).willReturn("aasp=1") + given(signIn).submitTwoFactorCode(.any, method: .any, scnt: .any, appleIDSessionID: .any, cookies: .any) + .willThrow(IrisAuthError.twoFactorCodeRejected(remainingAttempts: nil)) + let repo = IrisSDKSignIn(signIn: signIn, accounts: accounts(email: "", teamId: nil), now: { now }) + + await #expect(throws: IrisAuthError.twoFactorCodeRejected(remainingAttempts: nil)) { + try await repo.submitTwoFactorCode("000000", pending: pending) + } + } +} diff --git a/Tests/InfrastructureTests/Iris/Auth/OlympusClientTests.swift b/Tests/ASCKitTests/Iris/Internal/Auth/OlympusClientTests.swift similarity index 99% rename from Tests/InfrastructureTests/Iris/Auth/OlympusClientTests.swift rename to Tests/ASCKitTests/Iris/Internal/Auth/OlympusClientTests.swift index 01357cc8..a9b1c66e 100644 --- a/Tests/InfrastructureTests/Iris/Auth/OlympusClientTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/Auth/OlympusClientTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit /// Private URLProtocol subclass — see `IrisSDKInAppPurchaseSubmissionRepositoryTests` /// for the rationale (avoids racing the shared `URLProtocolStub.handler` static used diff --git a/Tests/InfrastructureTests/Iris/Auth/SRP/AppleHashcashTests.swift b/Tests/ASCKitTests/Iris/Internal/Auth/SRP/AppleHashcashTests.swift similarity index 98% rename from Tests/InfrastructureTests/Iris/Auth/SRP/AppleHashcashTests.swift rename to Tests/ASCKitTests/Iris/Internal/Auth/SRP/AppleHashcashTests.swift index 01357cf4..52393e51 100644 --- a/Tests/InfrastructureTests/Iris/Auth/SRP/AppleHashcashTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/Auth/SRP/AppleHashcashTests.swift @@ -1,7 +1,7 @@ import Crypto import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct AppleHashcashTests { diff --git a/Tests/InfrastructureTests/Iris/Auth/SRP/AppleSRPClientTests.swift b/Tests/ASCKitTests/Iris/Internal/Auth/SRP/AppleSRPClientTests.swift similarity index 99% rename from Tests/InfrastructureTests/Iris/Auth/SRP/AppleSRPClientTests.swift rename to Tests/ASCKitTests/Iris/Internal/Auth/SRP/AppleSRPClientTests.swift index 8951b919..a79c1d32 100644 --- a/Tests/InfrastructureTests/Iris/Auth/SRP/AppleSRPClientTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/Auth/SRP/AppleSRPClientTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct AppleSRPClientTests { diff --git a/Tests/InfrastructureTests/Iris/Auth/StoredSRPIrisCookieProviderTests.swift b/Tests/ASCKitTests/Iris/Internal/Auth/StoredSRPIrisCookieProviderTests.swift similarity index 98% rename from Tests/InfrastructureTests/Iris/Auth/StoredSRPIrisCookieProviderTests.swift rename to Tests/ASCKitTests/Iris/Internal/Auth/StoredSRPIrisCookieProviderTests.swift index 09c324c9..ee434aab 100644 --- a/Tests/InfrastructureTests/Iris/Auth/StoredSRPIrisCookieProviderTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/Auth/StoredSRPIrisCookieProviderTests.swift @@ -1,8 +1,7 @@ -import Domain import Foundation import Mockable import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct StoredSRPIrisCookieProviderTests { diff --git a/Tests/InfrastructureTests/Iris/Auth/URLProtocolStub.swift b/Tests/ASCKitTests/Iris/Internal/Auth/URLProtocolStub.swift similarity index 100% rename from Tests/InfrastructureTests/Iris/Auth/URLProtocolStub.swift rename to Tests/ASCKitTests/Iris/Internal/Auth/URLProtocolStub.swift diff --git a/Tests/ASCKitTests/Iris/Internal/BrowserIrisCookieProviderTests.swift b/Tests/ASCKitTests/Iris/Internal/BrowserIrisCookieProviderTests.swift new file mode 100644 index 00000000..4aad2168 --- /dev/null +++ b/Tests/ASCKitTests/Iris/Internal/BrowserIrisCookieProviderTests.swift @@ -0,0 +1,65 @@ +import Foundation +import Mockable +import Testing +@testable import ASCKit + +@Suite +struct BrowserIrisCookieProviderTests { + private func browsers(_ perBrowser: [[BrowserCookie]]) -> MockBrowserCookieStores { + let stores = MockBrowserCookieStores() + given(stores).cookiesPerBrowser(domains: .any).willReturn(perBrowser) + return stores + } + + @Test func `should use the cookies from ASC_IRIS_COOKIES before any browser`() throws { + let provider = BrowserIrisCookieProvider( + environment: ["ASC_IRIS_COOKIES": "myacinfo=from-env"], + browsers: browsers([[BrowserCookie(name: "myacinfo", value: "from-browser")]]) + ) + + #expect(try provider.resolveSession() == IrisSession(cookies: "myacinfo=from-env")) + #expect(try provider.resolveStatus() == IrisStatus(source: .environment, cookieCount: 1)) + } + + @Test func `should ignore ASC_IRIS_COOKIES when it is blank`() throws { + let provider = BrowserIrisCookieProvider( + environment: ["ASC_IRIS_COOKIES": " "], + browsers: browsers([[BrowserCookie(name: "myacinfo", value: "a")]]) + ) + + #expect(try provider.resolveSession() == IrisSession(cookies: "myacinfo=a")) + } + + @Test func `should take the iris cookies from the first browser signed in to App Store Connect`() throws { + let provider = BrowserIrisCookieProvider( + environment: [:], + browsers: browsers([ + [BrowserCookie(name: "dc", value: "not-signed-in")], + [ + BrowserCookie(name: "myacinfo", value: "a"), + BrowserCookie(name: "unrelated", value: "x"), + BrowserCookie(name: "itctx", value: "b"), + ], + [BrowserCookie(name: "myacinfo", value: "later-browser")], + ]) + ) + + #expect(try provider.resolveSession() == IrisSession(cookies: "itctx=b; myacinfo=a")) + #expect(try provider.resolveStatus() == IrisStatus(source: .browser, cookieCount: 2)) + } + + @Test func `should report no cookies when no browser is signed in to App Store Connect`() { + let provider = BrowserIrisCookieProvider( + environment: [:], + browsers: browsers([[BrowserCookie(name: "itctx", value: "b")], []]) + ) + + do { + _ = try provider.resolveSession() + Issue.record("expected no cookies") + } catch IrisCookieError.noCookiesFound { + } catch { + Issue.record("unexpected error \(error)") + } + } +} diff --git a/Tests/InfrastructureTests/Iris/IrisAPIErrorTests.swift b/Tests/ASCKitTests/Iris/Internal/IrisAPIErrorTests.swift similarity index 96% rename from Tests/InfrastructureTests/Iris/IrisAPIErrorTests.swift rename to Tests/ASCKitTests/Iris/Internal/IrisAPIErrorTests.swift index 3c1ab811..73143c88 100644 --- a/Tests/InfrastructureTests/Iris/IrisAPIErrorTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/IrisAPIErrorTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct IrisAPIErrorTests { diff --git a/Tests/InfrastructureTests/Iris/IrisCookieErrorTests.swift b/Tests/ASCKitTests/Iris/Internal/IrisCookieErrorTests.swift similarity index 91% rename from Tests/InfrastructureTests/Iris/IrisCookieErrorTests.swift rename to Tests/ASCKitTests/Iris/Internal/IrisCookieErrorTests.swift index 19a7bbd1..8f18f4d8 100644 --- a/Tests/InfrastructureTests/Iris/IrisCookieErrorTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/IrisCookieErrorTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct IrisCookieErrorTests { diff --git a/Tests/InfrastructureTests/Iris/IrisCreateAppDocumentTests.swift b/Tests/ASCKitTests/Iris/Internal/IrisCreateAppDocumentTests.swift similarity index 99% rename from Tests/InfrastructureTests/Iris/IrisCreateAppDocumentTests.swift rename to Tests/ASCKitTests/Iris/Internal/IrisCreateAppDocumentTests.swift index 5a12ab4f..eebeefa2 100644 --- a/Tests/InfrastructureTests/Iris/IrisCreateAppDocumentTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/IrisCreateAppDocumentTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct AppCreateRequestTests { diff --git a/Tests/ASCKitTests/Iris/Internal/IrisRequestTests.swift b/Tests/ASCKitTests/Iris/Internal/IrisRequestTests.swift new file mode 100644 index 00000000..57189d54 --- /dev/null +++ b/Tests/ASCKitTests/Iris/Internal/IrisRequestTests.swift @@ -0,0 +1,90 @@ +import Foundation +import Testing +@testable import ASCKit + +@Suite +struct IrisRequestTests { + @Test func `should ask iris for JSON:API as the web UI does, with the session cookies`() { + let request = IrisRequest.get(path: "apps", queryItems: [URLQueryItem(name: "limit", value: "1")], cookies: "myacinfo=abc") + + #expect(request.url?.absoluteString == "https://appstoreconnect.apple.com/iris/v1/apps?limit=1") + #expect(request.httpMethod == "GET") + #expect(request.value(forHTTPHeaderField: "accept") == "application/vnd.api+json") + #expect(request.value(forHTTPHeaderField: "content-type") == "application/vnd.api+json") + #expect(request.value(forHTTPHeaderField: "cookie") == "myacinfo=abc") + #expect(request.value(forHTTPHeaderField: "x-csrf-itc") == "[asc-ui]") + #expect(request.value(forHTTPHeaderField: "user-agent")?.hasPrefix("Mozilla/5.0 (Macintosh") == true) + } + + @Test func `should leave the query off when there are no query items`() { + let request = IrisRequest.get(path: "apps", queryItems: [], cookies: "c") + + #expect(request.url?.absoluteString == "https://appstoreconnect.apple.com/iris/v1/apps") + } + + @Test func `should send the body when posting to iris`() { + let request = IrisRequest.post(path: "appBundles", body: Data("{}".utf8), cookies: "c") + + #expect(request.url?.absoluteString == "https://appstoreconnect.apple.com/iris/v1/appBundles") + #expect(request.httpMethod == "POST") + #expect(request.httpBody == Data("{}".utf8)) + #expect(request.value(forHTTPHeaderField: "x-csrf-itc") == "[asc-ui]") + } + + @Test func `should delete at the iris path`() { + let request = IrisRequest.delete(path: "inAppPurchaseSubmissions/s1", cookies: "c") + + #expect(request.url?.absoluteString == "https://appstoreconnect.apple.com/iris/v1/inAppPurchaseSubmissions/s1") + #expect(request.httpMethod == "DELETE") + } + + @Test func `should fetch a download with only the session cookies`() { + let request = IrisRequest.download(absoluteURL: URL(string: "https://example.apple.com/a.png")!, cookies: "c") + + #expect(request.url?.absoluteString == "https://example.apple.com/a.png") + #expect(request.httpMethod == "GET") + #expect(request.value(forHTTPHeaderField: "cookie") == "c") + #expect(request.value(forHTTPHeaderField: "accept") == nil) + #expect(request.value(forHTTPHeaderField: "x-csrf-itc") == nil) + } +} + +@Suite +struct IrisResponseTests { + private let url = URL(string: "https://appstoreconnect.apple.com/iris/v1/apps")! + + @Test func `should answer the body when iris accepts the request`() throws { + let response = HTTPURLResponse(url: url, statusCode: 201, httpVersion: nil, headerFields: nil)! + + let (data, http) = try IrisResponse.accepted(data: Data("ok".utf8), response: response) + + #expect(data == Data("ok".utf8)) + #expect(http.statusCode == 201) + } + + @Test func `should fail with the status and body when iris refuses the request`() { + let response = HTTPURLResponse(url: url, statusCode: 403, httpVersion: nil, headerFields: nil)! + + do { + _ = try IrisResponse.accepted(data: Data("forbidden".utf8), response: response) + Issue.record("expected iris to refuse") + } catch IrisAPIError.httpError(let statusCode, let body) { + #expect(statusCode == 403) + #expect(body == "forbidden") + } catch { + Issue.record("unexpected error \(error)") + } + } + + @Test func `should fail when the reply is not an HTTP response`() { + let response = URLResponse(url: url, mimeType: nil, expectedContentLength: 0, textEncodingName: nil) + + do { + _ = try IrisResponse.accepted(data: Data(), response: response) + Issue.record("expected an invalid response") + } catch IrisAPIError.invalidResponse { + } catch { + Issue.record("unexpected error \(error)") + } + } +} diff --git a/Tests/InfrastructureTests/Iris/IrisResponseDecodingTests.swift b/Tests/ASCKitTests/Iris/Internal/IrisResponseDecodingTests.swift similarity index 98% rename from Tests/InfrastructureTests/Iris/IrisResponseDecodingTests.swift rename to Tests/ASCKitTests/Iris/Internal/IrisResponseDecodingTests.swift index c4e1d810..eea95beb 100644 --- a/Tests/InfrastructureTests/Iris/IrisResponseDecodingTests.swift +++ b/Tests/ASCKitTests/Iris/Internal/IrisResponseDecodingTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct IrisResponseDecodingTests { diff --git a/Tests/DomainTests/Iris/IrisSessionTests.swift b/Tests/ASCKitTests/Iris/IrisSessionTests.swift similarity index 94% rename from Tests/DomainTests/Iris/IrisSessionTests.swift rename to Tests/ASCKitTests/Iris/IrisSessionTests.swift index 8a700e70..9c5d173c 100644 --- a/Tests/DomainTests/Iris/IrisSessionTests.swift +++ b/Tests/ASCKitTests/Iris/IrisSessionTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct IrisSessionTests { diff --git a/Tests/DomainTests/Iris/IrisStatusTests.swift b/Tests/ASCKitTests/Iris/IrisStatusTests.swift similarity index 97% rename from Tests/DomainTests/Iris/IrisStatusTests.swift rename to Tests/ASCKitTests/Iris/IrisStatusTests.swift index 3d67fe5e..f8068782 100644 --- a/Tests/DomainTests/Iris/IrisStatusTests.swift +++ b/Tests/ASCKitTests/Iris/IrisStatusTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct IrisStatusTests { diff --git a/Tests/InfrastructureTests/Iris/ResolutionCenter/IrisSDKResolutionCenterRepositoryTests.swift b/Tests/ASCKitTests/Iris/ResolutionCenter/Internal/IrisSDKResolutionCenterRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Iris/ResolutionCenter/IrisSDKResolutionCenterRepositoryTests.swift rename to Tests/ASCKitTests/Iris/ResolutionCenter/Internal/IrisSDKResolutionCenterRepositoryTests.swift index 58fd7878..a3e7ef33 100644 --- a/Tests/InfrastructureTests/Iris/ResolutionCenter/IrisSDKResolutionCenterRepositoryTests.swift +++ b/Tests/ASCKitTests/Iris/ResolutionCenter/Internal/IrisSDKResolutionCenterRepositoryTests.swift @@ -1,7 +1,6 @@ -import Domain import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit /// Private URLProtocol subclass with its own `handler` static so this suite's /// stubs can't race with other iris suites' handlers when run in parallel diff --git a/Tests/DomainTests/Iris/ResolutionCenter/ResolutionCenterDetailTests.swift b/Tests/ASCKitTests/Iris/ResolutionCenter/ResolutionCenterDetailTests.swift similarity index 99% rename from Tests/DomainTests/Iris/ResolutionCenter/ResolutionCenterDetailTests.swift rename to Tests/ASCKitTests/Iris/ResolutionCenter/ResolutionCenterDetailTests.swift index 7b19adbe..a62382e9 100644 --- a/Tests/DomainTests/Iris/ResolutionCenter/ResolutionCenterDetailTests.swift +++ b/Tests/ASCKitTests/Iris/ResolutionCenter/ResolutionCenterDetailTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ResolutionCenterDetailTests { diff --git a/Tests/InfrastructureTests/Plugins/GitHubPluginSourceTests.swift b/Tests/ASCKitTests/Plugins/Internal/GitHubPluginSourceTests.swift similarity index 97% rename from Tests/InfrastructureTests/Plugins/GitHubPluginSourceTests.swift rename to Tests/ASCKitTests/Plugins/Internal/GitHubPluginSourceTests.swift index 43566760..47efd806 100644 --- a/Tests/InfrastructureTests/Plugins/GitHubPluginSourceTests.swift +++ b/Tests/ASCKitTests/Plugins/Internal/GitHubPluginSourceTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite("GitHubPluginSource — fetches registry from GitHub") struct GitHubPluginSourceTests { diff --git a/Tests/ASCKitTests/Plugins/Internal/MarketplacePluginsTests.swift b/Tests/ASCKitTests/Plugins/Internal/MarketplacePluginsTests.swift new file mode 100644 index 00000000..b6913e7e --- /dev/null +++ b/Tests/ASCKitTests/Plugins/Internal/MarketplacePluginsTests.swift @@ -0,0 +1,194 @@ +import Foundation +import Mockable +import Testing +@testable import ASCKit + +@Suite +struct MarketplacePluginsTests { + private let ascPro = InstalledPlugin( + slug: "ASCPro", name: "ASC Pro", uiScripts: ["ui/pro.js"], + version: "1.2.0", description: "Pro tools", author: "tddworks", + repositoryURL: "https://github.com/tddworks/asc-pro", categories: ["pro"] + ) + + private func market(_ plugins: [Plugin]) -> MockPluginSource { + let source = MockPluginSource() + given(source).fetchPlugins().willReturn(plugins) + return source + } + + private func folder(installed: [InstalledPlugin] = [], bundles: [PluginBundle] = []) -> MockPluginsFolder { + let folder = MockPluginsFolder() + given(folder).installed().willReturn(installed) + given(folder).bundles().willReturn(bundles) + given(folder).remove(slug: .any).willReturn(()) + given(folder).unpack(.any, named: .any).willReturn(true) + return folder + } + + private func repository( + folder: MockPluginsFolder, market: [Plugin] = [], downloads: MockPluginDownloads = MockPluginDownloads() + ) -> MarketplacePlugins { + MarketplacePlugins(sources: [self.market(market)], folder: folder, downloads: downloads) + } + + // MARK: - installed + + @Test func `should list each installed plugin with the details from its manifest`() async throws { + let plugins = try await repository(folder: folder(installed: [ascPro])).listInstalled() + + #expect(plugins == [Plugin( + id: "ASCPro", name: "ASC Pro", version: "1.2.0", description: "Pro tools", author: "tddworks", + repositoryURL: "https://github.com/tddworks/asc-pro", categories: ["pro"], + isInstalled: true, slug: "ASCPro", uiScripts: ["ui/pro.js"] + )]) + } + + @Test func `should list an installed plugin without a manifest as version 1.0`() async throws { + let bare = InstalledPlugin(slug: "Bare", name: "Bare", uiScripts: [], version: nil, description: nil, author: nil, repositoryURL: nil, categories: nil) + + let plugins = try await repository(folder: folder(installed: [bare])).listInstalled() + + #expect(plugins == [Plugin(id: "Bare", name: "Bare", version: "1.0", isInstalled: true, slug: "Bare")]) + } + + // MARK: - marketplace + + @Test func `should mark a marketplace plugin installed when its id is an installed plugin's name as an id`() async throws { + let plugins = try await repository( + folder: folder(installed: [ascPro]), + market: [ + Plugin(id: "asc-pro", name: "ASC Pro", version: "1.3.0", downloadURL: "https://example.com/pro.zip"), + Plugin(id: "hello", name: "Hello", version: "0.1.0"), + ] + ).listAvailable() + + #expect(plugins.map(\.isInstalled) == [true, false]) + } + + @Test func `should find marketplace plugins by name, description or category, ignoring case`() async throws { + let plugins = try await repository( + folder: folder(), + market: [ + Plugin(id: "a", name: "Screenshot Studio", version: "1"), + Plugin(id: "b", name: "B", version: "1", description: "Bulk SCREENSHOT upload"), + Plugin(id: "c", name: "C", version: "1", categories: ["Screenshots"]), + Plugin(id: "d", name: "D", version: "1", description: "Reviews"), + ] + ).searchAvailable(query: "screenshot") + + #expect(plugins.map(\.id) == ["a", "b", "c"]) + } + + @Test func `should list installed plugins whose marketplace version differs`() async throws { + let updates = try await repository( + folder: folder(installed: [ascPro]), + market: [Plugin(id: "asc-pro", name: "ASC Pro", version: "1.3.0", repositoryURL: "https://github.com/tddworks/asc-pro", downloadURL: "https://example.com/pro.zip")] + ).listOutdated() + + #expect(updates == [PluginUpdate( + name: "ASC Pro", installedVersion: "1.2.0", latestVersion: "1.3.0", + repositoryURL: "https://github.com/tddworks/asc-pro", downloadURL: "https://example.com/pro.zip" + )]) + } + + // MARK: - install + + @Test func `should install a marketplace plugin from its download`() async throws { + let downloads = MockPluginDownloads() + given(downloads).download(from: .value(URL(string: "https://example.com/hello.zip")!)).willReturn(Data("zip".utf8)) + let folder = folder() + + let plugin = try await repository( + folder: folder, + market: [Plugin(id: "hello", name: "Hello", version: "0.1.0", description: "Says hi", downloadURL: "https://example.com/hello.zip")], + downloads: downloads + ).install(name: "hello") + + #expect(plugin == Plugin(id: "hello", name: "Hello", version: "0.1.0", description: "Says hi", isInstalled: true, slug: "hello")) + verify(folder).unpack(.value(Data("zip".utf8)), named: .value("hello")).called(1) + } + + @Test func `should refuse to install a plugin the marketplace does not list`() async { + do { + _ = try await repository(folder: folder()).install(name: "missing") + Issue.record("expected the plugin not to be found") + } catch PluginMarketError.pluginNotFound(let name) { + #expect(name == "missing") + } catch { + Issue.record("unexpected error \(error)") + } + } + + @Test func `should report a failed install when the download does not unpack`() async { + let downloads = MockPluginDownloads() + given(downloads).download(from: .any).willReturn(Data()) + let folder = MockPluginsFolder() + given(folder).installed().willReturn([]) + given(folder).unpack(.any, named: .any).willReturn(false) + + do { + _ = try await repository( + folder: folder, + market: [Plugin(id: "hello", name: "Hello", version: "0.1.0", downloadURL: "https://example.com/hello.zip")], + downloads: downloads + ).install(name: "hello") + Issue.record("expected the install to fail") + } catch PluginMarketError.installFailed(let name) { + #expect(name == "hello") + } catch { + Issue.record("unexpected error \(error)") + } + } + + // MARK: - uninstall + + @Test func `should uninstall the plugin named by its folder`() async throws { + let folder = folder(bundles: [PluginBundle(slug: "ASCPro", manifestName: "ASC Pro")]) + + try await repository(folder: folder).uninstall(name: "ASCPro") + + verify(folder).remove(slug: .value("ASCPro")).called(1) + } + + @Test func `should uninstall the plugin whose name, as an id, is the one given`() async throws { + let folder = folder(bundles: [ + PluginBundle(slug: "Other", manifestName: "Other"), + PluginBundle(slug: "ASCPro", manifestName: "ASC Pro"), + ]) + + try await repository(folder: folder).uninstall(name: "asc-pro") + + verify(folder).remove(slug: .value("ASCPro")).called(1) + } + + @Test func `should refuse to uninstall a plugin that is not installed`() async { + do { + try await repository(folder: folder(bundles: [PluginBundle(slug: "Other", manifestName: nil)])).uninstall(name: "asc-pro") + Issue.record("expected the plugin not to be found") + } catch PluginMarketError.pluginNotFound(let name) { + #expect(name == "asc-pro") + } catch { + Issue.record("unexpected error \(error)") + } + } + + // MARK: - update + + @Test func `should update a plugin by reinstalling the marketplace version`() async throws { + let downloads = MockPluginDownloads() + given(downloads).download(from: .any).willReturn(Data("zip".utf8)) + let folder = folder(installed: [ascPro], bundles: [PluginBundle(slug: "ASCPro", manifestName: "ASC Pro")]) + + let plugin = try await repository( + folder: folder, + market: [Plugin(id: "asc-pro", name: "ASC Pro", version: "1.3.0", downloadURL: "https://example.com/pro.zip")], + downloads: downloads + ).update(name: "ASC Pro") + + #expect(plugin.version == "1.3.0") + #expect(plugin.isInstalled == true) + verify(folder).remove(slug: .value("ASCPro")).called(1) + verify(folder).unpack(.any, named: .value("asc-pro")).called(1) + } +} diff --git a/Tests/InfrastructureTests/Plugins/PluginSettingsStoreTests.swift b/Tests/ASCKitTests/Plugins/Internal/PluginSettingsStoreTests.swift similarity index 100% rename from Tests/InfrastructureTests/Plugins/PluginSettingsStoreTests.swift rename to Tests/ASCKitTests/Plugins/Internal/PluginSettingsStoreTests.swift diff --git a/Tests/DomainTests/Plugins/PluginSourceTests.swift b/Tests/ASCKitTests/Plugins/PluginSourceTests.swift similarity index 97% rename from Tests/DomainTests/Plugins/PluginSourceTests.swift rename to Tests/ASCKitTests/Plugins/PluginSourceTests.swift index b10aec33..0d87e690 100644 --- a/Tests/DomainTests/Plugins/PluginSourceTests.swift +++ b/Tests/ASCKitTests/Plugins/PluginSourceTests.swift @@ -1,7 +1,7 @@ import Foundation import Mockable import Testing -@testable import Domain +@testable import ASCKit @Suite("PluginSource — composable registry sources") struct PluginSourceTests { diff --git a/Tests/DomainTests/Plugins/PluginTests.swift b/Tests/ASCKitTests/Plugins/PluginTests.swift similarity index 99% rename from Tests/DomainTests/Plugins/PluginTests.swift rename to Tests/ASCKitTests/Plugins/PluginTests.swift index 563439da..8c160465 100644 --- a/Tests/DomainTests/Plugins/PluginTests.swift +++ b/Tests/ASCKitTests/Plugins/PluginTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("Plugin — unified plugin model") struct PluginTests { diff --git a/Tests/DomainTests/Plugins/PluginUpdateTests.swift b/Tests/ASCKitTests/Plugins/PluginUpdateTests.swift similarity index 98% rename from Tests/DomainTests/Plugins/PluginUpdateTests.swift rename to Tests/ASCKitTests/Plugins/PluginUpdateTests.swift index edab860f..f3dde8d2 100644 --- a/Tests/DomainTests/Plugins/PluginUpdateTests.swift +++ b/Tests/ASCKitTests/Plugins/PluginUpdateTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct PluginUpdateTests { diff --git a/Tests/InfrastructureTests/Projects/FileProjectConfigStorageTests.swift b/Tests/ASCKitTests/Projects/Internal/FileProjectConfigStorageTests.swift similarity index 98% rename from Tests/InfrastructureTests/Projects/FileProjectConfigStorageTests.swift rename to Tests/ASCKitTests/Projects/Internal/FileProjectConfigStorageTests.swift index 95c524f8..0aeefe65 100644 --- a/Tests/InfrastructureTests/Projects/FileProjectConfigStorageTests.swift +++ b/Tests/ASCKitTests/Projects/Internal/FileProjectConfigStorageTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct FileProjectConfigStorageTests { diff --git a/Tests/DomainTests/Projects/ProjectConfigTests.swift b/Tests/ASCKitTests/Projects/ProjectConfigTests.swift similarity index 99% rename from Tests/DomainTests/Projects/ProjectConfigTests.swift rename to Tests/ASCKitTests/Projects/ProjectConfigTests.swift index a5c2280a..aaac087a 100644 --- a/Tests/DomainTests/Projects/ProjectConfigTests.swift +++ b/Tests/ASCKitTests/Projects/ProjectConfigTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ProjectConfigTests { diff --git a/Tests/DomainTests/Reports/AnalyticsReportTests.swift b/Tests/ASCKitTests/Reports/AnalyticsReportTests.swift similarity index 99% rename from Tests/DomainTests/Reports/AnalyticsReportTests.swift rename to Tests/ASCKitTests/Reports/AnalyticsReportTests.swift index ab6ed489..338ebaa1 100644 --- a/Tests/DomainTests/Reports/AnalyticsReportTests.swift +++ b/Tests/ASCKitTests/Reports/AnalyticsReportTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AnalyticsAccessTypeTests { diff --git a/Tests/InfrastructureTests/Reports/SDKAnalyticsReportRepositoryTests.swift b/Tests/ASCKitTests/Reports/Internal/SDKAnalyticsReportRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Reports/SDKAnalyticsReportRepositoryTests.swift rename to Tests/ASCKitTests/Reports/Internal/SDKAnalyticsReportRepositoryTests.swift index c99c9051..b3068498 100644 --- a/Tests/InfrastructureTests/Reports/SDKAnalyticsReportRepositoryTests.swift +++ b/Tests/ASCKitTests/Reports/Internal/SDKAnalyticsReportRepositoryTests.swift @@ -1,8 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct SDKAnalyticsReportRepositoryCreateRequestTests { diff --git a/Tests/InfrastructureTests/Reports/SDKReportRepositoryTests.swift b/Tests/ASCKitTests/Reports/Internal/SDKReportsTests.swift similarity index 95% rename from Tests/InfrastructureTests/Reports/SDKReportRepositoryTests.swift rename to Tests/ASCKitTests/Reports/Internal/SDKReportsTests.swift index 9b7fe870..57130dd0 100644 --- a/Tests/InfrastructureTests/Reports/SDKReportRepositoryTests.swift +++ b/Tests/ASCKitTests/Reports/Internal/SDKReportsTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct GzipDecompressionTests { @@ -85,7 +84,7 @@ struct SDKReportRepositoryDownloadSalesReportTests { let stub = StubAPIClient() stub.willReturn(gzipped) - let repo = SDKReportRepository(client: stub) + let repo = SDKReports(client: stub) let rows = try await repo.downloadSalesReport( vendorNumber: "123", reportType: .sales, @@ -108,7 +107,7 @@ struct SDKReportRepositoryDownloadSalesReportTests { let stub = StubAPIClient() stub.willReturn(gzipped) - let repo = SDKReportRepository(client: stub) + let repo = SDKReports(client: stub) _ = try await repo.downloadSalesReport( vendorNumber: "123", reportType: .sales, @@ -129,7 +128,7 @@ struct SDKReportRepositoryDownloadSalesReportTests { let stub = StubAPIClient() stub.willReturn(gzipped) - let repo = SDKReportRepository(client: stub) + let repo = SDKReports(client: stub) _ = try await repo.downloadSalesReport( vendorNumber: "123", reportType: .sales, @@ -154,7 +153,7 @@ struct SDKReportRepositoryDownloadFinanceReportTests { let stub = StubAPIClient() stub.willReturn(gzipped) - let repo = SDKReportRepository(client: stub) + let repo = SDKReports(client: stub) let rows = try await repo.downloadFinanceReport( vendorNumber: "123", reportType: .financial, diff --git a/Tests/DomainTests/Reports/ReportFilterTests.swift b/Tests/ASCKitTests/Reports/ReportFilterTests.swift similarity index 99% rename from Tests/DomainTests/Reports/ReportFilterTests.swift rename to Tests/ASCKitTests/Reports/ReportFilterTests.swift index 3a6bf1f2..83a63a2a 100644 --- a/Tests/DomainTests/Reports/ReportFilterTests.swift +++ b/Tests/ASCKitTests/Reports/ReportFilterTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct SalesReportTypeTests { diff --git a/Tests/DomainTests/Screenshots/AppShotTemplateTests.swift b/Tests/ASCKitTests/Screenshots/AppShotTemplateTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/AppShotTemplateTests.swift rename to Tests/ASCKitTests/Screenshots/AppShotTemplateTests.swift index e09c5157..0fcb235d 100644 --- a/Tests/DomainTests/Screenshots/AppShotTemplateTests.swift +++ b/Tests/ASCKitTests/Screenshots/AppShotTemplateTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("AppShotTemplate") struct AppShotTemplateTests { diff --git a/Tests/DomainTests/Screenshots/AppShotsConfigTests.swift b/Tests/ASCKitTests/Screenshots/AppShotsConfigTests.swift similarity index 97% rename from Tests/DomainTests/Screenshots/AppShotsConfigTests.swift rename to Tests/ASCKitTests/Screenshots/AppShotsConfigTests.swift index 5ac34f5e..a42babf5 100644 --- a/Tests/DomainTests/Screenshots/AppShotsConfigTests.swift +++ b/Tests/ASCKitTests/Screenshots/AppShotsConfigTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AppShotsConfigTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/AppShotTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/AppShotTests.swift similarity index 98% rename from Tests/DomainTests/Screenshots/Gallery/AppShotTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/AppShotTests.swift index 7b46dd1d..a13ae5d4 100644 --- a/Tests/DomainTests/Screenshots/Gallery/AppShotTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/AppShotTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("AppShot") struct AppShotTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/GalleryApplyTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/GalleryApplyTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/GalleryApplyTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/GalleryApplyTests.swift index 5847154c..e1881576 100644 --- a/Tests/DomainTests/Screenshots/Gallery/GalleryApplyTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/GalleryApplyTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("Gallery Apply Screenshots") struct GalleryApplyTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/GalleryCodableTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/GalleryCodableTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/GalleryCodableTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/GalleryCodableTests.swift index 3e0a89da..d6904ce1 100644 --- a/Tests/DomainTests/Screenshots/Gallery/GalleryCodableTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/GalleryCodableTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("Gallery Codable") struct GalleryCodableTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/GalleryComposeTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/GalleryComposeTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/GalleryComposeTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/GalleryComposeTests.swift index 6ef50729..a97decc5 100644 --- a/Tests/DomainTests/Screenshots/Gallery/GalleryComposeTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/GalleryComposeTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("Gallery Compose") struct GalleryComposeTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/GalleryHTMLRendererTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/GalleryHTMLRendererTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/GalleryHTMLRendererTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/GalleryHTMLRendererTests.swift index cee7d12c..98ab1393 100644 --- a/Tests/DomainTests/Screenshots/Gallery/GalleryHTMLRendererTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/GalleryHTMLRendererTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("GalleryHTMLRenderer") struct GalleryHTMLRendererTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/GalleryPreviewOutputTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/GalleryPreviewOutputTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/GalleryPreviewOutputTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/GalleryPreviewOutputTests.swift index dda2776a..d23fb85f 100644 --- a/Tests/DomainTests/Screenshots/Gallery/GalleryPreviewOutputTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/GalleryPreviewOutputTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("Gallery Preview Output") struct GalleryPreviewOutputTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/GalleryPreviewTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/GalleryPreviewTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/GalleryPreviewTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/GalleryPreviewTests.swift index 6e71c7df..8ffe4a6c 100644 --- a/Tests/DomainTests/Screenshots/Gallery/GalleryPreviewTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/GalleryPreviewTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("Gallery Preview HTML") struct GalleryPreviewTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/GalleryTemplateRepositoryTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/GalleryTemplateRepositoryTests.swift similarity index 98% rename from Tests/DomainTests/Screenshots/Gallery/GalleryTemplateRepositoryTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/GalleryTemplateRepositoryTests.swift index 6c00a0a1..763d3d7d 100644 --- a/Tests/DomainTests/Screenshots/Gallery/GalleryTemplateRepositoryTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/GalleryTemplateRepositoryTests.swift @@ -1,7 +1,7 @@ import Foundation import Testing import Mockable -@testable import Domain +@testable import ASCKit @Suite("GalleryTemplateRepository") struct GalleryTemplateRepositoryTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/GalleryTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/GalleryTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/GalleryTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/GalleryTests.swift index 01f1b18b..d5bc2b66 100644 --- a/Tests/DomainTests/Screenshots/Gallery/GalleryTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/GalleryTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("Gallery") struct GalleryTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/HTMLComposerTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/HTMLComposerTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/HTMLComposerTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/HTMLComposerTests.swift index f76d9677..26649b5f 100644 --- a/Tests/DomainTests/Screenshots/Gallery/HTMLComposerTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/HTMLComposerTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("HTMLComposer") struct HTMLComposerTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/ScreenLayoutTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/ScreenLayoutTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/ScreenLayoutTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/ScreenLayoutTests.swift index 14e0e940..61e8349d 100644 --- a/Tests/DomainTests/Screenshots/Gallery/ScreenLayoutTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/ScreenLayoutTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("ScreenLayout") struct ScreenLayoutGalleryTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/TemplatePreviewPageTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/TemplatePreviewPageTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/TemplatePreviewPageTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/TemplatePreviewPageTests.swift index 258a0f20..a34c4950 100644 --- a/Tests/DomainTests/Screenshots/Gallery/TemplatePreviewPageTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/TemplatePreviewPageTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("Template Preview Page") struct TemplatePreviewPageTests { diff --git a/Tests/DomainTests/Screenshots/Gallery/TextSlotPreviewTests.swift b/Tests/ASCKitTests/Screenshots/Gallery/TextSlotPreviewTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/Gallery/TextSlotPreviewTests.swift rename to Tests/ASCKitTests/Screenshots/Gallery/TextSlotPreviewTests.swift index 40aaf1cc..366806c0 100644 --- a/Tests/DomainTests/Screenshots/Gallery/TextSlotPreviewTests.swift +++ b/Tests/ASCKitTests/Screenshots/Gallery/TextSlotPreviewTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("TextSlot Preview") struct TextSlotPreviewTests { diff --git a/Tests/InfrastructureTests/ScreenshotPlans/AggregateGalleryTemplateRepositoryTests.swift b/Tests/ASCKitTests/Screenshots/Internal/AggregateGalleryTemplateRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/ScreenshotPlans/AggregateGalleryTemplateRepositoryTests.swift rename to Tests/ASCKitTests/Screenshots/Internal/AggregateGalleryTemplateRepositoryTests.swift index bfa63408..6bfebe3a 100644 --- a/Tests/InfrastructureTests/ScreenshotPlans/AggregateGalleryTemplateRepositoryTests.swift +++ b/Tests/ASCKitTests/Screenshots/Internal/AggregateGalleryTemplateRepositoryTests.swift @@ -1,8 +1,7 @@ import Foundation import Mockable import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite("AggregateGalleryTemplateRepository") struct AggregateGalleryTemplateRepositoryTests { diff --git a/Tests/InfrastructureTests/ScreenshotPlans/AggregateTemplateRepositoryTests.swift b/Tests/ASCKitTests/Screenshots/Internal/AggregateTemplateRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/ScreenshotPlans/AggregateTemplateRepositoryTests.swift rename to Tests/ASCKitTests/Screenshots/Internal/AggregateTemplateRepositoryTests.swift index ff82a167..1549359b 100644 --- a/Tests/InfrastructureTests/ScreenshotPlans/AggregateTemplateRepositoryTests.swift +++ b/Tests/ASCKitTests/Screenshots/Internal/AggregateTemplateRepositoryTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite("AggregateTemplateRepository") struct AggregateTemplateRepositoryTests { diff --git a/Tests/InfrastructureTests/ScreenshotPlans/AggregateThemeRepositoryTests.swift b/Tests/ASCKitTests/Screenshots/Internal/AggregateThemesTests.swift similarity index 89% rename from Tests/InfrastructureTests/ScreenshotPlans/AggregateThemeRepositoryTests.swift rename to Tests/ASCKitTests/Screenshots/Internal/AggregateThemesTests.swift index 5b19b13a..a8cce676 100644 --- a/Tests/InfrastructureTests/ScreenshotPlans/AggregateThemeRepositoryTests.swift +++ b/Tests/ASCKitTests/Screenshots/Internal/AggregateThemesTests.swift @@ -1,11 +1,10 @@ import Foundation import Mockable import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit -@Suite("AggregateThemeRepository") -struct AggregateThemeRepositoryTests { +@Suite("AggregateThemes") +struct AggregateThemesTests { // MARK: - Helpers @@ -24,13 +23,13 @@ struct AggregateThemeRepositoryTests { } @Test func `listThemes returns empty when no providers registered`() async throws { - let repo = AggregateThemeRepository() + let repo = AggregateThemes() let themes = try await repo.listThemes() #expect(themes.isEmpty) } @Test func `listThemes returns themes from registered provider`() async throws { - let repo = AggregateThemeRepository() + let repo = AggregateThemes() let mockProvider = MockThemeProvider() given(mockProvider).providerId.willReturn("test") given(mockProvider).themes().willReturn([ @@ -46,7 +45,7 @@ struct AggregateThemeRepositoryTests { } @Test func `listThemes aggregates from multiple providers`() async throws { - let repo = AggregateThemeRepository() + let repo = AggregateThemes() let provider1 = MockThemeProvider() given(provider1).providerId.willReturn("blitz") @@ -63,7 +62,7 @@ struct AggregateThemeRepositoryTests { } @Test func `getTheme finds theme by id`() async throws { - let repo = AggregateThemeRepository() + let repo = AggregateThemes() let mockProvider = MockThemeProvider() given(mockProvider).providerId.willReturn("test") given(mockProvider).themes().willReturn([ @@ -77,7 +76,7 @@ struct AggregateThemeRepositoryTests { } @Test func `getTheme returns nil for unknown id`() async throws { - let repo = AggregateThemeRepository() + let repo = AggregateThemes() let mockProvider = MockThemeProvider() given(mockProvider).providerId.willReturn("test") given(mockProvider).themes().willReturn([makeTheme(id: "neon", name: "Neon")]) @@ -90,7 +89,7 @@ struct AggregateThemeRepositoryTests { // MARK: - Compose @Test func `compose delegates to the provider that owns the theme`() async throws { - let repo = AggregateThemeRepository() + let repo = AggregateThemes() let mockProvider = MockThemeProvider() let neonTheme = makeTheme(id: "neon", name: "Neon") given(mockProvider).providerId.willReturn("blitz") @@ -104,7 +103,7 @@ struct AggregateThemeRepositoryTests { } @Test func `compose throws when theme not found`() async throws { - let repo = AggregateThemeRepository() + let repo = AggregateThemes() do { _ = try await repo.compose(themeId: "nonexistent", html: "
", canvasWidth: 1320, canvasHeight: 2868) Issue.record("Expected error") diff --git a/Tests/InfrastructureTests/ScreenshotPlans/FileAppShotsConfigStorageTests.swift b/Tests/ASCKitTests/Screenshots/Internal/FileAppShotsConfigStorageTests.swift similarity index 96% rename from Tests/InfrastructureTests/ScreenshotPlans/FileAppShotsConfigStorageTests.swift rename to Tests/ASCKitTests/Screenshots/Internal/FileAppShotsConfigStorageTests.swift index 5b645f5b..61b64cd0 100644 --- a/Tests/InfrastructureTests/ScreenshotPlans/FileAppShotsConfigStorageTests.swift +++ b/Tests/ASCKitTests/Screenshots/Internal/FileAppShotsConfigStorageTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct FileAppShotsConfigStorageTests { diff --git a/Tests/ASCKitTests/Screenshots/Internal/LocalImagesTests.swift b/Tests/ASCKitTests/Screenshots/Internal/LocalImagesTests.swift new file mode 100644 index 00000000..73b9e7cd --- /dev/null +++ b/Tests/ASCKitTests/Screenshots/Internal/LocalImagesTests.swift @@ -0,0 +1,54 @@ +import Foundation +import Testing +@testable import ASCKit + +@Suite +struct LocalImagesTests { + private func images(_ files: [String: Data]) -> LocalImages { + LocalImages(workingDirectory: "/w", contents: { files[$0] }) + } + + @Test func `should inline an image beside the working directory as a data URL`() { + let html = images(["/w/shot.png": Data([1, 2, 3])]).inline(into: #""#) + + #expect(html == #""#) + } + + @Test func `should look in .asc/app-shots when the image is not beside the working directory`() { + let html = images(["/w/.asc/app-shots/bg.jpg": Data([1, 2, 3])]).inline(into: #""#) + + #expect(html == #""#) + } + + @Test func `should inline an image given by absolute path`() { + let html = images(["/abs/badge.gif": Data([1, 2, 3])]).inline(into: #""#) + + #expect(html == #""#) + } + + @Test func `should read the file behind a web server file URL`() { + let html = images(["/w/shots/a.webp": Data([1, 2, 3])]) + .inline(into: #""#) + + #expect(html == #""#) + } + + @Test func `should leave remote images and data URLs as they are`() { + let html = #""# + + #expect(images([:]).inline(into: html) == html) + } + + @Test func `should leave an image it cannot find as it is`() { + let html = #""# + + #expect(images([:]).inline(into: html) == html) + } + + @Test func `should inline every local image on the page`() { + let html = images(["/w/a.png": Data([1]), "/w/b.png": Data([2])]) + .inline(into: #""#) + + #expect(html == #""#) + } +} diff --git a/Tests/DomainTests/Screenshots/ScreenThemeTests.swift b/Tests/ASCKitTests/Screenshots/ScreenThemeTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/ScreenThemeTests.swift rename to Tests/ASCKitTests/Screenshots/ScreenThemeTests.swift index a60a67ca..e41d075b 100644 --- a/Tests/DomainTests/Screenshots/ScreenThemeTests.swift +++ b/Tests/ASCKitTests/Screenshots/ScreenThemeTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("ScreenTheme") struct ScreenThemeTests { diff --git a/Tests/DomainTests/Screenshots/TemplateApplyTests.swift b/Tests/ASCKitTests/Screenshots/TemplateApplyTests.swift similarity index 97% rename from Tests/DomainTests/Screenshots/TemplateApplyTests.swift rename to Tests/ASCKitTests/Screenshots/TemplateApplyTests.swift index 3fb1e6a2..48c6bd44 100644 --- a/Tests/DomainTests/Screenshots/TemplateApplyTests.swift +++ b/Tests/ASCKitTests/Screenshots/TemplateApplyTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct TemplateApplyTests { diff --git a/Tests/DomainTests/Screenshots/TemplateRenderTests.swift b/Tests/ASCKitTests/Screenshots/TemplateRenderTests.swift similarity index 98% rename from Tests/DomainTests/Screenshots/TemplateRenderTests.swift rename to Tests/ASCKitTests/Screenshots/TemplateRenderTests.swift index f047bb79..83008b1a 100644 --- a/Tests/DomainTests/Screenshots/TemplateRenderTests.swift +++ b/Tests/ASCKitTests/Screenshots/TemplateRenderTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct TemplateRenderTests { diff --git a/Tests/DomainTests/Screenshots/ThemeDesignApplierTests.swift b/Tests/ASCKitTests/Screenshots/ThemeDesignApplierTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/ThemeDesignApplierTests.swift rename to Tests/ASCKitTests/Screenshots/ThemeDesignApplierTests.swift index e5b4ae59..4cbb15b0 100644 --- a/Tests/DomainTests/Screenshots/ThemeDesignApplierTests.swift +++ b/Tests/ASCKitTests/Screenshots/ThemeDesignApplierTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("ThemeDesignApplier") struct ThemeDesignApplierTests { diff --git a/Tests/DomainTests/Screenshots/ThemeDesignTests.swift b/Tests/ASCKitTests/Screenshots/ThemeDesignTests.swift similarity index 99% rename from Tests/DomainTests/Screenshots/ThemeDesignTests.swift rename to Tests/ASCKitTests/Screenshots/ThemeDesignTests.swift index c4050447..a17a2e33 100644 --- a/Tests/DomainTests/Screenshots/ThemeDesignTests.swift +++ b/Tests/ASCKitTests/Screenshots/ThemeDesignTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("ThemeDesign") struct ThemeDesignTests { diff --git a/Tests/DomainTests/Shared/AffordanceRegistryTests.swift b/Tests/ASCKitTests/Shared/AffordanceRegistryTests.swift similarity index 99% rename from Tests/DomainTests/Shared/AffordanceRegistryTests.swift rename to Tests/ASCKitTests/Shared/AffordanceRegistryTests.swift index 4d93f914..a27a3843 100644 --- a/Tests/DomainTests/Shared/AffordanceRegistryTests.swift +++ b/Tests/ASCKitTests/Shared/AffordanceRegistryTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit /// Test-only type to avoid polluting the global AffordanceRegistry for real domain types. private struct StubModel: AffordanceProviding { diff --git a/Tests/DomainTests/Shared/AffordanceTests.swift b/Tests/ASCKitTests/Shared/AffordanceTests.swift similarity index 99% rename from Tests/DomainTests/Shared/AffordanceTests.swift rename to Tests/ASCKitTests/Shared/AffordanceTests.swift index 14d3571c..7fb0b44b 100644 --- a/Tests/DomainTests/Shared/AffordanceTests.swift +++ b/Tests/ASCKitTests/Shared/AffordanceTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct AffordanceTests { diff --git a/Tests/DomainTests/Shared/ImageAssetTests.swift b/Tests/ASCKitTests/Shared/ImageAssetTests.swift similarity index 96% rename from Tests/DomainTests/Shared/ImageAssetTests.swift rename to Tests/ASCKitTests/Shared/ImageAssetTests.swift index ceda350c..4180ea29 100644 --- a/Tests/DomainTests/Shared/ImageAssetTests.swift +++ b/Tests/ASCKitTests/Shared/ImageAssetTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ImageAssetTests { diff --git a/Tests/InfrastructureTests/Client/ClientFactoryTests.swift b/Tests/ASCKitTests/Shared/Internal/ClientFactoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/Client/ClientFactoryTests.swift rename to Tests/ASCKitTests/Shared/Internal/ClientFactoryTests.swift index 4bc9be73..77e9b15a 100644 --- a/Tests/InfrastructureTests/Client/ClientFactoryTests.swift +++ b/Tests/ASCKitTests/Shared/Internal/ClientFactoryTests.swift @@ -3,8 +3,7 @@ import CryptoKit import Foundation import Mockable import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct ClientFactoryTests { diff --git a/Tests/InfrastructureTests/Shared/UploadOperationsExecutorTests.swift b/Tests/ASCKitTests/Shared/Internal/UploadOperationsExecutorTests.swift similarity index 98% rename from Tests/InfrastructureTests/Shared/UploadOperationsExecutorTests.swift rename to Tests/ASCKitTests/Shared/Internal/UploadOperationsExecutorTests.swift index a974168e..4ff4ac3a 100644 --- a/Tests/InfrastructureTests/Shared/UploadOperationsExecutorTests.swift +++ b/Tests/ASCKitTests/Shared/Internal/UploadOperationsExecutorTests.swift @@ -1,7 +1,7 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Infrastructure +@testable import ASCKit @Suite struct UploadOperationsExecutorTests { diff --git a/Tests/DomainTests/Shared/OfferCodeEnvironmentTests.swift b/Tests/ASCKitTests/Shared/OfferCodeEnvironmentTests.swift similarity index 95% rename from Tests/DomainTests/Shared/OfferCodeEnvironmentTests.swift rename to Tests/ASCKitTests/Shared/OfferCodeEnvironmentTests.swift index 43c572ef..7b3b8534 100644 --- a/Tests/DomainTests/Shared/OfferCodeEnvironmentTests.swift +++ b/Tests/ASCKitTests/Shared/OfferCodeEnvironmentTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct OfferCodeEnvironmentTests { diff --git a/Tests/DomainTests/Shared/OfferCodePriceInputTests.swift b/Tests/ASCKitTests/Shared/OfferCodePriceInputTests.swift similarity index 97% rename from Tests/DomainTests/Shared/OfferCodePriceInputTests.swift rename to Tests/ASCKitTests/Shared/OfferCodePriceInputTests.swift index 964acc15..2285840b 100644 --- a/Tests/DomainTests/Shared/OfferCodePriceInputTests.swift +++ b/Tests/ASCKitTests/Shared/OfferCodePriceInputTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct OfferCodePriceInputTests { diff --git a/Tests/DomainTests/Shared/PaginatedResponseTests.swift b/Tests/ASCKitTests/Shared/PaginatedResponseTests.swift similarity index 97% rename from Tests/DomainTests/Shared/PaginatedResponseTests.swift rename to Tests/ASCKitTests/Shared/PaginatedResponseTests.swift index 154b8fe8..623d4b3d 100644 --- a/Tests/DomainTests/Shared/PaginatedResponseTests.swift +++ b/Tests/ASCKitTests/Shared/PaginatedResponseTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct PaginatedResponseTests { diff --git a/Tests/DomainTests/Shared/PresentableTests.swift b/Tests/ASCKitTests/Shared/PresentableTests.swift similarity index 99% rename from Tests/DomainTests/Shared/PresentableTests.swift rename to Tests/ASCKitTests/Shared/PresentableTests.swift index e71d866a..52501115 100644 --- a/Tests/DomainTests/Shared/PresentableTests.swift +++ b/Tests/ASCKitTests/Shared/PresentableTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct PresentableTests { diff --git a/Tests/InfrastructureTests/Simulators/SimctlSimulatorRepositoryTests.swift b/Tests/ASCKitTests/Simulators/Internal/SimctlSimulatorsTests.swift similarity index 84% rename from Tests/InfrastructureTests/Simulators/SimctlSimulatorRepositoryTests.swift rename to Tests/ASCKitTests/Simulators/Internal/SimctlSimulatorsTests.swift index 6f59f3f1..1e662ec5 100644 --- a/Tests/InfrastructureTests/Simulators/SimctlSimulatorRepositoryTests.swift +++ b/Tests/ASCKitTests/Simulators/Internal/SimctlSimulatorsTests.swift @@ -1,9 +1,8 @@ import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite -struct SimctlSimulatorRepositoryTests { +struct SimctlSimulatorsTests { // MARK: - listSimulators @@ -21,7 +20,7 @@ struct SimctlSimulatorRepositoryTests { } } """ - let repo = SimctlSimulatorRepository(shellRunner: StubShellRunner(stdout: json)) + let repo = SimctlSimulators(shellRunner: StubShellRunner(stdout: json)) let sims = try await repo.listSimulators(filter: .available) // Only iOS devices, watchOS filtered out @@ -52,7 +51,7 @@ struct SimctlSimulatorRepositoryTests { } } """ - let repo = SimctlSimulatorRepository(shellRunner: StubShellRunner(stdout: json)) + let repo = SimctlSimulators(shellRunner: StubShellRunner(stdout: json)) let sims = try await repo.listSimulators(filter: .all) #expect(sims.isEmpty) @@ -69,7 +68,7 @@ struct SimctlSimulatorRepositoryTests { } } """ - let repo = SimctlSimulatorRepository(shellRunner: StubShellRunner(stdout: json)) + let repo = SimctlSimulators(shellRunner: StubShellRunner(stdout: json)) let sims = try await repo.listSimulators(filter: .all) #expect(sims.count == 1) @@ -88,7 +87,7 @@ struct SimctlSimulatorRepositoryTests { } } """ - let repo = SimctlSimulatorRepository(shellRunner: StubShellRunner(stdout: json)) + let repo = SimctlSimulators(shellRunner: StubShellRunner(stdout: json)) let sims = try await repo.listSimulators(filter: .all) #expect(sims.map(\.name) == ["Alpha Phone", "Beta Phone", "Zebra Phone"]) @@ -96,7 +95,7 @@ struct SimctlSimulatorRepositoryTests { } @Test func `listSimulators returns empty for invalid json`() async throws { - let repo = SimctlSimulatorRepository(shellRunner: StubShellRunner(stdout: "not json")) + let repo = SimctlSimulators(shellRunner: StubShellRunner(stdout: "not json")) do { _ = try await repo.listSimulators(filter: .all) Issue.record("Expected error") @@ -106,7 +105,7 @@ struct SimctlSimulatorRepositoryTests { } @Test func `listSimulators handles empty json object`() async throws { - let repo = SimctlSimulatorRepository(shellRunner: StubShellRunner(stdout: "{\"devices\":{}}")) + let repo = SimctlSimulators(shellRunner: StubShellRunner(stdout: "{\"devices\":{}}")) let sims = try await repo.listSimulators(filter: .all) #expect(sims.isEmpty) } @@ -116,7 +115,7 @@ struct SimctlSimulatorRepositoryTests { { "devices": { "com.apple.CoreSimulator.SimRuntime.iOS-18-2": [] } } """ let runner = RecordingShellRunner(stdout: json) - let repo = SimctlSimulatorRepository(shellRunner: runner) + let repo = SimctlSimulators(shellRunner: runner) _ = try await repo.listSimulators(filter: .booted) #expect(runner.lastArguments?.contains("booted") == true) @@ -127,7 +126,7 @@ struct SimctlSimulatorRepositoryTests { { "devices": { "com.apple.CoreSimulator.SimRuntime.iOS-18-2": [] } } """ let runner = RecordingShellRunner(stdout: json) - let repo = SimctlSimulatorRepository(shellRunner: runner) + let repo = SimctlSimulators(shellRunner: runner) _ = try await repo.listSimulators(filter: .available) #expect(runner.lastArguments?.contains("available") == true) @@ -137,7 +136,7 @@ struct SimctlSimulatorRepositoryTests { @Test func `bootSimulator calls xcrun simctl boot with udid`() async throws { let runner = RecordingShellRunner(stdout: "") - let repo = SimctlSimulatorRepository(shellRunner: runner) + let repo = SimctlSimulators(shellRunner: runner) try await repo.bootSimulator(udid: "TEST-UDID") #expect(runner.lastCommand == "xcrun") @@ -147,7 +146,7 @@ struct SimctlSimulatorRepositoryTests { @Test func `shutdownSimulator calls xcrun simctl shutdown with udid`() async throws { let runner = RecordingShellRunner(stdout: "") - let repo = SimctlSimulatorRepository(shellRunner: runner) + let repo = SimctlSimulators(shellRunner: runner) try await repo.shutdownSimulator(udid: "TEST-UDID") #expect(runner.lastCommand == "xcrun") @@ -156,7 +155,7 @@ struct SimctlSimulatorRepositoryTests { } @Test func `bootSimulator throws when shell fails`() async throws { - let repo = SimctlSimulatorRepository(shellRunner: StubShellRunner(error: ShellRunnerError.executionFailed(exitCode: 1, stderr: "Already booted"))) + let repo = SimctlSimulators(shellRunner: StubShellRunner(error: ShellRunnerError.executionFailed(exitCode: 1, stderr: "Already booted"))) do { try await repo.bootSimulator(udid: "X") Issue.record("Expected error") diff --git a/Tests/DomainTests/Simulators/SimulatorTests.swift b/Tests/ASCKitTests/Simulators/SimulatorTests.swift similarity index 99% rename from Tests/DomainTests/Simulators/SimulatorTests.swift rename to Tests/ASCKitTests/Simulators/SimulatorTests.swift index eb68a5ff..8d7adc07 100644 --- a/Tests/DomainTests/Simulators/SimulatorTests.swift +++ b/Tests/ASCKitTests/Simulators/SimulatorTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct SimulatorTests { diff --git a/Tests/InfrastructureTests/Skills/FileSkillConfigStorageTests.swift b/Tests/ASCKitTests/Skills/Internal/FileSkillConfigStorageTests.swift similarity index 96% rename from Tests/InfrastructureTests/Skills/FileSkillConfigStorageTests.swift rename to Tests/ASCKitTests/Skills/Internal/FileSkillConfigStorageTests.swift index c935a950..026c35eb 100644 --- a/Tests/InfrastructureTests/Skills/FileSkillConfigStorageTests.swift +++ b/Tests/ASCKitTests/Skills/Internal/FileSkillConfigStorageTests.swift @@ -1,7 +1,6 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite struct FileSkillConfigStorageTests { diff --git a/Tests/InfrastructureTests/Skills/ProcessSkillRepositoryTests.swift b/Tests/ASCKitTests/Skills/Internal/ProcessSkillsTests.swift similarity index 78% rename from Tests/InfrastructureTests/Skills/ProcessSkillRepositoryTests.swift rename to Tests/ASCKitTests/Skills/Internal/ProcessSkillsTests.swift index 80db90b9..0201e00b 100644 --- a/Tests/InfrastructureTests/Skills/ProcessSkillRepositoryTests.swift +++ b/Tests/ASCKitTests/Skills/Internal/ProcessSkillsTests.swift @@ -1,70 +1,69 @@ import Foundation import Testing -@testable import Domain -@testable import Infrastructure +@testable import ASCKit @Suite -struct ProcessSkillRepositoryTests { +struct ProcessSkillsTests { @Test func `check parses updates available from stdout`() async throws { let runner = StubShellRunner(stdout: "2 update(s) available") - let repo = ProcessSkillRepository(runner: runner) + let repo = ProcessSkills(runner: runner) let result = try await repo.check() #expect(result == .updatesAvailable) } @Test func `check parses all skills are up to date`() async throws { let runner = StubShellRunner(stdout: "All skills are up to date") - let repo = ProcessSkillRepository(runner: runner) + let repo = ProcessSkills(runner: runner) let result = try await repo.check() #expect(result == .upToDate) } @Test func `check parses no updates available`() async throws { let runner = StubShellRunner(stdout: "No updates available") - let repo = ProcessSkillRepository(runner: runner) + let repo = ProcessSkills(runner: runner) let result = try await repo.check() #expect(result == .upToDate) } @Test func `check returns unavailable when runner throws`() async throws { let runner = StubShellRunner(error: ShellRunnerError.commandNotFound) - let repo = ProcessSkillRepository(runner: runner) + let repo = ProcessSkills(runner: runner) let result = try await repo.check() #expect(result == .unavailable) } @Test func `check returns up to date for unknown output`() async throws { let runner = StubShellRunner(stdout: "something unexpected") - let repo = ProcessSkillRepository(runner: runner) + let repo = ProcessSkills(runner: runner) let result = try await repo.check() #expect(result == .upToDate) } @Test func `listAvailable returns stdout from runner`() async throws { let runner = StubShellRunner(stdout: "asc-cli\nasc-auth\nasc-testflight") - let repo = ProcessSkillRepository(runner: runner) + let repo = ProcessSkills(runner: runner) let output = try await repo.listAvailable() #expect(output == "asc-cli\nasc-auth\nasc-testflight") } @Test func `install returns stdout from runner`() async throws { let runner = StubShellRunner(stdout: "Installed asc-cli skill") - let repo = ProcessSkillRepository(runner: runner) + let repo = ProcessSkills(runner: runner) let output = try await repo.install(name: "asc-cli") #expect(output == "Installed asc-cli skill") } @Test func `installAll returns stdout from runner`() async throws { let runner = StubShellRunner(stdout: "Installed 5 skills") - let repo = ProcessSkillRepository(runner: runner) + let repo = ProcessSkills(runner: runner) let output = try await repo.installAll() #expect(output == "Installed 5 skills") } @Test func `update returns stdout from runner`() async throws { let runner = StubShellRunner(stdout: "Updated 3 skills") - let repo = ProcessSkillRepository(runner: runner) + let repo = ProcessSkills(runner: runner) let output = try await repo.update() #expect(output == "Updated 3 skills") } diff --git a/Tests/ASCKitTests/Skills/Internal/ShellCommandTests.swift b/Tests/ASCKitTests/Skills/Internal/ShellCommandTests.swift new file mode 100644 index 00000000..255a9310 --- /dev/null +++ b/Tests/ASCKitTests/Skills/Internal/ShellCommandTests.swift @@ -0,0 +1,47 @@ +import Foundation +import Testing +@testable import ASCKit + +@Suite +struct ShellCommandTests { + @Test func `should run the command through env with its arguments`() { + let command = ShellCommand(command: "npx", arguments: ["skills", "list"], environment: nil) + + #expect(command.executable == URL(fileURLWithPath: "/usr/bin/env")) + #expect(command.argv == ["npx", "skills", "list"]) + } + + @Test func `should add the given variables on top of the inherited environment`() { + let command = ShellCommand(command: "npx", arguments: [], environment: ["A": "2", "B": "3"]) + + #expect(command.environment(inheriting: ["PATH": "/bin", "A": "1"]) == ["PATH": "/bin", "A": "2", "B": "3"]) + } + + @Test func `should inherit the environment unchanged when no variables are given`() { + let command = ShellCommand(command: "npx", arguments: [], environment: nil) + + #expect(command.environment(inheriting: ["PATH": "/bin"]) == nil) + } + + @Test func `should answer the trimmed output when the command succeeds`() throws { + let command = ShellCommand(command: "npx", arguments: [], environment: nil) + + let output = try command.output(exitCode: 0, stdout: Data(" installed\n".utf8), stderr: Data()) + + #expect(output == "installed") + } + + @Test func `should fail with the exit code and what it printed to stderr when the command fails`() { + let command = ShellCommand(command: "npx", arguments: [], environment: nil) + + do { + _ = try command.output(exitCode: 2, stdout: Data(), stderr: Data("boom".utf8)) + Issue.record("expected the command to fail") + } catch ShellRunnerError.executionFailed(let exitCode, let stderr) { + #expect(exitCode == 2) + #expect(stderr == "boom") + } catch { + Issue.record("unexpected error \(error)") + } + } +} diff --git a/Tests/InfrastructureTests/Skills/StubShellRunner.swift b/Tests/ASCKitTests/Skills/Internal/StubShellRunner.swift similarity index 93% rename from Tests/InfrastructureTests/Skills/StubShellRunner.swift rename to Tests/ASCKitTests/Skills/Internal/StubShellRunner.swift index 45dd4cdf..1fb43937 100644 --- a/Tests/InfrastructureTests/Skills/StubShellRunner.swift +++ b/Tests/ASCKitTests/Skills/Internal/StubShellRunner.swift @@ -1,5 +1,5 @@ import Foundation -@testable import Infrastructure +@testable import ASCKit struct StubShellRunner: ShellRunner { let stdout: String? diff --git a/Tests/DomainTests/Skills/SkillTests.swift b/Tests/ASCKitTests/Skills/SkillTests.swift similarity index 99% rename from Tests/DomainTests/Skills/SkillTests.swift rename to Tests/ASCKitTests/Skills/SkillTests.swift index 232d378c..7abdb1df 100644 --- a/Tests/DomainTests/Skills/SkillTests.swift +++ b/Tests/ASCKitTests/Skills/SkillTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite("Skill") struct SkillTests { diff --git a/Tests/InfrastructureTests/Submissions/SDKSubmissionRepositoryTests.swift b/Tests/ASCKitTests/Submissions/Internal/SDKSubmissionRepositoryTests.swift similarity index 62% rename from Tests/InfrastructureTests/Submissions/SDKSubmissionRepositoryTests.swift rename to Tests/ASCKitTests/Submissions/Internal/SDKSubmissionRepositoryTests.swift index 2c4b5fb9..524d5fc0 100644 --- a/Tests/InfrastructureTests/Submissions/SDKSubmissionRepositoryTests.swift +++ b/Tests/ASCKitTests/Submissions/Internal/SDKSubmissionRepositoryTests.swift @@ -1,167 +1,11 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKSubmissionRepositoryTests { - @Test func `submitVersion injects appId from version relationship`() async throws { - let stub = SequencedStubAPIClient() - - // Step 1: version response with app relationship - stub.enqueue(AppStoreVersionResponse( - data: AppStoreVersion( - type: .appStoreVersions, - id: "v-1", - attributes: .init(platform: .ios, versionString: "1.0.0"), - relationships: .init( - app: .init(data: .init(type: .apps, id: "app-42")) - ) - ), - links: .init(this: "") - )) - - // Step 2: no existing open submissions - stub.enqueue(ReviewSubmissionsResponse(data: [], links: .init(this: ""))) - - // Step 3: create submission response - stub.enqueue(ReviewSubmissionResponse( - data: ReviewSubmission( - type: .reviewSubmissions, - id: "sub-99", - attributes: .init(state: .waitingForReview) - ), - links: .init(this: "") - )) - - // Step 4: add item response - stub.enqueue(ReviewSubmissionItemResponse( - data: ReviewSubmissionItem( - type: .reviewSubmissionItems, - id: "item-1" - ), - links: .init(this: "") - )) - - // Step 5: patch (submitted) response - stub.enqueue(ReviewSubmissionResponse( - data: ReviewSubmission( - type: .reviewSubmissions, - id: "sub-99", - attributes: .init(state: .waitingForReview) - ), - links: .init(this: "") - )) - - let repo = OpenAPISubmissionRepository(client: stub) - let result = try await repo.submitVersion(versionId: "v-1") - - #expect(result.id == "sub-99") - #expect(result.appId == "app-42") - #expect(result.platform == .iOS) - #expect(result.state == .waitingForReview) - } - - @Test func `submitVersion maps state correctly`() async throws { - let stub = SequencedStubAPIClient() - - stub.enqueue(AppStoreVersionResponse( - data: AppStoreVersion( - type: .appStoreVersions, - id: "v-2", - attributes: .init(platform: .macOs, versionString: "2.0.0"), - relationships: .init( - app: .init(data: .init(type: .apps, id: "app-7")) - ) - ), - links: .init(this: "") - )) - stub.enqueue(ReviewSubmissionsResponse(data: [], links: .init(this: ""))) - stub.enqueue(ReviewSubmissionResponse( - data: ReviewSubmission( - type: .reviewSubmissions, - id: "sub-77", - attributes: .init(state: .inReview) - ), - links: .init(this: "") - )) - stub.enqueue(ReviewSubmissionItemResponse( - data: ReviewSubmissionItem(type: .reviewSubmissionItems, id: "item-2"), - links: .init(this: "") - )) - stub.enqueue(ReviewSubmissionResponse( - data: ReviewSubmission( - type: .reviewSubmissions, - id: "sub-77", - attributes: .init(state: .inReview) - ), - links: .init(this: "") - )) - - let repo = OpenAPISubmissionRepository(client: stub) - let result = try await repo.submitVersion(versionId: "v-2") - - #expect(result.platform == .macOS) - #expect(result.state == .inReview) - #expect(result.isPending == true) - } - - @Test func `should resubmit an open draft that already contains the version`() async throws { - let stub = SequencedStubAPIClient() - - // Step 1: version response - stub.enqueue(AppStoreVersionResponse( - data: AppStoreVersion( - type: .appStoreVersions, - id: "v-3", - attributes: .init(platform: .ios, versionString: "1.0.0"), - relationships: .init( - app: .init(data: .init(type: .apps, id: "app-42")) - ) - ), - links: .init(this: "") - )) - - // Step 2: existing submission with UNRESOLVED_ISSUES - stub.enqueue(ReviewSubmissionsResponse( - data: [ReviewSubmission( - type: .reviewSubmissions, - id: "sub-existing", - attributes: .init(state: .unresolvedIssues) - )], - links: .init(this: "") - )) - - // Step 3: the draft already contains this version, so no item is added - stub.enqueue(ReviewSubmissionItemsResponse( - data: [ReviewSubmissionItem( - type: .reviewSubmissionItems, - id: "item-1", - relationships: .init(appStoreVersion: .init(data: .init(type: .appStoreVersions, id: "v-3"))) - )], - links: .init(this: "") - )) - - // Step 4: patch (resubmit) response — skips create + add item - stub.enqueue(ReviewSubmissionResponse( - data: ReviewSubmission( - type: .reviewSubmissions, - id: "sub-existing", - attributes: .init(state: .waitingForReview) - ), - links: .init(this: "") - )) - - let repo = OpenAPISubmissionRepository(client: stub) - let result = try await repo.submitVersion(versionId: "v-3") - - #expect(result.id == "sub-existing") - #expect(result.appId == "app-42") - #expect(result.state == .waitingForReview) - } - @Test func `listSubmissions maps sdk submissions and injects appId from param`() async throws { let stub = SequencedStubAPIClient() stub.enqueue(ReviewSubmissionsResponse( @@ -361,7 +205,7 @@ struct SDKSubmissionRepositoryTests { let repo = OpenAPISubmissionRepository(client: stub) let submission = try await repo.createSubmission(appId: "app-1", platform: .iOS) - #expect(submission == Domain.ReviewSubmission(id: "draft-1", appId: "app-1", platform: .iOS, state: .readyForReview)) + #expect(submission == ASCKit.ReviewSubmission(id: "draft-1", appId: "app-1", platform: .iOS, state: .readyForReview)) #expect(!stub.requests.contains { $0.method == "POST" }) } @@ -377,14 +221,30 @@ struct SDKSubmissionRepositoryTests { let repo = OpenAPISubmissionRepository(client: stub) let submission = try await repo.createSubmission(appId: "app-1", platform: .iOS) - #expect(submission == Domain.ReviewSubmission(id: "new-1", appId: "app-1", platform: .iOS, state: .readyForReview)) + #expect(submission == ASCKit.ReviewSubmission(id: "new-1", appId: "app-1", platform: .iOS, state: .readyForReview)) let post = stub.requests.first { $0.method == "POST" } #expect(post?.path == "/v1/reviewSubmissions") #expect(post?.body == #"{"data":{"attributes":{"platform":"IOS"},"relationships":{"app":{"data":{"id":"app-1","type":"apps"}}},"type":"reviewSubmissions"}}"#) } + @Test func `should list each reason Apple gave when it refuses to open a draft`() async throws { + let stub = StubAPIClient() + stub.willReturn(ReviewSubmissionsResponse(data: [], links: .init(this: ""))) + stub.errorsByRequest["POST /v1/reviewSubmissions"] = appVersionNotReviewable() + + await #expect { + _ = try await OpenAPISubmissionRepository(client: stub).createSubmission(appId: "app-1", platform: .iOS) + } throws: { error in + String(describing: error) == """ + Apple refused the review submission: This resource cannot be reviewed, please check associated errors to see why. + - A screenshot for one of the following types is required but was not provided: APP_IPAD_PRO_3GEN_129 + - App is not eligible for submission until pricing has been set. + """ + } + } + @Test func `adding each kind of version sends it as the item's relationship`() async throws { - let cases: [(ReviewItemTarget, String, Domain.ReviewSubmissionItemLinkedResource)] = [ + let cases: [(ReviewItemTarget, String, ASCKit.ReviewSubmissionItemLinkedResource)] = [ (.appStoreVersion("v-1"), #""appStoreVersion":{"data":{"id":"v-1","type":"appStoreVersions"}}"#, .appStoreVersion), (.inAppPurchaseVersion("iv-1"), #""inAppPurchaseVersion":{"data":{"id":"iv-1","type":"inAppPurchaseVersions"}}"#, .inAppPurchaseVersion), (.subscriptionVersion("sv-1"), #""subscriptionVersion":{"data":{"id":"sv-1","type":"subscriptionVersions"}}"#, .subscriptionVersion), @@ -404,7 +264,7 @@ struct SDKSubmissionRepositoryTests { #expect(post?.path == "/v1/reviewSubmissionItems") #expect(post?.body?.contains(relationship) == true) #expect(post?.body?.contains(#""reviewSubmission":{"data":{"id":"sub-1","type":"reviewSubmissions"}}"#) == true) - #expect(item == Domain.ReviewSubmissionItem( + #expect(item == ASCKit.ReviewSubmissionItem( id: "item-1", submissionId: "sub-1", state: .readyForReview, linkedResourceId: target.id, linkedResourceType: linkedType )) @@ -435,7 +295,7 @@ struct SDKSubmissionRepositoryTests { let patch = stub.requests.first { $0.method == "PATCH" } #expect(patch?.path == "/v1/reviewSubmissions/sub-1") #expect(patch?.body == #"{"data":{"attributes":{"submitted":true},"id":"sub-1","type":"reviewSubmissions"}}"#) - #expect(submission == Domain.ReviewSubmission(id: "sub-1", appId: "app-1", platform: .iOS, state: .waitingForReview)) + #expect(submission == ASCKit.ReviewSubmission(id: "sub-1", appId: "app-1", platform: .iOS, state: .waitingForReview)) } // MARK: - Apple's reasons for refusing @@ -503,103 +363,4 @@ struct SDKSubmissionRepositoryTests { !(error is ReviewSubmissionError) && String(describing: error).contains("UNEXPECTED_ERROR") } } - - // MARK: - submitVersion with an open draft, and Apple's refusals - - /// Answers every request `submitVersion` makes for version v-1 of app-1. - private func submitVersionStub( - openDrafts: [AppStoreConnect_Swift_SDK.ReviewSubmission] = [], - itemsInDraft: [AppStoreConnect_Swift_SDK.ReviewSubmissionItem] = [] - ) -> StubAPIClient { - let stub = StubAPIClient() - stub.willReturn(AppStoreVersionResponse( - data: AppStoreVersion( - type: .appStoreVersions, id: "v-1", - attributes: .init(platform: .ios, versionString: "1.0.0"), - relationships: .init(app: .init(data: .init(type: .apps, id: "app-1"))) - ), - links: .init(this: "") - )) - stub.willReturn(ReviewSubmissionsResponse(data: openDrafts, links: .init(this: ""))) - stub.willReturn(ReviewSubmissionItemsResponse(data: itemsInDraft, links: .init(this: ""))) - stub.willReturn(ReviewSubmissionItemResponse( - data: ReviewSubmissionItem(type: .reviewSubmissionItems, id: "item-new"), - links: .init(this: "") - )) - stub.willReturn(ReviewSubmissionResponse( - data: ReviewSubmission(type: .reviewSubmissions, id: "sub-1", attributes: .init(state: .waitingForReview)), - links: .init(this: "") - )) - return stub - } - - private var openDraft: AppStoreConnect_Swift_SDK.ReviewSubmission { - ReviewSubmission(type: .reviewSubmissions, id: "sub-1", attributes: .init(state: .readyForReview)) - } - - @Test func `should add the version before submitting when the open draft is empty`() async throws { - let stub = submitVersionStub(openDrafts: [openDraft], itemsInDraft: []) - - let submission = try await OpenAPISubmissionRepository(client: stub).submitVersion(versionId: "v-1") - - #expect(stub.requests.filter { $0.method != "GET" }.map { "\($0.method) \($0.path)" } == [ - "POST /v1/reviewSubmissionItems", - "PATCH /v1/reviewSubmissions/sub-1", - ]) - let addItem = stub.requests.first { $0.method == "POST" } - #expect(addItem?.body == #"{"data":{"relationships":{"appStoreVersion":{"data":{"id":"v-1","type":"appStoreVersions"}},"reviewSubmission":{"data":{"id":"sub-1","type":"reviewSubmissions"}}},"type":"reviewSubmissionItems"}}"#) - #expect(submission.state == .waitingForReview) - } - - @Test func `should submit without adding the version again when the open draft already contains it`() async throws { - let stub = submitVersionStub(openDrafts: [openDraft], itemsInDraft: [ - ReviewSubmissionItem( - type: .reviewSubmissionItems, id: "item-1", - relationships: .init(appStoreVersion: .init(data: .init(type: .appStoreVersions, id: "v-1"))) - ), - ]) - - let submission = try await OpenAPISubmissionRepository(client: stub).submitVersion(versionId: "v-1") - - #expect(stub.requests.filter { $0.method != "GET" }.map { "\($0.method) \($0.path)" } == [ - "PATCH /v1/reviewSubmissions/sub-1", - ]) - #expect(submission.state == .waitingForReview) - } - - @Test func `should add the version when the open draft only contains other items`() async throws { - let stub = submitVersionStub(openDrafts: [openDraft], itemsInDraft: [ - ReviewSubmissionItem( - type: .reviewSubmissionItems, id: "item-1", - relationships: .init(inAppPurchaseVersion: .init(data: .init(type: .inAppPurchaseVersions, id: "iap-v-1"))) - ), - ]) - - _ = try await OpenAPISubmissionRepository(client: stub).submitVersion(versionId: "v-1") - - #expect(stub.requests.filter { $0.method != "GET" }.map { "\($0.method) \($0.path)" } == [ - "POST /v1/reviewSubmissionItems", - "PATCH /v1/reviewSubmissions/sub-1", - ]) - } - - @Test(arguments: [ - "POST /v1/reviewSubmissions", - "POST /v1/reviewSubmissionItems", - "PATCH /v1/reviewSubmissions/sub-1", - ]) - func `should list each reason Apple gave when it refuses to submit a version`(refusedRequest: String) async throws { - let stub = submitVersionStub() - stub.errorsByRequest[refusedRequest] = appVersionNotReviewable() - - await #expect { - _ = try await OpenAPISubmissionRepository(client: stub).submitVersion(versionId: "v-1") - } throws: { error in - String(describing: error) == """ - Apple refused the review submission: This resource cannot be reviewed, please check associated errors to see why. - - A screenshot for one of the following types is required but was not provided: APP_IPAD_PRO_3GEN_129 - - App is not eligible for submission until pricing has been set. - """ - } - } } diff --git a/Tests/DomainTests/Submissions/ReviewItemTargetTests.swift b/Tests/ASCKitTests/Submissions/ReviewItemTargetTests.swift similarity index 96% rename from Tests/DomainTests/Submissions/ReviewItemTargetTests.swift rename to Tests/ASCKitTests/Submissions/ReviewItemTargetTests.swift index 61489d93..ccd36b38 100644 --- a/Tests/DomainTests/Submissions/ReviewItemTargetTests.swift +++ b/Tests/ASCKitTests/Submissions/ReviewItemTargetTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct ReviewItemTargetTests { diff --git a/Tests/DomainTests/Submissions/ReviewSubmissionItemTests.swift b/Tests/ASCKitTests/Submissions/ReviewSubmissionItemTests.swift similarity index 99% rename from Tests/DomainTests/Submissions/ReviewSubmissionItemTests.swift rename to Tests/ASCKitTests/Submissions/ReviewSubmissionItemTests.swift index c71b6ecf..7b8da4a3 100644 --- a/Tests/DomainTests/Submissions/ReviewSubmissionItemTests.swift +++ b/Tests/ASCKitTests/Submissions/ReviewSubmissionItemTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ReviewSubmissionItemTests { diff --git a/Tests/DomainTests/Submissions/ReviewSubmissionTests.swift b/Tests/ASCKitTests/Submissions/ReviewSubmissionTests.swift similarity index 99% rename from Tests/DomainTests/Submissions/ReviewSubmissionTests.swift rename to Tests/ASCKitTests/Submissions/ReviewSubmissionTests.swift index 3aa3535a..9fb7e675 100644 --- a/Tests/DomainTests/Submissions/ReviewSubmissionTests.swift +++ b/Tests/ASCKitTests/Submissions/ReviewSubmissionTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct ReviewSubmissionTests { diff --git a/Tests/DomainTests/Submissions/SubmissionPlannerTests.swift b/Tests/ASCKitTests/Submissions/SubmissionPlannerTests.swift similarity index 99% rename from Tests/DomainTests/Submissions/SubmissionPlannerTests.swift rename to Tests/ASCKitTests/Submissions/SubmissionPlannerTests.swift index bc31fc9b..d69e7cbe 100644 --- a/Tests/DomainTests/Submissions/SubmissionPlannerTests.swift +++ b/Tests/ASCKitTests/Submissions/SubmissionPlannerTests.swift @@ -1,7 +1,7 @@ import Foundation import Mockable import Testing -@testable import Domain +@testable import ASCKit @Suite struct SubmissionPlannerTests { diff --git a/Tests/InfrastructureTests/Territories/SDKTerritoryRepositoryTests.swift b/Tests/ASCKitTests/Territories/Internal/SDKTerritoryRepositoryTests.swift similarity index 96% rename from Tests/InfrastructureTests/Territories/SDKTerritoryRepositoryTests.swift rename to Tests/ASCKitTests/Territories/Internal/SDKTerritoryRepositoryTests.swift index 23930aed..0f943ade 100644 --- a/Tests/InfrastructureTests/Territories/SDKTerritoryRepositoryTests.swift +++ b/Tests/ASCKitTests/Territories/Internal/SDKTerritoryRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKTerritoryRepositoryTests { diff --git a/Tests/DomainTests/Territories/TerritoryTests.swift b/Tests/ASCKitTests/Territories/TerritoryTests.swift similarity index 97% rename from Tests/DomainTests/Territories/TerritoryTests.swift rename to Tests/ASCKitTests/Territories/TerritoryTests.swift index 50871368..a2ac26f3 100644 --- a/Tests/DomainTests/Territories/TerritoryTests.swift +++ b/Tests/ASCKitTests/Territories/TerritoryTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct TerritoryTests { diff --git a/Tests/DomainTests/TestHelpers/MockRepositoryFactory.swift b/Tests/ASCKitTests/TestHelpers/MockRepositoryFactory.swift similarity index 99% rename from Tests/DomainTests/TestHelpers/MockRepositoryFactory.swift rename to Tests/ASCKitTests/TestHelpers/MockRepositoryFactory.swift index c2ba912a..8d91783e 100644 --- a/Tests/DomainTests/TestHelpers/MockRepositoryFactory.swift +++ b/Tests/ASCKitTests/TestHelpers/MockRepositoryFactory.swift @@ -1,6 +1,6 @@ import Foundation import Mockable -@testable import Domain +@testable import ASCKit struct MockRepositoryFactory { diff --git a/Tests/InfrastructureTests/TestHelpers/SequencedStubAPIClient.swift b/Tests/ASCKitTests/TestHelpers/SequencedStubAPIClient.swift similarity index 95% rename from Tests/InfrastructureTests/TestHelpers/SequencedStubAPIClient.swift rename to Tests/ASCKitTests/TestHelpers/SequencedStubAPIClient.swift index cd292487..3765722f 100644 --- a/Tests/InfrastructureTests/TestHelpers/SequencedStubAPIClient.swift +++ b/Tests/ASCKitTests/TestHelpers/SequencedStubAPIClient.swift @@ -1,5 +1,5 @@ @preconcurrency import AppStoreConnect_Swift_SDK -@testable import Infrastructure +@testable import ASCKit final class SequencedStubAPIClient: APIClient, @unchecked Sendable { private var queue: [Any] = [] diff --git a/Tests/InfrastructureTests/TestHelpers/SequencedStubHTTPClient.swift b/Tests/ASCKitTests/TestHelpers/SequencedStubHTTPClient.swift similarity index 97% rename from Tests/InfrastructureTests/TestHelpers/SequencedStubHTTPClient.swift rename to Tests/ASCKitTests/TestHelpers/SequencedStubHTTPClient.swift index b3c6f6d3..a353f543 100644 --- a/Tests/InfrastructureTests/TestHelpers/SequencedStubHTTPClient.swift +++ b/Tests/ASCKitTests/TestHelpers/SequencedStubHTTPClient.swift @@ -1,5 +1,5 @@ import Foundation -@testable import Infrastructure +@testable import ASCKit final class SequencedStubHTTPClient: HTTPPerforming, @unchecked Sendable { private var queue: [Result<(Data, URLResponse), Error>] = [] diff --git a/Tests/InfrastructureTests/TestHelpers/StubAPIClient.swift b/Tests/ASCKitTests/TestHelpers/StubAPIClient.swift similarity index 99% rename from Tests/InfrastructureTests/TestHelpers/StubAPIClient.swift rename to Tests/ASCKitTests/TestHelpers/StubAPIClient.swift index abc2b76d..1f2e62a4 100644 --- a/Tests/InfrastructureTests/TestHelpers/StubAPIClient.swift +++ b/Tests/ASCKitTests/TestHelpers/StubAPIClient.swift @@ -1,6 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Foundation -@testable import Infrastructure +@testable import ASCKit /// Throwing error used by `StubAPIClient` when no stub matches the requested response type. /// Adapters that tolerate ASC 404s (like `getAvailability` for new IAPs) can be tested by diff --git a/Tests/InfrastructureTests/TestHelpers/StubHTTPClient.swift b/Tests/ASCKitTests/TestHelpers/StubHTTPClient.swift similarity index 92% rename from Tests/InfrastructureTests/TestHelpers/StubHTTPClient.swift rename to Tests/ASCKitTests/TestHelpers/StubHTTPClient.swift index fb71a6f4..e895fec3 100644 --- a/Tests/InfrastructureTests/TestHelpers/StubHTTPClient.swift +++ b/Tests/ASCKitTests/TestHelpers/StubHTTPClient.swift @@ -1,5 +1,5 @@ import Foundation -@testable import Infrastructure +@testable import ASCKit final class StubHTTPClient: HTTPPerforming, @unchecked Sendable { var response: (Data, URLResponse)? diff --git a/Tests/InfrastructureTests/TestHelpers/UploadFixtures.swift b/Tests/ASCKitTests/TestHelpers/UploadFixtures.swift similarity index 100% rename from Tests/InfrastructureTests/TestHelpers/UploadFixtures.swift rename to Tests/ASCKitTests/TestHelpers/UploadFixtures.swift diff --git a/Tests/InfrastructureTests/Users/SDKUserRepositoryTests.swift b/Tests/ASCKitTests/Users/Internal/SDKUserRepositoryTests.swift similarity index 99% rename from Tests/InfrastructureTests/Users/SDKUserRepositoryTests.swift rename to Tests/ASCKitTests/Users/Internal/SDKUserRepositoryTests.swift index f33f7cde..a09f0478 100644 --- a/Tests/InfrastructureTests/Users/SDKUserRepositoryTests.swift +++ b/Tests/ASCKitTests/Users/Internal/SDKUserRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKUserRepositoryTests { diff --git a/Tests/DomainTests/Users/UserRoleTests.swift b/Tests/ASCKitTests/Users/UserRoleTests.swift similarity index 99% rename from Tests/DomainTests/Users/UserRoleTests.swift rename to Tests/ASCKitTests/Users/UserRoleTests.swift index 8ad23701..3d51ebdd 100644 --- a/Tests/DomainTests/Users/UserRoleTests.swift +++ b/Tests/ASCKitTests/Users/UserRoleTests.swift @@ -1,5 +1,5 @@ import Testing -@testable import Domain +@testable import ASCKit @Suite struct UserRoleTests { diff --git a/Tests/InfrastructureTests/XcodeCloud/SDKXcodeCloudBuildRunRepositoryTests.swift b/Tests/ASCKitTests/XcodeCloud/Internal/SDKXcodeCloudBuildRunRepositoryTests.swift similarity index 98% rename from Tests/InfrastructureTests/XcodeCloud/SDKXcodeCloudBuildRunRepositoryTests.swift rename to Tests/ASCKitTests/XcodeCloud/Internal/SDKXcodeCloudBuildRunRepositoryTests.swift index 82a8321b..c8729c90 100644 --- a/Tests/InfrastructureTests/XcodeCloud/SDKXcodeCloudBuildRunRepositoryTests.swift +++ b/Tests/ASCKitTests/XcodeCloud/Internal/SDKXcodeCloudBuildRunRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKXcodeCloudBuildRunRepositoryTests { diff --git a/Tests/InfrastructureTests/XcodeCloud/SDKXcodeCloudProductRepositoryTests.swift b/Tests/ASCKitTests/XcodeCloud/Internal/SDKXcodeCloudProductRepositoryTests.swift similarity index 97% rename from Tests/InfrastructureTests/XcodeCloud/SDKXcodeCloudProductRepositoryTests.swift rename to Tests/ASCKitTests/XcodeCloud/Internal/SDKXcodeCloudProductRepositoryTests.swift index 87b4a35e..e097cd4f 100644 --- a/Tests/InfrastructureTests/XcodeCloud/SDKXcodeCloudProductRepositoryTests.swift +++ b/Tests/ASCKitTests/XcodeCloud/Internal/SDKXcodeCloudProductRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKXcodeCloudProductRepositoryTests { diff --git a/Tests/InfrastructureTests/XcodeCloud/SDKXcodeCloudWorkflowRepositoryTests.swift b/Tests/ASCKitTests/XcodeCloud/Internal/SDKXcodeCloudWorkflowRepositoryTests.swift similarity index 97% rename from Tests/InfrastructureTests/XcodeCloud/SDKXcodeCloudWorkflowRepositoryTests.swift rename to Tests/ASCKitTests/XcodeCloud/Internal/SDKXcodeCloudWorkflowRepositoryTests.swift index e311e127..5ad42ad5 100644 --- a/Tests/InfrastructureTests/XcodeCloud/SDKXcodeCloudWorkflowRepositoryTests.swift +++ b/Tests/ASCKitTests/XcodeCloud/Internal/SDKXcodeCloudWorkflowRepositoryTests.swift @@ -1,7 +1,6 @@ @preconcurrency import AppStoreConnect_Swift_SDK import Testing -@testable import Infrastructure -@testable import Domain +@testable import ASCKit @Suite struct SDKXcodeCloudWorkflowRepositoryTests { diff --git a/Tests/DomainTests/XcodeCloud/XcodeCloudBuildRunTests.swift b/Tests/ASCKitTests/XcodeCloud/XcodeCloudBuildRunTests.swift similarity index 99% rename from Tests/DomainTests/XcodeCloud/XcodeCloudBuildRunTests.swift rename to Tests/ASCKitTests/XcodeCloud/XcodeCloudBuildRunTests.swift index 07e55ff7..f620f514 100644 --- a/Tests/DomainTests/XcodeCloud/XcodeCloudBuildRunTests.swift +++ b/Tests/ASCKitTests/XcodeCloud/XcodeCloudBuildRunTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct XcodeCloudBuildRunTests { diff --git a/Tests/DomainTests/XcodeCloud/XcodeCloudProductTests.swift b/Tests/ASCKitTests/XcodeCloud/XcodeCloudProductTests.swift similarity index 98% rename from Tests/DomainTests/XcodeCloud/XcodeCloudProductTests.swift rename to Tests/ASCKitTests/XcodeCloud/XcodeCloudProductTests.swift index cdb55392..12a89df2 100644 --- a/Tests/DomainTests/XcodeCloud/XcodeCloudProductTests.swift +++ b/Tests/ASCKitTests/XcodeCloud/XcodeCloudProductTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct XcodeCloudProductTests { diff --git a/Tests/DomainTests/XcodeCloud/XcodeCloudWorkflowTests.swift b/Tests/ASCKitTests/XcodeCloud/XcodeCloudWorkflowTests.swift similarity index 99% rename from Tests/DomainTests/XcodeCloud/XcodeCloudWorkflowTests.swift rename to Tests/ASCKitTests/XcodeCloud/XcodeCloudWorkflowTests.swift index d3de946d..b5ada40e 100644 --- a/Tests/DomainTests/XcodeCloud/XcodeCloudWorkflowTests.swift +++ b/Tests/ASCKitTests/XcodeCloud/XcodeCloudWorkflowTests.swift @@ -1,6 +1,6 @@ import Foundation import Testing -@testable import Domain +@testable import ASCKit @Suite struct XcodeCloudWorkflowTests { diff --git a/apps/asc-web/command-center/js/presentation/pages/submissions.js b/apps/asc-web/command-center/js/presentation/pages/submissions.js index c84bbbbc..7f635917 100644 --- a/apps/asc-web/command-center/js/presentation/pages/submissions.js +++ b/apps/asc-web/command-center/js/presentation/pages/submissions.js @@ -64,7 +64,13 @@ async function checkReadiness() { async function submitForReview() { const vid = document.getElementById('submitVersionId')?.value || 'v-ps-002'; showToast('Submitting...', 'info'); - await DataProvider.fetch(`versions submit --version-id ${vid}`); + const submission = await DataProvider.fetch(`versions submit --version-id ${vid}`); + // DataProvider answers null when the command fails (e.g. the version can't be + // edited, or Apple refused it); the reason is already in the command log. + if (!submission) { + showToast('Not submitted for review — see the command log for why.', 'error'); + return; + } showToast('Submitted for App Store Review!', 'success'); } diff --git a/codecov.yml b/codecov.yml index a45ce28a..0815ba14 100644 --- a/codecov.yml +++ b/codecov.yml @@ -16,12 +16,17 @@ comment: ignore: - "Tests/**/*" + # The bare outside call — Process, URLSession, WebKit — ≤100 lines, no decisions. + # Its decisions live beside it in Internal/ and are unit-tested. + # (docs/features/concept-folders/design.md) + - "Sources/**/Internal/System/**" + # TUI — terminal UI framework, not unit-testable - "Sources/ASCCommand/Commands/TUI/**/*" # Composition roots — wire real SDK clients, not unit-testable - "Sources/ASCCommand/ClientProvider.swift" - - "Sources/Infrastructure/Client/ClientFactory.swift" + - "Sources/ASCKit/Shared/Internal/ClientFactory.swift" # Entry points (minimal logic, hard to unit test) - "Sources/ASCCommand/ASC.swift" @@ -35,26 +40,8 @@ ignore: # Web server runtime — Hummingbird server, certs, dylib loading - "Sources/ASCCommand/Commands/Web/**/*" - - "Sources/Infrastructure/Web/**/*" - - # Iris — real browser cookie extraction and HTTP calls, not unit-testable - - "Sources/Infrastructure/Iris/BrowserIrisCookieProvider.swift" - - "Sources/Infrastructure/Iris/IrisClient.swift" - - # Iris auth — drives Apple SRP login + idmsa.apple.com HTTP, third-party-interactive - - "Sources/Infrastructure/Iris/Auth/**" - - # Iris private app-bundle API — Apple iris HTTP adapter, third-party-interactive - - "Sources/Infrastructure/Iris/AppBundles/**" - - # WebKit HTML renderer — WKWebView + AppKit GUI snapshot, not unit-testable - - "Sources/Infrastructure/ScreenshotPlans/WebKitHTMLRenderer.swift" - - # Shell runner — spawns real subprocesses, not unit-testable - - "Sources/Infrastructure/Skills/ShellRunner.swift" + - "Sources/ASCKit/Web/**/*" - # Plugin marketplace — wraps PluginLoader (filesystem) + URLSession download + unzip - - "Sources/Infrastructure/Plugins/PluginMarketRepository.swift" # Simulator stream — HTTP server, subprocess management, AXe shell integration - "Sources/Infrastructure/Simulators/DeviceStreamServer.swift" diff --git a/docs/design.md b/docs/design.md index 032c9fc1..e4879760 100644 --- a/docs/design.md +++ b/docs/design.md @@ -127,48 +127,24 @@ extension AppStoreVersion: AffordanceProviding { ``` Sources/ -├── Domain/ # Pure business logic, protocols, rich models (zero deps except Mockable) -├── Infrastructure/ # Implementations: API client, auth provider -└── ASCCommand/ # CLI executable + TUI: argument parsing, output formatting, interactive UI +├── ASCKit// # public face: rich models, state enums, affordances, @Mockable repositories (zero I/O) +│ └── Internal/ # implementations: SDK adapters (appstoreconnect-swift-sdk), DTO mapping, auth providers +│ └── System/ # only the bare outside call, ≤100 lines +└── ASCCommand/ # CLI executable + TUI: argument parsing, output formatting, interactive UI ``` -Dependency flow: `ASCCommand -> Infrastructure -> Domain` +Import flow: `ASCCommand -> ASCKit`. One folder per App Store Connect concept +(`ASCKit/Apps/Builds/`, `ASCKit/Auth/`, …), each with its public face at the +top and its implementations in `Internal/`. The layout and its rules: +[concept-folders design](features/concept-folders/design.md). -### Domain Layer +**Key model design rules:** -Pure value types and `@Mockable` protocols. No networking, no frameworks. - -| Directory | Contents | -|-----------|----------| -| `Apps/` | `App`, `AppStoreVersion` (+ `AppStorePlatform`, `AppStoreVersionState`), `AppRepository` protocol | -| `Builds/` | `Build` model (version, state, expired), `BuildRepository` protocol | -| `TestFlight/` | `BetaGroup`, `BetaTester` models, `TestFlightRepository` protocol | -| `Screenshots/` | `AppStoreVersionLocalization`, `AppScreenshotSet`, `AppScreenshot`, `ScreenshotDisplayType` (32 display types), `ScreenshotRepository` protocol | -| `Auth/` | `AuthCredentials` value object, `AuthProvider` protocol, `AuthError` enum | -| `Shared/` | `PaginatedResponse`, `OutputFormat` enum, `APIError` | - -**Key domain design rules:** - -- Every model carries its **parent ID** (e.g. `AppStoreVersion.appId`, `AppScreenshot.setId`) +- Every model carries its **parent ID** (e.g. `AppStoreVersion.appId`, `AppScreenshot.setId`). The App Store Connect API does not include parent IDs in response bodies, so the `Internal/` mappers inject them from the request parameter. - State enums expose **semantic booleans** (`isLive`, `isEditable`, `isPending`, `isComplete`) - All models are `Sendable`, `Equatable`, `Codable` — the JSON encoding IS the public schema -### Infrastructure Layer - -Implements Domain protocols using [appstoreconnect-swift-sdk](https://github.com/AvdLee/appstoreconnect-swift-sdk). - -| File | Role | -|------|------| -| `Auth/EnvironmentAuthProvider.swift` | Resolves credentials from environment variables | -| `Apps/OpenAPIAppRepository.swift` | `AppRepository` — injects `appId` into each mapped `AppStoreVersion` | -| `Builds/OpenAPIBuildRepository.swift` | `BuildRepository` implementation | -| `TestFlight/OpenAPITestFlightRepository.swift` | `TestFlightRepository` implementation | -| `Screenshots/OpenAPIScreenshotRepository.swift` | `ScreenshotRepository` — injects parent IDs at each level | -| `Client/ClientFactory.swift` | Wires authenticated client from `AuthProvider` | - -Mappers always inject the parent ID from the request parameter into the response models, since the App Store Connect API does not include parent IDs in response bodies. - -### ASCCommand Layer (CLI + TUI) +### ASCCommand (CLI + TUI) #### CLI Commands @@ -196,7 +172,7 @@ Key files: #### TUI Mode (`asc tui`) -Interactive terminal UI built with [TauTUI](https://github.com/steipete/TauTUI). Purely a presentation layer — reuses the same Domain protocols and Infrastructure implementations as the CLI. +Interactive terminal UI built with [TauTUI](https://github.com/steipete/TauTUI). Purely a presentation layer — reuses the same `ASCKit` repositories as the CLI. Navigation follows the real App Store Connect resource hierarchy: @@ -220,17 +196,9 @@ Chicago School TDD — state-based, not interaction-based. Tests verify what dom ``` Tests/ -├── DomainTests/ -│ ├── Apps/ # AppTests, AppStoreVersionTests, AppStoreVersionStateTests, AppRepositoryTests -│ ├── Builds/ # BuildTests -│ ├── Auth/ # AuthCredentialsTests -│ ├── Shared/ # PaginatedResponseTests -│ ├── Screenshots/ # ScreenshotDisplayTypeTests, AppScreenshotSetTests, AppScreenshotTests, ScreenshotRepositoryTests +├── ASCKitTests/ # mirrors Sources/ASCKit/ folder for folder — / and /Internal/ │ └── TestHelpers/ # MockRepositoryFactory -├── InfrastructureTests/ -│ └── Auth/ # EnvironmentAuthProviderTests -└── ASCCommandTests/ - └── OutputFormatterTests +└── ASCCommandTests/ # commands and REST routes, asserting the full output ``` Test naming: backtick style (`func \`version is live when state is readyForSale\`()`). Mocking: `@Mockable` + `given().willReturn()`. diff --git a/docs/features/app-shots-themes/authoring.md b/docs/features/app-shots-themes/authoring.md index dc38721d..3d049b87 100644 --- a/docs/features/app-shots-themes/authoring.md +++ b/docs/features/app-shots-themes/authoring.md @@ -44,10 +44,10 @@ struct MyThemeProvider: ThemeProvider { } // Register at plugin startup: -await AggregateThemeRepository.shared.register(provider: MyThemeProvider()) +await AggregateThemes.shared.register(provider: MyThemeProvider()) ``` -`AggregateThemeRepository` finds which provider owns the requested theme and delegates `compose()` / `design()` to it. +`AggregateThemes` finds which provider owns the requested theme and delegates `compose()` / `design()` to it. For an example of the prompt `buildContext()` produces, for a "Space" theme: diff --git a/docs/features/command-center-react/design.md b/docs/features/command-center-react/design.md index b21fc65a..89f36e12 100644 --- a/docs/features/command-center-react/design.md +++ b/docs/features/command-center-react/design.md @@ -1327,7 +1327,7 @@ Progressive migration — React app runs alongside the existing vanilla JS durin ### What stays unchanged - `apps/asc-web/console/` — unchanged (separate app) -- `Sources/Infrastructure/Web/` — unchanged (same REST API) +- `Sources/ASCKit/Web/` — unchanged (same REST API) - `Sources/ASCCommand/Commands/Web/` — unchanged (same controllers) - `Sources/ASCPlugin/` — unchanged (same plugin loading, manifest format) diff --git a/docs/features/concept-folders/design.md b/docs/features/concept-folders/design.md new file mode 100644 index 00000000..9ce3550a --- /dev/null +++ b/docs/features/concept-folders/design.md @@ -0,0 +1,144 @@ +--- +description: The source layout reworked from layers (Domain/, Infrastructure/) to concept folders — one ASCKit module where each App Store Connect concept holds its public face at the top, its implementations in Internal/, and the bare outside call in Internal/System/. Evidence from today's code, the target tree, the rules and their owners, and the refactor as one-PR steps. +--- + +# Concept folders, not layers + +**Status: BUILT** — steps 1–5: one `ASCKit` module in concept folders; docs and skills follow; one composition root, held by a test; every adapter's decisions tested with only the bare call in `Internal/System/`; `Repository` for CRUD, role nouns for what runs outside asc-cli, workflows over aggregates on the model. asc-cli is split by layer: `Sources/Domain/` +and `Sources/Infrastructure/` are two modules that mirror each other folder +for folder. Every concept therefore lives in two places, and every change to +one touches both trees. The goal, stated as a test: + +> **A concept is one folder.** Adding or changing a resource (a model, its +> repository, its SDK adapter, its tests) touches `Sources/ASCKit//` +> and `Tests/ASCKitTests//` and nothing else below the way in. + +| For | Read | +|---|---| +| why the CLI is built this way (CAEOAS, parent ids) | [docs/design.md](../../design.md) | +| how the REST server is wired | [web-server-architecture](../web-server-architecture/design.md) | +| the pattern this follows | `.claude/skills/app-implement-feature/SKILL.md` | + +## 1 · What's wrong today (measured on `main`, f75d42821) + +| Cost | Evidence | What it costs a change | +|---|---|---| +| **A concept lives in two trees** | `Domain/` 269 files and `Infrastructure/` 107 files mirror each other: `Domain/Apps/Builds/` beside `Infrastructure/Apps/Builds/`, 17 concept folders each side | one feature opens two folder trees and two test targets (`DomainTests`, `InfrastructureTests`) | +| **The two trees already disagree** | `Domain/Screenshots/` is implemented by `Infrastructure/ScreenshotPlans/`; `Infrastructure/Client/`, `Web/` and `Iris/Auth/` have no Domain twin | finding an implementation means knowing a second name | +| **The module split is paid for by hand** | 613 `Domain.X` qualifiers in 69 files, to tell a Domain type from the SDK type of the same name (`Domain.Territory` vs the SDK's `Territory`) | every new adapter repeats the qualifier dance | +| **Implementations leak to the way in** | `ASCCommand` imports `Infrastructure` in 80 files; outside `ClientProvider`, 14 files name 12 implementation types (22 uses) — `FileAuthStorage()` in 10 auth and report commands, and `RESTRoutes` builds its own `CompositeAuthProvider`, `ClientFactory` and five more | swapping an implementation (keychain auth storage, another renderer) edits every command that names it | +| **The outside call is mixed with decisions** | the SDK adapters are already split right: they depend on the narrow `APIClient` role, whose real implementation is the SDK's own `APIProvider`, and 472 tests drive them through `StubAPIClient`. The rest are not: seven adapters (`ShellRunner`, `IrisClient`, `WebKitHTMLRenderer`, `BrowserIrisCookieProvider`, `IrisSDKAppBundleRepository`, `IrisSDKSignIn`, `MarketplacePlugins`, ~860 lines) hold their decisions beside a `Process`, `URLSession`, WebKit or cookie call, and `codecov.yml` skips each by file path | their decisions — argv, environment, status → error, parsing — have no test | + +## 2 · The shape — outside to inside + +``` + asc asc web-server (REST + _links) asc tui + │ │ │ + └────────────────────────────┴──────────────────────────────┘ + │ parse, call one concept, render + ▼ + ASCCommand/ THE WAY IN — commands, output formatting, the TUI, the composition root (ClientProvider) + │ imports the public face only + ▼ + ASCKit// WHAT IT IS — models, state enums with semantic booleans, affordances, + @Mockable repositories; the CLI and REST both derive from these + │ + ASCKit//Internal/ HOW IT WORKS — SDK adapters, DTO mapping, file storage + │ + ASCKit//Internal/System/ THE BARE CALL — the SDK request, URLSession, WebKit, SRP; ≤100 lines + ▼ + App Store Connect API · iris · the file system +``` + +``` +Sources/ +├── ASCCommand/ THE WAY IN (unchanged) +├── ASCPlugin/ the plugin SDK third parties link (unchanged) +└── ASCKit/ ONE module, one folder per App Store Connect concept + ├── Shared/ the kernel: Affordance, APIError, OutputFormat, pagination, RESTPathResolver + │ └── Internal/ APIClient, ClientFactory, HTTPPerforming, SDKFilter, uploads + ├── Apps/ + │ ├── App.swift AppRepository.swift App+RESTRoutes.swift public face + │ ├── Internal/OpenAPIAppRepository.swift implementation + │ ├── Builds/ + │ │ ├── Build.swift BuildRepository.swift … public face + │ │ └── Internal/SDKBuildRepository.swift … implementation + │ ├── Versions/ TestFlight/ InAppPurchases/ Subscriptions/ … (same shape, nested as today) + ├── Auth/ Internal/ (FileAuthProvider, EnvironmentAuthProvider, CompositeAuthProvider) + ├── Iris/ Internal/ Internal/Auth/ Internal/Auth/SRP/ + ├── Screenshots/ Internal/ (was Infrastructure/ScreenshotPlans/) + ├── Web/ the REST server (ASCWebServer, CORS, routes) + └── CodeSigning/ GameCenter/ Plugins/ Projects/ Reports/ Simulators/ + Skills/ Submissions/ Territories/ Users/ XcodeCloud/ AppWall/ +Tests/ +├── ASCKitTests/ mirrors Sources/ASCKit/ folder for folder (was DomainTests + InfrastructureTests) +└── ASCCommandTests/ unchanged +``` + +| Part | Holds | Access | Tested how | +|---|---|---|---| +| `/` | models, state enums, affordances, `@Mockable` repositories, `+RESTRoutes` | `public` | 100%, state-based | +| `/Internal/` | the SDK adapters, DTO mappers, file storage — every decision about the outside | `public` only where `ASCCommand`'s composition root builds it; otherwise `internal` | via `MockAPIClient` / the role's mock | +| `/Internal/System/` | the irreducible call: the SDK request, `URLSession`, `WebKit`, SRP | `internal` | integration only; the one folder coverage leaves out | +| `ASCCommand/` | parse, call, render; the composition root | — | command tests assert the full output | + +## 3 · The rules, each with one owner + +| Rule | Owner — and how it's checked | +|---|---| +| **A concept is one folder**: its face, its `Internal/`, its tests | the tree (§2); no `Domain/` or `Infrastructure/` folder exists | +| **Imports flow inward**: `ASCCommand → ASCKit`; a concept may use another's public face, never its `Internal/` | the module graph; a grep for `/Internal/` type names outside their concept | +| **Only the composition root names an `Internal/` type** | `ASCCommand/ClientProvider.swift`; `CompositionRootTests` fails, naming the file and type, when any other `ASCCommand` file names one | +| **The bare call is ≤100 lines with no decisions** | `Internal/System/`; a decision found there moves up into `Internal/` with a test | +| **Every model carries its parent id; affordances are state-aware; CLI and REST ship together** | unchanged — [CLAUDE.md](../../../CLAUDE.md) still owns these | + +## 4 · Adding a resource, under this design + +| Step | Touches | +|---|---| +| the model, its repository, its affordances | `ASCKit//.swift` (+ test beside it in `ASCKitTests//`) | +| the SDK adapter | `ASCKit//Internal/SDKRepository.swift` (+ test) | +| wiring | one factory in `ClientProvider` | +| the command and the route | `ASCCommand/Commands//`, `/+RESTRoutes.swift` | + +Contrast with today: the same resource is split over `Domain/`, `Infrastructure/`, +`DomainTests/` and `InfrastructureTests/`. + +## 5 · The refactor, step by step + +Each step is one PR: green (`swift test`, `make check-docs`), no behaviour a +user sees changed. A pure move adds no behaviour, so the existing tests are its +safety net; any step that moves a rule writes its test first. + +| # | Step | Today | Change | Test first | +|---|---|---|---|---| +| 0 | **this doc** | — | the target tree and rules | — | +| 1 | **one module, concept folders** ✓ | `Domain` + `Infrastructure` targets, `DomainTests` + `InfrastructureTests` | `git mv` into `Sources/ASCKit//` and `/Internal/`; `ScreenshotPlans` → `Screenshots/Internal/`; `Client` + infra `Shared` → `Shared/Internal/`; one `ASCKit` target, one `ASCKitTests`; `import Domain`/`Infrastructure` → `import ASCKit`; `Domain.X` → `ASCKit.X`. Library users and `examples/blitz-screenshots` change two imports to one (CHANGELOG line, `docs/library.md`) | — (move only; 787+ tests stay green) | +| 2 | **docs and skills follow** ✓ | `CLAUDE.md`, `docs/design.md`, `implement-feature` / `fix-bug` / `improvement` skills describe `Domain → Infrastructure` (16 files) | describe concept folders; link this doc | — | +| 3 | **one composition root** ✓ | 22 uses of 12 `Internal/` types in 14 `ASCCommand` files outside `ClientProvider`; `RESTRoutes` wires its own `ClientFactory` | `ClientProvider` gains `makeAuthStorage`, `makeEnvironmentAuthProvider`, `makeXcodeBuildRunner`, `makeProjectConfigStorage`; commands and `RESTRoutes` ask it for the public protocol | "should build every concept's Internal implementation only in the composition root" | +| 4 | **`Internal/System/` per adapter** ✓ (one commit each) | seven untested adapters mix decisions with I/O; `codecov.yml` lists each file | each adapter's decisions become a tested value or orchestrator in `Internal/`; only the call stays, ≤100 lines, in `Internal/System/`; the per-file ignores become one `**/Internal/System/**` rule. The SDK adapters stay as they are | per adapter, its decisions: e.g. "should add the given variables on top of the inherited environment" | +| 5 | **names for roles** ✓ | 75 `XxxRepository` protocols; some ran something outside asc-cli, and one (`SubmissionRepository.submitVersion`) held a workflow over aggregates | `XxxRepository` stays for the 68 that are CRUD — a state change such as submit is an update. The 7 that run something outside asc-cli take role nouns: `IrisSignIn`, `Reports`, `AppWall`, `Simulators`, `Skills`, `Plugins`, `Themes`. The workflow moves to the model: `AppStoreVersion.submitForReview(to:)` (refuses a version that can't be edited, by the same `isEditable` as its affordance), built from the repository's primitives like `SubmissionPlan.submit(repo:)`. `XxxProvider`s stay | "should refuse to send a version to review when it can no longer be edited"; the rest is a rename, 2,958 → 2,961 tests | + +Step 1 removes most of §1's cost on its own; 3 and 4 make the fence real; 5 is +cosmetic and can wait. + +## 6 · Decided + +- **`Web/`** stays in `ASCKit/Web/` for step 1, so the step is a pure move. + Whether it moves out to the way in is still open (below). +- **Library users break cleanly**: one CHANGELOG line, no `Domain` / + `Infrastructure` re-export shims. +- **`MOCKING` in release builds** is its own fix, not part of this refactor. + +## 7 · Open + +- **`Web/`** — the REST server is a *way in*, like `ASCCommand`. Move it into + `ASCCommand/` (or its own module), or keep it in `ASCKit` because plugins + mount routes on it? +- **`MOCKING` in release builds** — the `ASCKit` target defines it + unconditionally (inherited from `Domain`), so mocks ship in `asc`. +- **`IdmsaAPIClient`'s wire** — 46% covered; its own HTTP tests miss most of + sign-in-complete and verify. Its URLProtocol tests are the right tool there: + they pin the bytes Apple expects. +- **The other iris repositories' tests** still drive a real `IrisClient` through + `URLProtocol` stubs; they can move onto `MockIrisAPI` as they are touched. diff --git a/docs/features/iap-subscriptions/submission-iris-parity.md b/docs/features/iap-subscriptions/submission-iris-parity.md index 1629cc0c..88e65ab4 100644 --- a/docs/features/iap-subscriptions/submission-iris-parity.md +++ b/docs/features/iap-subscriptions/submission-iris-parity.md @@ -40,8 +40,8 @@ The web UI expresses "alongside next version" via `submitWithNextAppStoreVersion ## Plumbing already in place -- `Sources/Infrastructure/Iris/IrisClient.swift` — handles cookie injection, `[asc-ui]` CSRF header, JSON:API content-type -- `Sources/Infrastructure/Iris/BrowserIrisCookieProvider.swift` — pulls cookies from the user's logged-in browser +- `Sources/ASCKit/Iris/Internal/IrisClient.swift` — handles cookie injection, `[asc-ui]` CSRF header, JSON:API content-type +- `Sources/ASCKit/Iris/Internal/BrowserIrisCookieProvider.swift` — pulls cookies from the user's logged-in browser - Working precedent: `IrisSDKAppBundleRepository` already calls iris through `IrisClient` ## Shipped approach (IAP) @@ -133,4 +133,4 @@ Same gap exists at `POST /iris/v1/subscriptionSubmissions`. The implementation w ## See also - `docs/features/iap-subscriptions/lifecycle.md` — current submission CLI/REST commands -- `Sources/Infrastructure/Iris/IrisClient.swift` — iris HTTP layer +- `Sources/ASCKit/Iris/Internal/IrisClient.swift` — iris HTTP layer diff --git a/docs/features/iris/iris-srp-login.md b/docs/features/iris/iris-srp-login.md index a2083ff6..1036917b 100644 --- a/docs/features/iris/iris-srp-login.md +++ b/docs/features/iris/iris-srp-login.md @@ -8,7 +8,7 @@ The iris private API at `https://appstoreconnect.apple.com/iris/v1/` is the only path Apple exposes for several App Store Connect features (notably `submitWithNextAppStoreVersion` for IAP/subscription submissions). Iris is gated by **session cookies obtained from an Apple ID login** at `idmsa.apple.com`. -We already have **`BrowserIrisCookieProvider`** (`Sources/Infrastructure/Iris/BrowserIrisCookieProvider.swift`) which borrows cookies from the user's browser after they've signed in to App Store Connect manually. That works for desktop interactive use but **not for headless CI** — there's no browser to borrow from. +We already have **`BrowserIrisCookieProvider`** (`Sources/ASCKit/Iris/Internal/BrowserIrisCookieProvider.swift`) which borrows cookies from the user's browser after they've signed in to App Store Connect manually. That works for desktop interactive use but **not for headless CI** — there's no browser to borrow from. Three paths considered. Only one survives: @@ -93,27 +93,27 @@ The existing `BrowserIrisCookieProvider` is **not removed** — users on a deskt ``` Sources/ -├── Domain/Auth/Iris/ (new — pure value types & @Mockable protocols, zero I/O) +├── ASCKit/Auth/Iris/ (new — pure value types & @Mockable protocols, zero I/O) │ ├── IrisAuthCredentials.swift appleId, password │ ├── IrisAuthSession.swift cookies, scnt, serviceKey, appleIDSessionID, providerID, teamId, userEmail, expiresAt -│ ├── IrisAuthRepository.swift @Mockable: login, requestTwoFactorCode, submitTwoFactorCode, logout +│ ├── IrisSignIn.swift @Mockable: login, requestTwoFactorCode, submitTwoFactorCode, logout │ ├── IrisSessionRepository.swift @Mockable: save(IrisAuthSession), load() throws -> IrisAuthSession?, clear() │ ├── IrisAuthError.swift invalidCredentials, twoFactorRequired, twoFactorRejected, applePromptRequired, networkError │ ├── TwoFactorChallenge.swift method (trustedDevice/phone), maskedDestination, codeLength │ └── PendingTwoFactorState.swift serialized partial session: scnt, serviceKey, appleIDSessionID, twoFactorCookieBag │ -├── Infrastructure/Iris/Auth/ (new — implementations of Domain protocols) +├── ASCKit/Iris/Internal/Auth/ (new — implementations of the face's protocols) │ ├── SRP/ (Apple-specific glue on top of swift-srp) │ │ ├── AppleSRPClient.swift init() → A using swift-srp keys; completeWith(salt, B, iterations) computes Apple x via PBKDF2 then S using swift-srp's BigNum + config.k/g/N │ │ └── AppleM1.swift HKDF-SHA256-derived M1 — Apple's variant, distinct from RFC 2945 proof │ ├── IdmsaAPIClient.swift HTTP for idmsa.apple.com (signin/init, signin/complete, verify//securitycode, 2sv/trust); cookie jar & header threading │ ├── OlympusClient.swift olympus/v1/session for team metadata -│ ├── IrisAuthSDKRepository.swift implements `Domain.IrisAuthRepository`; composes AppleSRPClient + IdmsaAPIClient + OlympusClient -│ ├── KeychainIrisSessionRepository.swift implements `Domain.IrisSessionRepository` via macOS Keychain (Security framework) -│ ├── FileIrisSessionRepository.swift implements `Domain.IrisSessionRepository` via `~/.asc/iris/session.json`, written with `0600` -│ ├── CompositeIrisSessionRepository.swift implements `Domain.IrisSessionRepository` by trying Keychain first, falling back to file (so macOS gets keychain protection, Linux silently falls through) -│ ├── KeychainIrisCookieProvider.swift implements existing `Domain.IrisCookieProvider`; reads from any `IrisSessionRepository` -│ └── CompositeIrisCookieProvider.swift implements `Domain.IrisCookieProvider`; resolution order env → stored → browser +│ ├── IrisSDKSignIn.swift implements `ASCKit.IrisSignIn`; composes AppleSRPClient + IdmsaAPIClient + OlympusClient +│ ├── KeychainIrisSessionRepository.swift implements `ASCKit.IrisSessionRepository` via macOS Keychain (Security framework) +│ ├── FileIrisSessionRepository.swift implements `ASCKit.IrisSessionRepository` via `~/.asc/iris/session.json`, written with `0600` +│ ├── CompositeIrisSessionRepository.swift implements `ASCKit.IrisSessionRepository` by trying Keychain first, falling back to file (so macOS gets keychain protection, Linux silently falls through) +│ ├── KeychainIrisCookieProvider.swift implements existing `ASCKit.IrisCookieProvider`; reads from any `IrisSessionRepository` +│ └── CompositeIrisCookieProvider.swift implements `ASCKit.IrisCookieProvider`; resolution order env → stored → browser │ └── ASCCommand/Commands/Iris/Auth/ (new — CLI) ├── IrisAuthCommand.swift `asc iris auth` @@ -122,7 +122,7 @@ Sources/ └── IrisAuthLogout.swift `asc iris auth logout` ``` -`IrisCommand.subcommands` gets `IrisAuthCommand.self` appended. `ClientProvider` gets `makeIrisAuthRepository()` and `makeIrisCookieProvider()` updated to return `CompositeIrisCookieProvider`. +`IrisCommand.subcommands` gets `IrisAuthCommand.self` appended. `ClientProvider` gets `makeIrisSignIn()` and `makeIrisCookieProvider()` updated to return `CompositeIrisCookieProvider`. ## Domain models @@ -234,7 +234,7 @@ Strict TDD. Each slice has a red test before any production code. ### Crypto primitives (slice 1) - **RFC 5054 base correctness comes free** — `swift-srp` already has its own test suite verified against RFC 5054 vectors, Mozilla's verifier vectors, and several cross-implementations. We do not re-test what they own. -- **Apple-specific test vectors**: we test only our delta — Apple's PBKDF2-based `x` derivation and HKDF-based `M1`. Captured from a single real successful login through `mitmproxy`. Stored as `Tests/InfrastructureTests/Iris/Auth/Fixtures/apple-srp-vectors.json` (no real password — only the post-derivation values: salt, iterations, expected `x`, expected `M1`). +- **Apple-specific test vectors**: we test only our delta — Apple's PBKDF2-based `x` derivation and HKDF-based `M1`. Captured from a single real successful login through `mitmproxy`. Stored as `Tests/ASCKitTests/Iris/Internal/Auth/Fixtures/apple-srp-vectors.json` (no real password — only the post-derivation values: salt, iterations, expected `x`, expected `M1`). ### Idmsa flow (slices 2–3) - `IdmsaAPIClient` accepts an injected `URLSession` (via `URLProtocol` mock or `XCTNetworking` shim). @@ -251,7 +251,7 @@ Strict TDD. Each slice has a red test before any production code. - Keychain tests: macOS-only, conditionally skipped on CI without keychain. ### CLI commands (slice 6) -- Mock `IrisAuthRepository`, exact JSON snapshot per `formatAgentItems`. +- Mock `IrisSignIn`, exact JSON snapshot per `formatAgentItems`. - Two-step flow: `login` returns `twoFactorRequired` → output mentions "verify-code" → `verify-code` succeeds → output shows team info. ## Milestones @@ -259,7 +259,7 @@ Strict TDD. Each slice has a red test before any production code. | # | Slice | Done when | |---|---|---| | 1 | Add `swift-srp` to `Package.swift`; wire `AppleSRPClient` (Apple-x via PBKDF2, S via swift-srp's BigNum + config) and `AppleM1` (HKDF-derived) | Apple-captured test vectors pass; ~150 LoC + tests | -| 2 | Idmsa happy path (no 2FA) | `IrisAuthRepository.login` returns full `IrisAuthSession` against stubbed Apple endpoints | +| 2 | Idmsa happy path (no 2FA) | `IrisSignIn.login` returns full `IrisAuthSession` against stubbed Apple endpoints | | 3 | 2FA flow (trusted-device + phone) | `verifyTwoFactorCode` succeeds; `IrisAuthError.twoFactorRequired` carries the right `PendingTwoFactorState` | | 4 | Olympus + composite cookie provider | iris calls succeed end-to-end against a stubbed test server | | 5 | Keychain / file persistence | Login → restart process → cookies still resolve from storage | @@ -284,5 +284,5 @@ Strict TDD. Each slice has a red test before any production code. ## See also - `docs/features/iap-subscriptions/submission-iris-parity.md` — the original gap that motivated this build -- `Sources/Infrastructure/Iris/IrisClient.swift` — the iris HTTP layer that consumes the cookies SRP login produces -- `Sources/Infrastructure/Iris/BrowserIrisCookieProvider.swift` — the existing browser-based path; remains as the third resolver in the composite +- `Sources/ASCKit/Iris/Internal/IrisClient.swift` — the iris HTTP layer that consumes the cookies SRP login produces +- `Sources/ASCKit/Iris/Internal/BrowserIrisCookieProvider.swift` — the existing browser-based path; remains as the third resolver in the composite diff --git a/docs/features/screenshot-editor/design.md b/docs/features/screenshot-editor/design.md index f880e589..be423cce 100644 --- a/docs/features/screenshot-editor/design.md +++ b/docs/features/screenshot-editor/design.md @@ -147,11 +147,11 @@ homepage/editor/ Web editor source └── *.png 121 device bezels Sources/ -├── Domain/Screenshots/ +├── ASCKit/Apps/Versions/Localizations/ScreenshotSets/ │ ├── ScreenshotImport.swift ScreenshotManifest + nested types │ └── ScreenshotRepository.swift Modified: added importScreenshots │ -├── Infrastructure/Screenshots/ +├── ASCKit/Apps/Versions/Localizations/ScreenshotSets/Internal/ │ └── OpenAPIScreenshotRepository.swift Modified: implements importScreenshots │ └── ASCCommand/Commands/Screenshots/ diff --git a/docs/features/web-server-architecture/design.md b/docs/features/web-server-architecture/design.md index ee0eda69..64ef5ebd 100644 --- a/docs/features/web-server-architecture/design.md +++ b/docs/features/web-server-architecture/design.md @@ -18,7 +18,7 @@ Browser (asccli.app) ←──HTTP/WS──→ Swift Server (localhost:8420) │ ASCCommand │ │ └── WebServerCommand.swift CLI entry, command runner │ ├──────────────────────────────────────────────────────────────┤ -│ Infrastructure/Web │ +│ ASCKit/Web │ │ ├── ASCWebServer.swift Hummingbird app, routes, │ │ │ plugin loading, HTTPS │ │ ├── CORSMiddleware.swift Cross-origin for asccli.app │ @@ -98,11 +98,11 @@ Sources/ ├── ASCPlugin/ │ ├── ASCPlugin.swift # @objc protocol, ASCRouter typealias │ └── PluginLoader.swift # .plugin/.framework/.dylib discovery -├── Infrastructure/Web/ +├── ASCKit/Web/ │ ├── ASCWebServer.swift # Hummingbird server, plugin loading │ ├── CORSMiddleware.swift # CORS for asccli.app → localhost │ └── SelfSignedCert.swift # HTTPS cert management -├── Domain/Shared/ +├── ASCKit/Shared/ │ └── AffordanceRegistry.swift # Plugin affordance extension └── ASCCommand/Commands/Web/ └── WebServerCommand.swift # CLI entry point diff --git a/docs/library.md b/docs/library.md index 2bcc1887..b67d6ef8 100644 --- a/docs/library.md +++ b/docs/library.md @@ -23,8 +23,7 @@ targets: [ ## Example ```swift -import Domain -import Infrastructure +import ASCKit // 1. Provide credentials (inline, env vars, or your own AuthProvider) let credentials = AuthCredentials( @@ -57,4 +56,4 @@ let builds = try await buildRepo.listBuilds(appId: "YOUR_APP_ID", platform: nil, ## Repositories -`ClientFactory` has a `make…Repository(authProvider:)` method for every domain area: apps, builds, versions, TestFlight, screenshots, in-app purchases, subscriptions, reports, code signing, Xcode Cloud and more. The full list is in [`Sources/Infrastructure/Client/ClientFactory.swift`](../Sources/Infrastructure/Client/ClientFactory.swift); each returns a protocol from the `Domain` module. +`ClientFactory` has a `make…Repository(authProvider:)` method for every domain area: apps, builds, versions, TestFlight, screenshots, in-app purchases, subscriptions, reports, code signing, Xcode Cloud and more. The full list is in [`Sources/ASCKit/Shared/Internal/ClientFactory.swift`](../Sources/ASCKit/Shared/Internal/ClientFactory.swift); each returns a protocol from the concept's public face. diff --git a/examples/hello-plugin/Sources/HelloPlugin/HelloPlugin.swift b/examples/hello-plugin/Sources/HelloPlugin/HelloPlugin.swift index cd71d1e2..12d0b1f5 100644 --- a/examples/hello-plugin/Sources/HelloPlugin/HelloPlugin.swift +++ b/examples/hello-plugin/Sources/HelloPlugin/HelloPlugin.swift @@ -1,6 +1,6 @@ import Foundation import ASCPlugin -import Domain +import ASCKit import Hummingbird // MARK: - Entry point (required)