@c-time/frelio-data-json-recipe 1.2.1 → 1.3.14

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/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  /**
5
5
  * カスタムフィールドのフォーマット種別(変換系)
6
6
  */
7
- type CustomFieldFormatType = 'string' | 'date' | 'number' | 'escape' | 'toc' | 'truncate' | 'stripHtml' | 'slug' | 'lowercase' | 'uppercase' | 'default' | 'count' | 'first' | 'last' | 'join' | 'url' | 'picture' | 'img' | 'srcset' | 'fileLink' | 'relationList';
7
+ type CustomFieldFormatType = 'string' | 'date' | 'number' | 'escape' | 'toc' | 'truncate' | 'stripHtml' | 'slug' | 'lowercase' | 'uppercase' | 'default' | 'count' | 'first' | 'last' | 'join' | 'url' | 'picture' | 'img' | 'srcset' | 'fileLink' | 'relationList' | 'constant';
8
8
  /**
9
9
  * ソート設定
10
10
  */
@@ -68,7 +68,7 @@ type CustomFieldTransform = {
68
68
  /** 元となる式(例: "{$this.title} - {$this.subtitle}") */
69
69
  source: string;
70
70
  /** フォーマット種別 */
71
- type?: Exclude<CustomFieldFormatType, 'relationList'>;
71
+ type: Exclude<CustomFieldFormatType, 'relationList' | 'constant'>;
72
72
  /** フォーマット文字列(例: "YYYY年MM月DD日", "#,###円") */
73
73
  format?: string;
74
74
  /** truncate用の文字数 */
@@ -109,11 +109,23 @@ type CustomFieldRelationList = {
109
109
  /** ページネーション設定(任意) */
110
110
  pagination?: RelationListPaginationConfig;
111
111
  };
112
+ /**
113
+ * カスタムフィールド(定数)
114
+ * コンテンツに依存しない固定値を出力する
115
+ */
116
+ type CustomFieldConstant = {
117
+ /** 出力フィールド名 */
118
+ field: string;
119
+ /** フォーマット種別(constant 固定) */
120
+ type: 'constant';
121
+ /** 固定値(string, number, boolean, array, object) */
122
+ value: unknown;
123
+ };
112
124
  /**
113
125
  * カスタムフィールド設定
114
- * 変換系(CustomFieldTransform)または RelationList(CustomFieldRelationList)のユニオン型
126
+ * 変換系(CustomFieldTransform)、RelationList(CustomFieldRelationList)、定数(CustomFieldConstant)のユニオン型
115
127
  */
116
- type CustomField = CustomFieldTransform | CustomFieldRelationList;
128
+ type CustomField = CustomFieldTransform | CustomFieldRelationList | CustomFieldConstant;
117
129
  /**
118
130
  * Relation 展開設定
119
131
  * リレーションフィールドを展開し、さらにネストした relation も展開可能
@@ -319,6 +331,10 @@ declare function isListPageRecipeWithPagination(recipe: ListPageRecipe): recipe
319
331
  * ListPageRecipe がページネーション無効かどうかを判定
320
332
  */
321
333
  declare function isListPageRecipeWithoutPagination(recipe: ListPageRecipe): recipe is ListPageRecipeWithoutPagination;
334
+ /**
335
+ * CustomField が定数(Constant)かどうかを判定
336
+ */
337
+ declare function isCustomFieldConstant(field: CustomField): field is CustomFieldConstant;
322
338
  /**
323
339
  * CustomField が RelationList かどうかを判定
324
340
  */
@@ -328,4 +344,4 @@ declare function isCustomFieldRelationList(field: CustomField): field is CustomF
328
344
  */
329
345
  declare function isCustomFieldTransform(field: CustomField): field is CustomFieldTransform;
330
346
 
331
- export { type ContentTypeRecipe, type CustomField, type CustomFieldFormatType, type CustomFieldRelationList, type CustomFieldTransform, type DetailPageRecipe, type FrelioBuildDataRecipe, type ListPageRecipe, type ListPageRecipePaginationConfig, type ListPageRecipeWithPagination, type ListPageRecipeWithoutPagination, type PaginatedListOutput, type PaginationConfigBase, type RecipeFilter, type RecipeFilterOperator, type RecipeRepeat, type RecipeSort, type RelationExpand, type RelationListPaginationConfig, type StaticPageRecipe, type TemplateIncludes, type TocEntry, isCustomFieldRelationList, isCustomFieldTransform, isListPageRecipeWithPagination, isListPageRecipeWithoutPagination };
347
+ export { type ContentTypeRecipe, type CustomField, type CustomFieldConstant, type CustomFieldFormatType, type CustomFieldRelationList, type CustomFieldTransform, type DetailPageRecipe, type FrelioBuildDataRecipe, type ListPageRecipe, type ListPageRecipePaginationConfig, type ListPageRecipeWithPagination, type ListPageRecipeWithoutPagination, type PaginatedListOutput, type PaginationConfigBase, type RecipeFilter, type RecipeFilterOperator, type RecipeRepeat, type RecipeSort, type RelationExpand, type RelationListPaginationConfig, type StaticPageRecipe, type TemplateIncludes, type TocEntry, isCustomFieldConstant, isCustomFieldRelationList, isCustomFieldTransform, isListPageRecipeWithPagination, isListPageRecipeWithoutPagination };
package/dist/index.js CHANGED
@@ -5,13 +5,16 @@ function isListPageRecipeWithPagination(recipe) {
5
5
  function isListPageRecipeWithoutPagination(recipe) {
6
6
  return recipe.pagination === void 0;
7
7
  }
8
+ function isCustomFieldConstant(field) {
9
+ return field.type === "constant";
10
+ }
8
11
  function isCustomFieldRelationList(field) {
9
12
  return field.type === "relationList";
10
13
  }
11
14
  function isCustomFieldTransform(field) {
12
- return field.type !== "relationList";
15
+ return field.type !== "relationList" && field.type !== "constant";
13
16
  }
14
17
 
15
- export { isCustomFieldRelationList, isCustomFieldTransform, isListPageRecipeWithPagination, isListPageRecipeWithoutPagination };
18
+ export { isCustomFieldConstant, isCustomFieldRelationList, isCustomFieldTransform, isListPageRecipeWithPagination, isListPageRecipeWithoutPagination };
16
19
  //# sourceMappingURL=index.js.map
17
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/guards.ts"],"names":[],"mappings":";AAgBO,SAAS,+BACd,MAAA,EACwC;AACxC,EAAA,OAAO,OAAO,UAAA,KAAe,MAAA;AAC/B;AAKO,SAAS,kCACd,MAAA,EAC2C;AAC3C,EAAA,OAAO,OAAO,UAAA,KAAe,MAAA;AAC/B;AAKO,SAAS,0BACd,KAAA,EACkC;AAClC,EAAA,OAAO,MAAM,IAAA,KAAS,cAAA;AACxB;AAKO,SAAS,uBACd,KAAA,EAC+B;AAC/B,EAAA,OAAO,MAAM,IAAA,KAAS,cAAA;AACxB","file":"index.js","sourcesContent":["/**\n * Type guard functions for Frelio build data recipe.\n */\n\nimport type {\n ListPageRecipe,\n ListPageRecipeWithPagination,\n ListPageRecipeWithoutPagination,\n CustomField,\n CustomFieldRelationList,\n CustomFieldTransform,\n} from './types.js'\n\n/**\n * ListPageRecipe がページネーション有効かどうかを判定\n */\nexport function isListPageRecipeWithPagination(\n recipe: ListPageRecipe\n): recipe is ListPageRecipeWithPagination {\n return recipe.pagination !== undefined\n}\n\n/**\n * ListPageRecipe がページネーション無効かどうかを判定\n */\nexport function isListPageRecipeWithoutPagination(\n recipe: ListPageRecipe\n): recipe is ListPageRecipeWithoutPagination {\n return recipe.pagination === undefined\n}\n\n/**\n * CustomField が RelationList かどうかを判定\n */\nexport function isCustomFieldRelationList(\n field: CustomField\n): field is CustomFieldRelationList {\n return field.type === 'relationList'\n}\n\n/**\n * CustomField が変換系(Transform)かどうかを判定\n */\nexport function isCustomFieldTransform(\n field: CustomField\n): field is CustomFieldTransform {\n return field.type !== 'relationList'\n}\n"]}
1
+ {"version":3,"sources":["../src/guards.ts"],"names":[],"mappings":";AAiBO,SAAS,+BACd,MAAA,EACwC;AACxC,EAAA,OAAO,OAAO,UAAA,KAAe,MAAA;AAC/B;AAKO,SAAS,kCACd,MAAA,EAC2C;AAC3C,EAAA,OAAO,OAAO,UAAA,KAAe,MAAA;AAC/B;AAKO,SAAS,sBACd,KAAA,EAC8B;AAC9B,EAAA,OAAO,MAAM,IAAA,KAAS,UAAA;AACxB;AAKO,SAAS,0BACd,KAAA,EACkC;AAClC,EAAA,OAAO,MAAM,IAAA,KAAS,cAAA;AACxB;AAKO,SAAS,uBACd,KAAA,EAC+B;AAC/B,EAAA,OAAO,KAAA,CAAM,IAAA,KAAS,cAAA,IAAkB,KAAA,CAAM,IAAA,KAAS,UAAA;AACzD","file":"index.js","sourcesContent":["/**\n * Type guard functions for Frelio build data recipe.\n */\n\nimport type {\n ListPageRecipe,\n ListPageRecipeWithPagination,\n ListPageRecipeWithoutPagination,\n CustomField,\n CustomFieldConstant,\n CustomFieldRelationList,\n CustomFieldTransform,\n} from './types.js'\n\n/**\n * ListPageRecipe がページネーション有効かどうかを判定\n */\nexport function isListPageRecipeWithPagination(\n recipe: ListPageRecipe\n): recipe is ListPageRecipeWithPagination {\n return recipe.pagination !== undefined\n}\n\n/**\n * ListPageRecipe がページネーション無効かどうかを判定\n */\nexport function isListPageRecipeWithoutPagination(\n recipe: ListPageRecipe\n): recipe is ListPageRecipeWithoutPagination {\n return recipe.pagination === undefined\n}\n\n/**\n * CustomField が定数(Constant)かどうかを判定\n */\nexport function isCustomFieldConstant(\n field: CustomField\n): field is CustomFieldConstant {\n return field.type === 'constant'\n}\n\n/**\n * CustomField が RelationList かどうかを判定\n */\nexport function isCustomFieldRelationList(\n field: CustomField\n): field is CustomFieldRelationList {\n return field.type === 'relationList'\n}\n\n/**\n * CustomField が変換系(Transform)かどうかを判定\n */\nexport function isCustomFieldTransform(\n field: CustomField\n): field is CustomFieldTransform {\n return field.type !== 'relationList' && field.type !== 'constant'\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-time/frelio-data-json-recipe",
3
- "version": "1.2.1",
3
+ "version": "1.3.14",
4
4
  "description": "Type definitions for frelio data JSON recipe",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",