@iyulab/enterprise 0.10.0 → 0.10.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.2
4
+
5
+ ### Changed
6
+
7
+ - **`CurrencyHelper` now logs a one-time `console.warn`** (per process) the first time any of its
8
+ `format*` methods (`formatCurrency`/`formatKRW`/`formatUSD`/`formatEUR`/`formatJPY`/`formatCNY`)
9
+ is called, pointing callers to `formatCurrency`/`formatNumber`/`formatDate` from
10
+ `@iyulab/components` directly. `parseCurrency` is unaffected (no equivalent exists elsewhere yet).
11
+ No behavior change — this is usage telemetry ahead of a future removal, not a functional change.
12
+
13
+ ## 0.10.1
14
+
15
+ ### Added
16
+
17
+ - **`ODataService` gained `apiPut<T>(path, body?)`.** The other three custom-REST verbs
18
+ (`apiGet`/`apiPost`/`apiPatch`/`apiDelete`) were already there; `PUT` was the one missing member
19
+ of that set, even though the underlying `@iyulab/http-client` `HttpClient` has always had `.put()`.
20
+ A consumer whose backend models "replace this resource" as `PUT` had no way to reach it through
21
+ this wrapper. Passing a `FormData` body to `apiPost`/`apiPut`/`apiPatch` already worked before this
22
+ change and needed no fix — `HttpClient` never forces JSON serialization on it and lets the browser
23
+ set the multipart boundary itself.
24
+
3
25
  ## 0.10.0
4
26
 
5
27
  ### Changed
package/README.md CHANGED
@@ -95,9 +95,21 @@ export const svc = createODataService({
95
95
 
96
96
  await svc.odataGet<Order>('Orders', { $top: '20' }) // value 배열 언랩
97
97
  await svc.odataPost<Order>('Orders', { name: 'A', note: '' }) // '' → null 정규화 + 성공 토스트
98
- await svc.apiDelete('orders/7') // 204 안전
99
98
  svc.odataUrl('Orders') // flex-table useODataSource 엔드포인트
100
99
  svc.sourceDefaults // { baseUrl, onUnauthorized } 주입용
100
+
101
+ // custom REST — GET/POST/PUT/PATCH/DELETE 전부, 204 빈 바디 안전 파싱 포함
102
+ await svc.apiGet<Order>('reports/summary')
103
+ await svc.apiPost<Order>('orders', { name: 'A' })
104
+ await svc.apiPut<Order>('orders/7', { name: 'A (revised)' }) // 리소스 전체 교체
105
+ await svc.apiPatch<Order>('orders/7', { note: 'urgent' })
106
+ await svc.apiDelete('orders/7') // 204 안전
107
+
108
+ // body가 FormData 인스턴스면 그대로(직렬화 없이) 멀티파트로 전송된다 —
109
+ // Content-Type은 브라우저가 boundary와 함께 자동 설정한다. apiPost/apiPut/apiPatch 전부 동일.
110
+ const form = new FormData()
111
+ form.append('file', file)
112
+ await svc.apiPost<Order>('orders/7/attachments', form)
101
113
  ```
102
114
 
103
115
  주입 항목:
@@ -73,9 +73,13 @@ export interface ODataService {
73
73
  odataDelete(entity: string, id: string): Promise<void>;
74
74
  /** custom REST GET — 204 등 빈 바디를 안전 파싱. */
75
75
  apiGet<T>(path: string): Promise<T>;
76
- /** custom REST POST. */
76
+ /** custom REST POST. `body`가 `FormData` 인스턴스면 그대로(직렬화 없이) 멀티파트로
77
+ * 전송된다 — `@iyulab/http-client`가 Content-Type을 브라우저 자동 설정에 맡기고
78
+ * JSON 직렬화 분기를 타지 않는다. `apiPut`/`apiPatch`도 동일하게 동작한다. */
77
79
  apiPost<T>(path: string, body?: unknown): Promise<T>;
78
- /** custom REST PATCH. */
80
+ /** custom REST PUT(리소스 전체 교체/생성). `body`의 `FormData` 처리는 `apiPost` 참조. */
81
+ apiPut<T>(path: string, body?: unknown): Promise<T>;
82
+ /** custom REST PATCH. `body`의 `FormData` 처리는 `apiPost` 참조. */
79
83
  apiPatch<T>(path: string, body?: unknown): Promise<T>;
80
84
  /** custom REST DELETE — 대부분 204 No Content. */
81
85
  apiDelete<T = void>(path: string): Promise<T>;
package/dist/index.js CHANGED
@@ -126,6 +126,12 @@ messages.register("ko", {
126
126
  var EMPTY_VALUE_DISPLAY = "—";
127
127
  //#endregion
128
128
  //#region src/helpers/CurrencyHelper.ts
129
+ var warnedCurrencyHelperDeprecated = false;
130
+ function warnCurrencyHelperDeprecatedOnce() {
131
+ if (warnedCurrencyHelperDeprecated) return;
132
+ warnedCurrencyHelperDeprecated = true;
133
+ console.warn("[@iyulab/enterprise] \"CurrencyHelper\" is deprecated and will be removed in a future major version. Use `formatCurrency`/`formatNumber`/`formatDate` from `@iyulab/components` directly instead. This warning fires once per process.");
134
+ }
129
135
  /**
130
136
  * Currency formatting utility class.
131
137
  *
@@ -143,6 +149,7 @@ var CurrencyHelper = class {
143
149
  * @param locale - Locale for formatting (default: 'ko-KR')
144
150
  */
145
151
  static formatCurrency(amount, currency = "KRW", locale = "ko-KR") {
152
+ warnCurrencyHelperDeprecatedOnce();
146
153
  if (amount === null || amount === void 0) return "—";
147
154
  return formatCurrency(amount, currency, {
148
155
  minimumFractionDigits: 0,
@@ -774,6 +781,11 @@ function createODataService(config) {
774
781
  await throwIfError(res);
775
782
  return parseJsonBody(res);
776
783
  }
784
+ async function apiPut(path, body) {
785
+ const res = await client.put(apiUrl(path), body ?? {});
786
+ await throwIfError(res);
787
+ return parseJsonBody(res);
788
+ }
777
789
  async function apiPatch(path, body) {
778
790
  const res = await client.patch(apiUrl(path), body ?? {});
779
791
  await throwIfError(res);
@@ -801,6 +813,7 @@ function createODataService(config) {
801
813
  odataDelete,
802
814
  apiGet,
803
815
  apiPost,
816
+ apiPut,
804
817
  apiPatch,
805
818
  apiDelete,
806
819
  fetchRaw,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyulab/enterprise",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Enterprise utilities and components for iyulab framework",
5
5
  "keywords": [
6
6
  "enterprise",