Skip to content

Commit 48c9e08

Browse files
committed
fix: type issues
1 parent aee5128 commit 48c9e08

File tree

24 files changed

+542
-495
lines changed

24 files changed

+542
-495
lines changed

apps/frontend/src/helpers/api.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import type {
2-
AbstractFeature,
3-
type AuthConfig,
1+
import {
42
AuthFeature,
53
CircuitBreakerFeature,
64
NuxtCircuitBreakerStorage,
7-
type NuxtClientConfig,
85
NuxtModrinthClient,
96
VerboseLoggingFeature,
7+
type AbstractFeature,
8+
type AuthConfig,
9+
type NuxtClientConfig,
1010
} from '@modrinth/api-client'
1111

1212
export function createModrinthClient(

apps/frontend/src/pages/[type]/[id]/settings/environment.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const supportsEnvironment = computed(() =>
2727
const needsToVerify = computed(
2828
() =>
2929
projectV3.value.side_types_migration_review_status === 'pending' &&
30-
projectV3.value.environment?.length > 0 &&
30+
(projectV3.value.environment?.length ?? 0) > 0 &&
3131
projectV3.value.environment?.[0] !== 'unknown' &&
3232
supportsEnvironment.value,
3333
)
@@ -156,12 +156,12 @@ const messages = defineMessages({
156156
/>
157157
<ProjectSettingsEnvSelector
158158
v-model="current.environment"
159-
:disabled="!hasPermission || projectV3?.environment?.length > 1"
159+
:disabled="!hasPermission || (projectV3?.environment?.length ?? 0) > 1"
160160
/>
161161
</template>
162162
</div>
163163
<UnsavedChangesPopup
164-
v-if="supportsEnvironment && hasPermission && projectV3?.environment?.length <= 1"
164+
v-if="supportsEnvironment && hasPermission && (projectV3?.environment?.length ?? 0) <= 1"
165165
:original="saved"
166166
:modified="current"
167167
:saving="saving"

packages/api-client/src/index.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
export { AbstractModrinthClient } from './core/abstract-client'
22
export { AbstractFeature, type FeatureConfig } from './core/abstract-feature'
33
export { ModrinthApiError, ModrinthServerError } from './core/errors'
4-
export { type AuthConfig, AuthFeature } from './features/auth'
4+
export { AuthFeature, type AuthConfig } from './features/auth'
55
export {
6-
type CircuitBreakerConfig,
76
CircuitBreakerFeature,
7+
InMemoryCircuitBreakerStorage,
8+
type CircuitBreakerConfig,
89
type CircuitBreakerState,
910
type CircuitBreakerStorage,
10-
InMemoryCircuitBreakerStorage,
1111
} from './features/circuit-breaker'
12-
export { type BackoffStrategy, type RetryConfig, RetryFeature } from './features/retry'
13-
export { type VerboseLoggingConfig, VerboseLoggingFeature } from './features/verbose-logging'
12+
export { RetryFeature, type BackoffStrategy, type RetryConfig } from './features/retry'
13+
export { VerboseLoggingFeature, type VerboseLoggingConfig } from './features/verbose-logging'
1414
export type { InferredClientModules } from './modules'
15-
export type { Labrinth } from './modules/labrinth/billing/types'
1615
export * from './modules/types'
1716
export { GenericModrinthClient } from './platform/generic'
18-
export type { NuxtClientConfig } from './platform/nuxt'
1917
export { NuxtCircuitBreakerStorage, NuxtModrinthClient } from './platform/nuxt'
20-
export type { TauriClientConfig } from './platform/tauri'
18+
export type { NuxtClientConfig } from './platform/nuxt'
2119
export { TauriModrinthClient } from './platform/tauri'
20+
export type { TauriClientConfig } from './platform/tauri'
2221
export * from './types'

packages/api-client/src/modules/archon/servers/types/v0.ts

Lines changed: 0 additions & 106 deletions
This file was deleted.

packages/api-client/src/modules/archon/servers/types/v1.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/api-client/src/modules/archon/servers/v0.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AbstractModule } from '../../../core/abstract-module'
2-
import type { Archon } from './types/'
2+
import type { Archon } from '../types'
33

44
export class ArchonServersV0Module extends AbstractModule {
55
public getModuleID(): string {

packages/api-client/src/modules/archon/servers/v1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AbstractModule } from '../../../core/abstract-module'
2-
import type { Archon } from './types/'
2+
import type { Archon } from '../types'
33

44
export class ArchonServersV1Module extends AbstractModule {
55
public getModuleID(): string {
Lines changed: 124 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,128 @@
1-
import * as ServersV0 from './servers/types/v0'
2-
import * as ServersV1 from './servers/types/v1'
3-
41
export namespace Archon {
52
export namespace Servers {
6-
export import v0 = ServersV0
7-
export import v1 = ServersV1
3+
export namespace v0 {
4+
export type ServerGetResponse = {
5+
servers: Server[]
6+
pagination: Pagination
7+
}
8+
9+
export type Pagination = {
10+
current_page: number
11+
page_size: number
12+
total_pages: number
13+
total_items: number
14+
}
15+
16+
export type Status = 'installing' | 'broken' | 'available' | 'suspended'
17+
18+
export type SuspensionReason =
19+
| 'moderated'
20+
| 'paymentfailed'
21+
| 'cancelled'
22+
| 'upgrading'
23+
| 'other'
24+
25+
export type Loader =
26+
| 'Forge'
27+
| 'NeoForge'
28+
| 'Fabric'
29+
| 'Quilt'
30+
| 'Purpur'
31+
| 'Spigot'
32+
| 'Vanilla'
33+
| 'Paper'
34+
35+
export type Game = 'Minecraft'
36+
37+
export type UpstreamKind = 'modpack' | 'none'
38+
39+
export type Server = {
40+
server_id: string
41+
name: string
42+
owner_id: string
43+
net: Net
44+
game: Game
45+
backup_quota: number
46+
used_backup_quota: number
47+
status: Status
48+
suspension_reason: SuspensionReason | null
49+
loader: Loader | null
50+
loader_version: string | null
51+
mc_version: string | null
52+
upstream: Upstream | null
53+
sftp_username: string
54+
sftp_password: string
55+
sftp_host: string
56+
datacenter: string
57+
notices: Notice[]
58+
node: NodeInfo | null
59+
flows: Flows
60+
is_medal: boolean
61+
62+
medal_expires?: string
63+
}
64+
65+
export type Net = {
66+
ip: string
67+
port: number
68+
domain: string
69+
}
70+
71+
export type Upstream = {
72+
kind: UpstreamKind
73+
version_id: string
74+
project_id: string
75+
}
76+
77+
export type Notice = {
78+
id: number
79+
dismissable: boolean
80+
title: string
81+
message: string
82+
level: string
83+
announced: string
84+
}
85+
86+
export type NodeInfo = {
87+
token: string
88+
instance: string
89+
}
90+
91+
export type Flows = {
92+
intro: boolean
93+
}
94+
95+
export type GetServersOptions = {
96+
limit?: number
97+
offset?: number
98+
}
99+
100+
export type StockRequest = {
101+
cpu?: number
102+
memory_mb?: number
103+
swap_mb?: number
104+
storage_mb?: number
105+
}
106+
107+
export type StockResponse = {
108+
available: number
109+
}
110+
111+
export type JWTAuth = {
112+
url: string // e.g., "node-xyz.modrinth.com/modrinth/v0/fs"
113+
token: string // JWT token for filesystem access
114+
}
115+
}
116+
117+
export namespace v1 {
118+
export type Region = {
119+
shortcode: string
120+
country_code: string
121+
display_name: string
122+
lat: number
123+
lon: number
124+
zone: string
125+
}
126+
}
8127
}
9128
}

packages/api-client/src/modules/kyros/files/types/v0.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as FilesV0 from './files/types/v0'
2-
31
export namespace Kyros {
42
export namespace Files {
5-
export import v0 = FilesV0
3+
export namespace v0 {
4+
// Empty for now
5+
}
66
}
77
}

0 commit comments

Comments
 (0)