@uniai-fe/uds-templates 0.5.24 → 0.5.26

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": "@uniai-fe/uds-templates",
3
- "version": "0.5.24",
3
+ "version": "0.5.26",
4
4
  "description": "UNIAI Design System; UI Templates Package",
5
5
  "type": "module",
6
6
  "private": false,
@@ -16,11 +16,13 @@ export const getClientCctvCompanyList = async ({
16
16
 
17
17
  export const useQueryCctvCompanyList = ({
18
18
  url,
19
+ queryKeyDeps = [],
19
20
  }: {
20
21
  url?: string;
22
+ queryKeyDeps?: readonly unknown[];
21
23
  }): UseQueryResult<API_Res_CctvCompany> =>
22
24
  useQuery({
23
- queryKey: ["cctv_company_list", url],
25
+ queryKey: ["cctv_company_list", url, ...queryKeyDeps],
24
26
  queryFn: () => getClientCctvCompanyList({ url }),
25
27
  });
26
28
 
@@ -51,7 +51,7 @@ export default function CCTVCamListItem({
51
51
  activeLiveState: true,
52
52
  activeTitle: false,
53
53
  isLive,
54
- isShared: typeof cam.cam_shared === "boolean" ? cam.cam_shared : true,
54
+ isShared: cam.is_public === true,
55
55
  title: cam.cam_name,
56
56
  }}
57
57
  footerOptions={{ activeTitle: true, activeOpenButton: true, cam }}
@@ -54,8 +54,7 @@ export default function CCTVPaginationListItem({
54
54
  activeLiveState: true,
55
55
  activeTitle: false,
56
56
  isLive,
57
- isShared:
58
- typeof cam.cam_shared === "boolean" ? cam.cam_shared : true,
57
+ isShared: cam.is_public === true,
59
58
  title: cam.cam_name,
60
59
  }}
61
60
  footerOptions={{ cam }}
@@ -51,7 +51,7 @@ export default function CCTVViewerDesktopVideo({
51
51
  activeTitle: true,
52
52
  activeCloseButton: true,
53
53
  isLive,
54
- isShared: typeof cam?.cam_shared === "boolean" ? cam.cam_shared : true,
54
+ isShared: cam?.is_public === true,
55
55
  title: cam?.cam_name,
56
56
  }}
57
57
  footerOptions={{ activeTitle: false }}
@@ -14,6 +14,7 @@ import type {
14
14
  * @hook
15
15
  * @param {UseCctvCompanyDataParams} [params] 훅 파라미터
16
16
  * @property {string} [url] 회사 리스트 API URL (Provider에서 주입된 기본값 대신 사용)
17
+ * @property {readonly unknown[]} [queryKeyDeps] 회사 리스트 캐시 분리용 query key deps
17
18
  * @return {UseCctvCompanyDataReturn} 회사 리스트 쿼리 반환값
18
19
  * @desc
19
20
  * return {
@@ -26,8 +27,8 @@ import type {
26
27
  export default function useCctvCompanyData(
27
28
  params?: UseCctvCompanyDataParams,
28
29
  ): UseCctvCompanyDataReturn {
29
- // 변경: list 조회 계약은 URL override 대상으로 유지한다.
30
- const { url } = params || {};
30
+ // 변경: list 조회 계약은 URL override 캐시 분리 deps만 소비한다.
31
+ const { url, queryKeyDeps } = params || {};
31
32
 
32
33
  const { listUrl } = useCctvApiUrl();
33
34
  const resolvedUrl = useMemo(() => url ?? listUrl, [url, listUrl]);
@@ -36,6 +37,7 @@ export default function useCctvCompanyData(
36
37
  // URL에 맞춰 회사 리스트 API를 호출한다.
37
38
  const { data, isFetching, isError, ...rest } = useQueryCctvCompanyList({
38
39
  url: resolvedUrl,
40
+ queryKeyDeps,
39
41
  });
40
42
 
41
43
  // 응답 데이터를 react-hook-form rawData 필드로 반영한다.
@@ -118,8 +118,6 @@ export default function useCctvContext(): UseCctvContextReturn {
118
118
  onSelect: () => onSelectCompany(d.company_id),
119
119
  cam_list: d.cam_list.map((cam: CctvCompanyCameraList) => ({
120
120
  ...cam,
121
- cam_shared:
122
- typeof cam.cam_shared === "boolean" ? cam.cam_shared : true,
123
121
  selected: cam.cam_id === selectedCamId,
124
122
  onSelect: () => onOpenCamera(cam.cam_id),
125
123
  })),
@@ -1,5 +1,4 @@
1
1
  import type { API_Res_Base } from "@uniai-fe/util-api";
2
- import type { UtilQueryBaseParams } from "@uniai-fe/util-functions";
3
2
  import type { NextRequest } from "next/server";
4
3
 
5
4
  /**
@@ -29,44 +28,180 @@ export interface API_Req_GetCompanyListParams {
29
28
  }
30
29
 
31
30
  /**
32
- * CCTV: 업체에 설치된 카메라 목록
31
+ * CCTV; 카메라 식별 응답 구조
33
32
  * @property {string} cam_id 카메라 id코드
34
- * @property {string} cam_name 카메라 별칭
35
- * @property {boolean} cam_online 카메라 설치상태
36
- * @property {string} [cam_rtc] 카메라 스트리밍 WebRTC 경로
37
- * @property {string} [cam_rtcp] 카메라 RTCP 경로
38
- * @property {boolean} [cam_shared] 카메라 외부공유 여부
39
33
  */
40
- export interface API_Res_CctvCompanyCameraList {
41
- // API 응답은 데이터-only 구조이므로 UI 전용 콜백은 포함하지 않는다.
34
+ export interface API_Res_CctvCameraIdentity {
42
35
  /**
43
36
  * 카메라 ID (번호)
44
37
  */
45
38
  cam_id: string;
39
+ }
40
+
41
+ /**
42
+ * CCTV; 카메라 기본 메타데이터 응답 구조
43
+ * @property {string} cam_id 카메라 id코드
44
+ * @property {string} cam_name 카메라 별칭
45
+ */
46
+ export interface API_Res_CctvCameraMeta extends API_Res_CctvCameraIdentity {
46
47
  /**
47
48
  * 카메라 이름
48
49
  * ex) 1동, 2동, ..., 외부1, 외부2, ...
49
50
  */
50
51
  cam_name: string;
52
+ }
53
+
54
+ /**
55
+ * CCTV; 카메라 스트림 path 응답 구조
56
+ * @property {string} stream_path 카메라 스트림 path
57
+ */
58
+ export interface API_Res_CctvCameraStreamPath {
51
59
  /**
52
- * 카메라 설치 상태
60
+ * 스트림 path
61
+ * ex) cam1, cam7
53
62
  */
54
- cam_online: boolean;
63
+ stream_path: string;
64
+ }
65
+
66
+ /**
67
+ * CCTV; 카메라 RTC/RTSP 경로 응답 구조
68
+ * @property {string} cam_rtc 카메라 스트리밍 WebRTC 경로
69
+ * @property {string} cam_rtcp 카메라 RTCP 경로
70
+ * @property {string} cam_rtsp 카메라 RTSP 경로
71
+ */
72
+ export interface API_Res_CctvCameraRtc {
55
73
  /**
56
74
  * RTC 경로
57
75
  * https://{company_id}.rtc.uniai.com/cam{cam_id}
58
76
  */
59
- cam_rtc?: string;
77
+ cam_rtc: string;
60
78
  /**
61
79
  * RTCP 경로
62
80
  */
63
- cam_rtcp?: string;
81
+ cam_rtcp: string;
64
82
  /**
65
- * 외부공유 상태
83
+ * RTSP 경로
66
84
  */
67
- cam_shared?: boolean;
85
+ cam_rtsp: string;
68
86
  }
69
87
 
88
+ /**
89
+ * CCTV; 카메라 스트림 경로 응답 구조
90
+ * @property {string} stream_path 카메라 스트림 path
91
+ * @property {string} cam_rtc 카메라 스트리밍 WebRTC 경로
92
+ * @property {string} cam_rtcp 카메라 RTCP 경로
93
+ * @property {string} cam_rtsp 카메라 RTSP 경로
94
+ */
95
+ export interface API_Res_CctvCameraStream
96
+ extends API_Res_CctvCameraStreamPath, API_Res_CctvCameraRtc {}
97
+
98
+ /**
99
+ * CCTV; 카메라 외부공유 응답 구조
100
+ * @property {boolean} is_public 카메라 외부공유 여부
101
+ */
102
+ export interface API_Res_CctvCameraVisibility {
103
+ /**
104
+ * 카메라 외부공유 여부
105
+ */
106
+ is_public: boolean;
107
+ }
108
+
109
+ /**
110
+ * CCTV; 카메라 외부시청 상태 응답 구조
111
+ * @property {boolean} is_watching 외부시청 중 여부
112
+ * @property {number} viewer_count 현재 외부시청 세션 수
113
+ */
114
+ export interface API_Res_CctvCameraViewerStatus {
115
+ /**
116
+ * 외부시청 중 여부
117
+ */
118
+ is_watching: boolean;
119
+ /**
120
+ * 현재 외부시청 세션 수
121
+ */
122
+ viewer_count: number;
123
+ }
124
+
125
+ /**
126
+ * CCTV; 카메라 목록의 각 카메라 응답 데이터
127
+ * @property {string} cam_id
128
+ * @property {string} cam_name
129
+ * @property {string} cam_rtc
130
+ * @property {string} cam_rtcp
131
+ * @property {string} cam_rtsp
132
+ * @property {string} stream_path
133
+ * @property {boolean} is_public
134
+ * @property {boolean} is_watching
135
+ * @property {number} viewer_count
136
+ */
137
+ export interface API_Res_CctvCameraData
138
+ extends
139
+ API_Res_CctvCameraMeta,
140
+ API_Res_CctvCameraStream,
141
+ API_Res_CctvCameraVisibility,
142
+ API_Res_CctvCameraViewerStatus {}
143
+
144
+ /**
145
+ * CCTV: 업체에 설치된 카메라 목록
146
+ * @property {string} cam_id 카메라 id코드
147
+ * @property {string} cam_name 카메라 별칭
148
+ * @property {boolean} cam_online 카메라 설치상태
149
+ * @property {string} cam_rtc 카메라 스트리밍 WebRTC 경로
150
+ * @property {string} cam_rtcp 카메라 RTCP 경로
151
+ * @property {string} cam_rtsp 카메라 RTSP 경로
152
+ * @property {string} stream_path 카메라 스트림 path
153
+ * @property {boolean} is_public 카메라 외부공유 여부
154
+ * @property {boolean} is_watching 외부시청 중 여부
155
+ * @property {number} viewer_count 현재 외부시청 세션 수
156
+ */
157
+ export interface API_Res_CctvCompanyCameraList extends API_Res_CctvCameraData {
158
+ // API 응답은 데이터-only 구조이므로 UI 전용 콜백은 포함하지 않는다.
159
+ /**
160
+ * 카메라 설치 상태
161
+ */
162
+ cam_online: boolean;
163
+ }
164
+
165
+ /**
166
+ * CCTV; 카메라 외부시청 상태 응답 데이터
167
+ * @property {string} company_id 업체 id코드
168
+ * @property {string} cam_id 카메라 id코드
169
+ * @property {string} stream_path 카메라 스트림 path
170
+ * @property {boolean} is_public 카메라 외부공유 여부
171
+ * @property {boolean} is_watching 외부시청 중 여부
172
+ * @property {number} viewer_count 현재 외부시청 세션 수
173
+ */
174
+ export interface API_Res_CctvViewerStatusData
175
+ extends
176
+ API_Res_CctvCameraIdentity,
177
+ API_Res_CctvCameraStreamPath,
178
+ API_Res_CctvCameraVisibility,
179
+ API_Res_CctvCameraViewerStatus {
180
+ /**
181
+ * 업체 ID
182
+ */
183
+ company_id: string;
184
+ /**
185
+ * 스트림 path
186
+ */
187
+ stream_path: string;
188
+ /**
189
+ * 외부시청 중 여부
190
+ */
191
+ is_watching: boolean;
192
+ /**
193
+ * 현재 외부시청 세션 수
194
+ */
195
+ viewer_count: number;
196
+ }
197
+
198
+ /**
199
+ * CCTV; 카메라 외부시청 상태 응답
200
+ * @typedef {API_Res_Base<API_Res_CctvViewerStatusData>} API_Res_CctvViewerStatus
201
+ */
202
+ export type API_Res_CctvViewerStatus =
203
+ API_Res_Base<API_Res_CctvViewerStatusData>;
204
+
70
205
  /**
71
206
  * CCTV; 각 분야그룹의 업체목록
72
207
  * @property {string} company_id 업체 id코드 (a.k.a site)
@@ -277,10 +412,15 @@ export type API_Req_CctvTokenPreset = Partial<
277
412
  Pick<API_Req_CctvRtcTokenOrigin, "password" | "ttl_seconds" | "kid">
278
413
  >;
279
414
 
280
- export interface API_Req_GetCctvTokenParams extends Omit<
281
- UtilQueryBaseParams,
282
- "queryUrl"
283
- > {
415
+ export interface API_Req_GetCctvTokenParams {
416
+ /**
417
+ * API 도메인
418
+ */
419
+ domain: string;
420
+ /**
421
+ * Next.js /app/api 라우트 주소
422
+ */
423
+ routeUrl: string;
284
424
  /**
285
425
  * 백엔드 요청 url
286
426
  */
@@ -114,12 +114,17 @@ export interface UseCctvRtcStreamReturn extends UseCctvRtcStreamState {
114
114
  /**
115
115
  * CCTV; useCctvCompanyData params
116
116
  * @property {string} [url] 업체 리스트 API URL
117
+ * @property {readonly unknown[]} [queryKeyDeps] 업체 리스트 캐시 분리용 query key deps
117
118
  */
118
119
  export interface UseCctvCompanyDataParams {
119
120
  /**
120
121
  * 업체 리스트 API URL
121
122
  */
122
123
  url?: string;
124
+ /**
125
+ * 업체 리스트 캐시 분리용 query key deps
126
+ */
127
+ queryKeyDeps?: readonly unknown[];
123
128
  }
124
129
 
125
130
  /**
@@ -13,6 +13,11 @@ import type {
13
13
  * @property {boolean} cam_online 카메라 설치상태
14
14
  * @property {string} [cam_rtc] 카메라 스트리밍 WebRTC 경로
15
15
  * @property {string} [cam_rtcp] 카메라 RTCP 경로
16
+ * @property {string} [cam_rtsp] 카메라 RTSP 경로
17
+ * @property {string} [stream_path] 카메라 스트림 path
18
+ * @property {boolean} is_public 카메라 외부공유 여부
19
+ * @property {boolean} [is_watching] 외부시청 중 여부
20
+ * @property {number} [viewer_count] 현재 외부시청 세션 수
16
21
  */
17
22
  export interface CctvCompanyCameraData extends API_Res_CctvCompanyCameraList {
18
23
  /**
@@ -44,6 +49,11 @@ export interface CctvCompanyCameraData extends API_Res_CctvCompanyCameraList {
44
49
  * @property {boolean} cam_online 카메라 설치상태
45
50
  * @property {string} [cam_rtc] 카메라 스트리밍 WebRTC 경로
46
51
  * @property {string} [cam_rtcp] 카메라 RTCP 경로
52
+ * @property {string} [cam_rtsp] 카메라 RTSP 경로
53
+ * @property {string} [stream_path] 카메라 스트림 path
54
+ * @property {boolean} is_public 카메라 외부공유 여부
55
+ * @property {boolean} [is_watching] 외부시청 중 여부
56
+ * @property {number} [viewer_count] 현재 외부시청 세션 수
47
57
  */
48
58
  export interface CctvCompanyCameraList extends CctvCompanyCameraData {
49
59
  /**
@@ -193,7 +193,11 @@ export interface CctvVideoTemplateProps extends CctvVideoStateProps {
193
193
  * @property {boolean} cam_online 카메라 online 여부
194
194
  * @property {string} [cam_rtc] 카메라 rtc 경로
195
195
  * @property {string} [cam_rtcp] 카메라 rtcp 경로
196
- * @property {boolean} [cam_shared] 카메라 외부공유 여부
196
+ * @property {string} [cam_rtsp] 카메라 RTSP 경로
197
+ * @property {string} [stream_path] 카메라 스트림 path
198
+ * @property {boolean} is_public 카메라 외부공유 여부
199
+ * @property {boolean} [is_watching] 외부시청 중 여부
200
+ * @property {number} [viewer_count] 현재 외부시청 세션 수
197
201
  * @property {string} [company_id] 소속 업체 id
198
202
  * @property {string} [company_name] 소속 업체명
199
203
  */