From efbe562ae6ee50d2a67a9277cffd0ece5b4eb029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20G=C3=BCnther?= Date: Tue, 19 Sep 2023 09:43:54 +0200 Subject: [PATCH 01/10] Properly define typescript types as module --- fhir-context/dstu2/index.d.ts | 8 ++++ fhir-context/r4/index.d.ts | 8 ++++ fhir-context/r5/index.d.ts | 8 ++++ fhir-context/stu3/index.d.ts | 8 ++++ index.d.ts | 81 ----------------------------------- package.json | 1 + src/fhirpath.d.ts | 46 ++++++++++++++++++++ 7 files changed, 79 insertions(+), 81 deletions(-) create mode 100644 fhir-context/dstu2/index.d.ts create mode 100644 fhir-context/r4/index.d.ts create mode 100644 fhir-context/r5/index.d.ts create mode 100644 fhir-context/stu3/index.d.ts delete mode 100644 index.d.ts create mode 100644 src/fhirpath.d.ts diff --git a/fhir-context/dstu2/index.d.ts b/fhir-context/dstu2/index.d.ts new file mode 100644 index 00000000..32448c58 --- /dev/null +++ b/fhir-context/dstu2/index.d.ts @@ -0,0 +1,8 @@ +import { Model } from "../../src/fhirpath"; + +export const { + choiceTypePaths, + pathsDefinedElsewhere, + type2Parent, + path2Type +}: Model; diff --git a/fhir-context/r4/index.d.ts b/fhir-context/r4/index.d.ts new file mode 100644 index 00000000..32448c58 --- /dev/null +++ b/fhir-context/r4/index.d.ts @@ -0,0 +1,8 @@ +import { Model } from "../../src/fhirpath"; + +export const { + choiceTypePaths, + pathsDefinedElsewhere, + type2Parent, + path2Type +}: Model; diff --git a/fhir-context/r5/index.d.ts b/fhir-context/r5/index.d.ts new file mode 100644 index 00000000..32448c58 --- /dev/null +++ b/fhir-context/r5/index.d.ts @@ -0,0 +1,8 @@ +import { Model } from "../../src/fhirpath"; + +export const { + choiceTypePaths, + pathsDefinedElsewhere, + type2Parent, + path2Type +}: Model; diff --git a/fhir-context/stu3/index.d.ts b/fhir-context/stu3/index.d.ts new file mode 100644 index 00000000..32448c58 --- /dev/null +++ b/fhir-context/stu3/index.d.ts @@ -0,0 +1,8 @@ +import { Model } from "../../src/fhirpath"; + +export const { + choiceTypePaths, + pathsDefinedElsewhere, + type2Parent, + path2Type +}: Model; diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 671845fd..00000000 --- a/index.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -declare module "fhirpath" { - export function compile( - path: string | Path, - model?: Model, - options?: { - resolveInternalTypes?: boolean - } - ): Compile; - export function evaluate( - fhirData: any, - path: string | Path, - context?: Context, - model?: Model, - options?: { - resolveInternalTypes?: boolean, - traceFn?: (value: any, label: string) => void - } - ): any[]; - export function resolveInternalTypes(value: any): any; - export function types(value: any): string[]; -} - -declare module "fhirpath/fhir-context/dstu2" { - export const { - choiceTypePaths, - pathsDefinedElsewhere, - type2Parent, - path2Type - }: Model; -} - -declare module "fhirpath/fhir-context/r5" { - export const { - choiceTypePaths, - pathsDefinedElsewhere, - type2Parent, - path2Type - }: Model; -} - -declare module "fhirpath/fhir-context/r4" { - export const { - choiceTypePaths, - pathsDefinedElsewhere, - type2Parent, - path2Type - }: Model; -} - -declare module "fhirpath/fhir-context/stu3" { - export const { - choiceTypePaths, - pathsDefinedElsewhere, - type2Parent, - path2Type - }: Model; -} - -interface Path { - base: string; - expression: string; -} - -interface Model { - choiceTypePaths: { - [path: string]: string[]; - }; - pathsDefinedElsewhere: { - [path: string]: string; - }; - type2Parent: { - [path: string]: string; - }; - path2Type: { - [path: string]: string; - }; -} - -type Compile = (resource: any, context?: Context) => any[]; - -type Context = void | Record; diff --git a/package.json b/package.json index 2dbfff34..6393fa18 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "3.6.1", "description": "A FHIRPath engine", "main": "src/fhirpath.js", + "types": "src/fhirpath.d.ts", "dependencies": { "@lhncbc/ucum-lhc": "^4.1.3", "antlr4": "~4.9.3", diff --git a/src/fhirpath.d.ts b/src/fhirpath.d.ts new file mode 100644 index 00000000..6916b570 --- /dev/null +++ b/src/fhirpath.d.ts @@ -0,0 +1,46 @@ +export function compile( + path: string | Path, + model?: Model, + options?: { + resolveInternalTypes?: boolean + } +): Compile; + +export function evaluate( + fhirData: any, + path: string | Path, + context?: Context, + model?: Model, + options?: { + resolveInternalTypes?: boolean, + traceFn?: (value: any, label: string) => void + } +): any[]; + +export function resolveInternalTypes(value: any): any; + +export function types(value: any): string[]; + +interface Path { + base: string; + expression: string; +} + +interface Model { + choiceTypePaths: { + [path: string]: string[]; + }; + pathsDefinedElsewhere: { + [path: string]: string; + }; + type2Parent: { + [path: string]: string; + }; + path2Type: { + [path: string]: string; + }; +} + +type Compile = (resource: any, context?: Context) => any[]; + +type Context = void | Record; From 1388b60e5542d4c8ba6de373d5c9026976d84917 Mon Sep 17 00:00:00 2001 From: sedinkinya Date: Thu, 25 Apr 2024 17:48:07 -0400 Subject: [PATCH 02/10] Enabled unicode-aware mode for regular expressions in fhirpath LF-3015 --- CHANGELOG.md | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- src/strings.js | 6 +++--- test/cases/5.6_string_manipulation.yaml | 8 ++++++++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ddf3ea9..0b593c61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ This log documents significant changes for each release. This project follows [Semantic Versioning](http://semver.org/). +## [3.13.1] - 2024-04-25 +### Fixed +- Added flag 'u' for regular expressions in the `matches` and `replaceMatches` + functions to support the use of unicode character class escapes. + ## [3.13.0] - 2024-04-10 ### Added - Function `defineVariable(name: String [, expr: expression])`. diff --git a/package-lock.json b/package-lock.json index 016e682a..647100a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fhirpath", - "version": "3.13.0", + "version": "3.13.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "fhirpath", - "version": "3.13.0", + "version": "3.13.1", "license": "SEE LICENSE in LICENSE.md", "dependencies": { "@lhncbc/ucum-lhc": "^5.0.0", diff --git a/package.json b/package.json index e241ca40..90633319 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fhirpath", - "version": "3.13.0", + "version": "3.13.1", "description": "A FHIRPath engine", "main": "src/fhirpath.js", "dependencies": { diff --git a/src/strings.js b/src/strings.js index 24ab3436..5232ec00 100644 --- a/src/strings.js +++ b/src/strings.js @@ -162,7 +162,7 @@ if (dotAllIsSupported) { if (util.isEmpty(regex) || util.isEmpty(str)) { return []; } - const reg = new RegExp(regex, 's'); + const reg = new RegExp(regex, 'su'); return reg.test(str); }; } else { @@ -171,7 +171,7 @@ if (dotAllIsSupported) { if (util.isEmpty(regex) || util.isEmpty(str)) { return []; } - const reg = new RegExp(rewritePatternForDotAll(regex)); + const reg = new RegExp(rewritePatternForDotAll(regex), 'u'); return reg.test(str); }; } @@ -190,7 +190,7 @@ engine.replaceMatches = function (coll, regex, repl) { if (util.isEmpty(regex) || util.isEmpty(repl) || util.isEmpty(str)) { return []; } - const reg = new RegExp(regex, 'g'); + const reg = new RegExp(regex, 'gu'); return str.replace(reg, repl); }; diff --git a/test/cases/5.6_string_manipulation.yaml b/test/cases/5.6_string_manipulation.yaml index 74936dfc..2533de9c 100644 --- a/test/cases/5.6_string_manipulation.yaml +++ b/test/cases/5.6_string_manipulation.yaml @@ -258,6 +258,10 @@ tests: expression: Patient.name.given[0].matches('.*') result: [] + - desc: '** matches with unicode character class escapes' + expression: "'Taupō'.matches('^\\\\p{Lu}\\\\p{Ll}*$')" + result: [true] + - desc: '5.6.10. replaceMatches(regex : string, substitution: string) : string' # If the input collection contains a single item of type string, the function will match the input using the regular expression in regex and replace each match with the substitution string. The substitution may refer to identified match groups in the regular expression. # This example of replaceMatches() will convert a string with a date formatted as MM/dd/yy to dd-MM-yy: @@ -299,6 +303,10 @@ tests: expression: Patient.name.given[0].replaceMatches('(.*)', '$1') result: [] + - desc: '** replaceMatches with a unicode character class escape' + expression: "'Taupō'.replaceMatches('(\\\\p{Lu})', 'city: $1')" + result: ['city: Taupō'] + - desc: '5.6.11. length() : integer' # If the input collection contains a single item of type string, the function will return the length of the string. If the input collection is empty ({ }), the result is empty. - desc: '** length' From 11a1840d69283f18a77cac4bbfa1c478c34e5fa5 Mon Sep 17 00:00:00 2001 From: sedinkinya Date: Thu, 2 May 2024 15:09:57 -0400 Subject: [PATCH 03/10] Changes as per review LF-3015 --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b593c61..d66664de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,9 @@ This log documents significant changes for each release. This project follows ## [3.13.1] - 2024-04-25 ### Fixed -- Added flag 'u' for regular expressions in the `matches` and `replaceMatches` - functions to support the use of unicode character class escapes. +- Added flag 'u' for regular expressions in the specification's `matches` and + `replaceMatches` functions to support the use of unicode character class + escapes. ## [3.13.0] - 2024-04-10 ### Added From 172cf3505fe4e3a56dcd751b97aeb6aa01981dc3 Mon Sep 17 00:00:00 2001 From: sedinkinya Date: Tue, 14 May 2024 16:26:17 -0400 Subject: [PATCH 04/10] Changes as per review LF-3005 --- src/fhirpath.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/fhirpath.js b/src/fhirpath.js index b7c44079..76bb1656 100644 --- a/src/fhirpath.js +++ b/src/fhirpath.js @@ -279,14 +279,16 @@ engine.ExternalConstantTerm = function(ctx, parentData, node) { ctx.processedVars[varName] = value; delete ctx.vars[varName]; } else if (varName in ctx.processedVars) { + // "processedVars" are variables with ready-to-use values that have already + // been converted to ResourceNodes if necessary. value = ctx.processedVars[varName]; + } else if (ctx.definedVars && varName in ctx.definedVars) { + // "definedVars" are variables defined with the "defineVariable" function. + value = ctx.definedVars[varName]; } else { - if (ctx.definedVars && varName in ctx.definedVars) - value = ctx.definedVars[varName]; - else - throw new Error( - "Attempting to access an undefined environment variable: " + varName - ); + throw new Error( + "Attempting to access an undefined environment variable: " + varName + ); } // For convenience, we all variable values to be passed in without their array // wrapper. However, when evaluating, we need to put the array back in. From 7273e8fd5e0493dbb3479ac65df3e9fcc198acee Mon Sep 17 00:00:00 2001 From: sedinkinya Date: Wed, 15 May 2024 13:37:30 -0400 Subject: [PATCH 05/10] Resolved merge conflicts LF-3005 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index f56e204c..2bff4f87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16870,7 +16870,7 @@ "version": "git+ssh://git@github.com/caderek/benny.git#0ad058d3c7ef0b488a8fe9ae3519159fc7f36bb6", "integrity": "sha512-E6Hn7OIXBdxjgl6yKBTL7fEp143s2+5tQyks9DMzsoT9dMuN+jQTsmlaE9QbjuyUH2N+NrxslWdcGlN8B/xrcw==", "dev": true, - "from": "benny@git+ssh://git@github.com:caderek/benny.git#0ad058d3c7ef0b488a8fe9ae3519159fc7f36bb6", + "from": "benny@github:caderek/benny#0ad058d3c7ef0b488a8fe9ae3519159fc7f36bb6", "requires": { "@arrows/composition": "^1.0.0", "@arrows/dispatch": "^1.0.2", diff --git a/package.json b/package.json index 204447e3..e09ff508 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fhirpath", - "version": "3.13.1", + "version": "3.13.2", "description": "A FHIRPath engine", "main": "src/fhirpath.js", "dependencies": { From 7b904986a3d975cba0293a78266c2a8a33b3ff77 Mon Sep 17 00:00:00 2001 From: sedinkinya Date: Fri, 24 May 2024 13:50:43 -0400 Subject: [PATCH 06/10] Resolved merge conflicts LF-2769 --- src/fhirpath.d.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/fhirpath.d.ts b/src/fhirpath.d.ts index 6916b570..b24dbdce 100644 --- a/src/fhirpath.d.ts +++ b/src/fhirpath.d.ts @@ -3,6 +3,8 @@ export function compile( model?: Model, options?: { resolveInternalTypes?: boolean + traceFn?: (value: any, label: string) => void, + userInvocationTable?: UserInvocationTable } ): Compile; @@ -14,6 +16,7 @@ export function evaluate( options?: { resolveInternalTypes?: boolean, traceFn?: (value: any, label: string) => void + userInvocationTable?: UserInvocationTable } ): any[]; @@ -21,6 +24,10 @@ export function resolveInternalTypes(value: any): any; export function types(value: any): string[]; +export function parse(expression: string): any; + +export const version :string; + interface Path { base: string; expression: string; @@ -44,3 +51,14 @@ interface Model { type Compile = (resource: any, context?: Context) => any[]; type Context = void | Record; + +type UserInvocationTable = { + [name: string]: { + fn: Function, + arity: { + [numberOfParams: number]: Array<'Expr' | 'AnyAtRoot' | 'Identifier' | 'TypeSpecifier' | 'Any' | 'Integer' | 'Boolean' | 'Number' | 'String'> + }, + nullable?: boolean, + internalStructures?: boolean + } +}; From 4e664f1850dfc194abb47e68c40abd95e6365a75 Mon Sep 17 00:00:00 2001 From: sedinkinya Date: Fri, 24 May 2024 17:01:26 -0400 Subject: [PATCH 07/10] version info LF-2769 --- CHANGELOG.md | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd4b807c..1d2312ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ This log documents significant changes for each release. This project follows [Semantic Versioning](http://semver.org/). +## [3.13.3] - 2024-05-24 +### Changed +- TypeScript definitions. + ## [3.13.2] - 2024-05-15 ### Fixed - an issue with evaluating an expression for a resource passed through an diff --git a/package-lock.json b/package-lock.json index 2bff4f87..11efc25d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fhirpath", - "version": "3.13.2", + "version": "3.13.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "fhirpath", - "version": "3.13.2", + "version": "3.13.3", "hasInstallScript": true, "license": "SEE LICENSE in LICENSE.md", "dependencies": { diff --git a/package.json b/package.json index cf9d1949..89b3743a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fhirpath", - "version": "3.13.2", + "version": "3.13.3", "description": "A FHIRPath engine", "main": "src/fhirpath.js", "types": "src/fhirpath.d.ts", From 6753ec736f1767876ada93508f586bbafa18dd83 Mon Sep 17 00:00:00 2001 From: sedinkinya Date: Fri, 31 May 2024 18:34:50 -0400 Subject: [PATCH 08/10] Changes as per review LF-2769 --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d2312ab..008c6e7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ This log documents significant changes for each release. This project follows ## [3.13.3] - 2024-05-24 ### Changed -- TypeScript definitions. +- Added separate TypeScript type definition files for the main file and each + supported model. ## [3.13.2] - 2024-05-15 ### Fixed From 60290f4dcffb283e2b3ef8a78ae957d7e567fc07 Mon Sep 17 00:00:00 2001 From: sedinkinya Date: Thu, 13 Jun 2024 17:12:49 -0400 Subject: [PATCH 09/10] Fixed a bug that could cause the context input parameter containing environment variables to change LF-3060 --- CHANGELOG.md | 5 +++++ package-lock.json | 4 ++-- package.json | 2 +- src/fhirpath.js | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 008c6e7c..9738da88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ This log documents significant changes for each release. This project follows [Semantic Versioning](http://semver.org/). +## [3.13.4] - 2024-06-13 +### Fixed +- a bug that could cause the context input parameter containing environment + variables to change. + ## [3.13.3] - 2024-05-24 ### Changed - Added separate TypeScript type definition files for the main file and each diff --git a/package-lock.json b/package-lock.json index 11efc25d..e312e721 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fhirpath", - "version": "3.13.3", + "version": "3.13.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "fhirpath", - "version": "3.13.3", + "version": "3.13.4", "hasInstallScript": true, "license": "SEE LICENSE in LICENSE.md", "dependencies": { diff --git a/package.json b/package.json index 89b3743a..f847d048 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fhirpath", - "version": "3.13.3", + "version": "3.13.4", "description": "A FHIRPath engine", "main": "src/fhirpath.js", "types": "src/fhirpath.d.ts", diff --git a/src/fhirpath.js b/src/fhirpath.js index 76bb1656..d919d835 100644 --- a/src/fhirpath.js +++ b/src/fhirpath.js @@ -686,7 +686,7 @@ function applyParsedPath(resource, parsedPath, context, model, options) { // Set up default standard variables, and allow override from the variables. // However, we'll keep our own copy of dataRoot for internal processing. let vars = {context: dataRoot, ucum: 'http://unitsofmeasure.org'}; - let ctx = {dataRoot, processedVars: vars, vars: context || {}, model}; + let ctx = {dataRoot, processedVars: vars, vars: {...context}, model}; if (options.traceFn) { ctx.customTraceFn = options.traceFn; } From 4ed1ef42c695e26ee37d9573e8a20ec9e83cd410 Mon Sep 17 00:00:00 2001 From: sedinkinya Date: Mon, 24 Jun 2024 14:25:19 -0400 Subject: [PATCH 10/10] Added a unit test and npm audit fix LF-3060 --- demo/package-lock.json | 52 +++++++++---------- package-lock.json | 112 ++++++++++++++++------------------------- test/api.test.js | 11 ++++ 3 files changed, 79 insertions(+), 96 deletions(-) diff --git a/demo/package-lock.json b/demo/package-lock.json index 3074d8ee..ffcc12b3 100644 --- a/demo/package-lock.json +++ b/demo/package-lock.json @@ -811,12 +811,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -1838,9 +1838,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -5462,9 +5462,9 @@ } }, "node_modules/webpack-plugin-serve/node_modules/ws": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", - "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "dev": true, "engines": { "node": ">=8.3.0" @@ -5737,9 +5737,9 @@ "dev": true }, "node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "dev": true, "engines": { "node": ">=10.0.0" @@ -6468,12 +6468,12 @@ } }, "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "requires": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" } }, "browserslist": { @@ -7256,9 +7256,9 @@ } }, "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "requires": { "to-regex-range": "^5.0.1" @@ -9972,9 +9972,9 @@ } }, "ws": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", - "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "dev": true, "requires": {} } @@ -10162,9 +10162,9 @@ "dev": true }, "ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "dev": true, "requires": {} }, diff --git a/package-lock.json b/package-lock.json index e312e721..021d3446 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4400,12 +4400,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -6638,9 +6638,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -10085,27 +10085,6 @@ "node": ">= 6" } }, - "node_modules/jsdom/node_modules/ws": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", - "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==", - "dev": true, - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -12998,27 +12977,6 @@ "node": ">=8" } }, - "node_modules/webpack-bundle-analyzer/node_modules/ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "dev": true, - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/webpack-cli": { "version": "4.9.1", "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.9.1.tgz", @@ -13409,6 +13367,27 @@ "typedarray-to-buffer": "^3.1.5" } }, + "node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "dev": true, + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", @@ -16989,12 +16968,12 @@ } }, "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "requires": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" } }, "browser-process-hrtime": { @@ -18657,9 +18636,9 @@ } }, "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "requires": { "to-regex-range": "^5.0.1" @@ -21220,13 +21199,6 @@ "agent-base": "6", "debug": "4" } - }, - "ws": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz", - "integrity": "sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w==", - "dev": true, - "requires": {} } } }, @@ -23490,13 +23462,6 @@ "requires": { "has-flag": "^4.0.0" } - }, - "ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "dev": true, - "requires": {} } } }, @@ -23749,6 +23714,13 @@ "typedarray-to-buffer": "^3.1.5" } }, + "ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "dev": true, + "requires": {} + }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", diff --git a/test/api.test.js b/test/api.test.js index 46f9eeff..60de04c5 100644 --- a/test/api.test.js +++ b/test/api.test.js @@ -260,5 +260,16 @@ describe('evaluate type() on a FHIRPath evaluation result', () => { 'Quantity', 'Quantity', 'Quantity', 'Quantity', 'Date' ]); }); + + it('should not change the context input parameter containing environment variables', () => { + const originalVars = {a: 'abc'}; + const vars = _.cloneDeep(originalVars); + expect(fhirpath.evaluate( + {}, + '%a = \'abc\'', + vars + )).toStrictEqual([true]); + expect(originalVars).toStrictEqual(vars); + }) });