@glion/lint-profile-required-fields 0.16.0 → 0.20.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +13 -14
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKvC;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAKvC;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,uBAAuB,mDAiC5B,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { visit } from "@glion/util-visit";
|
|
1
|
+
import { SKIP, visit } from "@glion/util-visit";
|
|
2
2
|
import { isEmptyNode } from "@glion/utils";
|
|
3
3
|
import { lintRule } from "unified-lint-rule";
|
|
4
4
|
//#region src/index.ts
|
|
@@ -23,7 +23,7 @@ const hl7v2LintRequiredFields = lintRule({ origin: "hl7v2-lint:required-fields"
|
|
|
23
23
|
if (!ctx) return;
|
|
24
24
|
visit(tree, "segment", (node, parents) => {
|
|
25
25
|
const fieldDef = ctx.fields.get(node.name);
|
|
26
|
-
if (!fieldDef) return;
|
|
26
|
+
if (!fieldDef) return SKIP;
|
|
27
27
|
for (const sequence of fieldDef.requiredSequences) {
|
|
28
28
|
const fieldNode = node.children[sequence - 1];
|
|
29
29
|
if (!fieldNode || isEmptyNode(fieldNode)) {
|
|
@@ -39,6 +39,7 @@ const hl7v2LintRequiredFields = lintRule({ origin: "hl7v2-lint:required-fields"
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
return SKIP;
|
|
42
43
|
});
|
|
43
44
|
});
|
|
44
45
|
//#endregion
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// oxlint-disable-next-line no-unused-vars -- triggers VFile DataMap augmentation\nimport type { ProfileContext } from \"@glion/annotate-profile-context\";\nimport type { Root } from \"@glion/ast\";\nimport { visit } from \"@glion/util-visit\";\nimport { isEmptyNode } from \"@glion/utils\";\nimport { lintRule } from \"unified-lint-rule\";\n\n/**\n * Lint rule that validates required fields per HL7v2 profile.\n *\n * For each segment, checks that all fields marked `required: true`\n * in the field definition are present and non-empty.\n *\n * Segments without a known profile (e.g., Z-segments) are silently skipped.\n *\n * Requires `@glion/annotate-profile-context` to run first\n * so that `file.data.fields` is populated.\n *\n * @example\n * ```typescript\n * unified().use(hl7v2AnnotateProfileContext).use(hl7v2LintRequiredFields);\n * ```;\n */\nconst hl7v2LintRequiredFields = lintRule<Root>(\n { origin: \"hl7v2-lint:required-fields\" },\n (tree, file) => {\n const ctx = file.data.profile;\n if (!ctx) {\n return;\n }\n\n visit(tree, \"segment\", (node, parents) => {\n const fieldDef = ctx.fields.get(node.name);\n if (!fieldDef) {\n return;\n }\n\n for (const sequence of fieldDef.requiredSequences) {\n const fieldNode = node.children[sequence - 1];\n\n if (!fieldNode || isEmptyNode(fieldNode)) {\n const profile = fieldDef.bySequence.get(sequence);\n const name = profile?.name ? ` (${profile.name})` : \"\";\n file.message(\n `Required field ${node.name}-${sequence}${name} is missing or empty`,\n {\n ancestors: [...parents, node, ...(fieldNode ? [fieldNode] : [])],\n place: fieldNode?.position ?? node.position,\n }\n );\n }\n }\n });\n }\n);\n\nexport default hl7v2LintRequiredFields;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,0BAA0B,SAC9B,EAAE,QAAQ,8BAA8B,GACvC,MAAM,SAAS;CACd,MAAM,MAAM,KAAK,KAAK;AACtB,KAAI,CAAC,IACH;AAGF,OAAM,MAAM,YAAY,MAAM,YAAY;EACxC,MAAM,WAAW,IAAI,OAAO,IAAI,KAAK,KAAK;AAC1C,MAAI,CAAC,SACH;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// oxlint-disable-next-line no-unused-vars -- triggers VFile DataMap augmentation\nimport type { ProfileContext } from \"@glion/annotate-profile-context\";\nimport type { Root } from \"@glion/ast\";\nimport { SKIP, visit } from \"@glion/util-visit\";\nimport { isEmptyNode } from \"@glion/utils\";\nimport { lintRule } from \"unified-lint-rule\";\n\n/**\n * Lint rule that validates required fields per HL7v2 profile.\n *\n * For each segment, checks that all fields marked `required: true`\n * in the field definition are present and non-empty.\n *\n * Segments without a known profile (e.g., Z-segments) are silently skipped.\n *\n * Requires `@glion/annotate-profile-context` to run first\n * so that `file.data.fields` is populated.\n *\n * @example\n * ```typescript\n * unified().use(hl7v2AnnotateProfileContext).use(hl7v2LintRequiredFields);\n * ```;\n */\nconst hl7v2LintRequiredFields = lintRule<Root>(\n { origin: \"hl7v2-lint:required-fields\" },\n (tree, file) => {\n const ctx = file.data.profile;\n if (!ctx) {\n return;\n }\n\n visit(tree, \"segment\", (node, parents) => {\n const fieldDef = ctx.fields.get(node.name);\n if (!fieldDef) {\n return SKIP;\n }\n\n for (const sequence of fieldDef.requiredSequences) {\n const fieldNode = node.children[sequence - 1];\n\n if (!fieldNode || isEmptyNode(fieldNode)) {\n const profile = fieldDef.bySequence.get(sequence);\n const name = profile?.name ? ` (${profile.name})` : \"\";\n file.message(\n `Required field ${node.name}-${sequence}${name} is missing or empty`,\n {\n ancestors: [...parents, node, ...(fieldNode ? [fieldNode] : [])],\n place: fieldNode?.position ?? node.position,\n }\n );\n }\n }\n\n return SKIP;\n });\n }\n);\n\nexport default hl7v2LintRequiredFields;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,0BAA0B,SAC9B,EAAE,QAAQ,8BAA8B,GACvC,MAAM,SAAS;CACd,MAAM,MAAM,KAAK,KAAK;AACtB,KAAI,CAAC,IACH;AAGF,OAAM,MAAM,YAAY,MAAM,YAAY;EACxC,MAAM,WAAW,IAAI,OAAO,IAAI,KAAK,KAAK;AAC1C,MAAI,CAAC,SACH,QAAO;AAGT,OAAK,MAAM,YAAY,SAAS,mBAAmB;GACjD,MAAM,YAAY,KAAK,SAAS,WAAW;AAE3C,OAAI,CAAC,aAAa,YAAY,UAAU,EAAE;IACxC,MAAM,UAAU,SAAS,WAAW,IAAI,SAAS;IACjD,MAAM,OAAO,SAAS,OAAO,KAAK,QAAQ,KAAK,KAAK;AACpD,SAAK,QACH,kBAAkB,KAAK,KAAK,GAAG,WAAW,KAAK,uBAC/C;KACE,WAAW;MAAC,GAAG;MAAS;MAAM,GAAI,YAAY,CAAC,UAAU,GAAG,EAAE;MAAE;KAChE,OAAO,WAAW,YAAY,KAAK;KACpC,CACF;;;AAIL,SAAO;GACP;EAEL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glion/lint-profile-required-fields",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Lint rule to validate required fields per HL7v2 profile",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"health",
|
|
@@ -34,33 +34,32 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"unified-lint-rule": "3.0.1",
|
|
37
|
-
"@glion/ast": "0.
|
|
38
|
-
"@glion/util-visit": "0.
|
|
39
|
-
"@glion/utils": "0.
|
|
37
|
+
"@glion/ast": "0.20.0",
|
|
38
|
+
"@glion/util-visit": "0.20.0",
|
|
39
|
+
"@glion/utils": "0.20.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "25.6.0",
|
|
43
|
-
"@vitest/coverage-v8": "4.1.
|
|
43
|
+
"@vitest/coverage-v8": "4.1.11",
|
|
44
44
|
"publint": "0.3.18",
|
|
45
45
|
"tsdown": "0.21.10",
|
|
46
46
|
"typescript": "6.0.3",
|
|
47
47
|
"unified": "^11.0.5",
|
|
48
48
|
"vfile": "^6.0.3",
|
|
49
|
-
"vitest": "4.1.
|
|
50
|
-
"@glion/
|
|
51
|
-
"@glion/
|
|
52
|
-
"@glion/check-readme": "0.
|
|
53
|
-
"@glion/testing": "0.
|
|
54
|
-
"@glion/tsconfig": "0.
|
|
49
|
+
"vitest": "4.1.11",
|
|
50
|
+
"@glion/annotate-profile-context": "0.20.0",
|
|
51
|
+
"@glion/builder": "0.20.0",
|
|
52
|
+
"@glion/check-readme": "0.18.0",
|
|
53
|
+
"@glion/testing": "0.18.0",
|
|
54
|
+
"@glion/tsconfig": "0.18.0"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
|
-
"node": ">=
|
|
57
|
+
"node": ">=22"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "tsdown && tsc --emitDeclarationOnly",
|
|
61
|
-
"check-types": "tsc --noEmit",
|
|
61
|
+
"check-types": "tsc --noEmit && tsc --noEmit -p tests/tsconfig.json",
|
|
62
62
|
"check:readme": "glion-check-readme",
|
|
63
|
-
"bench": "vitest bench --run",
|
|
64
63
|
"test": "vitest run",
|
|
65
64
|
"test:coverage": "vitest run --coverage",
|
|
66
65
|
"test:watch": "vitest",
|