@rethinkhealth/hl7v2-lint-required-message-header 0.2.22 → 0.2.25
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 +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -17
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Nodes } from "@rethinkhealth/hl7v2-ast";
|
|
2
2
|
/**
|
|
3
3
|
* hl7v2-lint rule to warn when message header segment (MSH) is missing.
|
|
4
4
|
*
|
|
5
5
|
* This rule is useful for ensuring that all messages start with a message
|
|
6
6
|
* header segment.
|
|
7
7
|
*/
|
|
8
|
-
declare const hl7v2LintSegmentRequiredMessageHeader: import("unified-lint-rule").Plugin<
|
|
8
|
+
declare const hl7v2LintSegmentRequiredMessageHeader: import("unified-lint-rule").Plugin<Nodes, undefined>;
|
|
9
9
|
export default hl7v2LintSegmentRequiredMessageHeader;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAItD;;;;;GAKG;AACH,QAAA,MAAM,qCAAqC,sDAwB1C,CAAC;AACF,eAAe,qCAAqC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { lintRule } from "unified-lint-rule";
|
|
3
|
-
import {
|
|
3
|
+
import { EXIT, visitParents } from "unist-util-visit-parents";
|
|
4
4
|
var hl7v2LintSegmentRequiredMessageHeader = lintRule(
|
|
5
5
|
{
|
|
6
6
|
origin: "hl7v2-lint:segment-required-message-header",
|
|
7
7
|
url: "https://github.com/rethinkhealth/hl7v2/tree/main/packages/hl7v2-lint-segment-required-message-header#readme"
|
|
8
8
|
},
|
|
9
9
|
(tree, file) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
file.message(
|
|
18
|
-
`Message header (MSH) segment is required. Received ${header} instead.`,
|
|
19
|
-
{
|
|
20
|
-
ancestors: [...parents, node, firstSegment],
|
|
21
|
-
place: firstSegment.position
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
}
|
|
10
|
+
if (tree.type !== "root") {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
visitParents(tree, (node) => {
|
|
14
|
+
if (node.type === "segment-header") {
|
|
15
|
+
if (node.value === "MSH") {
|
|
16
|
+
return EXIT;
|
|
25
17
|
}
|
|
18
|
+
file.fail(
|
|
19
|
+
`Message header (MSH) segment is required as the first segment. Received ${node.value} instead.`,
|
|
20
|
+
{ ancestors: [node], place: node.position }
|
|
21
|
+
);
|
|
26
22
|
}
|
|
27
|
-
return SKIP;
|
|
28
23
|
});
|
|
29
24
|
}
|
|
30
25
|
);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { Nodes } from \"@rethinkhealth/hl7v2-ast\";\nimport { lintRule } from \"unified-lint-rule\";\nimport { EXIT, visitParents } from \"unist-util-visit-parents\";\n\n/**\n * hl7v2-lint rule to warn when message header segment (MSH) is missing.\n *\n * This rule is useful for ensuring that all messages start with a message\n * header segment.\n */\nconst hl7v2LintSegmentRequiredMessageHeader = lintRule<Nodes, undefined>(\n {\n origin: \"hl7v2-lint:segment-required-message-header\",\n url: \"https://github.com/rethinkhealth/hl7v2/tree/main/packages/hl7v2-lint-segment-required-message-header#readme\",\n },\n (tree, file) => {\n if (tree.type !== \"root\") {\n return;\n }\n\n // Get the first segment in the message even if it's in a nested group(s).\n // We must ensure that it is the first segment in the message.\n visitParents(tree, (node) => {\n if (node.type === \"segment-header\") {\n if (node.value === \"MSH\") {\n return EXIT;\n }\n file.fail(\n `Message header (MSH) segment is required as the first segment. Received ${node.value} instead.`,\n { ancestors: [node], place: node.position }\n );\n }\n });\n }\n);\nexport default hl7v2LintSegmentRequiredMessageHeader;\n"],"mappings":";AACA,SAAS,gBAAgB;AACzB,SAAS,MAAM,oBAAoB;AAQnC,IAAM,wCAAwC;AAAA,EAC5C;AAAA,IACE,QAAQ;AAAA,IACR,KAAK;AAAA,EACP;AAAA,EACA,CAAC,MAAM,SAAS;AACd,QAAI,KAAK,SAAS,QAAQ;AACxB;AAAA,IACF;AAIA,iBAAa,MAAM,CAAC,SAAS;AAC3B,UAAI,KAAK,SAAS,kBAAkB;AAClC,YAAI,KAAK,UAAU,OAAO;AACxB,iBAAO;AAAA,QACT;AACA,aAAK;AAAA,UACH,2EAA2E,KAAK,KAAK;AAAA,UACrF,EAAE,WAAW,CAAC,IAAI,GAAG,OAAO,KAAK,SAAS;AAAA,QAC5C;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;AACA,IAAO,cAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rethinkhealth/hl7v2-lint-required-message-header",
|
|
3
3
|
"description": "hl7v2-lint rule to warn when message header segment is missing",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.25",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Melek Somai",
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
"unist-util-visit-parents": "6.0.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/node": "24.
|
|
24
|
+
"@types/node": "24.9.2",
|
|
25
25
|
"@types/unist": "^3.0.3",
|
|
26
|
-
"@vitest/coverage-v8": "^
|
|
26
|
+
"@vitest/coverage-v8": "^4.0.5",
|
|
27
27
|
"tsup": "8.5.0",
|
|
28
28
|
"typescript": "^5.9.3",
|
|
29
29
|
"vfile": "^6.0.3",
|
|
30
30
|
"vfile-reporter": "^8.1.1",
|
|
31
|
-
"vitest": "^
|
|
32
|
-
"@rethinkhealth/hl7v2-ast": "0.2.
|
|
33
|
-
"@rethinkhealth/hl7v2-builder": "0.2.
|
|
34
|
-
"@rethinkhealth/testing": "0.0.
|
|
31
|
+
"vitest": "^4.0.6",
|
|
32
|
+
"@rethinkhealth/hl7v2-ast": "0.2.25",
|
|
33
|
+
"@rethinkhealth/hl7v2-builder": "0.2.25",
|
|
34
|
+
"@rethinkhealth/testing": "0.0.2",
|
|
35
35
|
"@rethinkhealth/tsconfig": "0.0.1"
|
|
36
36
|
},
|
|
37
37
|
"repository": "rethinkhealth/hl7v2.git",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"rule",
|
|
48
48
|
"typescript"
|
|
49
49
|
],
|
|
50
|
+
"packageManager": "pnpm@10.14.0",
|
|
50
51
|
"publishConfig": {
|
|
51
52
|
"access": "public"
|
|
52
53
|
},
|