@c-time/frelio-data-json-recipe 1.0.0 → 1.2.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.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @c-time/frelio-data-json-recipe
2
+
3
+ Type definitions for Frelio build data recipe.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @c-time/frelio-data-json-recipe
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import type { FrelioBuildDataRecipe } from '@c-time/frelio-data-json-recipe'
15
+
16
+ const recipe: FrelioBuildDataRecipe = {
17
+ version: '1.0',
18
+ contentTypes: {
19
+ article: {
20
+ details: [{
21
+ type: 'detail',
22
+ outputPath: 'article/{$this.slug}.json',
23
+ templatePath: 'article/detail.html'
24
+ }],
25
+ lists: [{
26
+ type: 'list',
27
+ outputPath: 'articles/index.json',
28
+ templatePath: 'article/list.html'
29
+ }]
30
+ }
31
+ },
32
+ lastUpdatedAt: '2024-01-01T00:00:00Z',
33
+ lastUpdatedBy: 'user'
34
+ }
35
+ ```
36
+
37
+ ## Type Guards
38
+
39
+ ```typescript
40
+ import {
41
+ isListPageRecipeWithPagination,
42
+ isCustomFieldRelationList
43
+ } from '@c-time/frelio-data-json-recipe'
44
+
45
+ // Check if list recipe has pagination
46
+ if (isListPageRecipeWithPagination(listRecipe)) {
47
+ console.log(listRecipe.pagination.perPage)
48
+ }
49
+
50
+ // Check if custom field is relation list
51
+ if (isCustomFieldRelationList(customField)) {
52
+ console.log(customField.contentTypeId)
53
+ }
54
+ ```
55
+
56
+ ## Types
57
+
58
+ ### Main Types
59
+
60
+ - `FrelioBuildDataRecipe` - Site-wide build data recipe
61
+ - `ContentTypeRecipe` - Per content type recipe
62
+ - `DetailPageRecipe` - Detail page recipe
63
+ - `ListPageRecipe` - List page recipe (with/without pagination)
64
+ - `StaticPageRecipe` - Static page recipe
65
+
66
+ ### Custom Field Types
67
+
68
+ - `CustomField` - Union of transform and relation list
69
+ - `CustomFieldTransform` - Transform-based custom field
70
+ - `CustomFieldRelationList` - Relation list custom field
71
+
72
+ ### Configuration Types
73
+
74
+ - `RecipeSort` - Sort configuration
75
+ - `RecipeFilter` - Filter configuration
76
+ - `RelationExpand` - Relation expand configuration
77
+ - `PaginatedListOutput<T>` - Paginated list output structure
78
+
79
+ ## License
80
+
81
+ MIT
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Type guard functions for Frelio build data recipe.
3
+ */
4
+ import type { ListPageRecipe, ListPageRecipeWithPagination, ListPageRecipeWithoutPagination, CustomField, CustomFieldRelationList, CustomFieldTransform } from './types.js';
5
+ /**
6
+ * ListPageRecipe がページネーション有効かどうかを判定
7
+ */
8
+ export declare function isListPageRecipeWithPagination(recipe: ListPageRecipe): recipe is ListPageRecipeWithPagination;
9
+ /**
10
+ * ListPageRecipe がページネーション無効かどうかを判定
11
+ */
12
+ export declare function isListPageRecipeWithoutPagination(recipe: ListPageRecipe): recipe is ListPageRecipeWithoutPagination;
13
+ /**
14
+ * CustomField が RelationList かどうかを判定
15
+ */
16
+ export declare function isCustomFieldRelationList(field: CustomField): field is CustomFieldRelationList;
17
+ /**
18
+ * CustomField が変換系(Transform)かどうかを判定
19
+ */
20
+ export declare function isCustomFieldTransform(field: CustomField): field is CustomFieldTransform;
21
+ //# sourceMappingURL=guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,4BAA4B,EAC5B,+BAA+B,EAC/B,WAAW,EACX,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,YAAY,CAAA;AAEnB;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,cAAc,GACrB,MAAM,IAAI,4BAA4B,CAExC;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,cAAc,GACrB,MAAM,IAAI,+BAA+B,CAE3C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,WAAW,GACjB,KAAK,IAAI,uBAAuB,CAElC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,WAAW,GACjB,KAAK,IAAI,oBAAoB,CAE/B"}
package/dist/guards.js ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Type guard functions for Frelio build data recipe.
3
+ */
4
+ /**
5
+ * ListPageRecipe がページネーション有効かどうかを判定
6
+ */
7
+ export function isListPageRecipeWithPagination(recipe) {
8
+ return recipe.pagination !== undefined;
9
+ }
10
+ /**
11
+ * ListPageRecipe がページネーション無効かどうかを判定
12
+ */
13
+ export function isListPageRecipeWithoutPagination(recipe) {
14
+ return recipe.pagination === undefined;
15
+ }
16
+ /**
17
+ * CustomField が RelationList かどうかを判定
18
+ */
19
+ export function isCustomFieldRelationList(field) {
20
+ return field.type === 'relationList';
21
+ }
22
+ /**
23
+ * CustomField が変換系(Transform)かどうかを判定
24
+ */
25
+ export function isCustomFieldTransform(field) {
26
+ return field.type !== 'relationList';
27
+ }
28
+ //# sourceMappingURL=guards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAC5C,MAAsB;IAEtB,OAAO,MAAM,CAAC,UAAU,KAAK,SAAS,CAAA;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iCAAiC,CAC/C,MAAsB;IAEtB,OAAO,MAAM,CAAC,UAAU,KAAK,SAAS,CAAA;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAkB;IAElB,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAA;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAkB;IAElB,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAA;AACtC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,323 +1,27 @@
1
1
  /**
2
- * カスタムフィールドのフォーマット種別(変換系)
3
- */
4
- export type CustomFieldFormatType = 'string' | 'date' | 'number' | 'escape' | 'toc' | 'truncate' | 'stripHtml' | 'slug' | 'lowercase' | 'uppercase' | 'default' | 'count' | 'first' | 'last' | 'join' | 'url' | 'picture' | 'img' | 'srcset' | 'fileLink' | 'relationList';
5
- /**
6
- * カスタムフィールド(変換系)
7
- * source 式を元に値を変換・整形する
8
- */
9
- export type CustomFieldTransform = {
10
- /** 出力フィールド名 */
11
- field: string;
12
- /** 元となる式(例: "{$this.title} - {$this.subtitle}") */
13
- source: string;
14
- /** フォーマット種別 */
15
- type?: Exclude<CustomFieldFormatType, 'relationList'>;
16
- /** フォーマット文字列(例: "YYYY年MM月DD日", "#,###円") */
17
- format?: string;
18
- /** truncate用の文字数 */
19
- length?: number;
20
- /** truncate用の末尾文字列(デフォルト: "...") */
21
- suffix?: string;
22
- /** join用の区切り文字(デフォルト: ", ") */
23
- separator?: string;
24
- /** default用のデフォルト値 */
25
- defaultValue?: string;
26
- };
27
- /**
28
- * カスタムフィールド(RelationList)
29
- * 任意のコンテンツタイプのリストを参照し、埋め込む
30
- * RecipeInclude に似た構造を持つ
31
- */
32
- export type CustomFieldRelationList = {
33
- /** 出力フィールド名 */
34
- field: string;
35
- /** フォーマット種別(relationList 固定) */
36
- type: 'relationList';
37
- /** 参照先コンテンツタイプID */
38
- contentTypeId: string;
39
- /** 最大件数 */
40
- limit?: number;
41
- /** スキップ件数 */
42
- offset?: number;
43
- /** ソート設定 */
44
- sort?: RecipeSort | RecipeSort[];
45
- /** フィルター設定 */
46
- filters?: RecipeFilter[];
47
- /** 取得するフィールド(null = 全て) */
48
- listFields?: string[] | null;
49
- /** リレーション展開設定 */
50
- expand?: RelationExpand[];
51
- /** ネストしたカスタムフィールド */
52
- customFields?: CustomField[];
53
- /** ページネーション設定(任意) */
54
- pagination?: RelationListPaginationConfig;
55
- };
56
- /**
57
- * カスタムフィールド設定
58
- * 変換系(CustomFieldTransform)または RelationList(CustomFieldRelationList)のユニオン型
59
- */
60
- export type CustomField = CustomFieldTransform | CustomFieldRelationList;
61
- /**
62
- * Relation 展開設定
63
- * リレーションフィールドを展開し、さらにネストした relation も展開可能
64
- * 入れ子で「取得フィールド」「カスタムフィールド」「並び替え」「オフセット」等を設定可能
65
- */
66
- export type RelationExpand = {
67
- /** relation フィールド名 */
68
- field: string;
69
- /** 含めるフィールド(undefined = 全て) */
70
- fields?: string[];
71
- /** カスタムフィールド定義 */
72
- customFields?: CustomField[];
73
- /** ソート設定 */
74
- sort?: RecipeSort | RecipeSort[];
75
- /** 取得件数 */
76
- limit?: number;
77
- /** スキップ件数 */
78
- offset?: number;
79
- /** フィルター設定 */
80
- filters?: RecipeFilter[];
81
- /** ネストした展開設定(参照先の relation をさらに展開する場合) */
82
- expand?: RelationExpand[];
83
- };
84
- /**
85
- * ソート設定
86
- */
87
- export type RecipeSort = {
88
- /** ソート対象フィールド */
89
- field: string;
90
- /** ソート方向 */
91
- direction: 'asc' | 'desc';
92
- };
93
- /**
94
- * フィルター演算子
95
- */
96
- export type RecipeFilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'nin' | 'regex' | 'isNull' | 'isNotNull';
97
- /**
98
- * フィルター設定
99
- */
100
- export type RecipeFilter = {
101
- /** フィルター対象フィールド */
102
- field: string;
103
- /** 演算子 */
104
- operator: RecipeFilterOperator;
105
- /** 比較値(isNull/isNotNull の場合は不要) */
106
- value?: unknown;
107
- };
108
- /**
109
- * ページネーション設定の基底型
110
- */
111
- export type PaginationConfigBase = {
112
- /** 1ページあたりの件数 */
113
- perPage: number;
114
- };
115
- /**
116
- * ListPageRecipe 用ページネーション設定
117
- * outputPath にページ番号パターン(例: "articles/page/{$page}.json")を含めることを前提とする
118
- */
119
- export type ListPageRecipePaginationConfig = PaginationConfigBase & {
120
- /**
121
- * ページ番号のゼロ埋め桁数
122
- * 例: 3 なら "001", "002", ... "999"
123
- */
124
- numberFormatCount: number;
125
- /**
126
- * 1ページ目の固定パス(任意)
127
- * 例: "articles/index.json"
128
- * 指定しない場合は outputPath のパターンがそのまま適用される
129
- */
130
- startPath?: string;
131
- };
132
- /**
133
- * カスタムフィールド RelationList 用ページネーション設定
134
- * 将来の拡張に備えて予約
135
- */
136
- export type RelationListPaginationConfig = PaginationConfigBase & {};
137
- /**
138
- * 親をたどるリピート設定
139
- * カテゴリ階層などで親をたどってパスを生成する
140
- */
141
- export type RecipeRepeat = {
142
- /** 変数名(例: "parent")→ {$parent.xxx} でアクセス */
143
- as: string;
144
- /** たどる relation フィールド名(例: "parentCategory") */
145
- field: string;
146
- /** リピート時の出力パス(例: "{$parent.slug}/{$this.slug}/index.json") */
147
- outputPath: string;
148
- };
149
- /**
150
- * 詳細データ設定
151
- * 個別コンテンツの詳細データを生成するための設定
152
- */
153
- export type DetailPageRecipe = {
154
- type: 'detail';
155
- /** 出力パス(例: "article/{$this.slug}.json") */
156
- outputPath: string;
157
- /** テンプレートファイルのパス */
158
- templatePath: string;
159
- /** リレーション展開設定 */
160
- expand?: RelationExpand[];
161
- /** 親をたどるリピート設定 */
162
- repeat?: RecipeRepeat;
163
- /** カスタムフィールド定義 */
164
- customFields?: CustomField[];
165
- /** 追加で含めるデータ */
166
- include?: {
167
- /** サイト設定を含める */
168
- site?: boolean;
169
- };
170
- };
171
- /**
172
- * 一覧データ設定の共通プロパティ(内部用)
173
- */
174
- type ListPageRecipeBase = {
175
- type: 'list';
176
- /** 出力パス(例: "articles/index.json" または "articles/page/{$page}.json") */
177
- outputPath: string;
178
- /** テンプレートファイルのパス */
179
- templatePath: string;
180
- /** スキップ件数 */
181
- offset?: number;
182
- /** ソート設定(単一または複数) */
183
- sort?: RecipeSort | RecipeSort[];
184
- /** フィルター設定 */
185
- filters?: RecipeFilter[];
186
- /** カスタムフィールド定義 */
187
- customFields?: CustomField[];
188
- };
189
- /**
190
- * 一覧データ設定(ページネーション無効)
191
- * - listFields で出力フィールドを制御
192
- * - expand でリレーションを展開
193
- */
194
- export type ListPageRecipeWithoutPagination = ListPageRecipeBase & {
195
- pagination?: undefined;
196
- /** 最大件数 */
197
- limit?: number;
198
- /** 一覧に含めるフィールド(null = 全て) */
199
- listFields?: string[] | null;
200
- /** リレーション展開設定 */
201
- expand?: RelationExpand[];
202
- };
203
- /**
204
- * 一覧データ設定(ページネーション有効)
2
+ * @c-time/frelio-data-json-recipe
3
+ *
4
+ * Type definitions for Frelio build data recipe.
205
5
  *
206
- * ページネーション有効時の出力構造は固定:
207
- * {
208
- * "nextPage": "articles/page-002.json",
209
- * "prevPage": null,
210
- * "pageNumber": 1,
211
- * "totalPages": 10,
212
- * "totalItems": 95,
213
- * "pagedItems": [ ... ]
6
+ * @example
7
+ * ```typescript
8
+ * import type { FrelioBuildDataRecipe } from '@c-time/frelio-data-json-recipe'
9
+ *
10
+ * const recipe: FrelioBuildDataRecipe = {
11
+ * version: '1.0',
12
+ * contentTypes: {
13
+ * article: {
14
+ * details: [{ type: 'detail', outputPath: 'article/{$this.slug}.json', templatePath: 'article/detail.html' }],
15
+ * lists: [{ type: 'list', outputPath: 'articles/index.json', templatePath: 'article/list.html' }]
16
+ * }
17
+ * },
18
+ * lastUpdatedAt: '2024-01-01T00:00:00Z',
19
+ * lastUpdatedBy: 'user'
214
20
  * }
21
+ * ```
215
22
  *
216
- * - listFields は使用しない(pagedItems の構造に固定)
217
- * - items.fields / items.expand で pagedItems 内のアイテムに対する設定を行う
218
- */
219
- export type ListPageRecipeWithPagination = ListPageRecipeBase & {
220
- pagination: ListPageRecipePaginationConfig;
221
- /** pagedItems に適用する設定 */
222
- items?: {
223
- /** 一覧に含めるフィールド(null = 全て) */
224
- fields?: string[] | null;
225
- /** リレーション展開設定 */
226
- expand?: RelationExpand[];
227
- };
228
- };
229
- /**
230
- * 一覧データ設定
231
- * コンテンツの一覧データを生成するための設定
232
- */
233
- export type ListPageRecipe = ListPageRecipeWithoutPagination | ListPageRecipeWithPagination;
234
- /**
235
- * 固定ページレシピ(単体固定モード)
236
- * 1つのJSONファイルを出力
237
- */
238
- export type StaticPageRecipe = {
239
- type: 'static';
240
- /** 出力パス(例: "site-config.json") */
241
- outputPath: string;
242
- /** テンプレートファイルのパス */
243
- templatePath: string;
244
- /** カスタムフィールド定義 */
245
- customFields?: CustomField[];
246
- };
247
- /**
248
- * コンテンツタイプ別レシピ
249
- */
250
- export type ContentTypeRecipe = {
251
- /** 詳細データ設定(複数可:通常版、AMP版、印刷用など) */
252
- details?: DetailPageRecipe[];
253
- /** 一覧データ設定(複数可) */
254
- lists?: ListPageRecipe[];
255
- };
256
- /**
257
- * テンプレートのパーツ化ファイル定義
258
- * パーツファイルの変更が影響するテンプレートを定義
259
- * 例: { "_parts/*.html": ["*"] } → パーツ変更で全ビルド
260
- */
261
- export type TemplateIncludes = {
262
- /** キー: パーツファイルのglobパターン、値: 影響を受けるテンプレートパス配列("*"で全て) */
263
- [partsPattern: string]: string[];
264
- };
265
- /**
266
- * 目次エントリ(toc フォーマットの出力形式)
267
- */
268
- export type TocEntry = {
269
- /** 見出しレベル(1-6) */
270
- level: number;
271
- /** 見出しのID属性 */
272
- id: string;
273
- /** 見出しのテキスト */
274
- text: string;
275
- };
276
- /**
277
- * サイト全体のビルドデータレシピ(メタデータ含む)
278
- */
279
- export type SiteRecipe = {
280
- /** バージョン */
281
- version: '1.0';
282
- /** コンテンツタイプ別レシピ */
283
- contentTypes: Record<string, ContentTypeRecipe>;
284
- /** 固定ページレシピ */
285
- staticPages?: StaticPageRecipe[];
286
- /** テンプレートパーツ依存関係 */
287
- templateIncludes?: TemplateIncludes;
288
- /** 最終更新日時 */
289
- lastUpdatedAt: string;
290
- /** 最終更新者 */
291
- lastUpdatedBy: string;
292
- };
293
- /**
294
- * ページネーション有効時の出力 JSON 構造
295
- */
296
- export type PaginatedListOutput<T = unknown> = {
297
- /** 現在のページ番号(1始まり) */
298
- currentPageNumber: number;
299
- /** 総ページ数 */
300
- totalPagesCount: number;
301
- /** 総アイテム数 */
302
- totalItemsCount: number;
303
- /** このページのアイテム配列 */
304
- pagedItems: T[];
305
- };
306
- /**
307
- * ListPageRecipe がページネーション有効かどうかを判定
308
- */
309
- export declare function isListPageRecipeWithPagination(recipe: ListPageRecipe): recipe is ListPageRecipeWithPagination;
310
- /**
311
- * ListPageRecipe がページネーション無効かどうかを判定
312
- */
313
- export declare function isListPageRecipeWithoutPagination(recipe: ListPageRecipe): recipe is ListPageRecipeWithoutPagination;
314
- /**
315
- * CustomField が RelationList かどうかを判定
316
- */
317
- export declare function isCustomFieldRelationList(field: CustomField): field is CustomFieldRelationList;
318
- /**
319
- * CustomField が変換系(Transform)かどうかを判定
23
+ * @packageDocumentation
320
24
  */
321
- export declare function isCustomFieldTransform(field: CustomField): field is CustomFieldTransform;
322
- export {};
25
+ export type { CustomFieldFormatType, CustomFieldTransform, CustomFieldRelationList, CustomField, RecipeSort, RecipeFilterOperator, RecipeFilter, PaginationConfigBase, ListPageRecipePaginationConfig, RelationListPaginationConfig, RelationExpand, RecipeRepeat, DetailPageRecipe, ListPageRecipeWithoutPagination, ListPageRecipeWithPagination, ListPageRecipe, StaticPageRecipe, ContentTypeRecipe, TemplateIncludes, TocEntry, PaginatedListOutput, FrelioBuildDataRecipe, } from './types.js';
26
+ export { isListPageRecipeWithPagination, isListPageRecipeWithoutPagination, isCustomFieldRelationList, isCustomFieldTransform, } from './guards.js';
323
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,UAAU,GACV,WAAW,GACX,MAAM,GACN,WAAW,GACX,WAAW,GACX,SAAS,GACT,O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B,EACpB,uBAAuB,EACvB,WAAW,EAEX,UAAU,EACV,oBAAoB,EACpB,YAAY,EAEZ,oBAAoB,EACpB,8BAA8B,EAC9B,4BAA4B,EAE5B,cAAc,EACd,YAAY,EAEZ,gBAAgB,EAChB,+BAA+B,EAC/B,4BAA4B,EAC5B,cAAc,EACd,gBAAgB,EAEhB,iBAAiB,EACjB,gBAAgB,EAEhB,QAAQ,EACR,mBAAmB,EAEnB,qBAAqB,GACtB,MAAM,YAAY,CAAA;AAGnB,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,aAAa,CAAA"}
package/dist/index.js CHANGED
@@ -1,27 +1,27 @@
1
- // === Build Data Recipe ===
2
- // === 型ガード関数 ===
3
1
  /**
4
- * ListPageRecipe がページネーション有効かどうかを判定
2
+ * @c-time/frelio-data-json-recipe
3
+ *
4
+ * Type definitions for Frelio build data recipe.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import type { FrelioBuildDataRecipe } from '@c-time/frelio-data-json-recipe'
9
+ *
10
+ * const recipe: FrelioBuildDataRecipe = {
11
+ * version: '1.0',
12
+ * contentTypes: {
13
+ * article: {
14
+ * details: [{ type: 'detail', outputPath: 'article/{$this.slug}.json', templatePath: 'article/detail.html' }],
15
+ * lists: [{ type: 'list', outputPath: 'articles/index.json', templatePath: 'article/list.html' }]
16
+ * }
17
+ * },
18
+ * lastUpdatedAt: '2024-01-01T00:00:00Z',
19
+ * lastUpdatedBy: 'user'
20
+ * }
21
+ * ```
22
+ *
23
+ * @packageDocumentation
5
24
  */
6
- export function isListPageRecipeWithPagination(recipe) {
7
- return recipe.pagination !== undefined;
8
- }
9
- /**
10
- * ListPageRecipe がページネーション無効かどうかを判定
11
- */
12
- export function isListPageRecipeWithoutPagination(recipe) {
13
- return recipe.pagination === undefined;
14
- }
15
- /**
16
- * CustomField が RelationList かどうかを判定
17
- */
18
- export function isCustomFieldRelationList(field) {
19
- return field.type === 'relationList';
20
- }
21
- /**
22
- * CustomField が変換系(Transform)かどうかを判定
23
- */
24
- export function isCustomFieldTransform(field) {
25
- return field.type !== 'relationList';
26
- }
25
+ // Type guards
26
+ export { isListPageRecipeWithPagination, isListPageRecipeWithoutPagination, isCustomFieldRelationList, isCustomFieldTransform, } from './guards.js';
27
27
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4BAA4B;AA8W5B,iBAAiB;AAEjB;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAC5C,MAAsB;IAEtB,OAAO,MAAM,CAAC,UAAU,KAAK,SAAS,CAAA;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iCAAiC,CAC/C,MAAsB;IAEtB,OAAO,MAAM,CAAC,UAAU,KAAK,SAAS,CAAA;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAkB;IAElB,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAA;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAkB;IAElB,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAA;AACtC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAoCH,cAAc;AACd,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,aAAa,CAAA"}
@@ -0,0 +1,310 @@
1
+ /**
2
+ * Type definitions for Frelio build data recipe.
3
+ */
4
+ /**
5
+ * カスタムフィールドのフォーマット種別(変換系)
6
+ */
7
+ export type CustomFieldFormatType = 'string' | 'date' | 'number' | 'escape' | 'toc' | 'truncate' | 'stripHtml' | 'slug' | 'lowercase' | 'uppercase' | 'default' | 'count' | 'first' | 'last' | 'join' | 'url' | 'picture' | 'img' | 'srcset' | 'fileLink' | 'relationList';
8
+ /**
9
+ * ソート設定
10
+ */
11
+ export type RecipeSort = {
12
+ /** ソート対象フィールド */
13
+ field: string;
14
+ /** ソート方向 */
15
+ direction: 'asc' | 'desc';
16
+ };
17
+ /**
18
+ * フィルター演算子
19
+ */
20
+ export type RecipeFilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'nin' | 'regex' | 'isNull' | 'isNotNull';
21
+ /**
22
+ * フィルター設定
23
+ */
24
+ export type RecipeFilter = {
25
+ /** フィルター対象フィールド */
26
+ field: string;
27
+ /** 演算子 */
28
+ operator: RecipeFilterOperator;
29
+ /** 比較値(isNull/isNotNull の場合は不要) */
30
+ value?: unknown;
31
+ };
32
+ /**
33
+ * ページネーション設定の基底型
34
+ */
35
+ export type PaginationConfigBase = {
36
+ /** 1ページあたりの件数 */
37
+ perPage: number;
38
+ };
39
+ /**
40
+ * ListPageRecipe 用ページネーション設定
41
+ * outputPath にページ番号パターン(例: "articles/page/{$page}.json")を含めることを前提とする
42
+ */
43
+ export type ListPageRecipePaginationConfig = PaginationConfigBase & {
44
+ /**
45
+ * ページ番号のゼロ埋め桁数
46
+ * 例: 3 なら "001", "002", ... "999"
47
+ */
48
+ numberFormatCount: number;
49
+ /**
50
+ * 1ページ目の固定パス(任意)
51
+ * 例: "articles/index.json"
52
+ * 指定しない場合は outputPath のパターンがそのまま適用される
53
+ */
54
+ startPath?: string;
55
+ };
56
+ /**
57
+ * カスタムフィールド RelationList 用ページネーション設定
58
+ * 将来の拡張に備えて予約
59
+ */
60
+ export type RelationListPaginationConfig = PaginationConfigBase & {};
61
+ /**
62
+ * カスタムフィールド(変換系)
63
+ * source 式を元に値を変換・整形する
64
+ */
65
+ export type CustomFieldTransform = {
66
+ /** 出力フィールド名 */
67
+ field: string;
68
+ /** 元となる式(例: "{$this.title} - {$this.subtitle}") */
69
+ source: string;
70
+ /** フォーマット種別 */
71
+ type?: Exclude<CustomFieldFormatType, 'relationList'>;
72
+ /** フォーマット文字列(例: "YYYY年MM月DD日", "#,###円") */
73
+ format?: string;
74
+ /** truncate用の文字数 */
75
+ length?: number;
76
+ /** truncate用の末尾文字列(デフォルト: "...") */
77
+ suffix?: string;
78
+ /** join用の区切り文字(デフォルト: ", ") */
79
+ separator?: string;
80
+ /** default用のデフォルト値 */
81
+ defaultValue?: string;
82
+ };
83
+ /**
84
+ * カスタムフィールド(RelationList)
85
+ * 任意のコンテンツタイプのリストを参照し、埋め込む
86
+ * RecipeInclude に似た構造を持つ
87
+ */
88
+ export type CustomFieldRelationList = {
89
+ /** 出力フィールド名 */
90
+ field: string;
91
+ /** フォーマット種別(relationList 固定) */
92
+ type: 'relationList';
93
+ /** 参照先コンテンツタイプID */
94
+ contentTypeId: string;
95
+ /** 最大件数 */
96
+ limit?: number;
97
+ /** スキップ件数 */
98
+ offset?: number;
99
+ /** ソート設定 */
100
+ sort?: RecipeSort | RecipeSort[];
101
+ /** フィルター設定 */
102
+ filters?: RecipeFilter[];
103
+ /** 取得するフィールド(null = 全て) */
104
+ listFields?: string[] | null;
105
+ /** リレーション展開設定 */
106
+ expand?: RelationExpand[];
107
+ /** ネストしたカスタムフィールド */
108
+ customFields?: CustomField[];
109
+ /** ページネーション設定(任意) */
110
+ pagination?: RelationListPaginationConfig;
111
+ };
112
+ /**
113
+ * カスタムフィールド設定
114
+ * 変換系(CustomFieldTransform)または RelationList(CustomFieldRelationList)のユニオン型
115
+ */
116
+ export type CustomField = CustomFieldTransform | CustomFieldRelationList;
117
+ /**
118
+ * Relation 展開設定
119
+ * リレーションフィールドを展開し、さらにネストした relation も展開可能
120
+ * 入れ子で「取得フィールド」「カスタムフィールド」「並び替え」「オフセット」等を設定可能
121
+ */
122
+ export type RelationExpand = {
123
+ /** relation フィールド名 */
124
+ field: string;
125
+ /** 含めるフィールド(undefined = 全て) */
126
+ fields?: string[];
127
+ /** カスタムフィールド定義 */
128
+ customFields?: CustomField[];
129
+ /** ソート設定 */
130
+ sort?: RecipeSort | RecipeSort[];
131
+ /** 取得件数 */
132
+ limit?: number;
133
+ /** スキップ件数 */
134
+ offset?: number;
135
+ /** フィルター設定 */
136
+ filters?: RecipeFilter[];
137
+ /** ネストした展開設定(参照先の relation をさらに展開する場合) */
138
+ expand?: RelationExpand[];
139
+ };
140
+ /**
141
+ * 親をたどるリピート設定
142
+ * カテゴリ階層などで親をたどってパスを生成する
143
+ */
144
+ export type RecipeRepeat = {
145
+ /** 変数名(例: "parent")→ {$parent.xxx} でアクセス */
146
+ as: string;
147
+ /** たどる relation フィールド名(例: "parentCategory") */
148
+ field: string;
149
+ /** リピート時の出力パス(例: "{$parent.slug}/{$this.slug}/index.json") */
150
+ outputPath: string;
151
+ };
152
+ /**
153
+ * 詳細データ設定
154
+ * 個別コンテンツの詳細データを生成するための設定
155
+ */
156
+ export type DetailPageRecipe = {
157
+ type: 'detail';
158
+ /** 出力パス(例: "article/{$this.slug}.json") */
159
+ outputPath: string;
160
+ /** テンプレートファイルのパス */
161
+ templatePath: string;
162
+ /** リレーション展開設定 */
163
+ expand?: RelationExpand[];
164
+ /** 親をたどるリピート設定 */
165
+ repeat?: RecipeRepeat;
166
+ /** カスタムフィールド定義 */
167
+ customFields?: CustomField[];
168
+ /** 追加で含めるデータ */
169
+ include?: {
170
+ /** サイト設定を含める */
171
+ site?: boolean;
172
+ };
173
+ };
174
+ /**
175
+ * 一覧データ設定の共通プロパティ(内部用)
176
+ */
177
+ type ListPageRecipeBase = {
178
+ type: 'list';
179
+ /** 出力パス(例: "articles/index.json" または "articles/page/{$page}.json") */
180
+ outputPath: string;
181
+ /** テンプレートファイルのパス */
182
+ templatePath: string;
183
+ /** スキップ件数 */
184
+ offset?: number;
185
+ /** ソート設定(単一または複数) */
186
+ sort?: RecipeSort | RecipeSort[];
187
+ /** フィルター設定 */
188
+ filters?: RecipeFilter[];
189
+ /** カスタムフィールド定義 */
190
+ customFields?: CustomField[];
191
+ };
192
+ /**
193
+ * 一覧データ設定(ページネーション無効)
194
+ * - listFields で出力フィールドを制御
195
+ * - expand でリレーションを展開
196
+ */
197
+ export type ListPageRecipeWithoutPagination = ListPageRecipeBase & {
198
+ pagination?: undefined;
199
+ /** 最大件数 */
200
+ limit?: number;
201
+ /** 一覧に含めるフィールド(null = 全て) */
202
+ listFields?: string[] | null;
203
+ /** リレーション展開設定 */
204
+ expand?: RelationExpand[];
205
+ };
206
+ /**
207
+ * 一覧データ設定(ページネーション有効)
208
+ *
209
+ * ページネーション有効時の出力構造は固定:
210
+ * {
211
+ * "nextPage": "articles/page-002.json",
212
+ * "prevPage": null,
213
+ * "pageNumber": 1,
214
+ * "totalPages": 10,
215
+ * "totalItems": 95,
216
+ * "pagedItems": [ ... ]
217
+ * }
218
+ *
219
+ * - listFields は使用しない(pagedItems の構造に固定)
220
+ * - items.fields / items.expand で pagedItems 内のアイテムに対する設定を行う
221
+ */
222
+ export type ListPageRecipeWithPagination = ListPageRecipeBase & {
223
+ pagination: ListPageRecipePaginationConfig;
224
+ /** pagedItems に適用する設定 */
225
+ items?: {
226
+ /** 一覧に含めるフィールド(null = 全て) */
227
+ fields?: string[] | null;
228
+ /** リレーション展開設定 */
229
+ expand?: RelationExpand[];
230
+ };
231
+ };
232
+ /**
233
+ * 一覧データ設定
234
+ * コンテンツの一覧データを生成するための設定
235
+ */
236
+ export type ListPageRecipe = ListPageRecipeWithoutPagination | ListPageRecipeWithPagination;
237
+ /**
238
+ * 固定ページレシピ(単体固定モード)
239
+ * 1つのJSONファイルを出力
240
+ */
241
+ export type StaticPageRecipe = {
242
+ type: 'static';
243
+ /** 出力パス(例: "site-config.json") */
244
+ outputPath: string;
245
+ /** テンプレートファイルのパス */
246
+ templatePath: string;
247
+ /** カスタムフィールド定義 */
248
+ customFields?: CustomField[];
249
+ };
250
+ /**
251
+ * コンテンツタイプ別レシピ
252
+ */
253
+ export type ContentTypeRecipe = {
254
+ /** 詳細データ設定(複数可:通常版、AMP版、印刷用など) */
255
+ details?: DetailPageRecipe[];
256
+ /** 一覧データ設定(複数可) */
257
+ lists?: ListPageRecipe[];
258
+ };
259
+ /**
260
+ * テンプレートのパーツ化ファイル定義
261
+ * パーツファイルの変更が影響するテンプレートを定義
262
+ * 例: { "_parts/*.html": ["*"] } → パーツ変更で全ビルド
263
+ */
264
+ export type TemplateIncludes = {
265
+ /** キー: パーツファイルのglobパターン、値: 影響を受けるテンプレートパス配列("*"で全て) */
266
+ [partsPattern: string]: string[];
267
+ };
268
+ /**
269
+ * 目次エントリ(toc フォーマットの出力形式)
270
+ */
271
+ export type TocEntry = {
272
+ /** 見出しレベル(1-6) */
273
+ level: number;
274
+ /** 見出しのID属性 */
275
+ id: string;
276
+ /** 見出しのテキスト */
277
+ text: string;
278
+ };
279
+ /**
280
+ * ページネーション有効時の出力 JSON 構造
281
+ */
282
+ export type PaginatedListOutput<T = unknown> = {
283
+ /** 現在のページ番号(1始まり) */
284
+ currentPageNumber: number;
285
+ /** 総ページ数 */
286
+ totalPagesCount: number;
287
+ /** 総アイテム数 */
288
+ totalItemsCount: number;
289
+ /** このページのアイテム配列 */
290
+ pagedItems: T[];
291
+ };
292
+ /**
293
+ * サイト全体のビルドデータレシピ(メタデータ含む)
294
+ */
295
+ export type FrelioBuildDataRecipe = {
296
+ /** バージョン */
297
+ version: '1.0';
298
+ /** コンテンツタイプ別レシピ */
299
+ contentTypes: Record<string, ContentTypeRecipe>;
300
+ /** 固定ページレシピ */
301
+ staticPages?: StaticPageRecipe[];
302
+ /** テンプレートパーツ依存関係 */
303
+ templateIncludes?: TemplateIncludes;
304
+ /** 最終更新日時 */
305
+ lastUpdatedAt: string;
306
+ /** 最終更新者 */
307
+ lastUpdatedBy: string;
308
+ };
309
+ export {};
310
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,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AuD;IACvD,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CACjC,CAAA;AAID;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,eAAe;IACf,EAAE,EAAE,MAAM,CAAA;IACV,eAAe;IACf,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,OAAO,IAAI;IAC7C,qBAAqB;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,YAAY;IACZ,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa;IACb,eAAe,EAAE,MAAM,CAAA;IACvB,mBAAmB;IACnB,UAAU,EAAE,CAAC,EAAE,CAAA;CAChB,CAAA;AAID;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,YAAY;IACZ,OAAO,EAAE,KAAK,CAAA;IACd,mBAAmB;IACnB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC/C,eAAe;IACf,WAAW,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAChC,oBAAoB;IACpB,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,aAAa;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY;IACZ,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA"}
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type definitions for Frelio build data recipe.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-time/frelio-data-json-recipe",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Type definitions for frelio data JSON recipe",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",