@spfn/cms 0.1.0-alpha.69 → 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.
Files changed (36) hide show
  1. package/dist/api.d.ts +82 -246
  2. package/dist/api.js +25 -54
  3. package/dist/api.js.map +1 -1
  4. package/dist/client.js +26 -51
  5. package/dist/client.js.map +1 -1
  6. package/dist/lib/contracts/values.d.ts +4 -2
  7. package/dist/lib/contracts/values.js +5 -2
  8. package/dist/lib/contracts/values.js.map +1 -1
  9. package/dist/server/entities/cms-label-values.d.ts +2 -2
  10. package/dist/server/entities/cms-label-values.js +2 -2
  11. package/dist/server/entities/cms-label-values.js.map +1 -1
  12. package/dist/server/entities/index.js +2 -2
  13. package/dist/server/entities/index.js.map +1 -1
  14. package/dist/server/generators/index.js +2 -2
  15. package/dist/server/generators/index.js.map +1 -1
  16. package/dist/server/repositories/index.d.ts +2 -0
  17. package/dist/server/repositories/index.js +14 -9
  18. package/dist/server/repositories/index.js.map +1 -1
  19. package/dist/server/routes/labels/[id]/index.js +2 -2
  20. package/dist/server/routes/labels/[id]/index.js.map +1 -1
  21. package/dist/server/routes/labels/by-key/[key]/index.js +2 -2
  22. package/dist/server/routes/labels/by-key/[key]/index.js.map +1 -1
  23. package/dist/server/routes/labels/index.js +2 -2
  24. package/dist/server/routes/labels/index.js.map +1 -1
  25. package/dist/server/routes/published-cache/index.js +2 -2
  26. package/dist/server/routes/published-cache/index.js.map +1 -1
  27. package/dist/server/routes/values/[labelId]/[version]/index.js +19 -11
  28. package/dist/server/routes/values/[labelId]/[version]/index.js.map +1 -1
  29. package/dist/server/routes/values/[labelId]/index.js +19 -11
  30. package/dist/server/routes/values/[labelId]/index.js.map +1 -1
  31. package/dist/server.js +14 -9
  32. package/dist/server.js.map +1 -1
  33. package/migrations/0002_heavy_the_enforcers.sql +2 -0
  34. package/migrations/meta/0002_snapshot.json +686 -0
  35. package/migrations/meta/_journal.json +7 -0
  36. package/package.json +1 -1
package/dist/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { InferContract } from '@spfn/core';
2
2
  import { saveValuesContract, getValuesContract } from './lib/contracts/values.js';
3
- import { getPublishedCacheContract } from './lib/contracts/published-cache.js';
3
+ import { getPublishedCacheContract, upsertPublishedCacheContract } from './lib/contracts/published-cache.js';
4
4
  import { getLabelByKeyContract, getLabelsContract, createLabelContract, getLabelContract, updateLabelContract, deleteLabelContract } from './lib/contracts/labels.js';
5
5
  export { client } from '@spfn/core/client';
6
6
  import '@sinclair/typebox';
@@ -11,7 +11,7 @@ import '@sinclair/typebox';
11
11
  * Generated by @spfn/core codegen
12
12
  * DO NOT EDIT MANUALLY
13
13
  *
14
- * @generated 2025-11-02T11:18:13.331Z
14
+ * @generated 2025-11-02T14:38:21.625Z
15
15
  */
16
16
 
17
17
  type SaveValuesResponse = InferContract<typeof saveValuesContract>['response'];
@@ -20,43 +20,6 @@ type SaveValuesBody = InferContract<typeof saveValuesContract>['body'];
20
20
  type GetValuesResponse = InferContract<typeof getValuesContract>['response'];
21
21
  type GetValuesQuery = InferContract<typeof getValuesContract>['query'];
22
22
  type GetValuesParams = InferContract<typeof getValuesContract>['params'];
23
- /**
24
- * CmsValues API
25
- */
26
- declare const CmsValues: {
27
- /**
28
- * POST /_cms/values/:labelId
29
- */
30
- readonly post: (options: {
31
- params: SaveValuesParams;
32
- body: SaveValuesBody;
33
- }) => Promise<{
34
- version: number;
35
- success: boolean;
36
- saved: number;
37
- } | {
38
- error: string;
39
- }>;
40
- /**
41
- * GET /_cms/values/:labelId/:version
42
- */
43
- readonly getById: (options: {
44
- params: GetValuesParams;
45
- query?: GetValuesQuery;
46
- }) => Promise<{
47
- version: number;
48
- labelId: number;
49
- values: {
50
- locale: string;
51
- id: number;
52
- value: any;
53
- createdAt: string;
54
- breakpoint: string | null;
55
- }[];
56
- } | {
57
- error: string;
58
- }>;
59
- };
60
23
 
61
24
  /**
62
25
  * Auto-generated API Client
@@ -64,32 +27,13 @@ declare const CmsValues: {
64
27
  * Generated by @spfn/core codegen
65
28
  * DO NOT EDIT MANUALLY
66
29
  *
67
- * @generated 2025-11-02T11:18:13.331Z
30
+ * @generated 2025-11-02T14:38:21.624Z
68
31
  */
69
32
 
70
33
  type GetPublishedCacheResponse = InferContract<typeof getPublishedCacheContract>['response'];
71
34
  type GetPublishedCacheQuery = InferContract<typeof getPublishedCacheContract>['query'];
72
- /**
73
- * CmsPublishedCache API
74
- */
75
- declare const CmsPublishedCache: {
76
- /**
77
- * GET /_cms/published-cache
78
- */
79
- readonly get: (options: {
80
- query?: GetPublishedCacheQuery;
81
- }) => Promise<{
82
- section: string;
83
- locale: string;
84
- content: {
85
- [x: string]: any;
86
- };
87
- version: number;
88
- publishedAt: string | null;
89
- }[] | {
90
- error: string;
91
- }>;
92
- };
35
+ type UpsertPublishedCacheResponse = InferContract<typeof upsertPublishedCacheContract>['response'];
36
+ type UpsertPublishedCacheBody = InferContract<typeof upsertPublishedCacheContract>['body'];
93
37
 
94
38
  /**
95
39
  * Auto-generated API Client
@@ -97,34 +41,11 @@ declare const CmsPublishedCache: {
97
41
  * Generated by @spfn/core codegen
98
42
  * DO NOT EDIT MANUALLY
99
43
  *
100
- * @generated 2025-11-02T11:18:13.331Z
44
+ * @generated 2025-11-02T14:38:21.624Z
101
45
  */
102
46
 
103
47
  type GetLabelByKeyResponse = InferContract<typeof getLabelByKeyContract>['response'];
104
48
  type GetLabelByKeyParams = InferContract<typeof getLabelByKeyContract>['params'];
105
- /**
106
- * CmsLabelsByKey API
107
- */
108
- declare const CmsLabelsByKey: {
109
- /**
110
- * GET /_cms/labels/by-key/:key
111
- */
112
- readonly getById: (options: {
113
- params: GetLabelByKeyParams;
114
- }) => Promise<{
115
- section: string;
116
- id: number;
117
- key: string;
118
- type: string;
119
- publishedVersion: number | null;
120
- createdBy: string | null;
121
- createdAt: string;
122
- updatedAt: string;
123
- } | {
124
- key?: string | undefined;
125
- error: string;
126
- }>;
127
- };
128
49
 
129
50
  /**
130
51
  * Auto-generated API Client
@@ -132,7 +53,7 @@ declare const CmsLabelsByKey: {
132
53
  * Generated by @spfn/core codegen
133
54
  * DO NOT EDIT MANUALLY
134
55
  *
135
- * @generated 2025-11-02T11:18:13.330Z
56
+ * @generated 2025-11-02T14:38:21.623Z
136
57
  */
137
58
 
138
59
  type GetLabelsResponse = InferContract<typeof getLabelsContract>['response'];
@@ -146,16 +67,16 @@ type UpdateLabelParams = InferContract<typeof updateLabelContract>['params'];
146
67
  type UpdateLabelBody = InferContract<typeof updateLabelContract>['body'];
147
68
  type DeleteLabelResponse = InferContract<typeof deleteLabelContract>['response'];
148
69
  type DeleteLabelParams = InferContract<typeof deleteLabelContract>['params'];
70
+
149
71
  /**
150
- * CmsLabels API
72
+ * Type-safe API client
151
73
  */
152
- declare const CmsLabels: {
153
- /**
154
- * GET /_cms/labels
155
- */
156
- readonly get: (options: {
74
+ declare const cmsApi: {
75
+ readonly getLabels: (options: {
157
76
  query?: GetLabelsQuery;
158
77
  }) => Promise<{
78
+ limit: number;
79
+ offset: number;
159
80
  labels: {
160
81
  defaultValue?: any;
161
82
  section: string;
@@ -167,14 +88,9 @@ declare const CmsLabels: {
167
88
  createdAt: string;
168
89
  updatedAt: string;
169
90
  }[];
170
- limit: number;
171
- offset: number;
172
91
  total: number;
173
92
  }>;
174
- /**
175
- * POST /_cms/labels
176
- */
177
- readonly post: (options: {
93
+ readonly createLabel: (options: {
178
94
  body: CreateLabelBody;
179
95
  }) => Promise<{
180
96
  section: string;
@@ -189,10 +105,7 @@ declare const CmsLabels: {
189
105
  key?: string | undefined;
190
106
  error: string;
191
107
  }>;
192
- /**
193
- * GET /_cms/labels/:id
194
- */
195
- readonly getById: (options: {
108
+ readonly getLabel: (options: {
196
109
  params: GetLabelParams;
197
110
  }) => Promise<{
198
111
  section: string;
@@ -206,10 +119,7 @@ declare const CmsLabels: {
206
119
  } | {
207
120
  error: string;
208
121
  }>;
209
- /**
210
- * PATCH /_cms/labels/:id
211
- */
212
- readonly update: (options: {
122
+ readonly updateLabel: (options: {
213
123
  params: UpdateLabelParams;
214
124
  body: UpdateLabelBody;
215
125
  }) => Promise<{
@@ -224,10 +134,7 @@ declare const CmsLabels: {
224
134
  } | {
225
135
  error: string;
226
136
  }>;
227
- /**
228
- * DELETE /_cms/labels/:id
229
- */
230
- readonly delete: (options: {
137
+ readonly deleteLabel: (options: {
231
138
  params: DeleteLabelParams;
232
139
  }) => Promise<{
233
140
  id: number;
@@ -235,144 +142,73 @@ declare const CmsLabels: {
235
142
  } | {
236
143
  error: string;
237
144
  }>;
238
- };
239
-
240
- /**
241
- * Type-safe API client
242
- */
243
- declare const cmsApi: {
244
- readonly cmsLabels: {
245
- readonly get: (options: {
246
- query?: GetLabelsQuery;
247
- }) => Promise<{
248
- labels: {
249
- defaultValue?: any;
250
- section: string;
251
- id: number;
252
- key: string;
253
- type: string;
254
- publishedVersion: number | null;
255
- createdBy: string | null;
256
- createdAt: string;
257
- updatedAt: string;
258
- }[];
259
- limit: number;
260
- offset: number;
261
- total: number;
262
- }>;
263
- readonly post: (options: {
264
- body: CreateLabelBody;
265
- }) => Promise<{
266
- section: string;
267
- id: number;
268
- key: string;
269
- type: string;
270
- publishedVersion: number | null;
271
- createdBy: string | null;
272
- createdAt: string;
273
- updatedAt: string;
274
- } | {
275
- key?: string | undefined;
276
- error: string;
277
- }>;
278
- readonly getById: (options: {
279
- params: GetLabelParams;
280
- }) => Promise<{
281
- section: string;
282
- id: number;
283
- key: string;
284
- type: string;
285
- publishedVersion: number | null;
286
- createdBy: string | null;
287
- createdAt: string;
288
- updatedAt: string;
289
- } | {
290
- error: string;
291
- }>;
292
- readonly update: (options: {
293
- params: UpdateLabelParams;
294
- body: UpdateLabelBody;
295
- }) => Promise<{
296
- section: string;
297
- id: number;
298
- key: string;
299
- type: string;
300
- publishedVersion: number | null;
301
- createdBy: string | null;
302
- createdAt: string;
303
- updatedAt: string;
304
- } | {
305
- error: string;
306
- }>;
307
- readonly delete: (options: {
308
- params: DeleteLabelParams;
309
- }) => Promise<{
310
- id: number;
311
- success: boolean;
312
- } | {
313
- error: string;
314
- }>;
315
- };
316
- readonly cmsLabelsByKey: {
317
- readonly getById: (options: {
318
- params: GetLabelByKeyParams;
319
- }) => Promise<{
320
- section: string;
145
+ readonly getLabelByKey: (options: {
146
+ params: GetLabelByKeyParams;
147
+ }) => Promise<{
148
+ section: string;
149
+ id: number;
150
+ key: string;
151
+ type: string;
152
+ publishedVersion: number | null;
153
+ createdBy: string | null;
154
+ createdAt: string;
155
+ updatedAt: string;
156
+ } | {
157
+ key?: string | undefined;
158
+ error: string;
159
+ }>;
160
+ readonly getPublishedCache: (options: {
161
+ query?: GetPublishedCacheQuery;
162
+ }) => Promise<{
163
+ section: string;
164
+ locale: string;
165
+ content: {
166
+ [x: string]: any;
167
+ };
168
+ version: number;
169
+ publishedAt: string | null;
170
+ }[] | {
171
+ error: string;
172
+ }>;
173
+ readonly upsertPublishedCache: (options: {
174
+ body: UpsertPublishedCacheBody;
175
+ }) => Promise<{
176
+ section: string;
177
+ locale: string;
178
+ content: {
179
+ [x: string]: any;
180
+ };
181
+ version: number;
182
+ publishedAt: string | null;
183
+ } | {
184
+ error: string;
185
+ }>;
186
+ readonly saveValues: (options: {
187
+ params: SaveValuesParams;
188
+ body: SaveValuesBody;
189
+ }) => Promise<{
190
+ success: boolean;
191
+ version: number | null;
192
+ saved: number;
193
+ } | {
194
+ error: string;
195
+ }>;
196
+ readonly getValues: (options: {
197
+ params: GetValuesParams;
198
+ query?: GetValuesQuery;
199
+ }) => Promise<{
200
+ version: number;
201
+ labelId: number;
202
+ values: {
321
203
  id: number;
322
- key: string;
323
- type: string;
324
- publishedVersion: number | null;
325
- createdBy: string | null;
326
204
  createdAt: string;
327
- updatedAt: string;
328
- } | {
329
- key?: string | undefined;
330
- error: string;
331
- }>;
332
- };
333
- readonly cmsPublishedCache: {
334
- readonly get: (options: {
335
- query?: GetPublishedCacheQuery;
336
- }) => Promise<{
337
- section: string;
338
205
  locale: string;
339
- content: {
340
- [x: string]: any;
341
- };
342
- version: number;
343
- publishedAt: string | null;
344
- }[] | {
345
- error: string;
346
- }>;
347
- };
348
- readonly cmsValues: {
349
- readonly post: (options: {
350
- params: SaveValuesParams;
351
- body: SaveValuesBody;
352
- }) => Promise<{
353
- version: number;
354
- success: boolean;
355
- saved: number;
356
- } | {
357
- error: string;
358
- }>;
359
- readonly getById: (options: {
360
- params: GetValuesParams;
361
- query?: GetValuesQuery;
362
- }) => Promise<{
363
- version: number;
364
- labelId: number;
365
- values: {
366
- locale: string;
367
- id: number;
368
- value: any;
369
- createdAt: string;
370
- breakpoint: string | null;
371
- }[];
372
- } | {
373
- error: string;
374
- }>;
375
- };
206
+ breakpoint: string | null;
207
+ value: any;
208
+ }[];
209
+ } | {
210
+ error: string;
211
+ }>;
376
212
  };
377
213
 
378
- export { CmsLabels, CmsLabelsByKey, CmsPublishedCache, CmsValues, type CreateLabelBody, type CreateLabelResponse, type DeleteLabelParams, type DeleteLabelResponse, type GetLabelByKeyParams, type GetLabelByKeyResponse, type GetLabelParams, type GetLabelResponse, type GetLabelsQuery, type GetLabelsResponse, type GetPublishedCacheQuery, type GetPublishedCacheResponse, type GetValuesParams, type GetValuesQuery, type GetValuesResponse, type SaveValuesBody, type SaveValuesParams, type SaveValuesResponse, type UpdateLabelBody, type UpdateLabelParams, type UpdateLabelResponse, cmsApi };
214
+ export { type CreateLabelBody, type CreateLabelResponse, type DeleteLabelParams, type DeleteLabelResponse, type GetLabelByKeyParams, type GetLabelByKeyResponse, type GetLabelParams, type GetLabelResponse, type GetLabelsQuery, type GetLabelsResponse, type GetPublishedCacheQuery, type GetPublishedCacheResponse, type GetValuesParams, type GetValuesQuery, type GetValuesResponse, type SaveValuesBody, type SaveValuesParams, type SaveValuesResponse, type UpdateLabelBody, type UpdateLabelParams, type UpdateLabelResponse, type UpsertPublishedCacheBody, type UpsertPublishedCacheResponse, cmsApi };
package/dist/api.js CHANGED
@@ -165,37 +165,15 @@ var getLabelByKeyContract = {
165
165
  };
166
166
 
167
167
  // src/api/cms-labels.ts
168
- var CmsLabels = {
169
- /**
170
- * GET /_cms/labels
171
- */
172
- get: (options) => client.call(getLabelsContract, options),
173
- /**
174
- * POST /_cms/labels
175
- */
176
- post: (options) => client.call(createLabelContract, options),
177
- /**
178
- * GET /_cms/labels/:id
179
- */
180
- getById: (options) => client.call(getLabelContract, options),
181
- /**
182
- * PATCH /_cms/labels/:id
183
- */
184
- update: (options) => client.call(updateLabelContract, options),
185
- /**
186
- * DELETE /_cms/labels/:id
187
- */
188
- delete: (options) => client.call(deleteLabelContract, options)
189
- };
168
+ var getLabels = (options) => client.call(getLabelsContract, options);
169
+ var createLabel = (options) => client.call(createLabelContract, options);
170
+ var getLabel = (options) => client.call(getLabelContract, options);
171
+ var updateLabel = (options) => client.call(updateLabelContract, options);
172
+ var deleteLabel = (options) => client.call(deleteLabelContract, options);
190
173
 
191
174
  // src/api/cms-labels-by-key.ts
192
175
  import { client as client2 } from "@spfn/core/client";
193
- var CmsLabelsByKey = {
194
- /**
195
- * GET /_cms/labels/by-key/:key
196
- */
197
- getById: (options) => client2.call(getLabelByKeyContract, options)
198
- };
176
+ var getLabelByKey = (options) => client2.call(getLabelByKeyContract, options);
199
177
 
200
178
  // src/api/cms-published-cache.ts
201
179
  import { client as client3 } from "@spfn/core/client";
@@ -246,12 +224,8 @@ var upsertPublishedCacheContract = {
246
224
  };
247
225
 
248
226
  // src/api/cms-published-cache.ts
249
- var CmsPublishedCache = {
250
- /**
251
- * GET /_cms/published-cache
252
- */
253
- get: (options) => client3.call(getPublishedCacheContract, options)
254
- };
227
+ var getPublishedCache = (options) => client3.call(getPublishedCacheContract, options);
228
+ var upsertPublishedCache = (options) => client3.call(upsertPublishedCacheContract, options);
255
229
 
256
230
  // src/api/cms-values.ts
257
231
  import { client as client4 } from "@spfn/core/client";
@@ -294,7 +268,10 @@ var saveValuesContract = {
294
268
  labelId: Type3.String({ description: "\uB77C\uBCA8 ID" })
295
269
  }),
296
270
  body: Type3.Object({
297
- version: Type3.Number({ description: "\uBC84\uC804 \uBC88\uD638", minimum: 1 }),
271
+ version: Type3.Union([
272
+ Type3.Null({ description: "Draft \uC800\uC7A5 (\uB36E\uC5B4\uC4F0\uAE30)" }),
273
+ Type3.Number({ description: "\uBC84\uC804 \uBC88\uD638 (\uBD88\uBCC0)", minimum: 1 })
274
+ ]),
298
275
  values: Type3.Array(
299
276
  Type3.Object({
300
277
  locale: Type3.String({ description: "\uC5B8\uC5B4 \uCF54\uB4DC (ko, en, ja)", default: "ko" }),
@@ -314,7 +291,7 @@ var saveValuesContract = {
314
291
  Type3.Object({
315
292
  success: Type3.Boolean(),
316
293
  saved: Type3.Number(),
317
- version: Type3.Number()
294
+ version: Type3.Union([Type3.Null(), Type3.Number()])
318
295
  }),
319
296
  Type3.Object({
320
297
  error: Type3.String()
@@ -353,29 +330,23 @@ var getValuesContract = {
353
330
  };
354
331
 
355
332
  // src/api/cms-values.ts
356
- var CmsValues = {
357
- /**
358
- * POST /_cms/values/:labelId
359
- */
360
- post: (options) => client4.call(saveValuesContract, options),
361
- /**
362
- * GET /_cms/values/:labelId/:version
363
- */
364
- getById: (options) => client4.call(getValuesContract, options)
365
- };
333
+ var saveValues = (options) => client4.call(saveValuesContract, options);
334
+ var getValues = (options) => client4.call(getValuesContract, options);
366
335
 
367
336
  // src/api/index.ts
368
337
  var cmsApi = {
369
- cmsLabels: CmsLabels,
370
- cmsLabelsByKey: CmsLabelsByKey,
371
- cmsPublishedCache: CmsPublishedCache,
372
- cmsValues: CmsValues
338
+ getLabels,
339
+ createLabel,
340
+ getLabel,
341
+ updateLabel,
342
+ deleteLabel,
343
+ getLabelByKey,
344
+ getPublishedCache,
345
+ upsertPublishedCache,
346
+ saveValues,
347
+ getValues
373
348
  };
374
349
  export {
375
- CmsLabels,
376
- CmsLabelsByKey,
377
- CmsPublishedCache,
378
- CmsValues,
379
350
  client5 as client,
380
351
  cmsApi
381
352
  };