@spfn/cms 0.1.0-alpha.7 → 0.1.0-alpha.70
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/README.md +28 -416
- package/dist/{helpers/locale.actions.d.ts → actions-BpTAYuBA.d.ts} +70 -7
- package/dist/actions.d.ts +2 -9
- package/dist/actions.js +97 -10
- package/dist/actions.js.map +1 -1
- package/dist/api.d.ts +214 -0
- package/dist/api.js +353 -0
- package/dist/api.js.map +1 -0
- package/dist/client.d.ts +136 -127
- package/dist/client.js +1199 -59
- package/dist/client.js.map +1 -1
- package/dist/{types.d.ts → index-Dh5FjWzR.d.ts} +45 -7
- package/dist/index.d.ts +108 -16
- package/dist/index.js +610 -23
- package/dist/index.js.map +1 -1
- package/dist/label-sync-generator-B0EmvtWM.d.ts +32 -0
- package/dist/lib/contracts/labels.d.ts +151 -0
- package/dist/lib/contracts/labels.js +168 -0
- package/dist/lib/contracts/labels.js.map +1 -0
- package/dist/lib/contracts/published-cache.d.ts +48 -0
- package/dist/lib/contracts/published-cache.js +49 -0
- package/dist/lib/contracts/published-cache.js.map +1 -0
- package/dist/lib/contracts/values.d.ts +71 -0
- package/dist/lib/contracts/values.js +103 -0
- package/dist/lib/contracts/values.js.map +1 -0
- package/dist/locale.constants-BMBK70YM.d.ts +104 -0
- package/dist/{entities → server/entities}/cms-audit-logs.d.ts +15 -70
- package/dist/server/entities/cms-audit-logs.js +78 -0
- package/dist/server/entities/cms-audit-logs.js.map +1 -0
- package/dist/{entities → server/entities}/cms-draft-cache.d.ts +13 -73
- package/dist/server/entities/cms-draft-cache.js +38 -0
- package/dist/server/entities/cms-draft-cache.js.map +1 -0
- package/dist/{entities → server/entities}/cms-label-values.d.ts +16 -67
- package/dist/server/entities/cms-label-values.js +81 -0
- package/dist/server/entities/cms-label-values.js.map +1 -0
- package/dist/{entities → server/entities}/cms-label-versions.d.ts +16 -49
- package/dist/server/entities/cms-label-versions.js +76 -0
- package/dist/server/entities/cms-label-versions.js.map +1 -0
- package/dist/{entities → server/entities}/cms-labels.d.ts +17 -14
- package/dist/server/entities/cms-labels.js +42 -0
- package/dist/server/entities/cms-labels.js.map +1 -0
- package/dist/{entities → server/entities}/cms-published-cache.d.ts +14 -69
- package/dist/server/entities/cms-published-cache.js +36 -0
- package/dist/server/entities/cms-published-cache.js.map +1 -0
- package/dist/server/entities/index.d.ts +7 -0
- package/dist/server/entities/index.js +218 -0
- package/dist/server/entities/index.js.map +1 -0
- package/dist/server/generators/index.d.ts +19 -0
- package/dist/server/generators/index.js +753 -0
- package/dist/server/generators/index.js.map +1 -0
- package/dist/server/labels/index.d.ts +1 -0
- package/dist/server/labels/index.js +32 -0
- package/dist/server/labels/index.js.map +1 -0
- package/dist/server/repositories/index.d.ts +209 -0
- package/dist/server/repositories/index.js +441 -0
- package/dist/server/repositories/index.js.map +1 -0
- package/dist/server/routes/labels/[id]/index.js +508 -0
- package/dist/server/routes/labels/[id]/index.js.map +1 -0
- package/dist/{routes/labels/[id] → server/routes/labels/_id_}/index.d.ts +5 -3
- package/dist/server/routes/labels/by-key/[key]/index.js +458 -0
- package/dist/server/routes/labels/by-key/[key]/index.js.map +1 -0
- package/dist/server/routes/labels/by-key/_key_/index.d.ts +10 -0
- package/dist/server/routes/labels/index.d.ts +12 -0
- package/dist/server/routes/labels/index.js +617 -0
- package/dist/server/routes/labels/index.js.map +1 -0
- package/dist/server/routes/published-cache/index.d.ts +11 -0
- package/dist/server/routes/published-cache/index.js +369 -0
- package/dist/server/routes/published-cache/index.js.map +1 -0
- package/dist/server/routes/values/[labelId]/[version]/index.js +479 -0
- package/dist/server/routes/values/[labelId]/[version]/index.js.map +1 -0
- package/dist/server/routes/values/[labelId]/index.js +474 -0
- package/dist/server/routes/values/[labelId]/index.js.map +1 -0
- package/dist/server/routes/values/_labelId_/_version_/index.d.ts +10 -0
- package/dist/server/routes/values/_labelId_/index.d.ts +10 -0
- package/dist/server.d.ts +78 -7
- package/dist/server.js +1752 -247
- package/dist/server.js.map +1 -1
- package/migrations/0000_init.sql +3 -0
- package/migrations/0001_far_lady_vermin.sql +86 -0
- package/migrations/0002_heavy_the_enforcers.sql +2 -0
- package/migrations/meta/0000_snapshot.json +15 -0
- package/migrations/meta/0001_snapshot.json +687 -0
- package/migrations/meta/0002_snapshot.json +686 -0
- package/migrations/meta/_journal.json +27 -0
- package/package.json +55 -36
- package/dist/actions.d.ts.map +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/cms.config.d.ts +0 -77
- package/dist/cms.config.d.ts.map +0 -1
- package/dist/cms.config.js +0 -111
- package/dist/cms.config.js.map +0 -1
- package/dist/entities/cms-audit-logs.d.ts.map +0 -1
- package/dist/entities/cms-audit-logs.js +0 -103
- package/dist/entities/cms-audit-logs.js.map +0 -1
- package/dist/entities/cms-draft-cache.d.ts.map +0 -1
- package/dist/entities/cms-draft-cache.js +0 -112
- package/dist/entities/cms-draft-cache.js.map +0 -1
- package/dist/entities/cms-label-values.d.ts.map +0 -1
- package/dist/entities/cms-label-values.js +0 -105
- package/dist/entities/cms-label-values.js.map +0 -1
- package/dist/entities/cms-label-versions.d.ts.map +0 -1
- package/dist/entities/cms-label-versions.js +0 -80
- package/dist/entities/cms-label-versions.js.map +0 -1
- package/dist/entities/cms-labels.d.ts.map +0 -1
- package/dist/entities/cms-labels.js +0 -48
- package/dist/entities/cms-labels.js.map +0 -1
- package/dist/entities/cms-published-cache.d.ts.map +0 -1
- package/dist/entities/cms-published-cache.js +0 -103
- package/dist/entities/cms-published-cache.js.map +0 -1
- package/dist/entities/index.d.ts +0 -10
- package/dist/entities/index.d.ts.map +0 -1
- package/dist/entities/index.js +0 -10
- package/dist/entities/index.js.map +0 -1
- package/dist/generators/index.d.ts +0 -19
- package/dist/generators/index.d.ts.map +0 -1
- package/dist/generators/index.js +0 -19
- package/dist/generators/index.js.map +0 -1
- package/dist/generators/label-sync-generator.d.ts +0 -33
- package/dist/generators/label-sync-generator.d.ts.map +0 -1
- package/dist/generators/label-sync-generator.js +0 -87
- package/dist/generators/label-sync-generator.js.map +0 -1
- package/dist/helpers/locale.actions.d.ts.map +0 -1
- package/dist/helpers/locale.actions.js +0 -210
- package/dist/helpers/locale.actions.js.map +0 -1
- package/dist/helpers/locale.constants.d.ts +0 -10
- package/dist/helpers/locale.constants.d.ts.map +0 -1
- package/dist/helpers/locale.constants.js +0 -10
- package/dist/helpers/locale.constants.js.map +0 -1
- package/dist/helpers/locale.d.ts +0 -17
- package/dist/helpers/locale.d.ts.map +0 -1
- package/dist/helpers/locale.js +0 -20
- package/dist/helpers/locale.js.map +0 -1
- package/dist/helpers/sync.d.ts +0 -41
- package/dist/helpers/sync.d.ts.map +0 -1
- package/dist/helpers/sync.js +0 -309
- package/dist/helpers/sync.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/init.d.ts +0 -31
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -36
- package/dist/init.js.map +0 -1
- package/dist/labels/helpers.d.ts +0 -31
- package/dist/labels/helpers.d.ts.map +0 -1
- package/dist/labels/helpers.js +0 -60
- package/dist/labels/helpers.js.map +0 -1
- package/dist/labels/index.d.ts +0 -7
- package/dist/labels/index.d.ts.map +0 -1
- package/dist/labels/index.js +0 -7
- package/dist/labels/index.js.map +0 -1
- package/dist/repositories/cms-draft-cache.repository.d.ts +0 -62
- package/dist/repositories/cms-draft-cache.repository.d.ts.map +0 -1
- package/dist/repositories/cms-draft-cache.repository.js +0 -56
- package/dist/repositories/cms-draft-cache.repository.js.map +0 -1
- package/dist/repositories/cms-label-values.repository.d.ts +0 -32
- package/dist/repositories/cms-label-values.repository.d.ts.map +0 -1
- package/dist/repositories/cms-label-values.repository.js +0 -72
- package/dist/repositories/cms-label-values.repository.js.map +0 -1
- package/dist/repositories/cms-labels.repository.d.ts +0 -53
- package/dist/repositories/cms-labels.repository.d.ts.map +0 -1
- package/dist/repositories/cms-labels.repository.js +0 -77
- package/dist/repositories/cms-labels.repository.js.map +0 -1
- package/dist/repositories/cms-published-cache.repository.d.ts +0 -53
- package/dist/repositories/cms-published-cache.repository.d.ts.map +0 -1
- package/dist/repositories/cms-published-cache.repository.js +0 -54
- package/dist/repositories/cms-published-cache.repository.js.map +0 -1
- package/dist/repositories/index.d.ts +0 -8
- package/dist/repositories/index.d.ts.map +0 -1
- package/dist/repositories/index.js +0 -9
- package/dist/repositories/index.js.map +0 -1
- package/dist/routes/labels/[id]/contract.d.ts +0 -68
- package/dist/routes/labels/[id]/contract.d.ts.map +0 -1
- package/dist/routes/labels/[id]/contract.js +0 -84
- package/dist/routes/labels/[id]/contract.js.map +0 -1
- package/dist/routes/labels/[id]/index.d.ts.map +0 -1
- package/dist/routes/labels/[id]/index.js +0 -96
- package/dist/routes/labels/[id]/index.js.map +0 -1
- package/dist/routes/labels/by-key/[key]/contract.d.ts +0 -24
- package/dist/routes/labels/by-key/[key]/contract.d.ts.map +0 -1
- package/dist/routes/labels/by-key/[key]/contract.js +0 -28
- package/dist/routes/labels/by-key/[key]/contract.js.map +0 -1
- package/dist/routes/labels/by-key/[key]/index.d.ts +0 -8
- package/dist/routes/labels/by-key/[key]/index.d.ts.map +0 -1
- package/dist/routes/labels/by-key/[key]/index.js +0 -32
- package/dist/routes/labels/by-key/[key]/index.js.map +0 -1
- package/dist/routes/labels/contract.d.ts +0 -59
- package/dist/routes/labels/contract.d.ts.map +0 -1
- package/dist/routes/labels/contract.js +0 -75
- package/dist/routes/labels/contract.js.map +0 -1
- package/dist/routes/labels/index.d.ts +0 -10
- package/dist/routes/labels/index.d.ts.map +0 -1
- package/dist/routes/labels/index.js +0 -73
- package/dist/routes/labels/index.js.map +0 -1
- package/dist/routes/published-cache/contract.d.ts +0 -25
- package/dist/routes/published-cache/contract.d.ts.map +0 -1
- package/dist/routes/published-cache/contract.js +0 -35
- package/dist/routes/published-cache/contract.js.map +0 -1
- package/dist/routes/published-cache/index.d.ts +0 -8
- package/dist/routes/published-cache/index.d.ts.map +0 -1
- package/dist/routes/published-cache/index.js +0 -33
- package/dist/routes/published-cache/index.js.map +0 -1
- package/dist/routes/values/[labelId]/[version]/contract.d.ts +0 -29
- package/dist/routes/values/[labelId]/[version]/contract.d.ts.map +0 -1
- package/dist/routes/values/[labelId]/[version]/contract.js +0 -33
- package/dist/routes/values/[labelId]/[version]/contract.js.map +0 -1
- package/dist/routes/values/[labelId]/[version]/index.d.ts +0 -8
- package/dist/routes/values/[labelId]/[version]/index.d.ts.map +0 -1
- package/dist/routes/values/[labelId]/[version]/index.js +0 -45
- package/dist/routes/values/[labelId]/[version]/index.js.map +0 -1
- package/dist/routes/values/[labelId]/contract.d.ts +0 -38
- package/dist/routes/values/[labelId]/contract.d.ts.map +0 -1
- package/dist/routes/values/[labelId]/contract.js +0 -59
- package/dist/routes/values/[labelId]/contract.js.map +0 -1
- package/dist/routes/values/[labelId]/index.d.ts +0 -8
- package/dist/routes/values/[labelId]/index.d.ts.map +0 -1
- package/dist/routes/values/[labelId]/index.js +0 -42
- package/dist/routes/values/[labelId]/index.js.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/store.d.ts +0 -87
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js +0 -205
- package/dist/store.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -7
- package/dist/types.js.map +0 -1
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Label Values Entity
|
|
3
|
-
*
|
|
4
|
-
* 라벨의 실제 값을 저장합니다.
|
|
5
|
-
* - 다국어 지원 (locale)
|
|
6
|
-
* - 반응형 지원 (breakpoint)
|
|
7
|
-
* - 버전 관리 (version)
|
|
8
|
-
* - JSONB로 유연한 값 저장
|
|
9
|
-
*/
|
|
10
|
-
import { serial, integer, text, jsonb, timestamp, index, unique } from 'drizzle-orm/pg-core';
|
|
11
|
-
import { createFunctionSchema } from '@spfn/core/db';
|
|
12
|
-
import { cmsLabels } from './cms-labels.js';
|
|
13
|
-
// Create isolated schema for @spfn/cms
|
|
14
|
-
const schema = createFunctionSchema('@spfn/cms');
|
|
15
|
-
export const cmsLabelValues = schema.table('label_values', {
|
|
16
|
-
// Primary Key
|
|
17
|
-
id: serial('id').primaryKey(),
|
|
18
|
-
// Foreign Key: cms_labels
|
|
19
|
-
labelId: integer('label_id')
|
|
20
|
-
.notNull()
|
|
21
|
-
.references(() => cmsLabels.id, { onDelete: 'cascade' }),
|
|
22
|
-
// 버전 번호
|
|
23
|
-
version: integer('version').notNull().default(1),
|
|
24
|
-
// 언어 코드
|
|
25
|
-
locale: text('locale').notNull().default('ko'),
|
|
26
|
-
// "ko" | "en" | "ja"
|
|
27
|
-
// 반응형 브레이크포인트
|
|
28
|
-
breakpoint: text('breakpoint'),
|
|
29
|
-
// null = 기본값 (모든 화면 크기)
|
|
30
|
-
// "sm" | "md" | "lg" | "xl" | "2xl"
|
|
31
|
-
// 실제 값 (JSONB)
|
|
32
|
-
value: jsonb('value').notNull(),
|
|
33
|
-
// LabelValue 타입:
|
|
34
|
-
// - TextValue: { type: "text", content: string }
|
|
35
|
-
// - ImageValue: { type: "image", url: string, alt?: string, width?: number, height?: number }
|
|
36
|
-
// - VideoValue: { type: "video", url: string, thumbnail?: string, duration?: number }
|
|
37
|
-
// - FileValue: { type: "file", url: string, filename: string, size?: number }
|
|
38
|
-
// - ObjectValue: { type: "object", fields: Record<string, LabelValue> }
|
|
39
|
-
// 생성 시각
|
|
40
|
-
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
41
|
-
}, (table) => [
|
|
42
|
-
// UNIQUE 제약: 같은 버전에서 locale + breakpoint 조합은 유일
|
|
43
|
-
unique('cms_label_values_locale_breakpoint_unique')
|
|
44
|
-
.on(table.labelId, table.version, table.locale, table.breakpoint),
|
|
45
|
-
// 인덱스: labelId + version 복합 조회 최적화
|
|
46
|
-
index('cms_label_values_label_version_idx')
|
|
47
|
-
.on(table.labelId, table.version),
|
|
48
|
-
// 인덱스: locale 필터링 최적화
|
|
49
|
-
index('cms_label_values_locale_idx').on(table.locale),
|
|
50
|
-
]);
|
|
51
|
-
/**
|
|
52
|
-
* 사용 예시:
|
|
53
|
-
*
|
|
54
|
-
* // 텍스트 값 저장
|
|
55
|
-
* await db.insert(cmsLabelValues).values({
|
|
56
|
-
* labelId: 1,
|
|
57
|
-
* version: 1,
|
|
58
|
-
* locale: 'ko',
|
|
59
|
-
* breakpoint: null,
|
|
60
|
-
* value: {
|
|
61
|
-
* type: 'text',
|
|
62
|
-
* content: '미래를 만드는 기업'
|
|
63
|
-
* }
|
|
64
|
-
* });
|
|
65
|
-
*
|
|
66
|
-
* // 반응형 이미지 저장 (모바일용)
|
|
67
|
-
* await db.insert(cmsLabelValues).values({
|
|
68
|
-
* labelId: 2,
|
|
69
|
-
* version: 1,
|
|
70
|
-
* locale: 'ko',
|
|
71
|
-
* breakpoint: 'sm',
|
|
72
|
-
* value: {
|
|
73
|
-
* type: 'image',
|
|
74
|
-
* url: '/uploads/hero-mobile.jpg',
|
|
75
|
-
* alt: 'Hero Image',
|
|
76
|
-
* width: 640,
|
|
77
|
-
* height: 480
|
|
78
|
-
* }
|
|
79
|
-
* });
|
|
80
|
-
*
|
|
81
|
-
* // 특정 버전의 한국어 값 조회
|
|
82
|
-
* const values = await db.select()
|
|
83
|
-
* .from(cmsLabelValues)
|
|
84
|
-
* .where(and(
|
|
85
|
-
* eq(cmsLabelValues.labelId, 1),
|
|
86
|
-
* eq(cmsLabelValues.version, 2),
|
|
87
|
-
* eq(cmsLabelValues.locale, 'ko')
|
|
88
|
-
* ));
|
|
89
|
-
*
|
|
90
|
-
* // Object 타입 값 저장 (재귀 구조)
|
|
91
|
-
* await db.insert(cmsLabelValues).values({
|
|
92
|
-
* labelId: 3,
|
|
93
|
-
* version: 1,
|
|
94
|
-
* locale: 'ko',
|
|
95
|
-
* value: {
|
|
96
|
-
* type: 'object',
|
|
97
|
-
* fields: {
|
|
98
|
-
* title: { type: 'text', content: '특징 1' },
|
|
99
|
-
* icon: { type: 'image', url: '/icons/feature1.svg', alt: 'Icon' },
|
|
100
|
-
* description: { type: 'text', content: '상세 설명...' }
|
|
101
|
-
* }
|
|
102
|
-
* }
|
|
103
|
-
* });
|
|
104
|
-
*/
|
|
105
|
-
//# sourceMappingURL=cms-label-values.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cms-label-values.js","sourceRoot":"","sources":["../../src/entities/cms-label-values.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,uCAAuC;AACvC,MAAM,MAAM,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE;IACvD,cAAc;IACd,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAE7B,0BAA0B;IAC1B,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC;SACvB,OAAO,EAAE;SACT,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAE5D,QAAQ;IACR,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEhD,QAAQ;IACR,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9C,qBAAqB;IAErB,cAAc;IACd,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC;IAC9B,wBAAwB;IACxB,oCAAoC;IAE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kBAAkB,GAAG,OAAO,gBAAgB,CAAC,YAAY,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Label Versions Entity
|
|
3
|
-
*
|
|
4
|
-
* 라벨의 버전 메타데이터를 관리합니다.
|
|
5
|
-
* - 버전별 상태 (draft/published/archived)
|
|
6
|
-
* - 발행 정보 (publishedAt, publishedBy)
|
|
7
|
-
* - 버전 노트
|
|
8
|
-
*/
|
|
9
|
-
import { serial, integer, text, timestamp, index, unique } from 'drizzle-orm/pg-core';
|
|
10
|
-
import { createFunctionSchema } from '@spfn/core/db';
|
|
11
|
-
import { cmsLabels } from './cms-labels.js';
|
|
12
|
-
// Create isolated schema for @spfn/cms
|
|
13
|
-
const schema = createFunctionSchema('@spfn/cms');
|
|
14
|
-
export const cmsLabelVersions = schema.table('label_versions', {
|
|
15
|
-
// Primary Key
|
|
16
|
-
id: serial('id').primaryKey(),
|
|
17
|
-
// Foreign Key: cms_labels
|
|
18
|
-
labelId: integer('label_id')
|
|
19
|
-
.notNull()
|
|
20
|
-
.references(() => cmsLabels.id, { onDelete: 'cascade' }),
|
|
21
|
-
// 버전 번호
|
|
22
|
-
version: integer('version').notNull(),
|
|
23
|
-
// 버전 상태
|
|
24
|
-
status: text('status').notNull(),
|
|
25
|
-
// "draft" | "published" | "archived"
|
|
26
|
-
// 발행 정보
|
|
27
|
-
publishedAt: timestamp('published_at', { withTimezone: true }),
|
|
28
|
-
publishedBy: text('published_by'),
|
|
29
|
-
// 버전 노트 (변경사항 설명)
|
|
30
|
-
notes: text('notes'),
|
|
31
|
-
// 버전 생성자
|
|
32
|
-
createdBy: text('created_by'),
|
|
33
|
-
// 생성 시각
|
|
34
|
-
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
35
|
-
}, (table) => [
|
|
36
|
-
// UNIQUE 제약: 각 라벨의 버전 번호는 고유
|
|
37
|
-
unique('cms_label_versions_label_version_unique')
|
|
38
|
-
.on(table.labelId, table.version),
|
|
39
|
-
// 인덱스: labelId로 버전 목록 조회 최적화
|
|
40
|
-
index('cms_label_versions_label_id_idx').on(table.labelId),
|
|
41
|
-
// 인덱스: status 필터링 최적화
|
|
42
|
-
index('cms_label_versions_status_idx').on(table.status),
|
|
43
|
-
]);
|
|
44
|
-
/**
|
|
45
|
-
* 사용 예시:
|
|
46
|
-
*
|
|
47
|
-
* // 새 버전 생성 (draft)
|
|
48
|
-
* await db.insert(cmsLabelVersions).values({
|
|
49
|
-
* labelId: 1,
|
|
50
|
-
* version: 2,
|
|
51
|
-
* status: 'draft',
|
|
52
|
-
* notes: '문구 개선',
|
|
53
|
-
* createdBy: 'editor@futureplay.com'
|
|
54
|
-
* });
|
|
55
|
-
*
|
|
56
|
-
* // 버전 발행
|
|
57
|
-
* await db.update(cmsLabelVersions)
|
|
58
|
-
* .set({
|
|
59
|
-
* status: 'published',
|
|
60
|
-
* publishedAt: new Date(),
|
|
61
|
-
* publishedBy: 'admin@futureplay.com'
|
|
62
|
-
* })
|
|
63
|
-
* .where(and(
|
|
64
|
-
* eq(cmsLabelVersions.labelId, 1),
|
|
65
|
-
* eq(cmsLabelVersions.version, 2)
|
|
66
|
-
* ));
|
|
67
|
-
*
|
|
68
|
-
* // 라벨의 모든 버전 조회
|
|
69
|
-
* const versions = await db.select()
|
|
70
|
-
* .from(cmsLabelVersions)
|
|
71
|
-
* .where(eq(cmsLabelVersions.labelId, 1))
|
|
72
|
-
* .orderBy(desc(cmsLabelVersions.version));
|
|
73
|
-
*
|
|
74
|
-
* // 발행된 버전만 조회
|
|
75
|
-
* const published = await db.select()
|
|
76
|
-
* .from(cmsLabelVersions)
|
|
77
|
-
* .where(eq(cmsLabelVersions.status, 'published'))
|
|
78
|
-
* .orderBy(desc(cmsLabelVersions.publishedAt));
|
|
79
|
-
*/
|
|
80
|
-
//# sourceMappingURL=cms-label-versions.js.map
|
|
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CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;CACpF,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;IACV,6BAA6B;IAC7B,MAAM,CAAC,yCAAyC,CAAC;SAChD,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;IAEjC,6BAA6B;IAC7B,KAAK,CAAC,iCAAiC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;IAE1D,sBAAsB;IACtB,KAAK,CAAC,+BAA+B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;CAC1D,CAAC,CAAC;AAMH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cms-labels.d.ts","sourceRoot":"","sources":["../../src/entities/cms-labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CpB,CAAC;AAGH,MAAM,MAAM,QAAQ,GAAG,OAAO,SAAS,CAAC,YAAY,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,OAAO,SAAS,CAAC,YAAY,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Labels Entity
|
|
3
|
-
*
|
|
4
|
-
* 라벨의 메타데이터와 현재 발행 상태를 관리합니다.
|
|
5
|
-
* - 라벨 식별 (id, key)
|
|
6
|
-
* - 섹션 분류 (section)
|
|
7
|
-
* - 타입 정의 (type)
|
|
8
|
-
* - 발행 상태 (publishedVersion)
|
|
9
|
-
*/
|
|
10
|
-
import { index, integer, serial, text, timestamp } from 'drizzle-orm/pg-core';
|
|
11
|
-
import { createFunctionSchema } from '@spfn/core/db';
|
|
12
|
-
// Create isolated schema for @spfn/cms
|
|
13
|
-
const schema = createFunctionSchema('@spfn/cms');
|
|
14
|
-
export const cmsLabels = schema.table('labels', {
|
|
15
|
-
// Primary Key
|
|
16
|
-
id: serial('id').primaryKey(),
|
|
17
|
-
// 라벨 식별자
|
|
18
|
-
key: text('key').notNull().unique(),
|
|
19
|
-
// 예: "home.hero.title", "why-futureplay.hero.subtitle"
|
|
20
|
-
// 구조: {section}.{component}.{property}
|
|
21
|
-
// 섹션 분류 (페이지 단위)
|
|
22
|
-
section: text('section').notNull(),
|
|
23
|
-
// 예: "home", "why-futureplay", "team"
|
|
24
|
-
// 값 타입
|
|
25
|
-
type: text('type').notNull(),
|
|
26
|
-
// "text" | "image" | "video" | "file" | "object"
|
|
27
|
-
// 기본값
|
|
28
|
-
defaultValue: text('default_value'),
|
|
29
|
-
// 라벨의 기본값 (sync 시 설정)
|
|
30
|
-
// 설명
|
|
31
|
-
description: text('description'),
|
|
32
|
-
// 라벨에 대한 설명 (optional)
|
|
33
|
-
// 현재 발행된 버전 번호
|
|
34
|
-
publishedVersion: integer('published_version'),
|
|
35
|
-
// null = 미발행 상태
|
|
36
|
-
// 1, 2, 3... = 발행된 버전 번호
|
|
37
|
-
// 생성자 추적
|
|
38
|
-
createdBy: text('created_by'),
|
|
39
|
-
// 타임스탬프
|
|
40
|
-
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
41
|
-
updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
|
|
42
|
-
}, (table) => [
|
|
43
|
-
// 인덱스: 섹션별 조회 최적화
|
|
44
|
-
index('cms_labels_section_idx').on(table.section),
|
|
45
|
-
// 인덱스: key로 조회 최적화 (unique 제약으로 자동 생성되지만 명시)
|
|
46
|
-
index('cms_labels_key_idx').on(table.key),
|
|
47
|
-
]);
|
|
48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IACjF,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;CACpF,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;IACV,kBAAkB;IAClB,KAAK,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;IAEjD,6CAA6C;IAC7C,KAAK,CAAC,oBAAoB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;CAC5C,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cms-published-cache.d.ts","sourceRoot":"","sources":["../../src/entities/cms-published-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAQH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiC5B,CAAC;AAGH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAC;AACtE,MAAM,MAAM,oBAAoB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Published Cache Entity
|
|
3
|
-
*
|
|
4
|
-
* 발행된 콘텐츠를 섹션+언어 단위로 캐싱합니다.
|
|
5
|
-
* - 초고속 읽기 성능 (5ms)
|
|
6
|
-
* - 단일 쿼리로 섹션 전체 로드
|
|
7
|
-
* - JSONB로 즉시 사용 가능한 데이터
|
|
8
|
-
*
|
|
9
|
-
* 성능 비교:
|
|
10
|
-
* - 정규화 테이블 JOIN: 87ms
|
|
11
|
-
* - 캐시 테이블: 5ms (17배 빠름!)
|
|
12
|
-
*/
|
|
13
|
-
import { serial, text, jsonb, integer, timestamp, index, unique } from 'drizzle-orm/pg-core';
|
|
14
|
-
import { createFunctionSchema } from '@spfn/core/db';
|
|
15
|
-
// Create isolated schema for @spfn/cms
|
|
16
|
-
const schema = createFunctionSchema('@spfn/cms');
|
|
17
|
-
export const cmsPublishedCache = schema.table('published_cache', {
|
|
18
|
-
// Primary Key
|
|
19
|
-
id: serial('id').primaryKey(),
|
|
20
|
-
// 섹션 (페이지 단위)
|
|
21
|
-
section: text('section').notNull(),
|
|
22
|
-
// "home" | "why-futureplay" | "team" | "our-companies" | "apply"
|
|
23
|
-
// 언어
|
|
24
|
-
locale: text('locale').notNull(),
|
|
25
|
-
// "ko" | "en" | "ja"
|
|
26
|
-
// 캐시된 콘텐츠 (JSONB)
|
|
27
|
-
content: jsonb('content').notNull(),
|
|
28
|
-
// Record<string, LabelValue>
|
|
29
|
-
// {
|
|
30
|
-
// "home.hero.title": { type: "text", content: "..." },
|
|
31
|
-
// "home.hero.image": { type: "image", url: "...", alt: "..." },
|
|
32
|
-
// ...
|
|
33
|
-
// }
|
|
34
|
-
// 발행 정보
|
|
35
|
-
publishedAt: timestamp('published_at', { withTimezone: true }).notNull(),
|
|
36
|
-
publishedBy: text('published_by'),
|
|
37
|
-
// 캐시 버전 (클라이언트 캐싱용)
|
|
38
|
-
version: integer('version').notNull().default(1),
|
|
39
|
-
}, (table) => [
|
|
40
|
-
// UNIQUE 제약: section + locale 조합은 유일
|
|
41
|
-
unique('cms_published_cache_unique').on(table.section, table.locale),
|
|
42
|
-
// 인덱스: section으로 조회 최적화
|
|
43
|
-
index('cms_published_cache_section_idx').on(table.section),
|
|
44
|
-
]);
|
|
45
|
-
/**
|
|
46
|
-
* 사용 예시:
|
|
47
|
-
*
|
|
48
|
-
* // 캐시 생성/업데이트 (UPSERT)
|
|
49
|
-
* await db.insert(cmsPublishedCache)
|
|
50
|
-
* .values({
|
|
51
|
-
* section: 'home',
|
|
52
|
-
* locale: 'ko',
|
|
53
|
-
* content: {
|
|
54
|
-
* 'home.hero.title': {
|
|
55
|
-
* type: 'text',
|
|
56
|
-
* content: '미래를 만드는 기업'
|
|
57
|
-
* },
|
|
58
|
-
* 'home.hero.image': {
|
|
59
|
-
* type: 'image',
|
|
60
|
-
* url: '/uploads/hero.jpg',
|
|
61
|
-
* alt: 'Hero',
|
|
62
|
-
* width: 1920,
|
|
63
|
-
* height: 1080
|
|
64
|
-
* }
|
|
65
|
-
* },
|
|
66
|
-
* publishedAt: new Date(),
|
|
67
|
-
* publishedBy: 'admin@futureplay.com'
|
|
68
|
-
* })
|
|
69
|
-
* .onConflictDoUpdate({
|
|
70
|
-
* target: [cmsPublishedCache.section, cmsPublishedCache.locale],
|
|
71
|
-
* set: {
|
|
72
|
-
* content: sql`EXCLUDED.content`,
|
|
73
|
-
* publishedAt: sql`EXCLUDED.published_at`,
|
|
74
|
-
* publishedBy: sql`EXCLUDED.published_by`,
|
|
75
|
-
* version: sql`${cmsPublishedCache.version} + 1`
|
|
76
|
-
* }
|
|
77
|
-
* });
|
|
78
|
-
*
|
|
79
|
-
* // 캐시 조회 (초고속!)
|
|
80
|
-
* const cache = await db.select()
|
|
81
|
-
* .from(cmsPublishedCache)
|
|
82
|
-
* .where(and(
|
|
83
|
-
* eq(cmsPublishedCache.section, 'home'),
|
|
84
|
-
* eq(cmsPublishedCache.locale, 'ko')
|
|
85
|
-
* ))
|
|
86
|
-
* .limit(1);
|
|
87
|
-
*
|
|
88
|
-
* const labels = cache[0].content; // 즉시 사용 가능!
|
|
89
|
-
*
|
|
90
|
-
* // 섹션의 모든 언어 캐시 조회
|
|
91
|
-
* const allLocales = await db.select()
|
|
92
|
-
* .from(cmsPublishedCache)
|
|
93
|
-
* .where(eq(cmsPublishedCache.section, 'home'));
|
|
94
|
-
*
|
|
95
|
-
* // 오래된 캐시 감지
|
|
96
|
-
* const stale = await db.select()
|
|
97
|
-
* .from(cmsPublishedCache)
|
|
98
|
-
* .where(lt(
|
|
99
|
-
* cmsPublishedCache.publishedAt,
|
|
100
|
-
* new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)
|
|
101
|
-
* ));
|
|
102
|
-
*/
|
|
103
|
-
//# sourceMappingURL=cms-published-cache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cms-published-cache.js","sourceRoot":"","sources":["../../src/entities/cms-published-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,uCAAuC;AACvC,MAAM,MAAM,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC,iBAAiB,EAAE;IAC7D,cAAc;IACd,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAE7B,cAAc;IACd,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE;IAClC,iEAAiE;IAEjE,KAAK;IACL,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE;IAChC,qBAAqB;IAErB,kBAAkB;IAClB,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE;IACnC,6BAA6B;IAC7B,IAAI;IACJ,yDAAyD;IACzD,kEAAkE;IAClE,QAAQ;IACR,IAAI;IAEJ,QAAQ;IACR,WAAW,EAAE,SAAS,CAAC,cAAc,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;IACxE,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC;IAEjC,oBAAoB;IACpB,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CACnD,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC;IACV,qCAAqC;IACrC,MAAM,CAAC,4BAA4B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC;IAEpE,wBAAwB;IACxB,KAAK,CAAC,iCAAiC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;CAC7D,CAAC,CAAC;AAMH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG"}
|
package/dist/entities/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Database Entities
|
|
3
|
-
*/
|
|
4
|
-
export * from './cms-labels.js';
|
|
5
|
-
export * from './cms-label-values.js';
|
|
6
|
-
export * from './cms-label-versions.js';
|
|
7
|
-
export * from './cms-draft-cache.js';
|
|
8
|
-
export * from './cms-published-cache.js';
|
|
9
|
-
export * from './cms-audit-logs.js';
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
package/dist/entities/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CMS Database Entities
|
|
3
|
-
*/
|
|
4
|
-
export * from './cms-labels.js';
|
|
5
|
-
export * from './cms-label-values.js';
|
|
6
|
-
export * from './cms-label-versions.js';
|
|
7
|
-
export * from './cms-draft-cache.js';
|
|
8
|
-
export * from './cms-published-cache.js';
|
|
9
|
-
export * from './cms-audit-logs.js';
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SPFN CMS Generators Registry
|
|
3
|
-
*
|
|
4
|
-
* Exports generators for use with package-based naming convention
|
|
5
|
-
* e.g., @spfn/cms:label-sync
|
|
6
|
-
*/
|
|
7
|
-
import { createLabelSyncGenerator } from './label-sync-generator.js';
|
|
8
|
-
/**
|
|
9
|
-
* Generators registry
|
|
10
|
-
* Maps generator names to their factory functions
|
|
11
|
-
*/
|
|
12
|
-
export declare const generators: {
|
|
13
|
-
'label-sync': typeof createLabelSyncGenerator;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Re-export individual generator factories
|
|
17
|
-
*/
|
|
18
|
-
export { createLabelSyncGenerator, LabelSyncGenerator } from './label-sync-generator.js';
|
|
19
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,UAAU;;CAEtB,CAAC;AAEF;;GAEG;AACH,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/generators/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SPFN CMS Generators Registry
|
|
3
|
-
*
|
|
4
|
-
* Exports generators for use with package-based naming convention
|
|
5
|
-
* e.g., @spfn/cms:label-sync
|
|
6
|
-
*/
|
|
7
|
-
import { createLabelSyncGenerator } from './label-sync-generator.js';
|
|
8
|
-
/**
|
|
9
|
-
* Generators registry
|
|
10
|
-
* Maps generator names to their factory functions
|
|
11
|
-
*/
|
|
12
|
-
export const generators = {
|
|
13
|
-
'label-sync': createLabelSyncGenerator,
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Re-export individual generator factories
|
|
17
|
-
*/
|
|
18
|
-
export { createLabelSyncGenerator, LabelSyncGenerator } from './label-sync-generator.js';
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,YAAY,EAAE,wBAAwB;CACzC,CAAC;AAEF;;GAEG;AACH,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Label Sync Generator
|
|
3
|
-
*
|
|
4
|
-
* File-based label sync with JSON definitions
|
|
5
|
-
*
|
|
6
|
-
* Structure:
|
|
7
|
-
* cms/labels/
|
|
8
|
-
* layout/ # Section name
|
|
9
|
-
* nav.json # Label definitions
|
|
10
|
-
* footer.json
|
|
11
|
-
* homepage/
|
|
12
|
-
* hero.json
|
|
13
|
-
*/
|
|
14
|
-
import type { Generator, GeneratorOptions } from '@spfn/core/codegen';
|
|
15
|
-
export interface LabelSyncGeneratorConfig {
|
|
16
|
-
labelsDir?: string;
|
|
17
|
-
}
|
|
18
|
-
export declare class LabelSyncGenerator implements Generator {
|
|
19
|
-
name: string;
|
|
20
|
-
private readonly labelsDir;
|
|
21
|
-
constructor(config?: LabelSyncGeneratorConfig);
|
|
22
|
-
/**
|
|
23
|
-
* Watch patterns for label definition files
|
|
24
|
-
*/
|
|
25
|
-
get watchPatterns(): string[];
|
|
26
|
-
generate(options: GeneratorOptions): Promise<void>;
|
|
27
|
-
onFileChange(filePath: string, event: 'add' | 'change' | 'unlink'): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Create label sync generator instance
|
|
31
|
-
*/
|
|
32
|
-
export declare function createLabelSyncGenerator(config?: LabelSyncGeneratorConfig): Generator;
|
|
33
|
-
//# sourceMappingURL=label-sync-generator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"label-sync-generator.d.ts","sourceRoot":"","sources":["../../src/generators/label-sync-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAOtE,MAAM,WAAW,wBAAwB;IAErC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,kBAAmB,YAAW,SAAS;IAEhD,IAAI,SAAgB;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,MAAM,GAAE,wBAA6B;IAKjD;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,EAAE,CAK5B;IAEK,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiElD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAO1F;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAGrF"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Label Sync Generator
|
|
3
|
-
*
|
|
4
|
-
* File-based label sync with JSON definitions
|
|
5
|
-
*
|
|
6
|
-
* Structure:
|
|
7
|
-
* cms/labels/
|
|
8
|
-
* layout/ # Section name
|
|
9
|
-
* nav.json # Label definitions
|
|
10
|
-
* footer.json
|
|
11
|
-
* homepage/
|
|
12
|
-
* hero.json
|
|
13
|
-
*/
|
|
14
|
-
import { logger } from '@spfn/core';
|
|
15
|
-
import { join } from 'path';
|
|
16
|
-
import { syncAll, loadLabelsFromJson } from '../helpers/sync.js';
|
|
17
|
-
const syncLogger = logger.child('label-sync');
|
|
18
|
-
export class LabelSyncGenerator {
|
|
19
|
-
name = 'label-sync';
|
|
20
|
-
labelsDir;
|
|
21
|
-
constructor(config = {}) {
|
|
22
|
-
this.labelsDir = config.labelsDir ?? 'src/cms/labels';
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Watch patterns for label definition files
|
|
26
|
-
*/
|
|
27
|
-
get watchPatterns() {
|
|
28
|
-
return [
|
|
29
|
-
`${this.labelsDir}/**/*.json`,
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
async generate(options) {
|
|
33
|
-
const isDevelopment = process.env.NODE_ENV !== 'production';
|
|
34
|
-
if (options.debug) {
|
|
35
|
-
syncLogger.info('Starting label sync...');
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
const labelsPath = join(options.cwd, this.labelsDir);
|
|
39
|
-
// Load labels from JSON files
|
|
40
|
-
const sections = loadLabelsFromJson(labelsPath);
|
|
41
|
-
if (sections.length === 0) {
|
|
42
|
-
syncLogger.warn(`No labels found in ${labelsPath}`);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
syncLogger.info(`Found ${sections.length} sections`);
|
|
46
|
-
// Sync all sections
|
|
47
|
-
const results = await syncAll(sections, {
|
|
48
|
-
verbose: options.debug ?? false,
|
|
49
|
-
updateExisting: isDevelopment,
|
|
50
|
-
});
|
|
51
|
-
const totalCreated = results.reduce((sum, r) => sum + r.created, 0);
|
|
52
|
-
const totalUpdated = results.reduce((sum, r) => sum + r.updated, 0);
|
|
53
|
-
const totalErrors = results.reduce((sum, r) => sum + r.errors.length, 0);
|
|
54
|
-
if (options.debug || totalCreated > 0 || totalUpdated > 0) {
|
|
55
|
-
syncLogger.info('Label sync completed', {
|
|
56
|
-
sections: results.length,
|
|
57
|
-
created: totalCreated,
|
|
58
|
-
updated: totalUpdated,
|
|
59
|
-
errors: totalErrors,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
// Log errors if any
|
|
63
|
-
if (totalErrors > 0) {
|
|
64
|
-
results.forEach((result) => {
|
|
65
|
-
result.errors.forEach((error) => {
|
|
66
|
-
syncLogger.error(`[${result.section}] ${error.key}: ${error.error}`);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
syncLogger.error('Label sync failed', error instanceof Error ? error : new Error(String(error)));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
async onFileChange(filePath, event) {
|
|
76
|
-
syncLogger.info(`Label file ${event}`, { file: filePath });
|
|
77
|
-
// Re-sync all labels when any label file changes
|
|
78
|
-
await this.generate({ cwd: process.cwd(), debug: true });
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Create label sync generator instance
|
|
83
|
-
*/
|
|
84
|
-
export function createLabelSyncGenerator(config) {
|
|
85
|
-
return new LabelSyncGenerator(config);
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=label-sync-generator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"label-sync-generator.js","sourceRoot":"","sources":["../../src/generators/label-sync-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAA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