@haste-health/x-fhir-query 0.7.2

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/README.md ADDED
@@ -0,0 +1 @@
1
+ # x-fhir-query
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import * as fhirpath from "@haste-health/fhirpath";
2
+ export default function execute(xfhirQuery: string, fpOptions: Parameters<typeof fhirpath.evaluate>[2]): Promise<string>;
package/lib/index.js ADDED
@@ -0,0 +1,19 @@
1
+ import * as fhirpath from "@haste-health/fhirpath";
2
+ const EXPRESSION_REGEX = /{{([^}]*)}}/;
3
+ export default async function execute(xfhirQuery, fpOptions) {
4
+ let output = xfhirQuery;
5
+ while (EXPRESSION_REGEX.test(output)) {
6
+ const result = EXPRESSION_REGEX.exec(output);
7
+ const expression = result?.[1];
8
+ const match = result?.[0];
9
+ if (!match || !expression) {
10
+ throw new Error("Invalid expression");
11
+ }
12
+ const evaluation = (await fhirpath.evaluate(expression, undefined, fpOptions))
13
+ .map((e) => e.toString())
14
+ .join(",");
15
+ output = output.replace(match, evaluation);
16
+ }
17
+ return output;
18
+ }
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AAEnD,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,OAAO,CACnC,UAAkB,EAClB,SAAkD;IAElD,IAAI,MAAM,GAAG,UAAU,CAAC;IACxB,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,UAAU,GAAG,CACjB,MAAM,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAC1D;aACE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;aACxB,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@haste-health/x-fhir-query",
3
+ "version": "0.7.2",
4
+ "main": "lib/index.js",
5
+ "types": "lib/index.d.ts",
6
+ "type": "module",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "test": "pnpm node --experimental-vm-modules $(pnpm bin jest)",
10
+ "publish": "pnpm build && pnpm npm publish --access public --tolerate-republish"
11
+ },
12
+ "dependencies": {
13
+ "@haste-health/fhirpath": "workspace:^"
14
+ },
15
+ "devDependencies": {
16
+ "@babel/plugin-syntax-import-attributes": "^7.26.0",
17
+ "@babel/preset-env": "^7.26.9",
18
+ "@babel/preset-typescript": "^7.26.0",
19
+ "@jest/globals": "^29.7.0",
20
+ "@types/jest": "^29.5.14",
21
+ "jest": "^29.7.0",
22
+ "ts-jest": "^29.3.2",
23
+ "typescript": "5.9.2"
24
+ },
25
+ "files": [
26
+ "lib/**"
27
+ ]
28
+ }