@iyulab/enterprise 0.10.1 → 0.11.0

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,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Added
6
+
7
+ - **`ODataService.odataPatchQuiet`/`odataDeleteQuiet`** — quiet counterparts to
8
+ `odataPatch`/`odataDelete`, mirroring the existing `odataPost`/`odataPostQuiet`
9
+ split. For an action that fires more than one mutation in response to a single
10
+ user click (e.g. editing a row and syncing a denormalized parent field), the
11
+ toasting variants would show a toast per mutation; the quiet variants do the
12
+ request and error handling without one, so the caller can toast once for the
13
+ whole action. Previously PATCH/DELETE had no quiet path, forcing a raw
14
+ `fetch()` that lost 401 handling and `ApiError` extraction.
15
+
16
+ ## 0.10.2
17
+
18
+ ### Changed
19
+
20
+ - **`CurrencyHelper` now logs a one-time `console.warn`** (per process) the first time any of its
21
+ `format*` methods (`formatCurrency`/`formatKRW`/`formatUSD`/`formatEUR`/`formatJPY`/`formatCNY`)
22
+ is called, pointing callers to `formatCurrency`/`formatNumber`/`formatDate` from
23
+ `@iyulab/components` directly. `parseCurrency` is unaffected (no equivalent exists elsewhere yet).
24
+ No behavior change — this is usage telemetry ahead of a future removal, not a functional change.
25
+
3
26
  ## 0.10.1
4
27
 
5
28
  ### Added
@@ -67,8 +67,13 @@ export interface ODataService {
67
67
  odataPostQuiet<T>(entity: string, body: Partial<T>): Promise<T>;
68
68
  /** OData POST(생성) — 성공 시 `saved` 토스트. */
69
69
  odataPost<T>(entity: string, body: Partial<T>): Promise<T>;
70
+ /** OData PATCH(수정) — 토스트 없이 결과만(자식 컬렉션 편집 후 부모의 파생 필드를
71
+ * 함께 동기화하는 등, 한 사용자 액션이 여러 mutation을 낼 때 토스트 폭주 방지). */
72
+ odataPatchQuiet<T>(entity: string, id: string, body: Partial<T>): Promise<void>;
70
73
  /** OData PATCH(수정) — 성공 시 `updated` 토스트. */
71
74
  odataPatch<T>(entity: string, id: string, body: Partial<T>): Promise<void>;
75
+ /** OData DELETE — 토스트 없이(`odataPatchQuiet`와 같은 이유). */
76
+ odataDeleteQuiet(entity: string, id: string): Promise<void>;
72
77
  /** OData DELETE — 성공 시 `deleted` 토스트. */
73
78
  odataDelete(entity: string, id: string): Promise<void>;
74
79
  /** custom REST GET — 204 등 빈 바디를 안전 파싱. */
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,
@@ -736,31 +743,29 @@ function createODataService(config) {
736
743
  throw e;
737
744
  }
738
745
  }
746
+ async function odataPatchQuiet(entity, id, body) {
747
+ await throwIfError(await client.patch(`${odataUrl(entity)}(${id})`, normalizeBody(body)));
748
+ }
739
749
  async function odataPatch(entity, id, body) {
740
- const res = await client.patch(`${odataUrl(entity)}(${id})`, normalizeBody(body));
741
- if (!res.ok) {
742
- if (res.status === 401) {
743
- config.onUnauthorized?.(401);
744
- throw new ApiError(messages.sessionExpired, 401);
745
- }
746
- const msg = await extractErrorMsg(res);
747
- notifyError?.(msg);
748
- throw new ApiError(msg, res.status);
750
+ try {
751
+ await odataPatchQuiet(entity, id, body);
752
+ notifySuccess?.(messages.updated);
753
+ } catch (e) {
754
+ if (!(e instanceof ApiError && e.status === 401)) notifyError?.(e instanceof Error ? e.message : messages.requestFailed);
755
+ throw e;
749
756
  }
750
- notifySuccess?.(messages.updated);
757
+ }
758
+ async function odataDeleteQuiet(entity, id) {
759
+ await throwIfError(await client.delete(`${odataUrl(entity)}(${id})`));
751
760
  }
752
761
  async function odataDelete(entity, id) {
753
- const res = await client.delete(`${odataUrl(entity)}(${id})`);
754
- if (!res.ok) {
755
- if (res.status === 401) {
756
- config.onUnauthorized?.(401);
757
- throw new ApiError(messages.sessionExpired, 401);
758
- }
759
- const msg = await extractErrorMsg(res);
760
- notifyError?.(msg);
761
- throw new ApiError(msg, res.status);
762
+ try {
763
+ await odataDeleteQuiet(entity, id);
764
+ notifySuccess?.(messages.deleted);
765
+ } catch (e) {
766
+ if (!(e instanceof ApiError && e.status === 401)) notifyError?.(e instanceof Error ? e.message : messages.requestFailed);
767
+ throw e;
762
768
  }
763
- notifySuccess?.(messages.deleted);
764
769
  }
765
770
  async function apiGet(path) {
766
771
  const [p, ...q] = path.split("?");
@@ -802,7 +807,9 @@ function createODataService(config) {
802
807
  odataCount,
803
808
  odataPostQuiet,
804
809
  odataPost,
810
+ odataPatchQuiet,
805
811
  odataPatch,
812
+ odataDeleteQuiet,
806
813
  odataDelete,
807
814
  apiGet,
808
815
  apiPost,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyulab/enterprise",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "Enterprise utilities and components for iyulab framework",
5
5
  "keywords": [
6
6
  "enterprise",
@@ -45,6 +45,7 @@
45
45
  "./styles/preset.css": "./dist/styles/preset.css"
46
46
  },
47
47
  "scripts": {
48
+ "preversion": "node ../../scripts/preversion-check.mjs",
48
49
  "build": "npm run typecheck && vite build && node scripts/copy-styles.mjs",
49
50
  "test": "vitest run",
50
51
  "typecheck": "tsc --noEmit"