@c-time/frelio-data-json 1.0.0 → 1.2.1
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 +30 -5
- package/dist/index.js +12 -18
- package/dist/index.js.map +1 -1
- package/package.json +13 -3
- package/dist/index.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Frelio data JSON output.
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* frelio-data-json 操作タイプ
|
|
3
6
|
*/
|
|
4
|
-
|
|
7
|
+
type FrelioDataJsonType = 'create' | 'update' | 'delete';
|
|
5
8
|
/**
|
|
6
9
|
* frelio-data-json 単一エントリ
|
|
10
|
+
*
|
|
11
|
+
* データ JSON ジェネレーターが出力し、gentl が消費する中間形式。
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```json
|
|
15
|
+
* {
|
|
16
|
+
* "type": "create",
|
|
17
|
+
* "template": "article/detail.html",
|
|
18
|
+
* "outputFile": "articles/my-article.html",
|
|
19
|
+
* "data": { "title": "My Article", "body": "..." }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
7
22
|
*/
|
|
8
|
-
|
|
23
|
+
type FrelioDataJson = {
|
|
24
|
+
/** 操作タイプ: create(新規), update(更新), delete(削除) */
|
|
9
25
|
type: FrelioDataJsonType;
|
|
26
|
+
/** テンプレートファイルのパス */
|
|
10
27
|
template: string;
|
|
28
|
+
/** 出力ファイルのパス */
|
|
11
29
|
outputFile: string;
|
|
30
|
+
/** テンプレートに渡すデータ */
|
|
12
31
|
data: Record<string, unknown>;
|
|
13
32
|
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Type guard functions for Frelio data JSON.
|
|
36
|
+
*/
|
|
37
|
+
|
|
14
38
|
/**
|
|
15
39
|
* 型ガード: FrelioDataJson
|
|
16
40
|
*/
|
|
17
|
-
|
|
41
|
+
declare function isFrelioDataJson(value: unknown): value is FrelioDataJson;
|
|
18
42
|
/**
|
|
19
43
|
* 型ガード: FrelioDataJson[]
|
|
20
44
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
45
|
+
declare function isFrelioDataJsonArray(value: unknown): value is FrelioDataJson[];
|
|
46
|
+
|
|
47
|
+
export { type FrelioDataJson, type FrelioDataJsonType, isFrelioDataJson, isFrelioDataJsonArray };
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const obj = value;
|
|
9
|
-
return ((obj.type === 'create' || obj.type === 'update' || obj.type === 'delete') &&
|
|
10
|
-
typeof obj.template === 'string' &&
|
|
11
|
-
typeof obj.outputFile === 'string' &&
|
|
12
|
-
typeof obj.data === 'object' &&
|
|
13
|
-
obj.data !== null);
|
|
1
|
+
// src/guards.ts
|
|
2
|
+
function isFrelioDataJson(value) {
|
|
3
|
+
if (typeof value !== "object" || value === null) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
const obj = value;
|
|
7
|
+
return (obj.type === "create" || obj.type === "update" || obj.type === "delete") && typeof obj.template === "string" && typeof obj.outputFile === "string" && typeof obj.data === "object" && obj.data !== null;
|
|
14
8
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
18
|
-
export function isFrelioDataJsonArray(value) {
|
|
19
|
-
return Array.isArray(value) && value.every(isFrelioDataJson);
|
|
9
|
+
function isFrelioDataJsonArray(value) {
|
|
10
|
+
return Array.isArray(value) && value.every(isFrelioDataJson);
|
|
20
11
|
}
|
|
12
|
+
|
|
13
|
+
export { isFrelioDataJson, isFrelioDataJsonArray };
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
21
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/guards.ts"],"names":[],"mappings":";AASO,SAAS,iBAAiB,KAAA,EAAyC;AACxE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA,EAAM;AAC/C,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,MAAM,GAAA,GAAM,KAAA;AACZ,EAAA,OAAA,CACG,GAAA,CAAI,SAAS,QAAA,IAAY,GAAA,CAAI,SAAS,QAAA,IAAY,GAAA,CAAI,IAAA,KAAS,QAAA,KAChE,OAAO,GAAA,CAAI,aAAa,QAAA,IACxB,OAAO,IAAI,UAAA,KAAe,QAAA,IAC1B,OAAO,GAAA,CAAI,IAAA,KAAS,QAAA,IACpB,GAAA,CAAI,IAAA,KAAS,IAAA;AAEjB;AAKO,SAAS,sBAAsB,KAAA,EAA2C;AAC/E,EAAA,OAAO,MAAM,OAAA,CAAQ,KAAK,CAAA,IAAK,KAAA,CAAM,MAAM,gBAAgB,CAAA;AAC7D","file":"index.js","sourcesContent":["/**\n * Type guard functions for Frelio data JSON.\n */\n\nimport type { FrelioDataJson } from './types.js'\n\n/**\n * 型ガード: FrelioDataJson\n */\nexport function isFrelioDataJson(value: unknown): value is FrelioDataJson {\n if (typeof value !== 'object' || value === null) {\n return false\n }\n const obj = value as Record<string, unknown>\n return (\n (obj.type === 'create' || obj.type === 'update' || obj.type === 'delete') &&\n typeof obj.template === 'string' &&\n typeof obj.outputFile === 'string' &&\n typeof obj.data === 'object' &&\n obj.data !== null\n )\n}\n\n/**\n * 型ガード: FrelioDataJson[]\n */\nexport function isFrelioDataJsonArray(value: unknown): value is FrelioDataJson[] {\n return Array.isArray(value) && value.every(isFrelioDataJson)\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c-time/frelio-data-json",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Type definitions for frelio data JSON output",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,15 +11,24 @@
|
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
+
"sideEffects": false,
|
|
14
15
|
"files": [
|
|
15
16
|
"dist",
|
|
16
17
|
"README.md"
|
|
17
18
|
],
|
|
18
19
|
"scripts": {
|
|
19
|
-
"build": "
|
|
20
|
-
"dev": "
|
|
20
|
+
"build": "tsup",
|
|
21
|
+
"dev": "tsup --watch",
|
|
21
22
|
"prepublishOnly": "npm run build"
|
|
22
23
|
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/c-time/frelio.git",
|
|
30
|
+
"directory": "packages/data-json"
|
|
31
|
+
},
|
|
23
32
|
"keywords": [
|
|
24
33
|
"frelio",
|
|
25
34
|
"data-json",
|
|
@@ -29,6 +38,7 @@
|
|
|
29
38
|
],
|
|
30
39
|
"license": "MIT",
|
|
31
40
|
"devDependencies": {
|
|
41
|
+
"tsup": "^8.5.0",
|
|
32
42
|
"typescript": "^5.7.0"
|
|
33
43
|
},
|
|
34
44
|
"engines": {
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAE/D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,kBAAkB,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B,CAAA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAYxE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,EAAE,CAE/E"}
|