@uniai-fe/util-functions 0.2.4 → 0.2.6

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.
@@ -60,6 +60,116 @@ type FetchBackendQueryOptions<Infra extends InfraKey, FetchRequestType extends o
60
60
  method: "POST" | "DELETE";
61
61
  };
62
62
 
63
+ /** ---------------------------------------------------------- NEW */
64
+ /**
65
+ * API; Base Params
66
+ * @property {string} domain API 요청 도메인(서버)
67
+ * @property {string} routeUrl Next.js app/api 이하 경로 url
68
+ * @property {string} queryUrl 백엔드 요청 url
69
+ */
70
+ interface UtilQueryBaseParams {
71
+ /**
72
+ * API 도메인
73
+ */
74
+ domain: string;
75
+ /**
76
+ * Next.js /app/api 라우트 주소
77
+ */
78
+ routeUrl: string;
79
+ /**
80
+ * 백엔드 API url
81
+ */
82
+ queryUrl: string;
83
+ }
84
+ /**
85
+ * API; generateBackendQueryUrl_GET Params
86
+ * @property {string} domain API 요청 도메인(서버)
87
+ * @property {string} routeUrl Next.js app/api 이하 경로 url
88
+ * @property {string} queryUrl 백엔드 요청 url
89
+ * @property {URLSearchParams | object} [searchParams] 요청 searchParams
90
+ * @property {object} [log] 디버깅용 서버 로그 데이터 객체
91
+ * @property {boolean} [logDisabled] 로그 비활성화
92
+ */
93
+ interface GenerateGetQueryUrlParams extends UtilQueryBaseParams {
94
+ /**
95
+ * 쿼리 스트링
96
+ * @desc
97
+ * - URLSearchParams 객체로 가공된 파라미터
98
+ */
99
+ searchParams?: URLSearchParams | object;
100
+ /**
101
+ * 디버깅용 서버 로그 정보
102
+ */
103
+ log?: object;
104
+ /**
105
+ * 로그 비활성화
106
+ * @default false
107
+ */
108
+ logDisabled?: boolean;
109
+ }
110
+ /**
111
+ * API; fetchWithBody Params
112
+ * @property {string} domain API 요청 도메인(서버)
113
+ * @property {string} routeUrl Next.js app/api 이하 경로 url
114
+ * @property {string} queryUrl 백엔드 요청 url
115
+ * @property {string} method fetch method; PUT | POST | DELETE
116
+ * @property {object} alternateResponse 실패 시 대체응답
117
+ * @property {URLSearchParams | object} [searchParams] 요청 searchParams
118
+ * @property {HeadersInit} [headers]
119
+ * @property {BodyInit | null} [body]
120
+ * @property {object} [bodyData]
121
+ * @property {boolean} [isRawResponse]
122
+ * @property {object} [debug]
123
+ * @property {boolean} [disabled]
124
+ * @property {boolean} [disabledLog]
125
+ */
126
+ interface FetchWithBodyParams<BodyDataType = object> extends UtilQueryBaseParams {
127
+ /**
128
+ * 요청 방식
129
+ * POST, DELETE
130
+ */
131
+ method: string;
132
+ /**
133
+ * fetch 실패 시 대체 응답
134
+ */
135
+ alternateResponse: ResponseType;
136
+ /**
137
+ * 쿼리 스트링
138
+ * @desc
139
+ * - URLSearchParams 객체로 가공된 파라미터
140
+ */
141
+ searchParams?: URLSearchParams | object;
142
+ /**
143
+ * fetch Headers
144
+ */
145
+ headers?: HeadersInit;
146
+ /**
147
+ * fetch Body
148
+ */
149
+ body?: BodyInit | null;
150
+ /**
151
+ * fetch Body Data
152
+ */
153
+ bodyData?: BodyDataType;
154
+ /**
155
+ * 응답값 원본으로 return
156
+ * const responseRaw = await fetch(api);
157
+ */
158
+ isRawResponse?: boolean;
159
+ /**
160
+ * 디버그용 로그 객체
161
+ */
162
+ debug?: object;
163
+ /**
164
+ * fetch 비활성화
165
+ */
166
+ disabled?: boolean;
167
+ /**
168
+ * 로그 비활성화
169
+ */
170
+ disabledLog?: boolean;
171
+ }
172
+
63
173
  /**
64
174
  * API 요청 url 생성; GET 타입
65
175
  * @util
@@ -239,4 +349,4 @@ declare const fetchWithBody: <BodyDataType = object, ResponseType extends object
239
349
  disabledLog: boolean;
240
350
  }>) => Promise<ResponseType>;
241
351
 
242
- export { type ApiLogger, type BackendApiConfig, type CommonPostResponseType, type DomainResolver, type EnvDomainMap, type FetchBackendQueryOptions, type GenerateBackendQueryUrlOptions, type InfraKey, fetchBackendQuery, fetchWithBody, generateBackendQueryUrl_GET, getFetchOptions, getQueryString, nextAPILog };
352
+ export { type ApiLogger, type BackendApiConfig, type CommonPostResponseType, type DomainResolver, type EnvDomainMap, type FetchBackendQueryOptions, type FetchWithBodyParams, type GenerateBackendQueryUrlOptions, type GenerateGetQueryUrlParams, type InfraKey, type UtilQueryBaseParams, fetchBackendQuery, fetchWithBody, generateBackendQueryUrl_GET, getFetchOptions, getQueryString, nextAPILog };
@@ -60,6 +60,116 @@ type FetchBackendQueryOptions<Infra extends InfraKey, FetchRequestType extends o
60
60
  method: "POST" | "DELETE";
61
61
  };
62
62
 
63
+ /** ---------------------------------------------------------- NEW */
64
+ /**
65
+ * API; Base Params
66
+ * @property {string} domain API 요청 도메인(서버)
67
+ * @property {string} routeUrl Next.js app/api 이하 경로 url
68
+ * @property {string} queryUrl 백엔드 요청 url
69
+ */
70
+ interface UtilQueryBaseParams {
71
+ /**
72
+ * API 도메인
73
+ */
74
+ domain: string;
75
+ /**
76
+ * Next.js /app/api 라우트 주소
77
+ */
78
+ routeUrl: string;
79
+ /**
80
+ * 백엔드 API url
81
+ */
82
+ queryUrl: string;
83
+ }
84
+ /**
85
+ * API; generateBackendQueryUrl_GET Params
86
+ * @property {string} domain API 요청 도메인(서버)
87
+ * @property {string} routeUrl Next.js app/api 이하 경로 url
88
+ * @property {string} queryUrl 백엔드 요청 url
89
+ * @property {URLSearchParams | object} [searchParams] 요청 searchParams
90
+ * @property {object} [log] 디버깅용 서버 로그 데이터 객체
91
+ * @property {boolean} [logDisabled] 로그 비활성화
92
+ */
93
+ interface GenerateGetQueryUrlParams extends UtilQueryBaseParams {
94
+ /**
95
+ * 쿼리 스트링
96
+ * @desc
97
+ * - URLSearchParams 객체로 가공된 파라미터
98
+ */
99
+ searchParams?: URLSearchParams | object;
100
+ /**
101
+ * 디버깅용 서버 로그 정보
102
+ */
103
+ log?: object;
104
+ /**
105
+ * 로그 비활성화
106
+ * @default false
107
+ */
108
+ logDisabled?: boolean;
109
+ }
110
+ /**
111
+ * API; fetchWithBody Params
112
+ * @property {string} domain API 요청 도메인(서버)
113
+ * @property {string} routeUrl Next.js app/api 이하 경로 url
114
+ * @property {string} queryUrl 백엔드 요청 url
115
+ * @property {string} method fetch method; PUT | POST | DELETE
116
+ * @property {object} alternateResponse 실패 시 대체응답
117
+ * @property {URLSearchParams | object} [searchParams] 요청 searchParams
118
+ * @property {HeadersInit} [headers]
119
+ * @property {BodyInit | null} [body]
120
+ * @property {object} [bodyData]
121
+ * @property {boolean} [isRawResponse]
122
+ * @property {object} [debug]
123
+ * @property {boolean} [disabled]
124
+ * @property {boolean} [disabledLog]
125
+ */
126
+ interface FetchWithBodyParams<BodyDataType = object> extends UtilQueryBaseParams {
127
+ /**
128
+ * 요청 방식
129
+ * POST, DELETE
130
+ */
131
+ method: string;
132
+ /**
133
+ * fetch 실패 시 대체 응답
134
+ */
135
+ alternateResponse: ResponseType;
136
+ /**
137
+ * 쿼리 스트링
138
+ * @desc
139
+ * - URLSearchParams 객체로 가공된 파라미터
140
+ */
141
+ searchParams?: URLSearchParams | object;
142
+ /**
143
+ * fetch Headers
144
+ */
145
+ headers?: HeadersInit;
146
+ /**
147
+ * fetch Body
148
+ */
149
+ body?: BodyInit | null;
150
+ /**
151
+ * fetch Body Data
152
+ */
153
+ bodyData?: BodyDataType;
154
+ /**
155
+ * 응답값 원본으로 return
156
+ * const responseRaw = await fetch(api);
157
+ */
158
+ isRawResponse?: boolean;
159
+ /**
160
+ * 디버그용 로그 객체
161
+ */
162
+ debug?: object;
163
+ /**
164
+ * fetch 비활성화
165
+ */
166
+ disabled?: boolean;
167
+ /**
168
+ * 로그 비활성화
169
+ */
170
+ disabledLog?: boolean;
171
+ }
172
+
63
173
  /**
64
174
  * API 요청 url 생성; GET 타입
65
175
  * @util
@@ -239,4 +349,4 @@ declare const fetchWithBody: <BodyDataType = object, ResponseType extends object
239
349
  disabledLog: boolean;
240
350
  }>) => Promise<ResponseType>;
241
351
 
242
- export { type ApiLogger, type BackendApiConfig, type CommonPostResponseType, type DomainResolver, type EnvDomainMap, type FetchBackendQueryOptions, type GenerateBackendQueryUrlOptions, type InfraKey, fetchBackendQuery, fetchWithBody, generateBackendQueryUrl_GET, getFetchOptions, getQueryString, nextAPILog };
352
+ export { type ApiLogger, type BackendApiConfig, type CommonPostResponseType, type DomainResolver, type EnvDomainMap, type FetchBackendQueryOptions, type FetchWithBodyParams, type GenerateBackendQueryUrlOptions, type GenerateGetQueryUrlParams, type InfraKey, type UtilQueryBaseParams, fetchBackendQuery, fetchWithBody, generateBackendQueryUrl_GET, getFetchOptions, getQueryString, nextAPILog };
package/dist/index.d.cts CHANGED
@@ -7,7 +7,7 @@ export { MaskDecimalSeparatorOptions, MaskNumericValue, maskBusinessCode, maskDa
7
7
  export { SitemapBase, SitemapMatchBase, getClosestRoute, getMatchRoute } from './route/index.cjs';
8
8
  export { SortableDateValue, SortableValue, sortAsc, sortDateAsc, sortDateDesc, sortDesc } from './sort/index.cjs';
9
9
  export { BuildingNoListString, NullableNumericIdentifier, NumericIdentifier, TimeFormatString, isValidArray, isValidBuildingNo, isValidBuildingNoList, isValidBusinessCode, isValidDateNumber, isValidDateType, isValidFeedMedicineCategory, isValidFirmCategory, isValidIdx, isValidNumber, isValidTimeStringFormat, isValidUuidx } from './validation/index.cjs';
10
- export { ApiLogger, BackendApiConfig, CommonPostResponseType, DomainResolver, EnvDomainMap, FetchBackendQueryOptions, GenerateBackendQueryUrlOptions, InfraKey, fetchBackendQuery, fetchWithBody, generateBackendQueryUrl_GET, getFetchOptions, getQueryString, nextAPILog } from './api/index.cjs';
10
+ export { ApiLogger, BackendApiConfig, CommonPostResponseType, DomainResolver, EnvDomainMap, FetchBackendQueryOptions, FetchWithBodyParams, GenerateBackendQueryUrlOptions, GenerateGetQueryUrlParams, InfraKey, UtilQueryBaseParams, fetchBackendQuery, fetchWithBody, generateBackendQueryUrl_GET, getFetchOptions, getQueryString, nextAPILog } from './api/index.cjs';
11
11
  export { BreakPointType, DeviceCategoryType, DisplayMode, PwaRuntimeInfo, ResponsiveDeviceStateType, ViewportOrientationStateType, checkAppleDevice, checkResponsiveDevice, checkStandaloneApp, getPwaRuntimeInfo, userAgentCollection } from './runtime-env/index.cjs';
12
12
  export { CheckboxStateMap, syncAllToEach, syncEachToAll } from './form/checkbox/index.cjs';
13
13
  export { StyleSpacingArray, StyleSpacingPrimitive, StyleSpacingType, styleBaseSize, styleMarginSize, stylePaddingSize, styleRem, styleRemAmount, styleSpacingArray, styleSpacingSize } from './style/size/index.cjs';
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { MaskDecimalSeparatorOptions, MaskNumericValue, maskBusinessCode, maskDa
7
7
  export { SitemapBase, SitemapMatchBase, getClosestRoute, getMatchRoute } from './route/index.js';
8
8
  export { SortableDateValue, SortableValue, sortAsc, sortDateAsc, sortDateDesc, sortDesc } from './sort/index.js';
9
9
  export { BuildingNoListString, NullableNumericIdentifier, NumericIdentifier, TimeFormatString, isValidArray, isValidBuildingNo, isValidBuildingNoList, isValidBusinessCode, isValidDateNumber, isValidDateType, isValidFeedMedicineCategory, isValidFirmCategory, isValidIdx, isValidNumber, isValidTimeStringFormat, isValidUuidx } from './validation/index.js';
10
- export { ApiLogger, BackendApiConfig, CommonPostResponseType, DomainResolver, EnvDomainMap, FetchBackendQueryOptions, GenerateBackendQueryUrlOptions, InfraKey, fetchBackendQuery, fetchWithBody, generateBackendQueryUrl_GET, getFetchOptions, getQueryString, nextAPILog } from './api/index.js';
10
+ export { ApiLogger, BackendApiConfig, CommonPostResponseType, DomainResolver, EnvDomainMap, FetchBackendQueryOptions, FetchWithBodyParams, GenerateBackendQueryUrlOptions, GenerateGetQueryUrlParams, InfraKey, UtilQueryBaseParams, fetchBackendQuery, fetchWithBody, generateBackendQueryUrl_GET, getFetchOptions, getQueryString, nextAPILog } from './api/index.js';
11
11
  export { BreakPointType, DeviceCategoryType, DisplayMode, PwaRuntimeInfo, ResponsiveDeviceStateType, ViewportOrientationStateType, checkAppleDevice, checkResponsiveDevice, checkStandaloneApp, getPwaRuntimeInfo, userAgentCollection } from './runtime-env/index.js';
12
12
  export { CheckboxStateMap, syncAllToEach, syncEachToAll } from './form/checkbox/index.js';
13
13
  export { StyleSpacingArray, StyleSpacingPrimitive, StyleSpacingType, styleBaseSize, styleMarginSize, stylePaddingSize, styleRem, styleRemAmount, styleSpacingArray, styleSpacingSize } from './style/size/index.js';
@@ -1,7 +1,16 @@
1
1
  type DeviceCategoryType = "apple" | "tablet" | "mobile";
2
2
  type BreakPointType = "desktop" | "tablet" | "mobile";
3
+ /**
4
+ * 반응형 기기 상태; 하드웨어 스펙 기반의 추론 값과 viewport 정보를 함께 보관한다.
5
+ */
3
6
  interface ResponsiveDeviceStateType {
7
+ /**
8
+ * 디바이스 하드웨어 타입(UA 기반 추론)
9
+ */
4
10
  hardware: BreakPointType;
11
+ /**
12
+ * 현재 viewport 기준 타입(window 크기 기반)
13
+ */
5
14
  viewport: BreakPointType;
6
15
  }
7
16
  type ViewportOrientationStateType = "portrait" | "landscape";
@@ -1,7 +1,16 @@
1
1
  type DeviceCategoryType = "apple" | "tablet" | "mobile";
2
2
  type BreakPointType = "desktop" | "tablet" | "mobile";
3
+ /**
4
+ * 반응형 기기 상태; 하드웨어 스펙 기반의 추론 값과 viewport 정보를 함께 보관한다.
5
+ */
3
6
  interface ResponsiveDeviceStateType {
7
+ /**
8
+ * 디바이스 하드웨어 타입(UA 기반 추론)
9
+ */
4
10
  hardware: BreakPointType;
11
+ /**
12
+ * 현재 viewport 기준 타입(window 크기 기반)
13
+ */
5
14
  viewport: BreakPointType;
6
15
  }
7
16
  type ViewportOrientationStateType = "portrait" | "landscape";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniai-fe/util-functions",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "TypeScript Utilities for UNIAI FE Projects",
5
5
  "type": "module",
6
6
  "private": false,
@@ -10,7 +10,7 @@
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "packageManager": "pnpm@10.25.0",
13
+ "packageManager": "pnpm@10.28.0",
14
14
  "engines": {
15
15
  "node": ">=24",
16
16
  "pnpm": ">=10"
@@ -126,7 +126,7 @@
126
126
  "@types/node": "^24.10.2",
127
127
  "@uniai-fe/eslint-config": "workspace:*",
128
128
  "@uniai-fe/tsconfig": "workspace:*",
129
- "eslint": "^9.39.1",
129
+ "eslint": "^9.39.2",
130
130
  "prettier": "^3.7.4",
131
131
  "tsup": "^8.5.1",
132
132
  "typescript": "~5.9.3"