sonamu 0.7.36 → 0.7.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonamu",
3
- "version": "0.7.36",
3
+ "version": "0.7.37",
4
4
  "description": "Sonamu — TypeScript Fullstack API Framework",
5
5
  "keywords": [
6
6
  "typescript",
@@ -111,9 +111,9 @@
111
111
  "vitest": "^4.0.10",
112
112
  "exceljs": "^4.4.0",
113
113
  "zod": "^4.1.12",
114
- "@sonamu-kit/ts-loader": "^2.1.3",
115
- "@sonamu-kit/hmr-runner": "^0.1.1",
116
114
  "@sonamu-kit/hmr-hook": "^0.4.1",
115
+ "@sonamu-kit/hmr-runner": "^0.1.1",
116
+ "@sonamu-kit/ts-loader": "^2.1.3",
117
117
  "@sonamu-kit/tasks": "^0.1.3"
118
118
  },
119
119
  "devDependencies": {
@@ -11,6 +11,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
11
11
  import { Alert } from "react-native";
12
12
  import EventSource from "react-native-sse";
13
13
  import { type core, z } from "zod";
14
+ import { getCurrentLocale } from "~/i18n/sd.generated";
14
15
 
15
16
  // AbortSignal.timeout polyfill for React Native
16
17
  if (typeof AbortSignal !== "undefined" && !AbortSignal.timeout) {
@@ -350,10 +351,14 @@ export function useSSEStream<T extends Record<string, any>>(
350
351
 
351
352
  // URL에 파라미터 추가 - 절대 URL로 변환
352
353
  const queryString = qs.stringify(params);
353
- const baseUrl = url.startsWith("http") ? url : `$[[baseUrl]]${url}`;
354
+ const baseUrl = url.startsWith("http") ? url : `${axios.defaults.baseURL}${url}`;
354
355
  const fullUrl = queryString ? `${baseUrl}?${queryString}` : baseUrl;
355
356
 
356
- const eventSource = new EventSource(fullUrl);
357
+ const eventSource = new EventSource(fullUrl, {
358
+ headers: {
359
+ "Accept-Language": getCurrentLocale(),
360
+ },
361
+ });
357
362
  eventSourceRef.current = eventSource;
358
363
 
359
364
  // 연결 시도 중 상태 표시
@@ -8,6 +8,8 @@ import type { AxiosRequestConfig } from "axios";
8
8
  import axios from "axios";
9
9
  import qs from "qs";
10
10
  import { type core, z } from "zod";
11
+ import { EventSource } from 'eventsource'
12
+ import { getCurrentLocale } from "../i18n/sd.generated";
11
13
 
12
14
  // ISO 8601 및 타임존 포맷의 날짜 문자열을 Date 객체로 변환하는 reviver
13
15
  export function dateReviver(_key: string, value: any): any {
@@ -241,7 +243,14 @@ export function useSSEStream<T extends Record<string, any>>(
241
243
  const queryString = qs.stringify(params);
242
244
  const fullUrl = queryString ? `${url}?${queryString}` : url;
243
245
 
244
- const eventSource = new EventSource(fullUrl);
246
+ const eventSource = new EventSource(fullUrl, {
247
+ fetch: (url, options) =>
248
+ fetch({ url: url.toString(), ...options, headers: {
249
+ ...options?.headers,
250
+ "Accept-Language": getCurrentLocale(),
251
+ },
252
+ }),
253
+ });
245
254
  eventSourceRef.current = eventSource;
246
255
 
247
256
  // 연결 시도 중 상태 표시