@spfn/cms 0.1.0-alpha.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.
Files changed (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +490 -0
  3. package/dist/actions.d.ts +9 -0
  4. package/dist/actions.d.ts.map +1 -0
  5. package/dist/actions.js +11 -0
  6. package/dist/actions.js.map +1 -0
  7. package/dist/client.d.ts +138 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +62 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/cms.config.d.ts +77 -0
  12. package/dist/cms.config.d.ts.map +1 -0
  13. package/dist/cms.config.js +111 -0
  14. package/dist/cms.config.js.map +1 -0
  15. package/dist/entities/cms-audit-logs.d.ts +213 -0
  16. package/dist/entities/cms-audit-logs.d.ts.map +1 -0
  17. package/dist/entities/cms-audit-logs.js +103 -0
  18. package/dist/entities/cms-audit-logs.js.map +1 -0
  19. package/dist/entities/cms-draft-cache.d.ts +188 -0
  20. package/dist/entities/cms-draft-cache.d.ts.map +1 -0
  21. package/dist/entities/cms-draft-cache.js +112 -0
  22. package/dist/entities/cms-draft-cache.js.map +1 -0
  23. package/dist/entities/cms-label-values.d.ts +192 -0
  24. package/dist/entities/cms-label-values.d.ts.map +1 -0
  25. package/dist/entities/cms-label-values.js +105 -0
  26. package/dist/entities/cms-label-values.js.map +1 -0
  27. package/dist/entities/cms-label-versions.d.ts +207 -0
  28. package/dist/entities/cms-label-versions.d.ts.map +1 -0
  29. package/dist/entities/cms-label-versions.js +80 -0
  30. package/dist/entities/cms-label-versions.js.map +1 -0
  31. package/dist/entities/cms-labels.d.ts +189 -0
  32. package/dist/entities/cms-labels.d.ts.map +1 -0
  33. package/dist/entities/cms-labels.js +48 -0
  34. package/dist/entities/cms-labels.js.map +1 -0
  35. package/dist/entities/cms-published-cache.d.ts +199 -0
  36. package/dist/entities/cms-published-cache.d.ts.map +1 -0
  37. package/dist/entities/cms-published-cache.js +103 -0
  38. package/dist/entities/cms-published-cache.js.map +1 -0
  39. package/dist/entities/index.d.ts +10 -0
  40. package/dist/entities/index.d.ts.map +1 -0
  41. package/dist/entities/index.js +10 -0
  42. package/dist/entities/index.js.map +1 -0
  43. package/dist/generators/index.d.ts +19 -0
  44. package/dist/generators/index.d.ts.map +1 -0
  45. package/dist/generators/index.js +19 -0
  46. package/dist/generators/index.js.map +1 -0
  47. package/dist/generators/label-sync-generator.d.ts +33 -0
  48. package/dist/generators/label-sync-generator.d.ts.map +1 -0
  49. package/dist/generators/label-sync-generator.js +86 -0
  50. package/dist/generators/label-sync-generator.js.map +1 -0
  51. package/dist/helpers/locale.actions.d.ts +132 -0
  52. package/dist/helpers/locale.actions.d.ts.map +1 -0
  53. package/dist/helpers/locale.actions.js +210 -0
  54. package/dist/helpers/locale.actions.js.map +1 -0
  55. package/dist/helpers/locale.constants.d.ts +10 -0
  56. package/dist/helpers/locale.constants.d.ts.map +1 -0
  57. package/dist/helpers/locale.constants.js +10 -0
  58. package/dist/helpers/locale.constants.js.map +1 -0
  59. package/dist/helpers/locale.d.ts +17 -0
  60. package/dist/helpers/locale.d.ts.map +1 -0
  61. package/dist/helpers/locale.js +20 -0
  62. package/dist/helpers/locale.js.map +1 -0
  63. package/dist/helpers/sync.d.ts +41 -0
  64. package/dist/helpers/sync.d.ts.map +1 -0
  65. package/dist/helpers/sync.js +309 -0
  66. package/dist/helpers/sync.js.map +1 -0
  67. package/dist/index.d.ts +20 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +24 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/init.d.ts +31 -0
  72. package/dist/init.d.ts.map +1 -0
  73. package/dist/init.js +36 -0
  74. package/dist/init.js.map +1 -0
  75. package/dist/labels/helpers.d.ts +31 -0
  76. package/dist/labels/helpers.d.ts.map +1 -0
  77. package/dist/labels/helpers.js +60 -0
  78. package/dist/labels/helpers.js.map +1 -0
  79. package/dist/labels/index.d.ts +7 -0
  80. package/dist/labels/index.d.ts.map +1 -0
  81. package/dist/labels/index.js +7 -0
  82. package/dist/labels/index.js.map +1 -0
  83. package/dist/repositories/cms-draft-cache.repository.d.ts +62 -0
  84. package/dist/repositories/cms-draft-cache.repository.d.ts.map +1 -0
  85. package/dist/repositories/cms-draft-cache.repository.js +56 -0
  86. package/dist/repositories/cms-draft-cache.repository.js.map +1 -0
  87. package/dist/repositories/cms-label-values.repository.d.ts +32 -0
  88. package/dist/repositories/cms-label-values.repository.d.ts.map +1 -0
  89. package/dist/repositories/cms-label-values.repository.js +72 -0
  90. package/dist/repositories/cms-label-values.repository.js.map +1 -0
  91. package/dist/repositories/cms-labels.repository.d.ts +53 -0
  92. package/dist/repositories/cms-labels.repository.d.ts.map +1 -0
  93. package/dist/repositories/cms-labels.repository.js +77 -0
  94. package/dist/repositories/cms-labels.repository.js.map +1 -0
  95. package/dist/repositories/cms-published-cache.repository.d.ts +53 -0
  96. package/dist/repositories/cms-published-cache.repository.d.ts.map +1 -0
  97. package/dist/repositories/cms-published-cache.repository.js +54 -0
  98. package/dist/repositories/cms-published-cache.repository.js.map +1 -0
  99. package/dist/repositories/index.d.ts +8 -0
  100. package/dist/repositories/index.d.ts.map +1 -0
  101. package/dist/repositories/index.js +9 -0
  102. package/dist/repositories/index.js.map +1 -0
  103. package/dist/routes/labels/[id]/contract.d.ts +68 -0
  104. package/dist/routes/labels/[id]/contract.d.ts.map +1 -0
  105. package/dist/routes/labels/[id]/contract.js +84 -0
  106. package/dist/routes/labels/[id]/contract.js.map +1 -0
  107. package/dist/routes/labels/[id]/index.d.ts +10 -0
  108. package/dist/routes/labels/[id]/index.d.ts.map +1 -0
  109. package/dist/routes/labels/[id]/index.js +96 -0
  110. package/dist/routes/labels/[id]/index.js.map +1 -0
  111. package/dist/routes/labels/by-key/[key]/contract.d.ts +24 -0
  112. package/dist/routes/labels/by-key/[key]/contract.d.ts.map +1 -0
  113. package/dist/routes/labels/by-key/[key]/contract.js +28 -0
  114. package/dist/routes/labels/by-key/[key]/contract.js.map +1 -0
  115. package/dist/routes/labels/by-key/[key]/index.d.ts +8 -0
  116. package/dist/routes/labels/by-key/[key]/index.d.ts.map +1 -0
  117. package/dist/routes/labels/by-key/[key]/index.js +32 -0
  118. package/dist/routes/labels/by-key/[key]/index.js.map +1 -0
  119. package/dist/routes/labels/contract.d.ts +59 -0
  120. package/dist/routes/labels/contract.d.ts.map +1 -0
  121. package/dist/routes/labels/contract.js +75 -0
  122. package/dist/routes/labels/contract.js.map +1 -0
  123. package/dist/routes/labels/index.d.ts +10 -0
  124. package/dist/routes/labels/index.d.ts.map +1 -0
  125. package/dist/routes/labels/index.js +73 -0
  126. package/dist/routes/labels/index.js.map +1 -0
  127. package/dist/routes/published-cache/contract.d.ts +25 -0
  128. package/dist/routes/published-cache/contract.d.ts.map +1 -0
  129. package/dist/routes/published-cache/contract.js +35 -0
  130. package/dist/routes/published-cache/contract.js.map +1 -0
  131. package/dist/routes/published-cache/index.d.ts +8 -0
  132. package/dist/routes/published-cache/index.d.ts.map +1 -0
  133. package/dist/routes/published-cache/index.js +33 -0
  134. package/dist/routes/published-cache/index.js.map +1 -0
  135. package/dist/routes/sync/contract.d.ts +33 -0
  136. package/dist/routes/sync/contract.d.ts.map +1 -0
  137. package/dist/routes/sync/contract.js +34 -0
  138. package/dist/routes/sync/contract.js.map +1 -0
  139. package/dist/routes/sync/index.d.ts +13 -0
  140. package/dist/routes/sync/index.d.ts.map +1 -0
  141. package/dist/routes/sync/index.js +241 -0
  142. package/dist/routes/sync/index.js.map +1 -0
  143. package/dist/routes/values/[labelId]/[version]/contract.d.ts +29 -0
  144. package/dist/routes/values/[labelId]/[version]/contract.d.ts.map +1 -0
  145. package/dist/routes/values/[labelId]/[version]/contract.js +33 -0
  146. package/dist/routes/values/[labelId]/[version]/contract.js.map +1 -0
  147. package/dist/routes/values/[labelId]/[version]/index.d.ts +8 -0
  148. package/dist/routes/values/[labelId]/[version]/index.d.ts.map +1 -0
  149. package/dist/routes/values/[labelId]/[version]/index.js +45 -0
  150. package/dist/routes/values/[labelId]/[version]/index.js.map +1 -0
  151. package/dist/routes/values/[labelId]/contract.d.ts +38 -0
  152. package/dist/routes/values/[labelId]/contract.d.ts.map +1 -0
  153. package/dist/routes/values/[labelId]/contract.js +59 -0
  154. package/dist/routes/values/[labelId]/contract.js.map +1 -0
  155. package/dist/routes/values/[labelId]/index.d.ts +8 -0
  156. package/dist/routes/values/[labelId]/index.d.ts.map +1 -0
  157. package/dist/routes/values/[labelId]/index.js +42 -0
  158. package/dist/routes/values/[labelId]/index.js.map +1 -0
  159. package/dist/server.d.ts +99 -0
  160. package/dist/server.d.ts.map +1 -0
  161. package/dist/server.js +256 -0
  162. package/dist/server.js.map +1 -0
  163. package/dist/store.d.ts +87 -0
  164. package/dist/store.d.ts.map +1 -0
  165. package/dist/store.js +205 -0
  166. package/dist/store.js.map +1 -0
  167. package/dist/sync.d.ts +11 -0
  168. package/dist/sync.d.ts.map +1 -0
  169. package/dist/sync.js +179 -0
  170. package/dist/sync.js.map +1 -0
  171. package/dist/types.d.ts +74 -0
  172. package/dist/types.d.ts.map +1 -0
  173. package/dist/types.js +7 -0
  174. package/dist/types.js.map +1 -0
  175. package/package.json +95 -0
@@ -0,0 +1,20 @@
1
+ import "server-only";
2
+ /**
3
+ * @spfn/cms
4
+ *
5
+ * Backend + Server Components
6
+ * 백엔드 및 서버 컴포넌트 전용 (서버에서만 실행)
7
+ *
8
+ * For client components, use: import { ... } from '@spfn/cms/client'
9
+ */
10
+ export { getCmsConfig, configureCms, resetCmsConfig } from './cms.config.js';
11
+ export type { CmsConfig } from './cms.config.js';
12
+ export * from './server';
13
+ export type { SectionData, SectionAPI } from './server';
14
+ export * from './repositories';
15
+ export * from './entities';
16
+ export { syncSection, syncAll, initLabelSync, loadLabelsFromJson } from './helpers/sync';
17
+ export * from './labels';
18
+ export { createLabelSyncGenerator, LabelSyncGenerator } from './generators/label-sync-generator';
19
+ export type * from './types';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB;;;;;;;GAOG;AAGH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGxD,cAAc,gBAAgB,CAAC;AAG/B,cAAc,YAAY,CAAC;AAG3B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGzF,cAAc,UAAU,CAAC;AAGzB,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAGjG,mBAAmB,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ import "server-only";
2
+ /**
3
+ * @spfn/cms
4
+ *
5
+ * Backend + Server Components
6
+ * 백엔드 및 서버 컴포넌트 전용 (서버에서만 실행)
7
+ *
8
+ * For client components, use: import { ... } from '@spfn/cms/client'
9
+ */
10
+ // Configuration API
11
+ export { getCmsConfig, configureCms, resetCmsConfig } from './cms.config.js';
12
+ // Server Components API (React Server Components)
13
+ export * from './server';
14
+ // Backend: Repositories (DB access)
15
+ export * from './repositories';
16
+ // Backend: Entities (DB schemas)
17
+ export * from './entities';
18
+ // Backend: Sync utilities (server startup, CLI scripts)
19
+ export { syncSection, syncAll, initLabelSync, loadLabelsFromJson } from './helpers/sync';
20
+ // Backend: Label helpers (for processing JSON labels)
21
+ export * from './labels';
22
+ // Backend: Codegen generators (for development)
23
+ export { createLabelSyncGenerator, LabelSyncGenerator } from './generators/label-sync-generator';
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB;;;;;;;GAOG;AAEH,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG7E,kDAAkD;AAClD,cAAc,UAAU,CAAC;AAGzB,oCAAoC;AACpC,cAAc,gBAAgB,CAAC;AAE/B,iCAAiC;AACjC,cAAc,YAAY,CAAC;AAE3B,wDAAwD;AACxD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzF,sDAAsD;AACtD,cAAc,UAAU,CAAC;AAEzB,gDAAgD;AAChD,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC"}
package/dist/init.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * CMS Store Initializer
3
+ *
4
+ * 서버 컴포넌트에서 로드한 섹션 데이터를 클라이언트 store에 초기화
5
+ */
6
+ import type { SectionAPI } from './server';
7
+ interface InitCmsProps {
8
+ /**
9
+ * 서버에서 로드한 섹션 데이터
10
+ * { home: { t, data }, ... }
11
+ */
12
+ sections: Record<string, SectionAPI>;
13
+ }
14
+ /**
15
+ * CMS Store 초기화 컴포넌트
16
+ *
17
+ * 서버 컴포넌트에서 로드한 데이터를 클라이언트 store에 주입
18
+ * 이후 하위 클라이언트 컴포넌트에서 useSection() 사용 가능
19
+ *
20
+ * @param props - InitCmsProps
21
+ * @param props.sections - 서버에서 로드한 섹션 데이터
22
+ *
23
+ * @example
24
+ * // Server Component
25
+ * const home = await getSection('home');
26
+ * <InitCms sections={{ home }} />
27
+ * // 이후 하위 클라이언트 컴포넌트에서 useSection('home') 사용 가능
28
+ */
29
+ export declare function InitCms({ sections }: InitCmsProps): null;
30
+ export {};
31
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,UAAU,YAAY;IAElB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACxC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,YAAY,QAiBjD"}
package/dist/init.js ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * CMS Store Initializer
3
+ *
4
+ * 서버 컴포넌트에서 로드한 섹션 데이터를 클라이언트 store에 초기화
5
+ */
6
+ 'use client';
7
+ import { useEffect } from 'react';
8
+ import { useCmsStore } from './store';
9
+ /**
10
+ * CMS Store 초기화 컴포넌트
11
+ *
12
+ * 서버 컴포넌트에서 로드한 데이터를 클라이언트 store에 주입
13
+ * 이후 하위 클라이언트 컴포넌트에서 useSection() 사용 가능
14
+ *
15
+ * @param props - InitCmsProps
16
+ * @param props.sections - 서버에서 로드한 섹션 데이터
17
+ *
18
+ * @example
19
+ * // Server Component
20
+ * const home = await getSection('home');
21
+ * <InitCms sections={{ home }} />
22
+ * // 이후 하위 클라이언트 컴포넌트에서 useSection('home') 사용 가능
23
+ */
24
+ export function InitCms({ sections }) {
25
+ const setSections = useCmsStore((state) => state.setSections);
26
+ useEffect(() => {
27
+ // SectionAPI → SectionData 변환
28
+ const sectionsData = {};
29
+ Object.entries(sections).forEach(([key, { data }]) => {
30
+ sectionsData[key] = data;
31
+ });
32
+ setSections(sectionsData);
33
+ }, [sections, setSections]);
34
+ return null;
35
+ }
36
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAYtC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,QAAQ,EAAgB;IAE9C,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAE9D,SAAS,CAAC,GAAG,EAAE;QAEX,8BAA8B;QAC9B,MAAM,YAAY,GAAwB,EAAE,CAAC;QAC7C,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;YAEjD,YAAY,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,WAAW,CAAC,YAAY,CAAC,CAAC;IAC9B,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAE5B,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * CMS Label Helpers
3
+ *
4
+ * Utilities for processing label definitions from JSON files
5
+ */
6
+ import type { SectionDefinition, NestedLabels, FlatLabel } from '../types';
7
+ /**
8
+ * 중첩된 라벨을 플랫화
9
+ *
10
+ * @param labels - 중첩된 라벨 객체
11
+ * @returns 플랫화된 라벨 배열
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * flattenLabels({
16
+ * nav: {
17
+ * home: { key: 'layout.nav.home', defaultValue: 'Home' },
18
+ * },
19
+ * });
20
+ * // => [{ key: 'layout.nav.home', defaultValue: 'Home' }]
21
+ * ```
22
+ */
23
+ export declare function flattenLabels(labels: NestedLabels): FlatLabel[];
24
+ /**
25
+ * 섹션 정의에서 모든 라벨 추출
26
+ *
27
+ * @param definition - 섹션 정의
28
+ * @returns 플랫화된 라벨 배열
29
+ */
30
+ export declare function extractLabels(definition: SectionDefinition): FlatLabel[];
31
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/labels/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,SAAS,EAAmB,MAAM,UAAU,CAAC;AAE5F;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,EAAE,CAwC/D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,iBAAiB,GAAG,SAAS,EAAE,CAGxE"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * CMS Label Helpers
3
+ *
4
+ * Utilities for processing label definitions from JSON files
5
+ */
6
+ /**
7
+ * 중첩된 라벨을 플랫화
8
+ *
9
+ * @param labels - 중첩된 라벨 객체
10
+ * @returns 플랫화된 라벨 배열
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * flattenLabels({
15
+ * nav: {
16
+ * home: { key: 'layout.nav.home', defaultValue: 'Home' },
17
+ * },
18
+ * });
19
+ * // => [{ key: 'layout.nav.home', defaultValue: 'Home' }]
20
+ * ```
21
+ */
22
+ export function flattenLabels(labels) {
23
+ const result = [];
24
+ function isLabelDefinition(obj) {
25
+ return ('key' in obj &&
26
+ 'defaultValue' in obj &&
27
+ typeof obj.key === 'string' &&
28
+ (typeof obj.defaultValue === 'string' || typeof obj.defaultValue === 'object'));
29
+ }
30
+ function traverse(obj) {
31
+ if (isLabelDefinition(obj)) {
32
+ // LabelDefinition인 경우
33
+ result.push({
34
+ key: obj.key,
35
+ defaultValue: obj.defaultValue,
36
+ description: obj.description,
37
+ });
38
+ }
39
+ else {
40
+ // NestedLabels인 경우
41
+ Object.values(obj).forEach((value) => {
42
+ if (typeof value === 'object' && value !== null) {
43
+ traverse(value);
44
+ }
45
+ });
46
+ }
47
+ }
48
+ traverse(labels);
49
+ return result;
50
+ }
51
+ /**
52
+ * 섹션 정의에서 모든 라벨 추출
53
+ *
54
+ * @param definition - 섹션 정의
55
+ * @returns 플랫화된 라벨 배열
56
+ */
57
+ export function extractLabels(definition) {
58
+ return flattenLabels(definition.labels);
59
+ }
60
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/labels/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAAC,MAAoB;IAE9C,MAAM,MAAM,GAAgB,EAAE,CAAC;IAE/B,SAAS,iBAAiB,CAAC,GAAmC;QAE1D,OAAO,CACH,KAAK,IAAI,GAAG;YACZ,cAAc,IAAI,GAAG;YACrB,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ;YAC3B,CAAC,OAAO,GAAG,CAAC,YAAY,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,YAAY,KAAK,QAAQ,CAAC,CACjF,CAAC;IACN,CAAC;IAED,SAAS,QAAQ,CAAC,GAAmC;QAEjD,IAAI,iBAAiB,CAAC,GAAG,CAAC,EAC1B,CAAC;YACG,sBAAsB;YACtB,MAAM,CAAC,IAAI,CAAC;gBACR,GAAG,EAAE,GAAG,CAAC,GAAG;gBACZ,YAAY,EAAE,GAAG,CAAC,YAAY;gBAC9B,WAAW,EAAE,GAAG,CAAC,WAAW;aAC/B,CAAC,CAAC;QACP,CAAC;aAED,CAAC;YACG,mBAAmB;YACnB,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAEjC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAC/C,CAAC;oBACG,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACpB,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjB,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,UAA6B;IAEvD,OAAO,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * CMS Labels Helpers
3
+ *
4
+ * 라벨 정의를 위한 헬퍼 함수들
5
+ */
6
+ export * from './helpers';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/labels/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,WAAW,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * CMS Labels Helpers
3
+ *
4
+ * 라벨 정의를 위한 헬퍼 함수들
5
+ */
6
+ export * from './helpers';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/labels/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,WAAW,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * CMS Draft Cache Repository
3
+ *
4
+ * 관리자별 초안 캐시 관리 (동시 편집 지원)
5
+ */
6
+ import { type NewCmsDraftCache } from '../entities';
7
+ /**
8
+ * 섹션 + 언어 + 사용자로 초안 캐시 조회
9
+ */
10
+ export declare function findByUser(section: string, locale: string, userId: string): Promise<{
11
+ section: string;
12
+ id: number;
13
+ updatedAt: Date;
14
+ locale: string;
15
+ content: unknown;
16
+ userId: string;
17
+ } | null>;
18
+ /**
19
+ * 초안 캐시 생성 또는 업데이트 (UPSERT)
20
+ */
21
+ export declare function upsert(data: NewCmsDraftCache): Promise<{
22
+ section: string;
23
+ id: number;
24
+ updatedAt: Date;
25
+ locale: string;
26
+ content: unknown;
27
+ userId: string;
28
+ }>;
29
+ /**
30
+ * 특정 사용자의 모든 초안 조회
31
+ */
32
+ export declare function findAllByUser(userId: string): Promise<{
33
+ section: string;
34
+ id: number;
35
+ updatedAt: Date;
36
+ locale: string;
37
+ content: unknown;
38
+ userId: string;
39
+ }[]>;
40
+ /**
41
+ * 초안 삭제
42
+ */
43
+ export declare function deleteByUser(section: string, locale: string, userId: string): Promise<void>;
44
+ /**
45
+ * 오래된 초안 정리 (30일 이상 미사용)
46
+ */
47
+ export declare function cleanupOldDrafts(daysOld?: number): Promise<{
48
+ section: string;
49
+ id: number;
50
+ updatedAt: Date;
51
+ locale: string;
52
+ content: unknown;
53
+ userId: string;
54
+ }[]>;
55
+ export declare const cmsDraftCacheRepository: {
56
+ findByUser: typeof findByUser;
57
+ upsert: typeof upsert;
58
+ findAllByUser: typeof findAllByUser;
59
+ deleteByUser: typeof deleteByUser;
60
+ cleanupOldDrafts: typeof cleanupOldDrafts;
61
+ };
62
+ //# sourceMappingURL=cms-draft-cache.repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cms-draft-cache.repository.d.ts","sourceRoot":"","sources":["../../src/repositories/cms-draft-cache.repository.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEnE;;GAEG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;UAU/E;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,gBAAgB;;;;;;;GASlD;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM;;;;;;;KAKjD;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAUjF;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,GAAE,MAAW;;;;;;;KAS1D;AAED,eAAO,MAAM,uBAAuB;;;;;;CAMnC,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * CMS Draft Cache Repository
3
+ *
4
+ * 관리자별 초안 캐시 관리 (동시 편집 지원)
5
+ */
6
+ import { findOne, findMany, deleteOne, deleteMany, upsert as upsertHelper } from '@spfn/core/db';
7
+ import { eq, and, lt } from 'drizzle-orm';
8
+ import { cmsDraftCache } from '../entities';
9
+ /**
10
+ * 섹션 + 언어 + 사용자로 초안 캐시 조회
11
+ */
12
+ export async function findByUser(section, locale, userId) {
13
+ return findOne(cmsDraftCache, and(eq(cmsDraftCache.section, section), eq(cmsDraftCache.locale, locale), eq(cmsDraftCache.userId, userId)));
14
+ }
15
+ /**
16
+ * 초안 캐시 생성 또는 업데이트 (UPSERT)
17
+ */
18
+ export async function upsert(data) {
19
+ return upsertHelper(cmsDraftCache, data, {
20
+ target: [cmsDraftCache.section, cmsDraftCache.locale, cmsDraftCache.userId],
21
+ set: {
22
+ content: data.content,
23
+ updatedAt: new Date(),
24
+ }
25
+ });
26
+ }
27
+ /**
28
+ * 특정 사용자의 모든 초안 조회
29
+ */
30
+ export async function findAllByUser(userId) {
31
+ return findMany(cmsDraftCache, {
32
+ where: eq(cmsDraftCache.userId, userId)
33
+ });
34
+ }
35
+ /**
36
+ * 초안 삭제
37
+ */
38
+ export async function deleteByUser(section, locale, userId) {
39
+ await deleteOne(cmsDraftCache, and(eq(cmsDraftCache.section, section), eq(cmsDraftCache.locale, locale), eq(cmsDraftCache.userId, userId)));
40
+ }
41
+ /**
42
+ * 오래된 초안 정리 (30일 이상 미사용)
43
+ */
44
+ export async function cleanupOldDrafts(daysOld = 30) {
45
+ const cutoffDate = new Date();
46
+ cutoffDate.setDate(cutoffDate.getDate() - daysOld);
47
+ return deleteMany(cmsDraftCache, lt(cmsDraftCache.updatedAt, cutoffDate));
48
+ }
49
+ export const cmsDraftCacheRepository = {
50
+ findByUser,
51
+ upsert,
52
+ findAllByUser,
53
+ deleteByUser,
54
+ cleanupOldDrafts,
55
+ };
56
+ //# sourceMappingURL=cms-draft-cache.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cms-draft-cache.repository.js","sourceRoot":"","sources":["../../src/repositories/cms-draft-cache.repository.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAyB,MAAM,aAAa,CAAC;AAEnE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,MAAc,EAAE,MAAc;IAE5E,OAAO,OAAO,CACV,aAAa,EACb,GAAG,CACC,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,EAClC,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CACnC,CACJ,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAsB;IAE/C,OAAO,YAAY,CAAC,aAAa,EAAE,IAAI,EAAE;QACrC,MAAM,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC;QAC3E,GAAG,EAAE;YACD,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;SACxB;KACJ,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAc;IAE9C,OAAO,QAAQ,CAAC,aAAa,EAAE;QAC3B,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC;KAC1C,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAe,EAAE,MAAc,EAAE,MAAc;IAE9E,MAAM,SAAS,CACX,aAAa,EACb,GAAG,CACC,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,EAClC,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CACnC,CACJ,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAkB,EAAE;IAEvD,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;IAC9B,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;IAEnD,OAAO,UAAU,CACb,aAAa,EACb,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAC1C,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACnC,UAAU;IACV,MAAM;IACN,aAAa;IACb,YAAY;IACZ,gBAAgB;CACnB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * CMS Label Values Repository
3
+ *
4
+ * 라벨 값 관리를 위한 Repository
5
+ */
6
+ import { type CmsLabelValue, type NewCmsLabelValue } from '../entities';
7
+ /**
8
+ * 특정 라벨의 특정 버전 값들 조회
9
+ */
10
+ export declare function findByLabelIdAndVersion(labelId: number, version: number, options?: {
11
+ locale?: string;
12
+ breakpoint?: string | null;
13
+ }): Promise<CmsLabelValue[]>;
14
+ /**
15
+ * 값 저장 (upsert)
16
+ */
17
+ export declare function upsert(data: NewCmsLabelValue): Promise<CmsLabelValue>;
18
+ /**
19
+ * 여러 값 일괄 저장
20
+ */
21
+ export declare function upsertMany(values: NewCmsLabelValue[]): Promise<CmsLabelValue[]>;
22
+ /**
23
+ * 특정 버전의 모든 값 삭제
24
+ */
25
+ export declare function deleteByVersion(labelId: number, version: number): Promise<CmsLabelValue[]>;
26
+ export declare const cmsLabelValuesRepository: {
27
+ findByLabelIdAndVersion: typeof findByLabelIdAndVersion;
28
+ upsert: typeof upsert;
29
+ upsertMany: typeof upsertMany;
30
+ deleteByVersion: typeof deleteByVersion;
31
+ };
32
+ //# sourceMappingURL=cms-label-values.repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cms-label-values.repository.d.ts","sourceRoot":"","sources":["../../src/repositories/cms-label-values.repository.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAkB,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAExF;;GAEG;AACH,wBAAsB,uBAAuB,CACzC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IACN,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GACF,OAAO,CAAC,aAAa,EAAE,CAAC,CA0B1B;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CA8B3E;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CASrF;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAShG;AAGD,eAAO,MAAM,wBAAwB;;;;;CAKpC,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * CMS Label Values Repository
3
+ *
4
+ * 라벨 값 관리를 위한 Repository
5
+ */
6
+ import { findOne, findMany, create, updateOne, deleteMany } from '@spfn/core/db';
7
+ import { eq, and, isNull } from 'drizzle-orm';
8
+ import { cmsLabelValues } from '../entities';
9
+ /**
10
+ * 특정 라벨의 특정 버전 값들 조회
11
+ */
12
+ export async function findByLabelIdAndVersion(labelId, version, options) {
13
+ const { locale, breakpoint } = options || {};
14
+ const conditions = [
15
+ eq(cmsLabelValues.labelId, labelId),
16
+ eq(cmsLabelValues.version, version)
17
+ ];
18
+ if (locale) {
19
+ conditions.push(eq(cmsLabelValues.locale, locale));
20
+ }
21
+ if (breakpoint !== undefined) {
22
+ conditions.push(breakpoint === null
23
+ ? isNull(cmsLabelValues.breakpoint)
24
+ : eq(cmsLabelValues.breakpoint, breakpoint));
25
+ }
26
+ return findMany(cmsLabelValues, {
27
+ where: and(...conditions)
28
+ });
29
+ }
30
+ /**
31
+ * 값 저장 (upsert)
32
+ */
33
+ export async function upsert(data) {
34
+ // 기존 값이 있는지 확인
35
+ const existing = await findOne(cmsLabelValues, and(eq(cmsLabelValues.labelId, data.labelId), eq(cmsLabelValues.version, data.version ?? 1), eq(cmsLabelValues.locale, data.locale || 'ko'), data.breakpoint
36
+ ? eq(cmsLabelValues.breakpoint, data.breakpoint)
37
+ : isNull(cmsLabelValues.breakpoint)));
38
+ if (existing) {
39
+ // UPDATE
40
+ const updated = await updateOne(cmsLabelValues, { id: existing.id }, { value: data.value });
41
+ return updated;
42
+ }
43
+ else {
44
+ // INSERT
45
+ return create(cmsLabelValues, data);
46
+ }
47
+ }
48
+ /**
49
+ * 여러 값 일괄 저장
50
+ */
51
+ export async function upsertMany(values) {
52
+ const results = [];
53
+ for (const value of values) {
54
+ const result = await upsert(value);
55
+ results.push(result);
56
+ }
57
+ return results;
58
+ }
59
+ /**
60
+ * 특정 버전의 모든 값 삭제
61
+ */
62
+ export async function deleteByVersion(labelId, version) {
63
+ return deleteMany(cmsLabelValues, and(eq(cmsLabelValues.labelId, labelId), eq(cmsLabelValues.version, version)));
64
+ }
65
+ // Legacy export for backward compatibility
66
+ export const cmsLabelValuesRepository = {
67
+ findByLabelIdAndVersion,
68
+ upsert,
69
+ upsertMany,
70
+ deleteByVersion
71
+ };
72
+ //# sourceMappingURL=cms-label-values.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cms-label-values.repository.js","sourceRoot":"","sources":["../../src/repositories/cms-label-values.repository.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,EAAE,EAAE,GAAG,EAAO,MAAM,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,cAAc,EAA6C,MAAM,aAAa,CAAC;AAExF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CACzC,OAAe,EACf,OAAe,EACf,OAGC;IAGD,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE7C,MAAM,UAAU,GAAU;QACtB,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC;QACnC,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC;KACtC,CAAC;IAEF,IAAI,MAAM,EACV,CAAC;QACG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,IAAI,UAAU,KAAK,SAAS,EAC5B,CAAC;QACG,UAAU,CAAC,IAAI,CACX,UAAU,KAAK,IAAI;YACf,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC;YACnC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,UAAU,CAAC,CAClD,CAAC;IACN,CAAC;IAED,OAAO,QAAQ,CAAC,cAAc,EAAE;QAC5B,KAAK,EAAE,GAAG,CAAC,GAAG,UAAU,CAAC;KAC5B,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IA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AAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,EACnC,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CACtC,CACJ,CAAC;AACN,CAAC;AAED,2CAA2C;AAC3C,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACpC,uBAAuB;IACvB,MAAM;IACN,UAAU;IACV,eAAe;CAClB,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * CMS Labels Repository
3
+ *
4
+ * 라벨 메타데이터 관리를 위한 Repository
5
+ */
6
+ import { type CmsLabel, type NewCmsLabel } from '../entities';
7
+ /**
8
+ * 라벨 목록 조회 (페이지네이션)
9
+ */
10
+ export declare function findMany(options?: {
11
+ section?: string;
12
+ limit?: number;
13
+ offset?: number;
14
+ }): Promise<CmsLabel[]>;
15
+ /**
16
+ * 전체 라벨 수 조회
17
+ */
18
+ export declare function count(section?: string): Promise<number>;
19
+ /**
20
+ * ID로 라벨 조회
21
+ */
22
+ export declare function findById(id: number): Promise<CmsLabel | null>;
23
+ /**
24
+ * Key로 라벨 조회
25
+ */
26
+ export declare function findByKey(key: string): Promise<CmsLabel | null>;
27
+ /**
28
+ * 섹션으로 모든 라벨 조회
29
+ */
30
+ export declare function findBySection(section: string): Promise<CmsLabel[]>;
31
+ /**
32
+ * 라벨 생성
33
+ */
34
+ export declare function create(data: NewCmsLabel): Promise<CmsLabel>;
35
+ /**
36
+ * 라벨 수정
37
+ */
38
+ export declare function updateById(id: number, data: Partial<NewCmsLabel>): Promise<CmsLabel | null>;
39
+ /**
40
+ * 라벨 삭제
41
+ */
42
+ export declare function deleteById(id: number): Promise<CmsLabel | null>;
43
+ export declare const cmsLabelsRepository: {
44
+ findMany: typeof findMany;
45
+ count: typeof count;
46
+ findById: typeof findById;
47
+ findByKey: typeof findByKey;
48
+ findBySection: typeof findBySection;
49
+ create: typeof create;
50
+ updateById: typeof updateById;
51
+ deleteById: typeof deleteById;
52
+ };
53
+ //# sourceMappingURL=cms-labels.repository.d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-0,0 +1,77 @@
1
+ /**
2
+ * CMS Labels Repository
3
+ *
4
+ * 라벨 메타데이터 관리를 위한 Repository
5
+ */
6
+ import { findOne, findMany as findManyHelper, create as createHelper, updateOne, deleteOne, count as countHelper } from '@spfn/core/db';
7
+ import { desc } from 'drizzle-orm';
8
+ import { cmsLabels } from '../entities';
9
+ /**
10
+ * 라벨 목록 조회 (페이지네이션)
11
+ */
12
+ export async function findMany(options) {
13
+ const { section, limit = 20, offset = 0 } = options || {};
14
+ return findManyHelper(cmsLabels, {
15
+ where: section ? { section } : undefined,
16
+ orderBy: desc(cmsLabels.updatedAt),
17
+ limit,
18
+ offset
19
+ });
20
+ }
21
+ /**
22
+ * 전체 라벨 수 조회
23
+ */
24
+ export async function count(section) {
25
+ return countHelper(cmsLabels, section ? { section } : undefined);
26
+ }
27
+ /**
28
+ * ID로 라벨 조회
29
+ */
30
+ export async function findById(id) {
31
+ return findOne(cmsLabels, { id });
32
+ }
33
+ /**
34
+ * Key로 라벨 조회
35
+ */
36
+ export async function findByKey(key) {
37
+ return findOne(cmsLabels, { key });
38
+ }
39
+ /**
40
+ * 섹션으로 모든 라벨 조회
41
+ */
42
+ export async function findBySection(section) {
43
+ return findManyHelper(cmsLabels, {
44
+ where: { section },
45
+ orderBy: desc(cmsLabels.updatedAt),
46
+ });
47
+ }
48
+ /**
49
+ * 라벨 생성
50
+ */
51
+ export async function create(data) {
52
+ return createHelper(cmsLabels, data);
53
+ }
54
+ /**
55
+ * 라벨 수정
56
+ */
57
+ export async function updateById(id, data) {
58
+ return updateOne(cmsLabels, { id }, { ...data, updatedAt: new Date() });
59
+ }
60
+ /**
61
+ * 라벨 삭제
62
+ */
63
+ export async function deleteById(id) {
64
+ return deleteOne(cmsLabels, { id });
65
+ }
66
+ // Legacy export for backward compatibility
67
+ export const cmsLabelsRepository = {
68
+ findMany,
69
+ count,
70
+ findById,
71
+ findByKey,
72
+ findBySection,
73
+ create,
74
+ updateById,
75
+ deleteById
76
+ };
77
+ //# sourceMappingURL=cms-labels.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cms-labels.repository.js","sourceRoot":"","sources":["../../src/repositories/cms-labels.repository.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,IAAI,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACxI,OAAO,EAAE,IAAI,EAAW,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAmC,MAAM,aAAa,CAAC;AAEzE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,OAI9B;IAEG,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,EAAE,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE1D,OAAO,cAAc,CAAC,SAAS,EAAE;QAC7B,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS;QACxC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;QAClC,KAAK;QACL,MAAM;KACT,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAAgB;IAExC,OAAO,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AACrE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,EAAU;IAErC,OAAO,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW;IAEvC,OAAO,OAAO,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC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