@glion/lint-profile-field-repetition 0.26.0 → 0.27.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Rethink Health
3
+ Copyright (c) 2023 Rethink Health, SUARL
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -77,7 +77,7 @@ PID|1||PATID1234^^^HOSP^MR||DOE^JANE||19800101~19800102|F
77
77
  Reported message:
78
78
 
79
79
  ```
80
- Field `PID-7` (Date/Time of Birth) has 2 repetitions; it allows at most 1 repetition.
80
+ The field has 2 repetitions; it allows at most 1 repetition.
81
81
  ```
82
82
 
83
83
  ## Part of Glion
@@ -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;AAevC;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,wBAAwB,mDAuB7B,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAUvC;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,wBAAwB,mDAsB7B,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { SKIP, visit } from "@glion/util-visit";
2
2
  import pluralize from "pluralize";
3
3
  import { lintRule } from "unified-lint-rule";
4
4
  //#region src/index.ts
5
- const messages = { tooManyRepetitions: (field, name, count, max) => `Field \`${field}\` (${name}) has ${pluralize("repetition", count, true)}; it allows at most ${pluralize("repetition", max, true)}.` };
5
+ const messages = { tooManyRepetitions: (count, max) => `The field has ${pluralize("repetition", count, true)}; it allows at most ${pluralize("repetition", max, true)}.` };
6
6
  /**
7
7
  * Lint rule that reports a field with more repetitions than its RP/# allows.
8
8
  *
@@ -23,11 +23,10 @@ const hl7v2LintFieldRepetition = lintRule({
23
23
  url: "https://github.com/rethinkhealth/glion/tree/main/packages/lint-profile-field-repetition#readme"
24
24
  }, (tree, file) => {
25
25
  visit(tree, "field", (field, ancestors) => {
26
- const id = field.data?.id;
27
26
  const limit = field.data?.repetitions;
28
27
  const count = field.children.length;
29
- if (id === void 0 || typeof limit !== "number" || count <= limit) return SKIP;
30
- const message = file.message(messages.tooManyRepetitions(id, field.data?.name ?? "", count, limit), {
28
+ if (typeof limit !== "number" || count <= limit) return SKIP;
29
+ const message = file.message(messages.tooManyRepetitions(count, limit), {
31
30
  ancestors: [...ancestors, field],
32
31
  place: field.position
33
32
  });
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 FieldData augmentation\nimport type { hl7v2AnnotateProfileFields } from \"@glion/annotate-profile-fields\";\nimport type { Root } from \"@glion/ast\";\nimport { SKIP, visit } from \"@glion/util-visit\";\nimport pluralize from \"pluralize\";\nimport { lintRule } from \"unified-lint-rule\";\n\nconst messages = {\n tooManyRepetitions: (\n field: string,\n name: string,\n count: number,\n max: number\n ) =>\n `Field \\`${field}\\` (${name}) has ${pluralize(\"repetition\", count, true)}; it allows at most ${pluralize(\"repetition\", max, true)}.`,\n} as const;\n\n/**\n * Lint rule that reports a field with more repetitions than its RP/# allows.\n *\n * Reads `repetitions` from `field.data`, so `@glion/annotate-profile-fields`\n * MUST run before it. A field whose `repetitions` is `\"unbounded\"` is never\n * reported.\n *\n * @example\n * ```typescript\n * unified()\n * .use(hl7v2AnnotateProfileContext)\n * .use(hl7v2AnnotateProfileFields)\n * .use(hl7v2LintFieldRepetition);\n * ```;\n */\nconst hl7v2LintFieldRepetition = lintRule<Root>(\n {\n origin: \"hl7v2-lint:field-repetition\",\n url: \"https://github.com/rethinkhealth/glion/tree/main/packages/lint-profile-field-repetition#readme\",\n },\n (tree, file) => {\n visit(tree, \"field\", (field, ancestors) => {\n const id = field.data?.id;\n const limit = field.data?.repetitions;\n const count = field.children.length;\n // A limit of \"unbounded\" is never exceeded.\n if (id === undefined || typeof limit !== \"number\" || count <= limit) {\n return SKIP;\n }\n\n const message = file.message(\n messages.tooManyRepetitions(id, field.data?.name ?? \"\", count, limit),\n { ancestors: [...ancestors, field], place: field.position }\n );\n message.actual = String(count);\n return SKIP;\n });\n }\n);\n\nexport default hl7v2LintFieldRepetition;\n"],"mappings":";;;;AAOA,MAAM,WAAW,EACf,qBACE,OACA,MACA,OACA,QAEA,WAAW,MAAM,MAAM,KAAK,QAAQ,UAAU,cAAc,OAAO,KAAK,CAAC,sBAAsB,UAAU,cAAc,KAAK,KAAK,CAAC,IACrI;;;;;;;;;;;;;;;;AAiBD,MAAM,2BAA2B,SAC/B;CACE,QAAQ;CACR,KAAK;CACN,GACA,MAAM,SAAS;AACd,OAAM,MAAM,UAAU,OAAO,cAAc;EACzC,MAAM,KAAK,MAAM,MAAM;EACvB,MAAM,QAAQ,MAAM,MAAM;EAC1B,MAAM,QAAQ,MAAM,SAAS;AAE7B,MAAI,OAAO,KAAA,KAAa,OAAO,UAAU,YAAY,SAAS,MAC5D,QAAO;EAGT,MAAM,UAAU,KAAK,QACnB,SAAS,mBAAmB,IAAI,MAAM,MAAM,QAAQ,IAAI,OAAO,MAAM,EACrE;GAAE,WAAW,CAAC,GAAG,WAAW,MAAM;GAAE,OAAO,MAAM;GAAU,CAC5D;AACD,UAAQ,SAAS,OAAO,MAAM;AAC9B,SAAO;GACP;EAEL"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// oxlint-disable-next-line no-unused-vars -- triggers FieldData augmentation\nimport type { hl7v2AnnotateProfileFields } from \"@glion/annotate-profile-fields\";\nimport type { Root } from \"@glion/ast\";\nimport { SKIP, visit } from \"@glion/util-visit\";\nimport pluralize from \"pluralize\";\nimport { lintRule } from \"unified-lint-rule\";\n\nconst messages = {\n tooManyRepetitions: (count: number, max: number) =>\n `The field has ${pluralize(\"repetition\", count, true)}; it allows at most ${pluralize(\"repetition\", max, true)}.`,\n} as const;\n\n/**\n * Lint rule that reports a field with more repetitions than its RP/# allows.\n *\n * Reads `repetitions` from `field.data`, so `@glion/annotate-profile-fields`\n * MUST run before it. A field whose `repetitions` is `\"unbounded\"` is never\n * reported.\n *\n * @example\n * ```typescript\n * unified()\n * .use(hl7v2AnnotateProfileContext)\n * .use(hl7v2AnnotateProfileFields)\n * .use(hl7v2LintFieldRepetition);\n * ```;\n */\nconst hl7v2LintFieldRepetition = lintRule<Root>(\n {\n origin: \"hl7v2-lint:field-repetition\",\n url: \"https://github.com/rethinkhealth/glion/tree/main/packages/lint-profile-field-repetition#readme\",\n },\n (tree, file) => {\n visit(tree, \"field\", (field, ancestors) => {\n const limit = field.data?.repetitions;\n const count = field.children.length;\n // A limit of \"unbounded\" is never exceeded.\n if (typeof limit !== \"number\" || count <= limit) {\n return SKIP;\n }\n\n const message = file.message(messages.tooManyRepetitions(count, limit), {\n ancestors: [...ancestors, field],\n place: field.position,\n });\n message.actual = String(count);\n return SKIP;\n });\n }\n);\n\nexport default hl7v2LintFieldRepetition;\n"],"mappings":";;;;AAOA,MAAM,WAAW,EACf,qBAAqB,OAAe,QAClC,iBAAiB,UAAU,cAAc,OAAO,KAAK,CAAC,sBAAsB,UAAU,cAAc,KAAK,KAAK,CAAC,IAClH;;;;;;;;;;;;;;;;AAiBD,MAAM,2BAA2B,SAC/B;CACE,QAAQ;CACR,KAAK;CACN,GACA,MAAM,SAAS;AACd,OAAM,MAAM,UAAU,OAAO,cAAc;EACzC,MAAM,QAAQ,MAAM,MAAM;EAC1B,MAAM,QAAQ,MAAM,SAAS;AAE7B,MAAI,OAAO,UAAU,YAAY,SAAS,MACxC,QAAO;EAGT,MAAM,UAAU,KAAK,QAAQ,SAAS,mBAAmB,OAAO,MAAM,EAAE;GACtE,WAAW,CAAC,GAAG,WAAW,MAAM;GAChC,OAAO,MAAM;GACd,CAAC;AACF,UAAQ,SAAS,OAAO,MAAM;AAC9B,SAAO;GACP;EAEL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glion/lint-profile-field-repetition",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "Lint rule that flags non-repeatable fields with multiple repetitions",
5
5
  "keywords": [
6
6
  "health",
@@ -35,11 +35,13 @@
35
35
  "dependencies": {
36
36
  "pluralize": "8.0.0",
37
37
  "unified-lint-rule": "3.0.1",
38
- "@glion/annotate-profile-fields": "0.26.0",
39
- "@glion/ast": "0.26.0",
40
- "@glion/util-visit": "0.26.0"
38
+ "@glion/annotate-profile-fields": "0.27.0",
39
+ "@glion/ast": "0.27.0",
40
+ "@glion/util-visit": "0.27.0"
41
41
  },
42
42
  "devDependencies": {
43
+ "@stryker-mutator/core": "10.0.0",
44
+ "@stryker-mutator/vitest-runner": "10.0.0",
43
45
  "@types/node": "25.6.0",
44
46
  "@types/pluralize": "^0.0.33",
45
47
  "@vitest/coverage-v8": "4.1.11",
@@ -49,10 +51,10 @@
49
51
  "unified": "^11.0.5",
50
52
  "vfile": "^6.0.3",
51
53
  "vitest": "4.1.11",
52
- "@glion/annotate-profile-context": "0.26.0",
53
- "@glion/builder": "0.26.0",
54
+ "@glion/annotate-profile-context": "0.27.0",
55
+ "@glion/builder": "0.27.0",
54
56
  "@glion/check-readme": "0.18.0",
55
- "@glion/parser": "0.26.0",
57
+ "@glion/parser": "0.27.0",
56
58
  "@glion/testing": "0.18.0",
57
59
  "@glion/tsconfig": "0.18.0"
58
60
  },
@@ -63,9 +65,10 @@
63
65
  "build": "tsdown && tsc --emitDeclarationOnly",
64
66
  "check-types": "tsc --noEmit && tsc --noEmit -p tests/tsconfig.json",
65
67
  "check:readme": "glion-check-readme",
68
+ "mutate": "stryker run",
69
+ "publint": "publint --strict",
66
70
  "test": "vitest run",
67
71
  "test:coverage": "vitest run --coverage",
68
- "test:watch": "vitest",
69
- "publint": "publint --strict"
72
+ "test:watch": "vitest"
70
73
  }
71
74
  }