Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/api-client/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
import config from '@modrinth/tooling-config/eslint/nuxt.mjs'
import nPlugin from 'eslint-plugin-n'

export default config.append([
{
ignores: ['dist/'],
},
{
plugins: {
n: nPlugin,
},
settings: {
n: {
tryExtensions: ['.js', '.ts', '.mjs', '.mts', '.cjs', '.cts', '.json', '.node'],
typescriptExtensionMap: [['.ts', '.js']],
},
},
rules: {
'n/file-extension-in-import': ['error', 'always'],
},
},
])
1 change: 1 addition & 0 deletions packages/api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@modrinth/tooling-config": "workspace:*",
"@tauri-apps/plugin-http": "^2.0.0",
"esbuild": "0.27.2",
"eslint-plugin-n": "^18.2.1",
"typescript": "^5.9.3"
},
"peerDependencies": {
Expand Down
22 changes: 11 additions & 11 deletions packages/api-client/src/core/abstract-client.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { InferredClientModules } from '../modules'
import { buildModuleStructure } from '../modules'
import type { BaseUrlConfig, ClientConfig } from '../types/client'
import type { RequestContext, RequestOptions } from '../types/request'
import type { UploadMetadata, UploadProgress, UploadRequestOptions } from '../types/upload'
import type { AbstractFeature } from './abstract-feature'
import type { AbstractModule } from './abstract-module'
import type { AbstractSyncClient } from './abstract-sync'
import { AbstractUploadClient } from './abstract-upload-client'
import type { AbstractWebSocketClient } from './abstract-websocket'
import { ModrinthApiError, ModrinthServerError } from './errors'
import type { InferredClientModules } from '../modules/index.js'
import { buildModuleStructure } from '../modules/index.js'
import type { BaseUrlConfig, ClientConfig } from '../types/client.js'
import type { RequestContext, RequestOptions } from '../types/request.js'
import type { UploadMetadata, UploadProgress, UploadRequestOptions } from '../types/upload.js'
import type { AbstractFeature } from './abstract-feature.js'
import type { AbstractModule } from './abstract-module.js'
import type { AbstractSyncClient } from './abstract-sync.js'
import { AbstractUploadClient } from './abstract-upload-client.js'
import type { AbstractWebSocketClient } from './abstract-websocket.js'
import { ModrinthApiError, ModrinthServerError } from './errors.js'

type ArchonClientModules = Omit<InferredClientModules['archon'], 'backups_v1'> & {
/** @deprecated Use `backups_queue_v1` for the Backups Queue API. */
Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/src/core/abstract-feature.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RequestContext } from '../types/request'
import type { RequestContext } from '../types/request.js'

/**
* Base configuration for features
Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/src/core/abstract-module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AbstractModrinthClient } from './abstract-client'
import type { AbstractModrinthClient } from './abstract-client.js'

export abstract class AbstractModule {
protected client: AbstractModrinthClient
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/core/abstract-sync.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type mitt from 'mitt'

import type { Archon } from '../modules/archon/types'
import type { RequestOptions } from '../types/request'
import type { Archon } from '../modules/archon/types.js'
import type { RequestOptions } from '../types/request.js'

export type SyncEventType = Archon.Sync.v1.SyncEvent['type']

Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/src/core/abstract-upload-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UploadHandle, UploadRequestOptions } from '../types/upload'
import type { UploadHandle, UploadRequestOptions } from '../types/upload.js'

/**
* Abstract base class defining upload capability
Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/src/core/abstract-websocket.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type mitt from 'mitt'

import type { Archon } from '../modules/archon/types'
import type { Archon } from '../modules/archon/types.js'

export type WebSocketEventHandler<
E extends Archon.Websocket.v0.WSEvent = Archon.Websocket.v0.WSEvent,
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/core/errors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ApiErrorData, ModrinthErrorResponse } from '../types/errors'
import { isModrinthErrorResponse } from '../types/errors'
import type { ApiErrorData, ModrinthErrorResponse } from '../types/errors.js'
import { isModrinthErrorResponse } from '../types/errors.js'

/**
* Base error class for all Modrinth API errors
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/features/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractFeature, type FeatureConfig } from '../core/abstract-feature'
import type { RequestContext } from '../types/request'
import { AbstractFeature, type FeatureConfig } from '../core/abstract-feature.js'
import type { RequestContext } from '../types/request.js'

/**
* Authentication feature configuration
Expand Down
6 changes: 3 additions & 3 deletions packages/api-client/src/features/circuit-breaker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AbstractFeature, type FeatureConfig } from '../core/abstract-feature'
import { ModrinthApiError } from '../core/errors'
import type { RequestContext } from '../types/request'
import { AbstractFeature, type FeatureConfig } from '../core/abstract-feature.js'
import { ModrinthApiError } from '../core/errors.js'
import type { RequestContext } from '../types/request.js'

/**
* Circuit breaker state
Expand Down
8 changes: 4 additions & 4 deletions packages/api-client/src/features/node-auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AbstractFeature, type FeatureConfig } from '../core/abstract-feature'
import { ModrinthApiError } from '../core/errors'
import type { RequestContext } from '../types/request'
import { getNodeBaseUrl } from '../utils/node-url'
import { AbstractFeature, type FeatureConfig } from '../core/abstract-feature.js'
import { ModrinthApiError } from '../core/errors.js'
import type { RequestContext } from '../types/request.js'
import { getNodeBaseUrl } from '../utils/node-url.js'

/**
* Node authentication credentials
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/features/panel-version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractFeature } from '../core/abstract-feature'
import type { RequestContext } from '../types/request'
import { AbstractFeature } from '../core/abstract-feature.js'
import type { RequestContext } from '../types/request.js'

export const PANEL_VERSION = 1

Expand Down
6 changes: 3 additions & 3 deletions packages/api-client/src/features/retry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AbstractFeature, type FeatureConfig } from '../core/abstract-feature'
import { ModrinthApiError } from '../core/errors'
import type { RequestContext } from '../types/request'
import { AbstractFeature, type FeatureConfig } from '../core/abstract-feature.js'
import { ModrinthApiError } from '../core/errors.js'
import type { RequestContext } from '../types/request.js'

/**
* Backoff strategy for retries
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/features/verbose-logging.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractFeature, type FeatureConfig } from '../core/abstract-feature'
import type { RequestContext } from '../types/request'
import { AbstractFeature, type FeatureConfig } from '../core/abstract-feature.js'
import type { RequestContext } from '../types/request.js'

export type VerboseLoggingConfig = FeatureConfig

Expand Down
56 changes: 28 additions & 28 deletions packages/api-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { AbstractModrinthClient } from './core/abstract-client'
export { AbstractFeature, type FeatureConfig } from './core/abstract-feature'
export { AbstractModrinthClient } from './core/abstract-client.js'
export { AbstractFeature, type FeatureConfig } from './core/abstract-feature.js'
export {
AbstractSyncClient,
type SyncConnection,
Expand All @@ -10,46 +10,46 @@ export {
type SyncStatus,
type SyncStatusHandler,
type SyncStatusState,
} from './core/abstract-sync'
export { AbstractUploadClient } from './core/abstract-upload-client'
} from './core/abstract-sync.js'
export { AbstractUploadClient } from './core/abstract-upload-client.js'
export {
AbstractWebSocketClient,
type WebSocketConnection,
type WebSocketEventHandler,
type WebSocketStatus,
} from './core/abstract-websocket'
export { ModrinthApiError, ModrinthServerError } from './core/errors'
export { type AuthConfig, AuthFeature } from './features/auth'
} from './core/abstract-websocket.js'
export { ModrinthApiError, ModrinthServerError } from './core/errors.js'
export { type AuthConfig, AuthFeature } from './features/auth.js'
export {
type CircuitBreakerConfig,
CircuitBreakerFeature,
type CircuitBreakerState,
type CircuitBreakerStorage,
InMemoryCircuitBreakerStorage,
} from './features/circuit-breaker'
export { type NodeAuth, type NodeAuthConfig, NodeAuthFeature } from './features/node-auth'
export { PANEL_VERSION, PanelVersionFeature } from './features/panel-version'
export { type BackoffStrategy, type RetryConfig, RetryFeature } from './features/retry'
export { type VerboseLoggingConfig, VerboseLoggingFeature } from './features/verbose-logging'
export type { InferredClientModules } from './modules'
export * from './modules/types'
export { GenericModrinthClient } from './platform/generic'
export type { NuxtClientConfig } from './platform/nuxt'
export { NuxtCircuitBreakerStorage, NuxtModrinthClient } from './platform/nuxt'
export { GenericSyncClient } from './platform/sync-generic'
export type { TauriClientConfig } from './platform/tauri'
export { TauriModrinthClient } from './platform/tauri'
export { XHRUploadClient } from './platform/xhr-upload-client'
export { clearNodeAuthState, nodeAuthState, setNodeAuthState } from './state/node-auth'
export * from './types'
export { withJWTRetry } from './utils/jwt-retry'
export { getNodeWebSocketUrl } from './utils/node-url'
export { pingWebSocketUrl, type WebSocketPingOptions } from './utils/pingtest'
} from './features/circuit-breaker.js'
export { type NodeAuth, type NodeAuthConfig, NodeAuthFeature } from './features/node-auth.js'
export { PANEL_VERSION, PanelVersionFeature } from './features/panel-version.js'
export { type BackoffStrategy, type RetryConfig, RetryFeature } from './features/retry.js'
export { type VerboseLoggingConfig, VerboseLoggingFeature } from './features/verbose-logging.js'
export type { InferredClientModules } from './modules/index.js'
export * from './modules/types.js'
export { GenericModrinthClient } from './platform/generic.js'
export type { NuxtClientConfig } from './platform/nuxt.js'
export { NuxtCircuitBreakerStorage, NuxtModrinthClient } from './platform/nuxt.js'
export { GenericSyncClient } from './platform/sync-generic.js'
export type { TauriClientConfig } from './platform/tauri.js'
export { TauriModrinthClient } from './platform/tauri.js'
export { XHRUploadClient } from './platform/xhr-upload-client.js'
export { clearNodeAuthState, nodeAuthState, setNodeAuthState } from './state/node-auth.js'
export * from './types/index.js'
export { withJWTRetry } from './utils/jwt-retry.js'
export { getNodeWebSocketUrl } from './utils/node-url.js'
export { pingWebSocketUrl, type WebSocketPingOptions } from './utils/pingtest.js'
export {
type ParsedSseEvent,
type ParsedSseItem,
type ParsedSseRetry,
parseSyncEventData,
SseParser,
} from './utils/sse'
export type { Override, RawDecimal } from './utils/types'
} from './utils/sse.js'
export type { Override, RawDecimal } from './utils/types.js'
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/actions/v1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

export class ArchonActionsV1Module extends AbstractModule {
public getModuleID(): string {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/backups-queue/v1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

export class ArchonBackupsQueueV1Module extends AbstractModule {
public getModuleID(): string {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/backups/v1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

/**
* @deprecated Use `client.archon.backups_queue_v1` (Backups Queue API) instead.
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/content/v1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

export class ArchonContentV1Module extends AbstractModule {
public getModuleID(): string {
Expand Down
16 changes: 8 additions & 8 deletions packages/api-client/src/modules/archon/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export * from './actions/v1'
export * from './backups/v1'
export * from './backups-queue/v1'
export * from './content/v1'
export * from './properties/v1'
export * from './servers/v0'
export * from './servers/v1'
export * from './types'
export * from './actions/v1.js'
export * from './backups/v1.js'
export * from './backups-queue/v1.js'
export * from './content/v1.js'
export * from './properties/v1.js'
export * from './servers/v0.js'
export * from './servers/v1.js'
export * from './types.js'
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/nodes/internal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

export class ArchonNodesInternalModule extends AbstractModule {
public getModuleID(): string {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/notices/v0.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

export class ArchonNoticesV0Module extends AbstractModule {
public getModuleID(): string {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/options/v1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

export class ArchonOptionsV1Module extends AbstractModule {
public getModuleID(): string {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/properties/v1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

export class ArchonPropertiesV1Module extends AbstractModule {
public getModuleID(): string {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/server-users/v1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

export class ArchonServerUsersV1Module extends AbstractModule {
public getModuleID(): string {
Expand Down
6 changes: 3 additions & 3 deletions packages/api-client/src/modules/archon/servers/v0.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { UploadHandle, UploadProgress } from '../../../types/upload'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { UploadHandle, UploadProgress } from '../../../types/upload.js'
import type { Archon } from '../types.js'

export class ArchonServersV0Module extends AbstractModule {
public getModuleID(): string {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/servers/v1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

export class ArchonServersV1Module extends AbstractModule {
public getModuleID(): string {
Expand Down
4 changes: 2 additions & 2 deletions packages/api-client/src/modules/archon/transfers/internal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Archon } from '../types'
import { AbstractModule } from '../../../core/abstract-module.js'
import type { Archon } from '../types.js'

export class ArchonTransfersInternalModule extends AbstractModule {
public getModuleID(): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/src/modules/archon/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Labrinth } from '../labrinth/types'
import type { Labrinth } from '../labrinth/types.js'

export namespace Archon {
export namespace Nodes {
Expand Down
Loading
Loading