fix(sdk): restore native ESM imports and action exports

This commit is contained in:
DrSmoothl committed 2026-10-23 13:04:33 +08:00
1 parent f8cb15c27b
commit b997de44a2
33 files changed
+482 -81

No files matched your search

+3 -3
View File
@@ -1,5 +1,5 @@
import { createSnowLumaApiError } from '../errors';
import { normalizeMessage } from '../messages/index';
import { createSnowLumaApiError } from '../errors.js';
import { normalizeMessage } from '../messages/index.js';
import type {
ActionParams,
ActionResult,
@@ -19,7 +19,7 @@ import type {
SendMsgParams,
SetGroupReactionParams,
SnowLumaAction,
} from '../types/index';
} from '../types/index.js';
/**
* Base class for SnowLuma API clients.
+5 -5
View File
@@ -4,10 +4,10 @@ import {
SnowLumaParseError,
SnowLumaTimeoutError,
SnowLumaTransportError,
} from '../errors';
import { SnowLumaApiClient, toJsonObject } from './api-client';
import { createRequestAbortState, isAbortError } from '../internal/abort';
import { assertApiResponse } from '../internal/json';
} from '../errors.js';
import { SnowLumaApiClient, toJsonObject } from './api-client.js';
import { createRequestAbortState, isAbortError } from '../internal/abort.js';
import { assertApiResponse } from '../internal/json.js';
import type {
ActionParams,
ActionResult,
@@ -16,7 +16,7 @@ import type {
RequestOptions,
SnowLumaAction,
SnowLumaClientOptions,
} from '../types/index';
} from '../types/index.js';
/** Options for the HTTP transport client. */
export interface SnowLumaHttpClientOptions extends SnowLumaClientOptions {
+5 -5
View File
@@ -1,12 +1,12 @@
export { SnowLumaApiClient } from './api-client';
export { SnowLumaHttpClient, createHttpClient } from './http-client';
export { SnowLumaWebSocketClient, createWebSocketClient } from './websocket-client';
export { SnowLumaApiClient } from './api-client.js';
export { SnowLumaHttpClient, createHttpClient } from './http-client.js';
export { SnowLumaWebSocketClient, createWebSocketClient } from './websocket-client.js';
export type { SnowLumaHttpClientOptions } from './http-client';
export type { SnowLumaHttpClientOptions } from './http-client.js';
export type {
ReconnectOptions,
SnowLumaWebSocketClientOptions,
SnowLumaWebSocketEvents,
WebSocketCloseInfo,
WebSocketConstructor,
} from './websocket-client';
} from './websocket-client.js';
+10 -10
View File
@@ -3,8 +3,8 @@ import {
SnowLumaConnectionError,
SnowLumaParseError,
SnowLumaTimeoutError,
} from '../errors';
import { Emitter } from '../emitter';
} from '../errors.js';
import { Emitter } from '../emitter.js';
import {
createEventContext,
isBotStatusEvent,
@@ -22,16 +22,16 @@ import {
type EventHandler,
type EventMiddleware,
type EventPredicate,
} from '../events/index';
import { SnowLumaApiClient, toJsonObject } from './api-client';
import { raceWithAbort, throwIfAborted } from '../internal/abort';
} from '../events/index.js';
import { SnowLumaApiClient, toJsonObject } from './api-client.js';
import { raceWithAbort, throwIfAborted } from '../internal/abort.js';
import {
appendAccessToken,
assertApiResponse,
createEcho,
echoKey,
isJsonObject,
} from '../internal/json';
} from '../internal/json.js';
import {
addSocketListener,
closeInfo,
@@ -41,7 +41,7 @@ import {
unwrapMessagePayload,
WEBSOCKET_CLOSED,
WEBSOCKET_OPEN,
} from './websocket-utils';
} from './websocket-utils.js';
import type {
ActionParams,
ActionResult,
@@ -57,14 +57,14 @@ import type {
SnowLumaAction,
SnowLumaEvent,
WsRole,
} from '../types/index';
} from '../types/index.js';
import type {
ReconnectOptions,
SnowLumaWebSocketClientOptions,
SnowLumaWebSocketEvents,
WebSocketConstructor,
WebSocketLike,
} from './websocket-types';
} from './websocket-types.js';
export type {
ReconnectOptions,
@@ -72,7 +72,7 @@ export type {
SnowLumaWebSocketEvents,
WebSocketCloseInfo,
WebSocketConstructor,
} from './websocket-types';
} from './websocket-types.js';
interface SocketConnection {
socket: WebSocketLike;
+1 -1
View File
@@ -1,4 +1,4 @@
import type { ApiResponse, SnowLumaClientOptions, SnowLumaEvent, WsRole } from '../types/index';
import type { ApiResponse, SnowLumaClientOptions, SnowLumaEvent, WsRole } from '../types/index.js';
export interface WebSocketLike {
readyState: number;
+2 -2
View File
@@ -1,5 +1,5 @@
import { isJsonObject } from '../internal/json';
import type { ReconnectOptions, WebSocketCloseInfo, WebSocketLike } from './websocket-types';
import { isJsonObject } from '../internal/json.js';
import type { ReconnectOptions, WebSocketCloseInfo, WebSocketLike } from './websocket-types.js';
export const WEBSOCKET_OPEN = 1;
export const WEBSOCKET_CLOSED = 3;