diff --git a/.eslintrc.json b/.eslintrc.json index 635201211..511602c0c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,4 +1,5 @@ { + "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": 6, "sourceType": "module", @@ -7,6 +8,8 @@ } }, "rules": { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], "indent": ["error", 2, { "SwitchCase": 1 }], "linebreak-style": ["error", "unix"], "no-console": ["warn", { "allow": ["warn", "error"] }], @@ -15,10 +18,16 @@ "quotes": ["error", "single", { "allowTemplateLiterals": true, "avoidEscape": true }], "semi": ["error", "always"] }, + "overrides": [{ + "files": ["test/**/*.{js,ts}", "examples/**/*.js", "bin/**/*.js"], + "rules": { + "@typescript-eslint/no-var-requires": "off" + } + }], "env": { "es6": true, "node": true, "mocha": true }, - "extends": ["eslint:recommended", "prettier"] -} \ No newline at end of file + "extends": ["plugin:@typescript-eslint/recommended", "prettier"] +} diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 74028ccba..10d7ad8b5 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -11,9 +11,9 @@ It is strongly recommended to include a person from each of those projects as a - [ ] Tests are included and test edge cases - [ ] Tests have been run locally and pass - [ ] Code coverage has not gone down and all code touched or added is covered. -- [ ] Code passes lint and prettier (hint: use `yarn run test:plus` to run tests, lint, and prettier) +- [ ] Code passes lint and prettier (hint: use `npm run test:plus` to run tests, lint, and prettier) - [ ] All dependent libraries are appropriately updated or have a corresponding PR related to this change -- [ ] `cql4browsers.js` built with `yarn run build:browserify` if source changed. +- [ ] `cql4browsers.js` built with `npm run build:browserify` if source changed. **Reviewer:** diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 1d8dad0f8..f35d14e8f 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -4,14 +4,14 @@ on: [push, pull_request] jobs: audit: - name: Check yarn audit + name: Check npm audit runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 with: node-version: '12.x' - - run: yarn audit + - run: npm audit env: CI: true cql4browsers: @@ -33,9 +33,9 @@ jobs: - uses: actions/setup-node@v1 with: node-version: '12.x' - - run: yarn install - - run: yarn run lint - - run: yarn run prettier + - run: npm install + - run: npm run lint + - run: npm run prettier env: CI: true test: @@ -51,8 +51,8 @@ jobs: with: timezone: America/New_York - run: date +"%Y-%m-%d %T" - - run: yarn install + - run: npm install - run: ./bin/check_for_nonassertive_tests.sh - - run: npx nyc --reporter=lcov yarn test && npx codecov + - run: npx nyc --reporter=lcov npm test && npx codecov env: CI: true diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 000000000..3139515f4 --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,4 @@ +{ + "extension": ["ts"], + "require": "ts-node/register" +} diff --git a/OVERVIEW.md b/OVERVIEW.md index 63307d1cd..b524b8355 100644 --- a/OVERVIEW.md +++ b/OVERVIEW.md @@ -9,6 +9,7 @@ Technologies ------------ The CQL execution framework was originally written in [CoffeeScript](http://coffeescript.org/). CoffeeScript is a scripting language that compiles down to JavaScript. In 2020, the CQL Execution framework source code was migrated from CoffeeScript to ES6 JavaScript. JavaScript execution code allows the reference implementation to be integrated into a variety of environments, including servers, other languages’ runtime environments, and standard web browsers. +In 2022, the CQL execution framework was converted to [TypeScript](https://www.typescriptlang.org/) to make use of static typing and support both TypeScript and JavaScript users of the framework. The CQL execution framework tests and examples are configured to run using [Node.js](http://nodejs.org/), but can be easily integrated into other JavaScript runtime environments. @@ -46,7 +47,7 @@ The expression 1 + 2 is represented in JSON ELM as follows: ### ELM Expression Classes -Each ELM expression has a corresponding class defined in the JavaScript CQL execution framework. These classes all extend a common `Expression` class and define, at a minimum, these components: +Each ELM expression has a corresponding class defined in the TypeScript CQL execution framework. These classes all extend a common `Expression` class and define, at a minimum, these components: 1. A `constructor` that takes a JSON ELM object as its argument 2. An `exec` function that takes a `Context` object as its argument @@ -55,16 +56,19 @@ The `constructor` is responsible for setting class properties from the JSON ELM The following is an example of the `Add` class that corresponds to the JSON ELM example in the previous section: -```js +```typescript class Add extends Expression { - constructor(json) { + arg1: IntegerLiteral; + arg2: IntegerLiteral; + + constructor(json: any) { super(json); - this.arg1 = new IntegerLiteral(json.operand[0]) - this.arg2 = new IntegerLiteral(json.operand[1]) + this.arg1 = new IntegerLiteral(json.operand[0]); + this.arg2 = new IntegerLiteral(json.operand[1]); } - exec(ctx) { - return this.arg1.exec(ctx) + this.arg2.exec(ctx) + exec(ctx: Context) { + return this.arg1.exec(ctx) + this.arg2.exec(ctx); } } ``` @@ -92,8 +96,8 @@ In order for the CQL execution framework to determine if a code is in a valueset ### MessageListener The CQL specification defines a [Message](https://cql.hl7.org/09-b-cqlreference.html#message) operator that "provides a run-time mechanism for returning messages, warnings, traces, and errors to the calling environment." To support this, the CQL execution framework supports a "MessageListener" API. A MessageListener class must contain an `onMessage` function which will be called by the CQL execution framework if the `condition` passed to the `Message` operator is `true`: -```js -onMessage(source, code, severity, message) { +```typescript +onMessage(source: any, code: string, severity: string, message: string) { // do something with the message } ``` @@ -127,7 +131,7 @@ const parameters = { new cql.DateTime(2014, 1, 1, 0, 0, 0, 0), true, false - ); + ) }; const executor = new cql.Executor(lib, codeService, parameters, messageListener); diff --git a/README.md b/README.md index 0612f9638..88122af0c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -[![Build Status](https://travis-ci.org/cqframework/cql-execution.svg?branch=master)](https://travis-ci.org/cqframework/cql-execution) +[![CI Checks](https://github.com/cqframework/cql-execution/actions/workflows/ci-workflow.yml/badge.svg)](https://github.com/cqframework/cql-execution/actions/workflows/ci-workflow.yml) [![codecov](https://codecov.io/gh/cqframework/cql-execution/branch/master/graph/badge.svg)](https://codecov.io/gh/cqframework/cql-execution) # CQL Execution Framework -The CQL Execution Framework provides a JavaScript library for executing CQL artifacts expressed as +The CQL Execution Framework provides a TypeScript/JavaScript library for executing CQL artifacts expressed as JSON ELM. For more information, see the [CQL Execution Framework Overview](OVERVIEW.md). @@ -51,6 +51,9 @@ Implementors should be aware of the following limitations and gaps in `cql-execu * Unfiltered context retrieves * Unfiltered context references to other libraries * External functions +* While the source code of `cql-execution` is in TypeScript, full-fledged typing of the library is not yet implemented + * Conversion from JavaScript to TypeScript was done in [this pull request](https://github.com/cqframework/cql-execution/pull/260), + with the intent on making incremental type improvements in subsequent pull requests. The above is a partial list covering the most significant limitations. For more details, see the [CQL_Execution_Features.xlsx](CQL_Execution_Features.xlsx) spreadsheet. @@ -59,9 +62,8 @@ The above is a partial list covering the most significant limitations. For more To use this project, you should perform the following steps: -1. Install [Node.js](http://nodejs.org/) -2. Install [Yarn](https://yarnpkg.com) -3. Execute the following from the root directory: `yarn install` +1. Install [Node.js](http://nodejs.org/) (Note: `npm` version `6.x.x` recommended) +2. Execute the following from the root directory: `npm install` # To Execute Your CQL @@ -103,6 +105,62 @@ define InDemographic: AgeInYearsAt(start of MeasurementPeriod) >= 2 and AgeInYearsAt(start of MeasurementPeriod) < 18 ``` +## TypeScript Example + +Next, we can create a TypeScript file to execute the above CQL. This file will need to contain (or +`import`) JSON patient representations for testing as well. Our example CQL uses a "Simple" +data model developed only for demonstration and testing purposes. In this model, each patient is +represented using a simple JSON object. For ease of use, let's put the file in the `customCQL` +directory: + +``` typescript +import cql from '../../src/cql'; +import * as measure from './age.json'; // Requires the "resolveJsonModule" compiler option to be "true" + +const lib = new cql.Library(measure); +const executor = new cql.Executor(lib); +const psource = new cql.PatientSource([ + { + id: '1', + recordType: 'Patient', + name: 'John Smith', + gender: 'M', + birthDate: '1980-02-17T06:15' + }, + { + id: '2', + recordType: 'Patient', + name: 'Sally Smith', + gender: 'F', + birthDate: '2007-08-02T11:47' + } +]); + +const result = executor.exec(psource); +console.log(JSON.stringify(result, undefined, 2)); +``` + +In the above file, we've assumed the JSON ELM JSON file for the measure is called +`age.json` and is in the same directory as the file that requires is. We've +also assumed a couple of very simple patients. Let's call the file we just created +`exec-age.ts`. + +Now we can execute the measure using [ts-node](https://www.npmjs.com/package/ts-node): + +``` bash +npx ts-node -O '{ "resolveJsonModule": true }' --files ${path_to_cql-execution}/customCQL/exec-age.ts +``` + +If all is well, it should print the result object to standard out. + +## JavaScript Example + +For usage in regular JavaScript, we can refer to the compiled JavaScript in the `lib` directory. +Ensure that this JavaScript is present by running `npm run build` before continuing on to the example. +We will follow the same steps as the above TypeScript example, but our JavaScript code must use `require` +instead of `import`, and will load the `cql-execution` library from the `lib` directory. As before, +let's put the file in the `customCQL` directory: + Next, create a JavaScript file to execute the CQL above. This file will need to contain (or `require`) JSON patient representations for testing as well. Our example CQL uses a "Simple" data model developed only for demonstration and testing purposes. In this model, each patient is @@ -110,7 +168,7 @@ represented using a simple JSON object. For ease of use, let's put the file in directory: ```js -const cql = require('../src/cql'); +const cql = require('../lib/cql'); const measure = require('./age.json'); const lib = new cql.Library(measure); @@ -134,9 +192,7 @@ console.log(JSON.stringify(result, undefined, 2)); ``` -In the above file, we've assumed the JSON ELM JSON file for the measure is called -`age.json` and is in the same directory as the file that requires is. We've -also assumed a couple of very simple patients. Let's call the file we just created +The above file has the same assumptions as the TypeScript example above. Let's call the file we just created `exec-age.js`. Now we can execute the measure using Node.js: @@ -145,11 +201,11 @@ Now we can execute the measure using Node.js: node ${path_to_cql-execution}/customCQL/exec-age.js ``` -If all is well, it should print the result object to standard out. +If all is well, it should print the result object to standard out, and the output should be identical to that of the TypeScript example. # To Run the CQL Execution Unit Tests -Execute `yarn test`. +Execute `npm test`. # To Develop Tests @@ -167,7 +223,7 @@ statements that follows the `# And` represents the CQL Library that will be supp to the "And" test suite. To convert the CQL to JavaScript containing the JSON ELM representation, execute -`yarn build:test-data`. This will use the java _cql-to-elm_ project to generate the +`npm run build:test-data`. This will use the java _cql-to-elm_ project to generate the _test/elm/*/data.js_ file containing the following exported variable declaration (NOTE: It's been slimmed down a bit here to make it easier to read, but nothing substantial has been removed): @@ -244,23 +300,23 @@ module.exports['And'] = { Notice that since the CQL didn't declare a library name/version, a data model, or a context, default values were inserted into the CQL at generation time. Now this CQL can be used in a test -defined in _test/elm/*/logical-test.js_. For example: +defined in _test/elm/*/logical-test.ts_. For example: ```js describe('And', () => { - this.beforeEach(() => { + this.beforeEach(function () { setup(this, data); }); - it('should execute allTrue as true', () => { + it('should execute allTrue as true', function () { this.allTrue.exec(this.ctx).should.be.true(); }); - it('should execute someTrue as false', () => { + it('should execute someTrue as false', function () { this.someTrue.exec(this.ctx).should.be.false(); }); - it('should execute allFalse as false', () => { + it('should execute allFalse as false', function () { this.allFalse.exec(this.ctx).should.be.false(); }); }); @@ -275,16 +331,16 @@ use lowercase first letters even though the CQL expression name starts with an u # Watching For Changes -Rather than continually having to run `yarn build:test-data` and `yarn:test` after every +Rather than continually having to run `npm run build:test-data` and `npm test` after every modification to the test data text file, you can setup a process to _watch_ for changes and regenerate the `data.js` files every time it detects changes in the source text file. Simply -execute `yarn watch:test-data`. +execute `npm run watch:test-data`. # Pull Requests -If JavaScript source code is modified, `cql4browsers.js` needs to be included in the pull request, -otherwise Travis CI will fail. To generate this file, run: +If TypeScript source code is modified, `cql4browsers.js` needs to be included in the pull request, +otherwise GitHub Actions CI will fail. To generate this file, run: ``` -yarn build:all +npm run build:browserify ``` diff --git a/babel.config.json b/babel.config.json deleted file mode 100644 index 62dc93aa6..000000000 --- a/babel.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "presets": [ - [ - "@babel/env", - { - "targets": "defaults" - } - ] - ] -} \ No newline at end of file diff --git a/bin/validate_cql4browsers.sh b/bin/validate_cql4browsers.sh index 3b745e966..9b8ac2b9d 100755 --- a/bin/validate_cql4browsers.sh +++ b/bin/validate_cql4browsers.sh @@ -1,7 +1,7 @@ #!/bin/bash mkdir -p tmp/dist/ -git status --porcelain | grep cql4browsers +git status --porcelain | grep cql4browsers.js if [ $? == 0 ]; then echo "cql4browsers.js has uncommitted changes. Reset or commit them before continuing." exit 1 @@ -13,7 +13,7 @@ if [ $? != 0 ]; then echo "cql4browsers.js not found. Run this script from the base repository directory." exit 1 fi -yarn install +npm install # comm -3 only returns lines that differ between the two files. If none are different, diff will be empty diff=`diff ./examples/browser/cql4browsers.js.original ./examples/browser/cql4browsers.js` @@ -22,7 +22,7 @@ mv ./examples/browser/cql4browsers.js.original ./examples/browser/cql4browsers.j # Exit with a non-zero code if the diff isn't empty if [ "$diff" != "" ]; then - echo "cql4browsers.js is out of date. Please run 'yarn install' locally and commit/push the result" + echo "cql4browsers.js is out of date. Please run 'npm install' locally and commit/push the result" exit 1 fi diff --git a/examples/browser/README.md b/examples/browser/README.md index ca2b51248..29b1a3344 100644 --- a/examples/browser/README.md +++ b/examples/browser/README.md @@ -5,8 +5,7 @@ does not support other data models or execution on patients. The browserified code is checked into source control, but if you need to update it, you can follow these steps: -1. Install [Node.js](http://nodejs.org/) -2. Install [Yarn](https://yarnpkg.com) -3. Execute the following from the _cql-execution_ directory: - 1. `yarn install` - 2. `cake build:all` +1. Install [Node.js](http://nodejs.org/) (Note: `npm` version `6.x.x` recommended) +2. Execute the following from the _cql-execution_ directory: + 1. `npm install` + 2. `npm run build:all` diff --git a/examples/browser/cql4browsers.js b/examples/browser/cql4browsers.js index 6f1b44175..10c01bf1f 100644 --- a/examples/browser/cql4browsers.js +++ b/examples/browser/cql4browsers.js @@ -39,15284 +39,10638 @@ window.executeSimpleELM = function ( },{"../../lib/cql":4}],2:[function(require,module,exports){ "use strict"; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('./datatypes/datatypes'), - Code = _require.Code, - ValueSet = _require.ValueSet; - -var CodeService = /*#__PURE__*/function () { - function CodeService() { - var valueSetsJson = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - _classCallCheck(this, CodeService); - - this.valueSets = {}; - - for (var oid in valueSetsJson) { - this.valueSets[oid] = {}; - - for (var version in valueSetsJson[oid]) { - var codes = valueSetsJson[oid][version].map(function (code) { - return new Code(code.code, code.system, code.version); - }); - this.valueSets[oid][version] = new ValueSet(oid, version, codes); - } - } - } - - _createClass(CodeService, [{ - key: "findValueSetsByOid", - value: function findValueSetsByOid(oid) { - return this.valueSets[oid] ? Object.values(this.valueSets[oid]) : []; - } - }, { - key: "findValueSet", - value: function findValueSet(oid, version) { - if (version != null) { - return this.valueSets[oid] != null ? this.valueSets[oid][version] : undefined; - } else { - var results = this.findValueSetsByOid(oid); - - if (results.length === 0) { - return null; - } else { - return results.reduce(function (a, b) { - if (a.version > b.version) { - return a; - } else { - return b; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeService = void 0; +var datatypes_1 = require("./datatypes/datatypes"); +var CodeService = /** @class */ (function () { + function CodeService(valueSetsJson) { + if (valueSetsJson === void 0) { valueSetsJson = {}; } + this.valueSets = {}; + for (var oid in valueSetsJson) { + this.valueSets[oid] = {}; + for (var version in valueSetsJson[oid]) { + var codes = valueSetsJson[oid][version].map(function (code) { return new datatypes_1.Code(code.code, code.system, code.version); }); + this.valueSets[oid][version] = new datatypes_1.ValueSet(oid, version, codes); } - }); } - } } - }]); - - return CodeService; -}(); + CodeService.prototype.findValueSetsByOid = function (oid) { + return this.valueSets[oid] ? Object.values(this.valueSets[oid]) : []; + }; + CodeService.prototype.findValueSet = function (oid, version) { + if (version != null) { + return this.valueSets[oid] != null ? this.valueSets[oid][version] : null; + } + else { + var results = this.findValueSetsByOid(oid); + if (results.length === 0) { + return null; + } + else { + return results.reduce(function (a, b) { + if (a.version > b.version) { + return a; + } + else { + return b; + } + }); + } + } + }; + return CodeService; +}()); +exports.CodeService = CodeService; -module.exports.CodeService = CodeService; },{"./datatypes/datatypes":6}],3:[function(require,module,exports){ "use strict"; - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var DT = require('./datatypes/datatypes'); - -var Record = /*#__PURE__*/function () { - function Record(json) { - _classCallCheck(this, Record); - - this.json = json; - this.id = this.json.id; - } - - _createClass(Record, [{ - key: "_is", - value: function _is(typeSpecifier) { - return this._typeHierarchy().some(function (t) { - return t.type === typeSpecifier.type && t.name == typeSpecifier.name; - }); - } - }, { - key: "_typeHierarchy", - value: function _typeHierarchy() { - return [{ - name: "{https://github.com/cqframework/cql-execution/simple}".concat(this.json.recordType), - type: 'NamedTypeSpecifier' - }, { - name: '{https://github.com/cqframework/cql-execution/simple}Record', - type: 'NamedTypeSpecifier' - }, { - name: '{urn:hl7-org:elm-types:r1}Any', - type: 'NamedTypeSpecifier' - }]; - } - }, { - key: "_recursiveGet", - value: function _recursiveGet(field) { - if (field != null && field.indexOf('.') >= 0) { - var _field$split = field.split('.', 2), - _field$split2 = _slicedToArray(_field$split, 2), - root = _field$split2[0], - rest = _field$split2[1]; - - return new Record(this._recursiveGet(root))._recursiveGet(rest); - } - - return this.json[field]; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PatientSource = exports.Patient = exports.Record = void 0; +var DT = __importStar(require("./datatypes/datatypes")); +var Record = /** @class */ (function () { + function Record(json) { + this.json = json; + this.id = this.json.id; + } + Record.prototype._is = function (typeSpecifier) { + return this._typeHierarchy().some(function (t) { return t.type === typeSpecifier.type && t.name == typeSpecifier.name; }); + }; + Record.prototype._typeHierarchy = function () { + return [ + { + name: "{https://github.com/cqframework/cql-execution/simple}".concat(this.json.recordType), + type: 'NamedTypeSpecifier' + }, + { + name: '{https://github.com/cqframework/cql-execution/simple}Record', + type: 'NamedTypeSpecifier' + }, + { name: '{urn:hl7-org:elm-types:r1}Any', type: 'NamedTypeSpecifier' } + ]; + }; + Record.prototype._recursiveGet = function (field) { + if (field != null && field.indexOf('.') >= 0) { + var _a = field.split('.', 2), root = _a[0], rest = _a[1]; + return new Record(this._recursiveGet(root))._recursiveGet(rest); + } + return this.json[field]; + }; + Record.prototype.get = function (field) { + // the model should return the correct type for the field. For this simple model example, + // we just cheat and use the shape of the value to determine it. Real implementations should + // have a more sophisticated approach + var value = this._recursiveGet(field); + if (typeof value === 'string' && /\d{4}-\d{2}-\d{2}(T[\d\-.]+)?/.test(value)) { + return this.getDate(field); + } + if (value != null && typeof value === 'object' && value.code != null && value.system != null) { + return this.getCode(field); + } + if (value != null && typeof value === 'object' && (value.low != null || value.high != null)) { + return this.getInterval(field); + } + return value; + }; + Record.prototype.getId = function () { + return this.id; + }; + Record.prototype.getDate = function (field) { + var val = this._recursiveGet(field); + if (val != null) { + return DT.DateTime.parse(val); + } + else { + return null; + } + }; + Record.prototype.getInterval = function (field) { + var val = this._recursiveGet(field); + if (val != null && typeof val === 'object') { + var low = val.low != null ? DT.DateTime.parse(val.low) : null; + var high = val.high != null ? DT.DateTime.parse(val.high) : null; + return new DT.Interval(low, high); + } + }; + Record.prototype.getDateOrInterval = function (field) { + var val = this._recursiveGet(field); + if (val != null && typeof val === 'object') { + return this.getInterval(field); + } + else { + return this.getDate(field); + } + }; + Record.prototype.getCode = function (field) { + var val = this._recursiveGet(field); + if (val != null && typeof val === 'object') { + return new DT.Code(val.code, val.system, val.version); + } + }; + return Record; +}()); +exports.Record = Record; +var Patient = /** @class */ (function (_super) { + __extends(Patient, _super); + function Patient(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.gender = json.gender; + _this.birthDate = json.birthDate != null ? DT.DateTime.parse(json.birthDate) : undefined; + _this.records = {}; + (json.records || []).forEach(function (r) { + if (_this.records[r.recordType] == null) { + _this.records[r.recordType] = []; + } + _this.records[r.recordType].push(new Record(r)); + }); + return _this; } - }, { - key: "get", - value: function get(field) { - // the model should return the correct type for the field. For this simple model example, - // we just cheat and use the shape of the value to determine it. Real implementations should - // have a more sophisticated approach - var value = this._recursiveGet(field); - - if (typeof value === 'string' && /\d{4}-\d{2}-\d{2}(T[\d\-.]+)?/.test(value)) { - return this.getDate(field); - } - - if (value != null && _typeof(value) === 'object' && value.code != null && value.system != null) { - return this.getCode(field); - } - - if (value != null && _typeof(value) === 'object' && (value.low != null || value.high != null)) { - return this.getInterval(field); - } + Patient.prototype.findRecords = function (profile) { + if (profile == null) { + return []; + } + var match = profile.match(/(\{https:\/\/github\.com\/cqframework\/cql-execution\/simple\})?(.*)/); + if (match == null) + return []; + var recordType = match[2]; + if (recordType === 'Patient') { + return [this]; + } + else { + return this.records[recordType] || []; + } + }; + return Patient; +}(Record)); +exports.Patient = Patient; +var PatientSource = /** @class */ (function () { + function PatientSource(patients) { + this.patients = patients; + this.nextPatient(); + } + PatientSource.prototype.currentPatient = function () { + return this.current; + }; + PatientSource.prototype.nextPatient = function () { + var currentJSON = this.patients.shift(); + this.current = currentJSON ? new Patient(currentJSON) : undefined; + return this.current; + }; + return PatientSource; +}()); +exports.PatientSource = PatientSource; - return value; - } - }, { - key: "getId", - value: function getId() { - return this.id; - } - }, { - key: "getDate", - value: function getDate(field) { - var val = this._recursiveGet(field); +},{"./datatypes/datatypes":6}],4:[function(require,module,exports){ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueSet = exports.Ratio = exports.Quantity = exports.Interval = exports.DateTime = exports.Date = exports.Concept = exports.CodeSystem = exports.Code = exports.CodeService = exports.PatientSource = exports.Patient = exports.NullMessageListener = exports.ConsoleMessageListener = exports.Results = exports.Executor = exports.UnfilteredContext = exports.PatientContext = exports.Context = exports.Expression = exports.Repository = exports.Library = void 0; +// Library-related classes +var library_1 = require("./elm/library"); +Object.defineProperty(exports, "Library", { enumerable: true, get: function () { return library_1.Library; } }); +var repository_1 = require("./runtime/repository"); +Object.defineProperty(exports, "Repository", { enumerable: true, get: function () { return repository_1.Repository; } }); +var expression_1 = require("./elm/expression"); +Object.defineProperty(exports, "Expression", { enumerable: true, get: function () { return expression_1.Expression; } }); +// Execution-related classes +var context_1 = require("./runtime/context"); +Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return context_1.Context; } }); +Object.defineProperty(exports, "PatientContext", { enumerable: true, get: function () { return context_1.PatientContext; } }); +Object.defineProperty(exports, "UnfilteredContext", { enumerable: true, get: function () { return context_1.UnfilteredContext; } }); +var executor_1 = require("./runtime/executor"); +Object.defineProperty(exports, "Executor", { enumerable: true, get: function () { return executor_1.Executor; } }); +var results_1 = require("./runtime/results"); +Object.defineProperty(exports, "Results", { enumerable: true, get: function () { return results_1.Results; } }); +var messageListeners_1 = require("./runtime/messageListeners"); +Object.defineProperty(exports, "ConsoleMessageListener", { enumerable: true, get: function () { return messageListeners_1.ConsoleMessageListener; } }); +Object.defineProperty(exports, "NullMessageListener", { enumerable: true, get: function () { return messageListeners_1.NullMessageListener; } }); +// PatientSource-related classes +var cql_patient_1 = require("./cql-patient"); +Object.defineProperty(exports, "Patient", { enumerable: true, get: function () { return cql_patient_1.Patient; } }); +Object.defineProperty(exports, "PatientSource", { enumerable: true, get: function () { return cql_patient_1.PatientSource; } }); +// TerminologyService-related classes +var cql_code_service_1 = require("./cql-code-service"); +Object.defineProperty(exports, "CodeService", { enumerable: true, get: function () { return cql_code_service_1.CodeService; } }); +// DataType classes +var datatypes_1 = require("./datatypes/datatypes"); +Object.defineProperty(exports, "Code", { enumerable: true, get: function () { return datatypes_1.Code; } }); +Object.defineProperty(exports, "CodeSystem", { enumerable: true, get: function () { return datatypes_1.CodeSystem; } }); +Object.defineProperty(exports, "Concept", { enumerable: true, get: function () { return datatypes_1.Concept; } }); +Object.defineProperty(exports, "Date", { enumerable: true, get: function () { return datatypes_1.Date; } }); +Object.defineProperty(exports, "DateTime", { enumerable: true, get: function () { return datatypes_1.DateTime; } }); +Object.defineProperty(exports, "Interval", { enumerable: true, get: function () { return datatypes_1.Interval; } }); +Object.defineProperty(exports, "Quantity", { enumerable: true, get: function () { return datatypes_1.Quantity; } }); +Object.defineProperty(exports, "Ratio", { enumerable: true, get: function () { return datatypes_1.Ratio; } }); +Object.defineProperty(exports, "ValueSet", { enumerable: true, get: function () { return datatypes_1.ValueSet; } }); +// Custom Types +__exportStar(require("./types"), exports); +exports.default = { + Library: library_1.Library, + Repository: repository_1.Repository, + Expression: expression_1.Expression, + Context: context_1.Context, + PatientContext: context_1.PatientContext, + UnfilteredContext: context_1.UnfilteredContext, + Executor: executor_1.Executor, + Results: results_1.Results, + ConsoleMessageListener: messageListeners_1.ConsoleMessageListener, + NullMessageListener: messageListeners_1.NullMessageListener, + Patient: cql_patient_1.Patient, + PatientSource: cql_patient_1.PatientSource, + CodeService: cql_code_service_1.CodeService, + Code: datatypes_1.Code, + CodeSystem: datatypes_1.CodeSystem, + Concept: datatypes_1.Concept, + Date: datatypes_1.Date, + DateTime: datatypes_1.DateTime, + Interval: datatypes_1.Interval, + Quantity: datatypes_1.Quantity, + Ratio: datatypes_1.Ratio, + ValueSet: datatypes_1.ValueSet +}; - if (val != null) { - return DT.DateTime.parse(val); - } else { - return null; - } +},{"./cql-code-service":2,"./cql-patient":3,"./datatypes/datatypes":6,"./elm/expression":22,"./elm/library":27,"./runtime/context":42,"./runtime/executor":43,"./runtime/messageListeners":44,"./runtime/repository":45,"./runtime/results":46,"./types":49}],5:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeSystem = exports.ValueSet = exports.Concept = exports.Code = void 0; +var util_1 = require("../util/util"); +var Code = /** @class */ (function () { + function Code(code, system, version, display) { + this.code = code; + this.system = system; + this.version = version; + this.display = display; + } + Object.defineProperty(Code.prototype, "isCode", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Code.prototype.hasMatch = function (code) { + if (typeof code === 'string') { + // the specific behavior for this is not in the specification. Matching codesystem behavior. + return code === this.code; + } + else { + return codesInList(toCodeList(code), [this]); + } + }; + return Code; +}()); +exports.Code = Code; +var Concept = /** @class */ (function () { + function Concept(codes, display) { + this.codes = codes; + this.display = display; + this.codes || (this.codes = []); + } + Object.defineProperty(Concept.prototype, "isConcept", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Concept.prototype.hasMatch = function (code) { + return codesInList(toCodeList(code), this.codes); + }; + return Concept; +}()); +exports.Concept = Concept; +var ValueSet = /** @class */ (function () { + function ValueSet(oid, version, codes) { + if (codes === void 0) { codes = []; } + this.oid = oid; + this.version = version; + this.codes = codes; + this.codes || (this.codes = []); + } + Object.defineProperty(ValueSet.prototype, "isValueSet", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + ValueSet.prototype.hasMatch = function (code) { + var codesList = toCodeList(code); + // InValueSet String Overload + if (codesList.length === 1 && typeof codesList[0] === 'string') { + var matchFound = false; + var multipleCodeSystemsExist = false; + for (var _i = 0, _a = this.codes; _i < _a.length; _i++) { + var codeItem = _a[_i]; + // Confirm all code systems match + if (codeItem.system !== this.codes[0].system) { + multipleCodeSystemsExist = true; + } + if (codeItem.code === codesList[0]) { + matchFound = true; + } + if (multipleCodeSystemsExist && matchFound) { + throw new Error('In (valueset) is ambiguous -- multiple codes with multiple code systems exist in value set.'); + } + } + return matchFound; + } + else { + return codesInList(codesList, this.codes); + } + }; + return ValueSet; +}()); +exports.ValueSet = ValueSet; +function toCodeList(c) { + if (c == null) { + return []; } - }, { - key: "getInterval", - value: function getInterval(field) { - var val = this._recursiveGet(field); - - if (val != null && _typeof(val) === 'object') { - var low = val.low != null ? DT.DateTime.parse(val.low) : null; - var high = val.high != null ? DT.DateTime.parse(val.high) : null; - return new DT.Interval(low, high); - } + else if ((0, util_1.typeIsArray)(c)) { + var list = []; + for (var _i = 0, c_1 = c; _i < c_1.length; _i++) { + var c2 = c_1[_i]; + list = list.concat(toCodeList(c2)); + } + return list; } - }, { - key: "getDateOrInterval", - value: function getDateOrInterval(field) { - var val = this._recursiveGet(field); - - if (val != null && _typeof(val) === 'object') { - return this.getInterval(field); - } else { - return this.getDate(field); - } + else if ((0, util_1.typeIsArray)(c.codes)) { + return c.codes; } - }, { - key: "getCode", - value: function getCode(field) { - var val = this._recursiveGet(field); - - if (val != null && _typeof(val) === 'object') { - return new DT.Code(val.code, val.system, val.version); - } + else { + return [c]; } - }]); - - return Record; -}(); - -var Patient = /*#__PURE__*/function (_Record) { - _inherits(Patient, _Record); - - var _super = _createSuper(Patient); - - function Patient(json) { - var _this; - - _classCallCheck(this, Patient); - - _this = _super.call(this, json); - _this.name = json.name; - _this.gender = json.gender; - _this.birthDate = json.birthDate != null ? DT.DateTime.parse(json.birthDate) : undefined; - _this.records = {}; - (json.records || []).forEach(function (r) { - if (_this.records[r.recordType] == null) { - _this.records[r.recordType] = []; - } - - _this.records[r.recordType].push(new Record(r)); +} +function codesInList(cl1, cl2) { + // test each code in c1 against each code in c2 looking for a match + return cl1.some(function (c1) { + return cl2.some(function (c2) { + // only the left argument (cl1) can contain strings. cl2 will only contain codes. + if (typeof c1 === 'string') { + // for "string in codesystem" this should compare the string to + // the code's "code" field according to the specification. + return c1 === c2.code; + } + else { + return codesMatch(c1, c2); + } + }); }); - return _this; - } - - _createClass(Patient, [{ - key: "findRecords", - value: function findRecords(profile) { - if (profile == null) { - return []; - } - - var recordType = profile.match(/(\{https:\/\/github\.com\/cqframework\/cql-execution\/simple\})?(.*)/)[2]; - - if (recordType === 'Patient') { - return [this]; - } else { - return this.records[recordType] || []; - } - } - }]); - - return Patient; -}(Record); - -var PatientSource = /*#__PURE__*/function () { - function PatientSource(patients) { - _classCallCheck(this, PatientSource); - - this.patients = patients; - this.nextPatient(); - } - - _createClass(PatientSource, [{ - key: "currentPatient", - value: function currentPatient() { - return this.current; - } - }, { - key: "nextPatient", - value: function nextPatient() { - var currentJSON = this.patients.shift(); - this.current = currentJSON ? new Patient(currentJSON) : undefined; - return this.current; +} +function codesMatch(code1, code2) { + return code1.code === code2.code && code1.system === code2.system; +} +var CodeSystem = /** @class */ (function () { + function CodeSystem(id, version) { + this.id = id; + this.version = version; } - }]); - - return PatientSource; -}(); + return CodeSystem; +}()); +exports.CodeSystem = CodeSystem; -module.exports.Patient = Patient; -module.exports.PatientSource = PatientSource; -},{"./datatypes/datatypes":6}],4:[function(require,module,exports){ +},{"../util/util":55}],6:[function(require,module,exports){ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./logic"), exports); +__exportStar(require("./clinical"), exports); +__exportStar(require("./uncertainty"), exports); +__exportStar(require("./datetime"), exports); +__exportStar(require("./interval"), exports); +__exportStar(require("./quantity"), exports); +__exportStar(require("./ratio"), exports); -var library = require('./elm/library'); - -var expression = require('./elm/expression'); - -var repository = require('./runtime/repository'); - -var context = require('./runtime/context'); - -var exec = require('./runtime/executor'); - -var listeners = require('./runtime/messageListeners'); - -var results = require('./runtime/results'); - -var datatypes = require('./datatypes/datatypes'); - -var patient = require('./cql-patient'); - -var codeservice = require('./cql-code-service'); // Library-related classes - - -module.exports.Library = library.Library; -module.exports.Repository = repository.Repository; -module.exports.Expression = expression.Expression; // Execution-related classes - -module.exports.Context = context.Context; -module.exports.Executor = exec.Executor; -module.exports.PatientContext = context.PatientContext; -module.exports.UnfilteredContext = context.UnfilteredContext; -module.exports.Results = results.Results; -module.exports.ConsoleMessageListener = listeners.ConsoleMessageListener; -module.exports.NullMessageListener = listeners.NullMessageListener; // PatientSource-related classes - -module.exports.Patient = patient.Patient; -module.exports.PatientSource = patient.PatientSource; // TerminologyService-related classes - -module.exports.CodeService = codeservice.CodeService; // DataType classes - -module.exports.Code = datatypes.Code; -module.exports.CodeSystem = datatypes.CodeSystem; -module.exports.Concept = datatypes.Concept; -module.exports.Date = datatypes.Date; -module.exports.DateTime = datatypes.DateTime; -module.exports.Interval = datatypes.Interval; -module.exports.Quantity = datatypes.Quantity; -module.exports.Ratio = datatypes.Ratio; -module.exports.ValueSet = datatypes.ValueSet; -},{"./cql-code-service":2,"./cql-patient":3,"./datatypes/datatypes":6,"./elm/expression":22,"./elm/library":27,"./runtime/context":42,"./runtime/executor":43,"./runtime/messageListeners":44,"./runtime/repository":45,"./runtime/results":46}],5:[function(require,module,exports){ +},{"./clinical":5,"./datetime":7,"./interval":9,"./logic":10,"./quantity":11,"./ratio":12,"./uncertainty":13}],7:[function(require,module,exports){ "use strict"; - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('../util/util'), - typeIsArray = _require.typeIsArray; - -var Code = /*#__PURE__*/function () { - function Code(code, system, version, display) { - _classCallCheck(this, Code); - - this.code = code; - this.system = system; - this.version = version; - this.display = display; - } - - _createClass(Code, [{ - key: "isCode", - get: function get() { - return true; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } } - }, { - key: "hasMatch", - value: function hasMatch(code) { - if (typeof code === 'string') { - // the specific behavior for this is not in the specification. Matching codesystem behavior. - return code === this.code; - } else { - return codesInList(toCodeList(code), [this]); - } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +var _a, _b; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MAX_TIME_VALUE = exports.MIN_TIME_VALUE = exports.MAX_DATE_VALUE = exports.MIN_DATE_VALUE = exports.MAX_DATETIME_VALUE = exports.MIN_DATETIME_VALUE = exports.Date = exports.DateTime = void 0; +/* eslint-disable @typescript-eslint/ban-ts-comment */ +var uncertainty_1 = require("./uncertainty"); +var util_1 = require("../util/util"); +var luxon_1 = require("luxon"); +// It's easiest and most performant to organize formats by length of the supported strings. +// This way we can test strings only against the formats that have a chance of working. +// NOTE: Formats use Luxon formats, documented here: https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens +var LENGTH_TO_DATE_FORMAT_MAP = (function () { + var ltdfMap = new Map(); + ltdfMap.set(4, 'yyyy'); + ltdfMap.set(7, 'yyyy-MM'); + ltdfMap.set(10, 'yyyy-MM-dd'); + return ltdfMap; +})(); +var LENGTH_TO_DATETIME_FORMATS_MAP = (function () { + var formats = { + yyyy: '2012', + 'yyyy-MM': '2012-01', + 'yyyy-MM-dd': '2012-01-31', + "yyyy-MM-dd'T''Z'": '2012-01-31TZ', + "yyyy-MM-dd'T'ZZ": '2012-01-31T-04:00', + "yyyy-MM-dd'T'HH": '2012-01-31T12', + "yyyy-MM-dd'T'HH'Z'": '2012-01-31T12Z', + "yyyy-MM-dd'T'HHZZ": '2012-01-31T12-04:00', + "yyyy-MM-dd'T'HH:mm": '2012-01-31T12:30', + "yyyy-MM-dd'T'HH:mm'Z'": '2012-01-31T12:30Z', + "yyyy-MM-dd'T'HH:mmZZ": '2012-01-31T12:30-04:00', + "yyyy-MM-dd'T'HH:mm:ss": '2012-01-31T12:30:59', + "yyyy-MM-dd'T'HH:mm:ss'Z'": '2012-01-31T12:30:59Z', + "yyyy-MM-dd'T'HH:mm:ssZZ": '2012-01-31T12:30:59-04:00', + "yyyy-MM-dd'T'HH:mm:ss.SSS": '2012-01-31T12:30:59.000', + "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'": '2012-01-31T12:30:59.000Z', + "yyyy-MM-dd'T'HH:mm:ss.SSSZZ": '2012-01-31T12:30:59.000-04:00' + }; + var ltdtfMap = new Map(); + Object.keys(formats).forEach(function (k) { + var example = formats[k]; + if (!ltdtfMap.has(example.length)) { + ltdtfMap.set(example.length, [k]); + } + else { + ltdtfMap.get(example.length).push(k); + } + }); + return ltdtfMap; +})(); +function wholeLuxonDuration(duration, unit) { + var value = duration.get(unit); + return value >= 0 ? Math.floor(value) : Math.ceil(value); +} +function truncateLuxonDateTime(luxonDT, unit) { + // Truncating by week (to the previous Sunday) requires different logic than the rest + if (unit === DateTime.Unit.WEEK) { + // Sunday is ISO weekday 7 + if (luxonDT.weekday !== 7) { + luxonDT = luxonDT.set({ weekday: 7 }).minus({ weeks: 1 }); + } + unit = DateTime.Unit.DAY; } - }]); - - return Code; -}(); - -var Concept = /*#__PURE__*/function () { - function Concept(codes, display) { - _classCallCheck(this, Concept); - - this.codes = codes || []; - this.display = display; - } - - _createClass(Concept, [{ - key: "isConcept", - get: function get() { - return true; - } - }, { - key: "hasMatch", - value: function hasMatch(code) { - return codesInList(toCodeList(code), this.codes); - } - }]); - - return Concept; -}(); - -var ValueSet = /*#__PURE__*/function () { - function ValueSet(oid, version, codes) { - _classCallCheck(this, ValueSet); - - this.oid = oid; - this.version = version; - this.codes = codes || []; - } - - _createClass(ValueSet, [{ - key: "isValueSet", - get: function get() { - return true; - } - }, { - key: "hasMatch", - value: function hasMatch(code) { - var codesList = toCodeList(code); // InValueSet String Overload - - if (codesList.length === 1 && typeof codesList[0] === 'string') { - var matchFound = false; - var multipleCodeSystemsExist = false; - - var _iterator = _createForOfIteratorHelper(this.codes), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var codeItem = _step.value; - - // Confirm all code systems match - if (codeItem.system !== this.codes[0].system) { - multipleCodeSystemsExist = true; - } - - if (codeItem.code === codesList[0]) { - matchFound = true; + return luxonDT.startOf(unit); +} +/* + * Base class for Date and DateTime to extend from + * Implements shared functions by both classes + * TODO: we can probably iterate on this more to improve the accessing of "FIELDS" and the overall structure + * TODO: we can also investigate if it's reasonable for DateTime to extend Date directly instead + */ +var AbstractDate = /** @class */ (function () { + function AbstractDate(year, month, day) { + if (year === void 0) { year = null; } + if (month === void 0) { month = null; } + if (day === void 0) { day = null; } + this.year = year; + this.month = month; + this.day = day; + } + // Shared functions + AbstractDate.prototype.isPrecise = function () { + var _this = this; + // @ts-ignore + return this.constructor.FIELDS.every(function (field) { return _this[field] != null; }); + }; + AbstractDate.prototype.isImprecise = function () { + return !this.isPrecise(); + }; + AbstractDate.prototype.isMorePrecise = function (other) { + // @ts-ignore + if (typeof other === 'string' && this.constructor.FIELDS.includes(other)) { + // @ts-ignore + if (this[other] == null) { + return false; } - - if (multipleCodeSystemsExist && matchFound) { - throw new Error('In (valueset) is ambiguous -- multiple codes with multiple code systems exist in value set.'); + } + else { + // @ts-ignore + for (var _i = 0, _a = this.constructor.FIELDS; _i < _a.length; _i++) { + var field = _a[_i]; + // @ts-ignore + if (other[field] != null && this[field] == null) { + return false; + } } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); } - - return matchFound; - } else { - return codesInList(codesList, this.codes); - } - } - }]); - - return ValueSet; -}(); - -function toCodeList(c) { - if (c == null) { - return []; - } else if (typeIsArray(c)) { - var list = []; - - var _iterator2 = _createForOfIteratorHelper(c), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var c2 = _step2.value; - list = list.concat(toCodeList(c2)); - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - - return list; - } else if (typeIsArray(c.codes)) { - return c.codes; - } else { - return [c]; - } -} - -function codesInList(cl1, cl2) { - // test each code in c1 against each code in c2 looking for a match - return cl1.some(function (c1) { - return cl2.some(function (c2) { - // only the left argument (cl1) can contain strings. cl2 will only contain codes. - if (typeof c1 === 'string') { - // for "string in codesystem" this should compare the string to - // the code's "code" field according to the specification. - return c1 === c2.code; - } else { - return codesMatch(c1, c2); - } - }); - }); -} - -function codesMatch(code1, code2) { - return code1.code === code2.code && code1.system === code2.system; -} - -var CodeSystem = function CodeSystem(id, version) { - _classCallCheck(this, CodeSystem); - - this.id = id; - this.version = version; -}; - -module.exports = { - Code: Code, - Concept: Concept, - ValueSet: ValueSet, - CodeSystem: CodeSystem -}; -},{"../util/util":50}],6:[function(require,module,exports){ -"use strict"; - -var logic = require('./logic'); - -var clinical = require('./clinical'); - -var uncertainty = require('./uncertainty'); - -var datetime = require('./datetime'); - -var interval = require('./interval'); - -var quantity = require('./quantity'); - -var ratio = require('./ratio'); - -var libs = [logic, clinical, uncertainty, datetime, interval, quantity, ratio]; - -for (var _i = 0, _libs = libs; _i < _libs.length; _i++) { - var lib = _libs[_i]; - - for (var _i2 = 0, _Object$keys = Object.keys(lib); _i2 < _Object$keys.length; _i2++) { - var element = _Object$keys[_i2]; - module.exports[element] = lib[element]; - } -} -},{"./clinical":5,"./datetime":7,"./interval":9,"./logic":10,"./quantity":11,"./ratio":12,"./uncertainty":13}],7:[function(require,module,exports){ -"use strict"; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('./uncertainty'), - Uncertainty = _require.Uncertainty; - -var _require2 = require('../util/util'), - jsDate = _require2.jsDate, - normalizeMillisecondsField = _require2.normalizeMillisecondsField, - normalizeMillisecondsFieldInString = _require2.normalizeMillisecondsFieldInString; - -var luxon = require('luxon'); // It's easiest and most performant to organize formats by length of the supported strings. -// This way we can test strings only against the formats that have a chance of working. -// NOTE: Formats use Luxon formats, documented here: https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens - - -var LENGTH_TO_DATE_FORMAT_MAP = function () { - var ltdfMap = new Map(); - ltdfMap.set(4, 'yyyy'); - ltdfMap.set(7, 'yyyy-MM'); - ltdfMap.set(10, 'yyyy-MM-dd'); - return ltdfMap; -}(); - -var LENGTH_TO_DATETIME_FORMATS_MAP = function () { - var formats = { - yyyy: '2012', - 'yyyy-MM': '2012-01', - 'yyyy-MM-dd': '2012-01-31', - "yyyy-MM-dd'T''Z'": '2012-01-31TZ', - "yyyy-MM-dd'T'ZZ": '2012-01-31T-04:00', - "yyyy-MM-dd'T'HH": '2012-01-31T12', - "yyyy-MM-dd'T'HH'Z'": '2012-01-31T12Z', - "yyyy-MM-dd'T'HHZZ": '2012-01-31T12-04:00', - "yyyy-MM-dd'T'HH:mm": '2012-01-31T12:30', - "yyyy-MM-dd'T'HH:mm'Z'": '2012-01-31T12:30Z', - "yyyy-MM-dd'T'HH:mmZZ": '2012-01-31T12:30-04:00', - "yyyy-MM-dd'T'HH:mm:ss": '2012-01-31T12:30:59', - "yyyy-MM-dd'T'HH:mm:ss'Z'": '2012-01-31T12:30:59Z', - "yyyy-MM-dd'T'HH:mm:ssZZ": '2012-01-31T12:30:59-04:00', - "yyyy-MM-dd'T'HH:mm:ss.SSS": '2012-01-31T12:30:59.000', - "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'": '2012-01-31T12:30:59.000Z', - "yyyy-MM-dd'T'HH:mm:ss.SSSZZ": '2012-01-31T12:30:59.000-04:00' - }; - var ltdtfMap = new Map(); - Object.keys(formats).forEach(function (k) { - var example = formats[k]; - - if (!ltdtfMap.has(example.length)) { - ltdtfMap.set(example.length, [k]); - } else { - ltdtfMap.get(example.length).push(k); - } - }); - return ltdtfMap; -}(); - -function wholeLuxonDuration(duration, unit) { - var value = duration.get(unit); - return value >= 0 ? Math.floor(value) : Math.ceil(value); -} - -function truncateLuxonDateTime(luxonDT, unit) { - // Truncating by week (to the previous Sunday) requires different logic than the rest - if (unit === DateTime.Unit.WEEK) { - // Sunday is ISO weekday 7 - if (luxonDT.weekday !== 7) { - luxonDT = luxonDT.set({ - weekday: 7 - }).minus({ - weeks: 1 - }); - } - - unit = DateTime.Unit.DAY; - } - - return luxonDT.startOf(unit); -} - -var DateTime = /*#__PURE__*/function () { - function DateTime() { - var year = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var month = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - var day = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - var hour = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; - var minute = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; - var second = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null; - var millisecond = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null; - var timezoneOffset = arguments.length > 7 ? arguments[7] : undefined; - - _classCallCheck(this, DateTime); - - // from the spec: If no timezone is specified, the timezone of the evaluation request timestamp is used. - // NOTE: timezoneOffset will be explicitly null for the Time overload, whereas - // it will be undefined if simply unspecified - this.year = year; - this.month = month; - this.day = day; - this.hour = hour; - this.minute = minute; - this.second = second; - this.millisecond = millisecond; - this.timezoneOffset = timezoneOffset; - - if (this.timezoneOffset === undefined) { - this.timezoneOffset = new jsDate().getTimezoneOffset() / 60 * -1; - } - } - - _createClass(DateTime, [{ - key: "isDateTime", - get: function get() { - return true; - } - }, { - key: "copy", - value: function copy() { - return new DateTime(this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond, this.timezoneOffset); - } - }, { - key: "successor", - value: function successor() { - if (this.millisecond != null) { - return this.add(1, DateTime.Unit.MILLISECOND); - } else if (this.second != null) { - return this.add(1, DateTime.Unit.SECOND); - } else if (this.minute != null) { - return this.add(1, DateTime.Unit.MINUTE); - } else if (this.hour != null) { - return this.add(1, DateTime.Unit.HOUR); - } else if (this.day != null) { - return this.add(1, DateTime.Unit.DAY); - } else if (this.month != null) { - return this.add(1, DateTime.Unit.MONTH); - } else if (this.year != null) { - return this.add(1, DateTime.Unit.YEAR); - } - } - }, { - key: "predecessor", - value: function predecessor() { - if (this.millisecond != null) { - return this.add(-1, DateTime.Unit.MILLISECOND); - } else if (this.second != null) { - return this.add(-1, DateTime.Unit.SECOND); - } else if (this.minute != null) { - return this.add(-1, DateTime.Unit.MINUTE); - } else if (this.hour != null) { - return this.add(-1, DateTime.Unit.HOUR); - } else if (this.day != null) { - return this.add(-1, DateTime.Unit.DAY); - } else if (this.month != null) { - return this.add(-1, DateTime.Unit.MONTH); - } else if (this.year != null) { - return this.add(-1, DateTime.Unit.YEAR); - } - } - }, { - key: "convertToTimezoneOffset", - value: function convertToTimezoneOffset() { - var timezoneOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - var shiftedLuxonDT = this.toLuxonDateTime().setZone(luxon.FixedOffsetZone.instance(timezoneOffset * 60)); - var shiftedDT = DateTime.fromLuxonDateTime(shiftedLuxonDT); - return shiftedDT.reducedPrecision(this.getPrecision()); - } - }, { - key: "differenceBetween", - value: function differenceBetween(other, unitField) { - other = this._implicitlyConvert(other); - - if (other == null || !other.isDateTime) { - return null; - } // According to CQL spec: - // * "Difference calculations are performed by truncating the datetime values at the next precision, - // and then performing the corresponding duration calculation on the truncated values." - // * "When difference is calculated for hours or finer units, timezone offsets should be normalized - // prior to truncation to correctly consider real (actual elapsed) time. When difference is calculated - // for days or coarser units, however, the time components (including timezone offset) should be truncated - // without normalization to correctly reflect the difference in calendar days, months, and years." - - - var a = this.toLuxonUncertainty(); - var b = other.toLuxonUncertainty(); // If unit is days or above, reset all the DateTimes to UTC since TZ offset should not be considered; - // Otherwise, we don't actually have to "normalize" to a common TZ because Luxon takes TZ into account. - - if ([DateTime.Unit.YEAR, DateTime.Unit.MONTH, DateTime.Unit.WEEK, DateTime.Unit.DAY].includes(unitField)) { - a.low = a.low.toUTC(0, { - keepLocalTime: true - }); - a.high = a.high.toUTC(0, { - keepLocalTime: true - }); - b.low = b.low.toUTC(0, { - keepLocalTime: true - }); - b.high = b.high.toUTC(0, { - keepLocalTime: true - }); - } // Truncate all dates at precision below specified unit - - - a.low = truncateLuxonDateTime(a.low, unitField); - a.high = truncateLuxonDateTime(a.high, unitField); - b.low = truncateLuxonDateTime(b.low, unitField); - b.high = truncateLuxonDateTime(b.high, unitField); // Return the duration based on the normalize and truncated values - - return new Uncertainty(wholeLuxonDuration(b.low.diff(a.high, unitField), unitField), wholeLuxonDuration(b.high.diff(a.low, unitField), unitField)); - } - }, { - key: "durationBetween", - value: function durationBetween(other, unitField) { - other = this._implicitlyConvert(other); - - if (other == null || !other.isDateTime) { - return null; - } - - var a = this.toLuxonUncertainty(); - var b = other.toLuxonUncertainty(); - return new Uncertainty(wholeLuxonDuration(b.low.diff(a.high, unitField), unitField), wholeLuxonDuration(b.high.diff(a.low, unitField), unitField)); - } - }, { - key: "isUTC", - value: function isUTC() { - // A timezoneOffset of 0 indicates UTC time. - return !this.timezoneOffset; - } - }, { - key: "getPrecision", - value: function getPrecision() { - var result = null; - - if (this.year != null) { - result = DateTime.Unit.YEAR; - } else { - return result; - } - - if (this.month != null) { - result = DateTime.Unit.MONTH; - } else { - return result; - } - - if (this.day != null) { - result = DateTime.Unit.DAY; - } else { - return result; - } - - if (this.hour != null) { - result = DateTime.Unit.HOUR; - } else { - return result; - } - - if (this.minute != null) { - result = DateTime.Unit.MINUTE; - } else { - return result; - } - - if (this.second != null) { - result = DateTime.Unit.SECOND; - } else { - return result; - } - - if (this.millisecond != null) { - result = DateTime.Unit.MILLISECOND; - } - - return result; - } - }, { - key: "getPrecisionValue", - value: function getPrecisionValue() { - return this.isTime() ? TIME_PRECISION_VALUE_MAP.get(this.getPrecision()) : DATETIME_PRECISION_VALUE_MAP.get(this.getPrecision()); - } - }, { - key: "toLuxonDateTime", - value: function toLuxonDateTime() { - var offsetMins = this.timezoneOffset != null ? this.timezoneOffset * 60 : new jsDate().getTimezoneOffset() * -1; - return luxon.DateTime.fromObject({ - year: this.year, - month: this.month, - day: this.day, - hour: this.hour, - minute: this.minute, - second: this.second, - millisecond: this.millisecond, - zone: luxon.FixedOffsetZone.instance(offsetMins) - }); - } - }, { - key: "toLuxonUncertainty", - value: function toLuxonUncertainty() { - var low = this.toLuxonDateTime(); - var high = low.endOf(this.getPrecision()); - return new Uncertainty(low, high); - } - }, { - key: "toJSDate", - value: function toJSDate() { - var ignoreTimezone = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - var luxonDT = this.toLuxonDateTime(); // I don't know if anyone is using "ignoreTimezone" anymore (we aren't), but just in case - - if (ignoreTimezone) { - var offset = new jsDate().getTimezoneOffset() * -1; - luxonDT = luxonDT.setZone(luxon.FixedOffsetZone.instance(offset), { - keepLocalTime: true - }); - } - - return luxonDT.toJSDate(); - } - }, { - key: "toJSON", - value: function toJSON() { - return this.toString(); - } - }, { - key: "_pad", - value: function _pad(num) { - return String('0' + num).slice(-2); - } - }, { - key: "toString", - value: function toString() { - if (this.isTime()) { - return this.toStringTime(); - } else { - return this.toStringDateTime(); - } - } - }, { - key: "toStringTime", - value: function toStringTime() { - var str = ''; - - if (this.hour != null) { - str += this._pad(this.hour); - - if (this.minute != null) { - str += ':' + this._pad(this.minute); - - if (this.second != null) { - str += ':' + this._pad(this.second); - - if (this.millisecond != null) { - str += '.' + String('00' + this.millisecond).slice(-3); + return !this.isSamePrecision(other); + }; + // This function can take another Date-ish object, or a precision string (e.g. 'month') + AbstractDate.prototype.isLessPrecise = function (other) { + return !this.isSamePrecision(other) && !this.isMorePrecise(other); + }; + // This function can take another Date-ish object, or a precision string (e.g. 'month') + AbstractDate.prototype.isSamePrecision = function (other) { + // @ts-ignore + if (typeof other === 'string' && this.constructor.FIELDS.includes(other)) { + return other === this.getPrecision(); + } + // @ts-ignore + for (var _i = 0, _a = this.constructor.FIELDS; _i < _a.length; _i++) { + var field = _a[_i]; + // @ts-ignore + if (this[field] != null && other[field] == null) { + return false; + } + // @ts-ignore + if (this[field] == null && other[field] != null) { + return false; } - } } - } - - return str; - } - }, { - key: "toStringDateTime", - value: function toStringDateTime() { - var str = ''; - - if (this.year != null) { - str += this.year; - - if (this.month != null) { - str += '-' + this._pad(this.month); - - if (this.day != null) { - str += '-' + this._pad(this.day); - - if (this.hour != null) { - str += 'T' + this._pad(this.hour); - - if (this.minute != null) { - str += ':' + this._pad(this.minute); - - if (this.second != null) { - str += ':' + this._pad(this.second); - - if (this.millisecond != null) { - str += '.' + String('00' + this.millisecond).slice(-3); - } + return true; + }; + AbstractDate.prototype.equals = function (other) { + return compareWithDefaultResult(this, other, null); + }; + AbstractDate.prototype.equivalent = function (other) { + return compareWithDefaultResult(this, other, false); + }; + AbstractDate.prototype.sameAs = function (other, precision) { + if (!(other.isDate || other.isDateTime)) { + return null; + } + else if (this.isDate && other.isDateTime) { + return this.getDateTime().sameAs(other, precision); + } + else if (this.isDateTime && other.isDate) { + other = other.getDateTime(); + } + // @ts-ignore + if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { + throw new Error("Invalid precision: ".concat(precision)); + } + // make a copy of other in the correct timezone offset if they don't match. + if (this.timezoneOffset !== other.timezoneOffset) { + other = other.convertToTimezoneOffset(this.timezoneOffset); + } + // @ts-ignore + for (var _i = 0, _a = this.constructor.FIELDS; _i < _a.length; _i++) { + var field = _a[_i]; + // if both have this precision defined + // @ts-ignore + if (this[field] != null && other[field] != null) { + // if they are different then return with false + // @ts-ignore + if (this[field] !== other[field]) { + return false; } - } + // if both dont have this precision, return true of precision is not defined + // @ts-ignore + } + else if (this[field] == null && other[field] == null) { + if (precision == null) { + return true; + } + else { + // we havent met precision yet + return null; + } + // otherwise they have inconclusive precision, return null + } + else { + return null; + } + // if precision is defined and we have reached expected precision, we can leave the loop + if (precision != null && precision === field) { + break; } - } } - } - - if (str.indexOf('T') !== -1 && this.timezoneOffset != null) { - str += this.timezoneOffset < 0 ? '-' : '+'; - var offsetHours = Math.floor(Math.abs(this.timezoneOffset)); - str += this._pad(offsetHours); - var offsetMin = (Math.abs(this.timezoneOffset) - offsetHours) * 60; - str += ':' + this._pad(offsetMin); - } - - return str; - } - }, { - key: "getDateTime", - value: function getDateTime() { - return this; - } - }, { - key: "getDate", - value: function getDate() { - return new Date(this.year, this.month, this.day); - } - }, { - key: "getTime", - value: function getTime() { - // Times no longer have timezoneOffets, so we must explicitly set it to null - return new DateTime(0, 1, 1, this.hour, this.minute, this.second, this.millisecond, null); - } - }, { - key: "isTime", - value: function isTime() { - return this.year === 0 && this.month === 1 && this.day === 1; - } - }, { - key: "_implicitlyConvert", - value: function _implicitlyConvert(other) { - if (other != null && other.isDate) { - return other.getDateTime(); - } - - return other; - } - }, { - key: "reducedPrecision", - value: function reducedPrecision() { - var unitField = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DateTime.Unit.MILLISECOND; - var reduced = this.copy(); - - if (unitField !== DateTime.Unit.MILLISECOND) { - var fieldIndex = DateTime.FIELDS.indexOf(unitField); - var fieldsToRemove = DateTime.FIELDS.slice(fieldIndex + 1); - - var _iterator = _createForOfIteratorHelper(fieldsToRemove), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var field = _step.value; - reduced[field] = null; - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); + // if we made it here, then all fields matched. + return true; + }; + AbstractDate.prototype.sameOrBefore = function (other, precision) { + if (!(other.isDate || other.isDateTime)) { + return null; } - } - - return reduced; - } - }], [{ - key: "parse", - value: function parse(string) { - if (string === null) { - return null; - } - - var matches = /(\d{4})(-(\d{2}))?(-(\d{2}))?(T((\d{2})(:(\d{2})(:(\d{2})(\.(\d+))?)?)?)?(Z|(([+-])(\d{2})(:?(\d{2}))?))?)?/.exec(string); - - if (matches == null) { - return null; - } - - var years = matches[1]; - var months = matches[3]; - var days = matches[5]; - var hours = matches[8]; - var minutes = matches[10]; - var seconds = matches[12]; - var milliseconds = matches[14]; - - if (milliseconds != null) { - milliseconds = normalizeMillisecondsField(milliseconds); - } - - if (milliseconds != null) { - string = normalizeMillisecondsFieldInString(string, matches[14]); - } - - if (!isValidDateTimeStringFormat(string)) { - return null; - } // convert the args to integers - - - var args = [years, months, days, hours, minutes, seconds, milliseconds].map(function (arg) { - return arg != null ? parseInt(arg) : arg; - }); // convert timezone offset to decimal and add it to arguments - - if (matches[18] != null) { - var num = parseInt(matches[18]) + (matches[20] != null ? parseInt(matches[20]) / 60 : 0); - args.push(matches[17] === '+' ? num : num * -1); - } else if (matches[15] === 'Z') { - args.push(0); - } - - return _construct(DateTime, _toConsumableArray(args)); - } - }, { - key: "fromJSDate", - value: function fromJSDate(date, timezoneOffset) { - //This is from a JS Date, not a CQL Date - if (date instanceof DateTime) { - return date; - } - - if (timezoneOffset != null) { - date = new jsDate(date.getTime() + timezoneOffset * 60 * 60 * 1000); - return new DateTime(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds(), timezoneOffset); - } else { - return new DateTime(date.getFullYear(), date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()); - } - } - }, { - key: "fromLuxonDateTime", - value: function fromLuxonDateTime(luxonDT) { - if (luxonDT instanceof DateTime) { - return luxonDT; - } - - return new DateTime(luxonDT.year, luxonDT.month, luxonDT.day, luxonDT.hour, luxonDT.minute, luxonDT.second, luxonDT.millisecond, luxonDT.offset / 60); - } - }]); - - return DateTime; -}(); - -DateTime.Unit = { - YEAR: 'year', - MONTH: 'month', - WEEK: 'week', - DAY: 'day', - HOUR: 'hour', - MINUTE: 'minute', - SECOND: 'second', - MILLISECOND: 'millisecond' -}; -DateTime.FIELDS = [DateTime.Unit.YEAR, DateTime.Unit.MONTH, DateTime.Unit.DAY, DateTime.Unit.HOUR, DateTime.Unit.MINUTE, DateTime.Unit.SECOND, DateTime.Unit.MILLISECOND]; - -var Date = /*#__PURE__*/function () { - function Date() { - var year = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var month = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - var day = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - - _classCallCheck(this, Date); - - this.year = year; - this.month = month; - this.day = day; - } - - _createClass(Date, [{ - key: "isDate", - get: function get() { - return true; - } - }, { - key: "copy", - value: function copy() { - return new Date(this.year, this.month, this.day); - } - }, { - key: "successor", - value: function successor() { - if (this.day != null) { - return this.add(1, Date.Unit.DAY); - } else if (this.month != null) { - return this.add(1, Date.Unit.MONTH); - } else if (this.year != null) { - return this.add(1, Date.Unit.YEAR); - } - } - }, { - key: "predecessor", - value: function predecessor() { - if (this.day != null) { - return this.add(-1, Date.Unit.DAY); - } else if (this.month != null) { - return this.add(-1, Date.Unit.MONTH); - } else if (this.year != null) { - return this.add(-1, Date.Unit.YEAR); - } - } - }, { - key: "differenceBetween", - value: function differenceBetween(other, unitField) { - if (other != null && other.isDateTime) { - return this.getDateTime().differenceBetween(other, unitField); - } - - if (other == null || !other.isDate) { - return null; - } // According to CQL spec: - // * "Difference calculations are performed by truncating the datetime values at the next precision, - // and then performing the corresponding duration calculation on the truncated values." - - - var a = this.toLuxonUncertainty(); - var b = other.toLuxonUncertainty(); // Truncate all dates at precision below specified unit - - a.low = truncateLuxonDateTime(a.low, unitField); - a.high = truncateLuxonDateTime(a.high, unitField); - b.low = truncateLuxonDateTime(b.low, unitField); - b.high = truncateLuxonDateTime(b.high, unitField); // Return the duration based on the normalize and truncated values - - return new Uncertainty(wholeLuxonDuration(b.low.diff(a.high, unitField), unitField), wholeLuxonDuration(b.high.diff(a.low, unitField), unitField)); - } - }, { - key: "durationBetween", - value: function durationBetween(other, unitField) { - if (other != null && other.isDateTime) { - return this.getDateTime().durationBetween(other, unitField); - } - - if (other == null || !other.isDate) { - return null; - } - - var a = this.toLuxonUncertainty(); - var b = other.toLuxonUncertainty(); - return new Uncertainty(wholeLuxonDuration(b.low.diff(a.high, unitField), unitField), wholeLuxonDuration(b.high.diff(a.low, unitField), unitField)); - } - }, { - key: "getPrecision", - value: function getPrecision() { - var result = null; - - if (this.year != null) { - result = Date.Unit.YEAR; - } else { - return result; - } - - if (this.month != null) { - result = Date.Unit.MONTH; - } else { - return result; - } - - if (this.day != null) { - result = Date.Unit.DAY; - } else { - return result; - } - - return result; - } - }, { - key: "getPrecisionValue", - value: function getPrecisionValue() { - return DATETIME_PRECISION_VALUE_MAP.get(this.getPrecision()); - } - }, { - key: "toLuxonDateTime", - value: function toLuxonDateTime() { - return luxon.DateTime.fromObject({ - year: this.year, - month: this.month, - day: this.day, - zone: luxon.FixedOffsetZone.utcInstance - }); - } - }, { - key: "toLuxonUncertainty", - value: function toLuxonUncertainty() { - var low = this.toLuxonDateTime(); - var high = low.endOf(this.getPrecision()).startOf('day'); // Date type is always at T00:00:00.0 - - return new Uncertainty(low, high); - } - }, { - key: "toJSDate", - value: function toJSDate() { - var _ref = [this.year, this.month != null ? this.month - 1 : 0, this.day != null ? this.day : 1], - y = _ref[0], - mo = _ref[1], - d = _ref[2]; - return new jsDate(y, mo, d); - } - }, { - key: "toJSON", - value: function toJSON() { - return this.toString(); - } - }, { - key: "toString", - value: function toString() { - var str = ''; - - if (this.year != null) { - str += this.year.toString(); - - if (this.month != null) { - str += '-' + this.month.toString().padStart(2, '0'); - - if (this.day != null) { - str += '-' + this.day.toString().padStart(2, '0'); - } + else if (this.isDate && other.isDateTime) { + return this.getDateTime().sameOrBefore(other, precision); } - } - - return str; - } - }, { - key: "getDateTime", - value: function getDateTime() { - // from the spec: the result will be a DateTime with the time components set to zero, - // except for the timezone offset, which will be set to the timezone offset of the evaluation - // request timestamp. (this last part is acheived by just not passing in timezone offset) - if (this.year != null && this.month != null && this.day != null) { - return new DateTime(this.year, this.month, this.day, 0, 0, 0, 0); // from spec: no component may be specified at a precision below an unspecified precision. - // For example, hour may be null, but if it is, minute, second, and millisecond must all be null as well. - } else { - return new DateTime(this.year, this.month, this.day); - } - } - }, { - key: "reducedPrecision", - value: function reducedPrecision() { - var unitField = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Date.Unit.DAY; - var reduced = this.copy(); - - if (unitField !== Date.Unit.DAY) { - var fieldIndex = Date.FIELDS.indexOf(unitField); - var fieldsToRemove = Date.FIELDS.slice(fieldIndex + 1); - - var _iterator2 = _createForOfIteratorHelper(fieldsToRemove), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var field = _step2.value; - reduced[field] = null; - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); + else if (this.isDateTime && other.isDate) { + other = other.getDateTime(); } - } - - return reduced; - } - }], [{ - key: "parse", - value: function parse(string) { - if (string === null) { - return null; - } - - var matches = /(\d{4})(-(\d{2}))?(-(\d{2}))?/.exec(string); - - if (matches == null) { - return null; - } - - var years = matches[1]; - var months = matches[3]; - var days = matches[5]; - - if (!isValidDateStringFormat(string)) { - return null; - } // convert args to integers - - - var args = [years, months, days].map(function (arg) { - return arg != null ? parseInt(arg) : arg; - }); - return _construct(Date, _toConsumableArray(args)); - } - }, { - key: "fromJSDate", - value: function fromJSDate(date) { - if (date instanceof Date) { - return date; - } - - return new Date(date.getFullYear(), date.getMonth() + 1, date.getDate()); - } - }, { - key: "fromLuxonDateTime", - value: function fromLuxonDateTime(luxonDT) { - if (luxonDT instanceof Date) { - return luxonDT; - } - - return new Date(luxonDT.year, luxonDT.month, luxonDT.day); - } - }]); - - return Date; -}(); - -var MIN_DATETIME_VALUE = DateTime.parse('0001-01-01T00:00:00.000'); -var MAX_DATETIME_VALUE = DateTime.parse('9999-12-31T23:59:59.999'); -var MIN_DATE_VALUE = Date.parse('0001-01-01'); -var MAX_DATE_VALUE = Date.parse('9999-12-31'); -var MIN_TIME_VALUE = DateTime.parse('0000-01-01T00:00:00.000').getTime(); -var MAX_TIME_VALUE = DateTime.parse('0000-01-01T23:59:59.999').getTime(); -Date.Unit = { - YEAR: 'year', - MONTH: 'month', - WEEK: 'week', - DAY: 'day' -}; -Date.FIELDS = [Date.Unit.YEAR, Date.Unit.MONTH, Date.Unit.DAY]; - -var DATETIME_PRECISION_VALUE_MAP = function () { - var dtpvMap = new Map(); - dtpvMap.set(DateTime.Unit.YEAR, 4); - dtpvMap.set(DateTime.Unit.MONTH, 6); - dtpvMap.set(DateTime.Unit.DAY, 8); - dtpvMap.set(DateTime.Unit.HOUR, 10); - dtpvMap.set(DateTime.Unit.MINUTE, 12); - dtpvMap.set(DateTime.Unit.SECOND, 14); - dtpvMap.set(DateTime.Unit.MILLISECOND, 17); - return dtpvMap; -}(); - -var TIME_PRECISION_VALUE_MAP = function () { - var tpvMap = new Map(); - tpvMap.set(DateTime.Unit.HOUR, 2); - tpvMap.set(DateTime.Unit.MINUTE, 4); - tpvMap.set(DateTime.Unit.SECOND, 6); - tpvMap.set(DateTime.Unit.MILLISECOND, 9); - return tpvMap; -}(); // Shared Funtions For Date and DateTime - - -DateTime.prototype.isPrecise = Date.prototype.isPrecise = function () { - var _this = this; - - return this.constructor.FIELDS.every(function (field) { - return _this[field] != null; - }); -}; - -DateTime.prototype.isImprecise = Date.prototype.isImprecise = function () { - return !this.isPrecise(); -}; // This function can take another Date-ish object, or a precision string (e.g. 'month') - - -DateTime.prototype.isMorePrecise = Date.prototype.isMorePrecise = function (other) { - if (typeof other === 'string' && this.constructor.FIELDS.includes(other)) { - if (this[other] == null) { - return false; - } - } else { - var _iterator3 = _createForOfIteratorHelper(this.constructor.FIELDS), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var field = _step3.value; - - if (other[field] != null && this[field] == null) { - return false; + // @ts-ignore + if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { + throw new Error("Invalid precision: ".concat(precision)); } - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - } - - return !this.isSamePrecision(other); -}; // This function can take another Date-ish object, or a precision string (e.g. 'month') - - -DateTime.prototype.isLessPrecise = Date.prototype.isLessPrecise = function (other) { - return !this.isSamePrecision(other) && !this.isMorePrecise(other); -}; // This function can take another Date-ish object, or a precision string (e.g. 'month') - - -DateTime.prototype.isSamePrecision = Date.prototype.isSamePrecision = function (other) { - if (typeof other === 'string' && this.constructor.FIELDS.includes(other)) { - return other === this.getPrecision(); - } - - var _iterator4 = _createForOfIteratorHelper(this.constructor.FIELDS), - _step4; - - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { - var field = _step4.value; - - if (this[field] != null && other[field] == null) { - return false; - } - - if (this[field] == null && other[field] != null) { - return false; - } - } - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - - return true; -}; - -DateTime.prototype.equals = Date.prototype.equals = function (other) { - return compareWithDefaultResult(this, other, null); -}; - -DateTime.prototype.equivalent = Date.prototype.equivalent = function (other) { - return compareWithDefaultResult(this, other, false); -}; - -DateTime.prototype.sameAs = Date.prototype.sameAs = function (other, precision) { - if (!(other.isDate || other.isDateTime)) { - return null; - } else if (this.isDate && other.isDateTime) { - return this.getDateTime().sameAs(other, precision); - } else if (this.isDateTime && other.isDate) { - other = other.getDateTime(); - } - - if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { - throw new Error("Invalid precision: ".concat(precision)); - } // make a copy of other in the correct timezone offset if they don't match. - - - if (this.timezoneOffset !== other.timezoneOffset) { - other = other.convertToTimezoneOffset(this.timezoneOffset); - } - - var _iterator5 = _createForOfIteratorHelper(this.constructor.FIELDS), - _step5; - - try { - for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { - var field = _step5.value; - - // if both have this precision defined - if (this[field] != null && other[field] != null) { - // if they are different then return with false - if (this[field] !== other[field]) { - return false; - } // if both dont have this precision, return true of precision is not defined - - } else if (this[field] == null && other[field] == null) { - if (precision == null) { - return true; - } else { - // we havent met precision yet - return null; - } // otherwise they have inconclusive precision, return null - - } else { - return null; - } // if precision is defined and we have reached expected precision, we can leave the loop - - - if (precision != null && precision === field) { - break; - } - } // if we made it here, then all fields matched. - - } catch (err) { - _iterator5.e(err); - } finally { - _iterator5.f(); - } - - return true; -}; - -DateTime.prototype.sameOrBefore = Date.prototype.sameOrBefore = function (other, precision) { - if (!(other.isDate || other.isDateTime)) { - return null; - } else if (this.isDate && other.isDateTime) { - return this.getDateTime().sameOrBefore(other, precision); - } else if (this.isDateTime && other.isDate) { - other = other.getDateTime(); - } - - if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { - throw new Error("Invalid precision: ".concat(precision)); - } // make a copy of other in the correct timezone offset if they don't match. - - - if (this.timezoneOffset !== other.timezoneOffset) { - other = other.convertToTimezoneOffset(this.timezoneOffset); - } - - var _iterator6 = _createForOfIteratorHelper(this.constructor.FIELDS), - _step6; - - try { - for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { - var field = _step6.value; - - // if both have this precision defined - if (this[field] != null && other[field] != null) { - // if this value is less than the other return with true. this is before other - if (this[field] < other[field]) { - return true; // if this value is greater than the other return with false. this is after - } else if (this[field] > other[field]) { - return false; - } // execution continues if the values are the same - // if both dont have this precision, return true if precision is not defined - - } else if (this[field] == null && other[field] == null) { - if (precision == null) { - return true; - } else { - // we havent met precision yet - return null; - } // otherwise they have inconclusive precision, return null - - } else { - return null; - } // if precision is defined and we have reached expected precision, we can leave the loop - - - if (precision != null && precision === field) { - break; - } - } // if we made it here, then all fields matched and they are same - - } catch (err) { - _iterator6.e(err); - } finally { - _iterator6.f(); - } - - return true; -}; - -DateTime.prototype.sameOrAfter = Date.prototype.sameOrAfter = function (other, precision) { - if (!(other.isDate || other.isDateTime)) { - return null; - } else if (this.isDate && other.isDateTime) { - return this.getDateTime().sameOrAfter(other, precision); - } else if (this.isDateTime && other.isDate) { - other = other.getDateTime(); - } - - if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { - throw new Error("Invalid precision: ".concat(precision)); - } // make a copy of other in the correct timezone offset if they don't match. - - - if (this.timezoneOffset !== other.timezoneOffset) { - other = other.convertToTimezoneOffset(this.timezoneOffset); - } - - var _iterator7 = _createForOfIteratorHelper(this.constructor.FIELDS), - _step7; - - try { - for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { - var field = _step7.value; - - // if both have this precision defined - if (this[field] != null && other[field] != null) { - // if this value is greater than the other return with true. this is after other - if (this[field] > other[field]) { - return true; // if this value is greater than the other return with false. this is before - } else if (this[field] < other[field]) { - return false; - } // execution continues if the values are the same - // if both dont have this precision, return true if precision is not defined - - } else if (this[field] == null && other[field] == null) { - if (precision == null) { - return true; - } else { - // we havent met precision yet - return null; - } // otherwise they have inconclusive precision, return null - - } else { - return null; - } // if precision is defined and we have reached expected precision, we can leave the loop - - - if (precision != null && precision === field) { - break; - } - } // if we made it here, then all fields matched and they are same - - } catch (err) { - _iterator7.e(err); - } finally { - _iterator7.f(); - } - - return true; -}; - -DateTime.prototype.before = Date.prototype.before = function (other, precision) { - if (!(other.isDate || other.isDateTime)) { - return null; - } else if (this.isDate && other.isDateTime) { - return this.getDateTime().before(other, precision); - } else if (this.isDateTime && other.isDate) { - other = other.getDateTime(); - } - - if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { - throw new Error("Invalid precision: ".concat(precision)); - } // make a copy of other in the correct timezone offset if they don't match. - - - if (this.timezoneOffset !== other.timezoneOffset) { - other = other.convertToTimezoneOffset(this.timezoneOffset); - } - - var _iterator8 = _createForOfIteratorHelper(this.constructor.FIELDS), - _step8; - - try { - for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { - var field = _step8.value; - - // if both have this precision defined - if (this[field] != null && other[field] != null) { - // if this value is less than the other return with true. this is before other - if (this[field] < other[field]) { - return true; // if this value is greater than the other return with false. this is after - } else if (this[field] > other[field]) { - return false; - } // execution continues if the values are the same - // if both dont have this precision, return false if precision is not defined - - } else if (this[field] == null && other[field] == null) { - if (precision == null) { - return false; - } else { - // we havent met precision yet - return null; - } // otherwise they have inconclusive precision, return null - - } else { - return null; - } // if precision is defined and we have reached expected precision, we can leave the loop - - - if (precision != null && precision === field) { - break; - } - } // if we made it here, then all fields matched and they are same - - } catch (err) { - _iterator8.e(err); - } finally { - _iterator8.f(); - } - - return false; -}; - -DateTime.prototype.after = Date.prototype.after = function (other, precision) { - if (!(other.isDate || other.isDateTime)) { - return null; - } else if (this.isDate && other.isDateTime) { - return this.getDateTime().after(other, precision); - } else if (this.isDateTime && other.isDate) { - other = other.getDateTime(); - } - - if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { - throw new Error("Invalid precision: ".concat(precision)); - } // make a copy of other in the correct timezone offset if they don't match. - - - if (this.timezoneOffset !== other.timezoneOffset) { - other = other.convertToTimezoneOffset(this.timezoneOffset); - } - - var _iterator9 = _createForOfIteratorHelper(this.constructor.FIELDS), - _step9; - - try { - for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { - var field = _step9.value; - - // if both have this precision defined - if (this[field] != null && other[field] != null) { - // if this value is greater than the other return with true. this is after other - if (this[field] > other[field]) { - return true; // if this value is greater than the other return with false. this is before - } else if (this[field] < other[field]) { - return false; - } // execution continues if the values are the same - // if both dont have this precision, return false if precision is not defined - - } else if (this[field] == null && other[field] == null) { - if (precision == null) { - return false; - } else { - // we havent met precision yet - return null; - } // otherwise they have inconclusive precision, return null - - } else { - return null; - } // if precision is defined and we have reached expected precision, we can leave the loop - - - if (precision != null && precision === field) { - break; - } - } // if we made it here, then all fields matched and they are same - - } catch (err) { - _iterator9.e(err); - } finally { - _iterator9.f(); - } - - return false; -}; - -DateTime.prototype.add = Date.prototype.add = function (offset, field) { - if (offset === 0 || this.year == null) { - return this.copy(); - } // Use luxon to do the date math because it honors DST and it has the leap-year/end-of-month semantics we want. - // NOTE: The luxonDateTime will contain default values where this[unit] is null, but we'll account for that. - - - var luxonDateTime = this.toLuxonDateTime(); // From the spec: "The operation is performed by converting the time-based quantity to the most precise value - // specified in the date/time (truncating any resulting decimal portion) and then adding it to the date/time value." - // However, since you can't really convert days to months, if "this" is less precise than the field being added, we can - // add to the earliest possible value of "this" or subtract from the latest possible value of "this" (depending on the - // sign of the offset), and then null out the imprecise fields again after doing the calculation. Due to the way - // luxonDateTime is constructed above, it is already at the earliest value, so only adjust if the offset is negative. - - var offsetIsMorePrecise = this[field] == null; //whether the quantity we are adding is more precise than "this". - - if (offsetIsMorePrecise && offset < 0) { - luxonDateTime = luxonDateTime.endOf(this.getPrecision()); - } // Now do the actual math and convert it back to a Date/DateTime w/ originally null fields nulled out again - - - var luxonResult = luxonDateTime.plus(_defineProperty({}, field, offset)); - var result = this.constructor.fromLuxonDateTime(luxonResult).reducedPrecision(this.getPrecision()); // Luxon never has a null offset, but sometimes "this" does, so reset to null if applicable - - if (this.isDateTime && this.timezoneOffset == null) { - result.timezoneOffset = null; - } // Can't use overflowsOrUnderflows from math.js due to circular dependencies when we require it - - - if (result.after(MAX_DATETIME_VALUE || result.before(MIN_DATETIME_VALUE))) { - return null; - } else { - return result; - } -}; - -DateTime.prototype.getFieldFloor = Date.prototype.getFieldFloor = function (field) { - switch (field) { - case 'month': - return 1; - - case 'day': - return 1; - - case 'hour': - return 0; - - case 'minute': - return 0; - - case 'second': - return 0; - - case 'millisecond': - return 0; - - default: - throw new Error('Tried to floor a field that has no floor value: ' + field); - } -}; - -DateTime.prototype.getFieldCieling = Date.prototype.getFieldCieling = function (field) { - switch (field) { - case 'month': - return 12; - - case 'day': - return daysInMonth(this.year, this.month); - - case 'hour': - return 23; - - case 'minute': - return 59; - - case 'second': - return 59; - - case 'millisecond': - return 999; - - default: - throw new Error('Tried to clieling a field that has no cieling value: ' + field); - } -}; - -function compareWithDefaultResult(a, b, defaultResult) { - // return false there is a type mismatch - if ((!a.isDate || !b.isDate) && (!a.isDateTime || !b.isDateTime)) { - return false; - } // make a copy of other in the correct timezone offset if they don't match. - - - if (a.timezoneOffset !== b.timezoneOffset) { - b = b.convertToTimezoneOffset(a.timezoneOffset); - } - - var _iterator10 = _createForOfIteratorHelper(a.constructor.FIELDS), - _step10; - - try { - for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { - var field = _step10.value; - - // if both have this precision defined - if (a[field] != null && b[field] != null) { - // For the purposes of comparison, seconds and milliseconds are combined - // as a single precision using a decimal, with decimal equality semantics - if (field === 'second') { - // NOTE: if millisecond is null it will calcualte like this anyway, but - // if millisecond is undefined, using it will result in NaN calculations - var aMillisecond = a['millisecond'] != null ? a['millisecond'] : 0; - var aSecondAndMillisecond = a[field] + aMillisecond / 1000; - var bMillisecond = b['millisecond'] != null ? b['millisecond'] : 0; - var bSecondAndMillisecond = b[field] + bMillisecond / 1000; // second/millisecond is the most precise comparison, so we can directly return - - return aSecondAndMillisecond === bSecondAndMillisecond; - } // if they are different then return with false - - - if (a[field] !== b[field]) { - return false; - } // if both dont have this precision, return true - - } else if (a[field] == null && b[field] == null) { - return true; // otherwise they have inconclusive precision, return defaultResult - } else { - return defaultResult; - } - } // if we made it here, then all fields matched. - - } catch (err) { - _iterator10.e(err); - } finally { - _iterator10.f(); - } - - return true; -} - -function daysInMonth(year, month) { - if (year == null || month == null) { - throw new Error('daysInMonth requires year and month as arguments'); - } // Month is 1-indexed here because of the 0 day - - - return new jsDate(year, month, 0).getDate(); -} - -function isValidDateStringFormat(string) { - if (typeof string !== 'string') { - return false; - } - - var format = LENGTH_TO_DATE_FORMAT_MAP.get(string.length); - - if (format == null) { - return false; - } - - return luxon.DateTime.fromFormat(string, format).isValid; -} - -function isValidDateTimeStringFormat(string) { - if (typeof string !== 'string') { - return false; - } // Luxon doesn't support +hh offset, so change it to +hh:00 - - - if (/T[\d:.]*[+-]\d{2}$/.test(string)) { - string += ':00'; - } - - var formats = LENGTH_TO_DATETIME_FORMATS_MAP.get(string.length); - - if (formats == null) { - return false; - } - - return formats.some(function (fmt) { - return luxon.DateTime.fromFormat(string, fmt).isValid; - }); -} - -module.exports = { - DateTime: DateTime, - Date: Date, - MIN_DATETIME_VALUE: MIN_DATETIME_VALUE, - MAX_DATETIME_VALUE: MAX_DATETIME_VALUE, - MIN_DATE_VALUE: MIN_DATE_VALUE, - MAX_DATE_VALUE: MAX_DATE_VALUE, - MIN_TIME_VALUE: MIN_TIME_VALUE, - MAX_TIME_VALUE: MAX_TIME_VALUE -}; // Require MIN/MAX here because math.js requires this file, and when we make this file require -// math.js before it exports DateTime and Date, it errors due to the circular dependency... -// const { MAX_DATETIME_VALUE, MIN_DATETIME_VALUE } = require('../util/math'); -},{"../util/util":50,"./uncertainty":13,"luxon":67}],8:[function(require,module,exports){ -"use strict"; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Exception = function Exception(message, wrapped) { - _classCallCheck(this, Exception); - - this.message = message; - this.wrapped = wrapped; -}; - -module.exports = { - Exception: Exception -}; -},{}],9:[function(require,module,exports){ -"use strict"; - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('./uncertainty'), - Uncertainty = _require.Uncertainty; - -var _require2 = require('../datatypes/quantity'), - Quantity = _require2.Quantity, - doSubtraction = _require2.doSubtraction; - -var _require3 = require('./logic'), - ThreeValuedLogic = _require3.ThreeValuedLogic; - -var _require4 = require('../util/math'), - successor = _require4.successor, - predecessor = _require4.predecessor, - maxValueForInstance = _require4.maxValueForInstance, - minValueForInstance = _require4.minValueForInstance, - maxValueForType = _require4.maxValueForType, - minValueForType = _require4.minValueForType; - -var cmp = require('../util/comparison'); - -var Interval = /*#__PURE__*/function () { - function Interval(low, high, lowClosed, highClosed, defaultPointType) { - _classCallCheck(this, Interval); - - this.low = low; - this.high = high; - this.lowClosed = lowClosed != null ? lowClosed : true; - this.highClosed = highClosed != null ? highClosed : true; // defaultPointType is used in the case that both endpoints are null - - this.defaultPointType = defaultPointType; - } - - _createClass(Interval, [{ - key: "isInterval", - get: function get() { - return true; - } - }, { - key: "pointType", - get: function get() { - var pointType = null; - var point = this.low != null ? this.low : this.high; - - if (point != null) { - if (typeof point === 'number') { - pointType = parseInt(point) === point ? '{urn:hl7-org:elm-types:r1}Integer' : '{urn:hl7-org:elm-types:r1}Decimal'; - } else if (point.isTime && point.isTime()) { - pointType = '{urn:hl7-org:elm-types:r1}Time'; - } else if (point.isDate) { - pointType = '{urn:hl7-org:elm-types:r1}Date'; - } else if (point.isDateTime) { - pointType = '{urn:hl7-org:elm-types:r1}DateTime'; - } else if (point.isQuantity) { - pointType = '{urn:hl7-org:elm-types:r1}Quantity'; + // make a copy of other in the correct timezone offset if they don't match. + if (this.timezoneOffset !== other.timezoneOffset) { + other = other.convertToTimezoneOffset(this.timezoneOffset); } - } - - if (pointType == null && this.defaultPointType != null) { - pointType = this.defaultPointType; - } - - return pointType; - } - }, { - key: "copy", - value: function copy() { - var newLow = this.low; - var newHigh = this.high; - - if (this.low != null && typeof this.low.copy === 'function') { - newLow = this.low.copy(); - } - - if (this.high != null && typeof this.high.copy === 'function') { - newHigh = this.high.copy(); - } - - return new Interval(newLow, newHigh, this.lowClosed, this.highClosed); - } - }, { - key: "contains", - value: function contains(item, precision) { - // These first two checks ensure correct handling of edge case where an item equals the closed boundary - if (this.lowClosed && this.low != null && cmp.equals(this.low, item)) { - return true; - } - - if (this.highClosed && this.high != null && cmp.equals(this.high, item)) { + // @ts-ignore + for (var _i = 0, _a = this.constructor.FIELDS; _i < _a.length; _i++) { + var field = _a[_i]; + // if both have this precision defined + // @ts-ignore + if (this[field] != null && other[field] != null) { + // if this value is less than the other return with true. this is before other + // @ts-ignore + if (this[field] < other[field]) { + return true; + // if this value is greater than the other return with false. this is after + // @ts-ignore + } + else if (this[field] > other[field]) { + return false; + } + // execution continues if the values are the same + // if both dont have this precision, return true if precision is not defined + // @ts-ignore + } + else if (this[field] == null && other[field] == null) { + if (precision == null) { + return true; + } + else { + // we havent met precision yet + return null; + } + // otherwise they have inconclusive precision, return null + } + else { + return null; + } + // if precision is defined and we have reached expected precision, we can leave the loop + if (precision != null && precision === field) { + break; + } + } + // if we made it here, then all fields matched and they are same return true; - } - - if (item != null && item.isInterval) { - throw new Error('Argument to contains must be a point'); - } - - var lowFn; - - if (this.lowClosed && this.low == null) { - lowFn = function lowFn() { - return true; - }; - } else if (this.lowClosed) { - lowFn = cmp.lessThanOrEquals; - } else { - lowFn = cmp.lessThan; - } - - var highFn; - - if (this.highClosed && this.high == null) { - highFn = function highFn() { - return true; - }; - } else if (this.highClosed) { - highFn = cmp.greaterThanOrEquals; - } else { - highFn = cmp.greaterThan; - } - - return ThreeValuedLogic.and(lowFn(this.low, item, precision), highFn(this.high, item, precision)); - } - }, { - key: "properlyIncludes", - value: function properlyIncludes(other, precision) { - if (other == null || !other.isInterval) { - throw new Error('Argument to properlyIncludes must be an interval'); - } - - return ThreeValuedLogic.and(this.includes(other, precision), ThreeValuedLogic.not(other.includes(this, precision))); - } - }, { - key: "includes", - value: function includes(other, precision) { - if (other == null || !other.isInterval) { - return this.contains(other, precision); - } - - var a = this.toClosed(); - var b = other.toClosed(); - return ThreeValuedLogic.and(cmp.lessThanOrEquals(a.low, b.low, precision), cmp.greaterThanOrEquals(a.high, b.high, precision)); - } - }, { - key: "includedIn", - value: function includedIn(other, precision) { - // For the point overload, this operator is a synonym for the in operator - if (other == null || !other.isInterval) { - return this.contains(other, precision); - } else { - return other.includes(this); - } - } - }, { - key: "overlaps", - value: function overlaps(item, precision) { - var closed = this.toClosed(); - - var _ref = function () { - if (item != null && item.isInterval) { - var itemClosed = item.toClosed(); - return [itemClosed.low, itemClosed.high]; - } else { - return [item, item]; + }; + AbstractDate.prototype.sameOrAfter = function (other, precision) { + if (!(other.isDate || other.isDateTime)) { + return null; } - }(), - _ref2 = _slicedToArray(_ref, 2), - low = _ref2[0], - high = _ref2[1]; - - return ThreeValuedLogic.and(cmp.lessThanOrEquals(closed.low, high, precision), cmp.greaterThanOrEquals(closed.high, low, precision)); - } - }, { - key: "overlapsAfter", - value: function overlapsAfter(item, precision) { - var closed = this.toClosed(); - var high = item != null && item.isInterval ? item.toClosed().high : item; - return ThreeValuedLogic.and(cmp.lessThanOrEquals(closed.low, high, precision), cmp.greaterThan(closed.high, high, precision)); - } - }, { - key: "overlapsBefore", - value: function overlapsBefore(item, precision) { - var closed = this.toClosed(); - var low = item != null && item.isInterval ? item.toClosed().low : item; - return ThreeValuedLogic.and(cmp.lessThan(closed.low, low, precision), cmp.greaterThanOrEquals(closed.high, low, precision)); - } - }, { - key: "union", - value: function union(other) { - if (other == null || !other.isInterval) { - throw new Error('Argument to union must be an interval'); - } // Note that interval union is only defined if the arguments overlap or meet. - - - if (this.overlaps(other) || this.meets(other)) { - var _ref3 = [this.toClosed(), other.toClosed()], - a = _ref3[0], - b = _ref3[1]; - var l, lc; - - if (cmp.lessThanOrEquals(a.low, b.low)) { - var _ref4 = [this.low, this.lowClosed]; - l = _ref4[0]; - lc = _ref4[1]; - } else if (cmp.greaterThanOrEquals(a.low, b.low)) { - var _ref5 = [other.low, other.lowClosed]; - l = _ref5[0]; - lc = _ref5[1]; - } else if (areNumeric(a.low, b.low)) { - var _ref6 = [lowestNumericUncertainty(a.low, b.low), true]; - l = _ref6[0]; - lc = _ref6[1]; - } else if (areDateTimes(a.low, b.low) && a.low.isMorePrecise(b.low)) { - var _ref7 = [other.low, other.lowClosed]; - l = _ref7[0]; - lc = _ref7[1]; - } else { - var _ref8 = [this.low, this.lowClosed]; - l = _ref8[0]; - lc = _ref8[1]; - } - - var h, hc; - - if (cmp.greaterThanOrEquals(a.high, b.high)) { - var _ref9 = [this.high, this.highClosed]; - h = _ref9[0]; - hc = _ref9[1]; - } else if (cmp.lessThanOrEquals(a.high, b.high)) { - var _ref10 = [other.high, other.highClosed]; - h = _ref10[0]; - hc = _ref10[1]; - } else if (areNumeric(a.high, b.high)) { - var _ref11 = [highestNumericUncertainty(a.high, b.high), true]; - h = _ref11[0]; - hc = _ref11[1]; - } else if (areDateTimes(a.high, b.high) && a.high.isMorePrecise(b.high)) { - var _ref12 = [other.high, other.highClosed]; - h = _ref12[0]; - hc = _ref12[1]; - } else { - var _ref13 = [this.high, this.highClosed]; - h = _ref13[0]; - hc = _ref13[1]; - } - - return new Interval(l, h, lc, hc); - } else { - return null; - } - } - }, { - key: "intersect", - value: function intersect(other) { - if (other == null || !other.isInterval) { - throw new Error('Argument to union must be an interval'); - } // Note that interval union is only defined if the arguments overlap. - - - if (this.overlaps(other)) { - var _ref14 = [this.toClosed(), other.toClosed()], - a = _ref14[0], - b = _ref14[1]; - var l, lc; - - if (cmp.greaterThanOrEquals(a.low, b.low)) { - var _ref15 = [this.low, this.lowClosed]; - l = _ref15[0]; - lc = _ref15[1]; - } else if (cmp.lessThanOrEquals(a.low, b.low)) { - var _ref16 = [other.low, other.lowClosed]; - l = _ref16[0]; - lc = _ref16[1]; - } else if (areNumeric(a.low, b.low)) { - var _ref17 = [highestNumericUncertainty(a.low, b.low), true]; - l = _ref17[0]; - lc = _ref17[1]; - } else if (areDateTimes(a.low, b.low) && b.low.isMorePrecise(a.low)) { - var _ref18 = [other.low, other.lowClosed]; - l = _ref18[0]; - lc = _ref18[1]; - } else { - var _ref19 = [this.low, this.lowClosed]; - l = _ref19[0]; - lc = _ref19[1]; - } - - var h, hc; - - if (cmp.lessThanOrEquals(a.high, b.high)) { - var _ref20 = [this.high, this.highClosed]; - h = _ref20[0]; - hc = _ref20[1]; - } else if (cmp.greaterThanOrEquals(a.high, b.high)) { - var _ref21 = [other.high, other.highClosed]; - h = _ref21[0]; - hc = _ref21[1]; - } else if (areNumeric(a.high, b.high)) { - var _ref22 = [lowestNumericUncertainty(a.high, b.high), true]; - h = _ref22[0]; - hc = _ref22[1]; - } else if (areDateTimes(a.high, b.high) && b.high.isMorePrecise(a.high)) { - var _ref23 = [other.high, other.highClosed]; - h = _ref23[0]; - hc = _ref23[1]; - } else { - var _ref24 = [this.high, this.highClosed]; - h = _ref24[0]; - hc = _ref24[1]; - } - - return new Interval(l, h, lc, hc); - } else { - return null; - } - } - }, { - key: "except", - value: function except(other) { - if (other === null) { - return null; - } - - if (other == null || !other.isInterval) { - throw new Error('Argument to except must be an interval'); - } - - var ol = this.overlaps(other); - - if (ol === true) { - var olb = this.overlapsBefore(other); - var ola = this.overlapsAfter(other); - - if (olb === true && ola === false) { - return new Interval(this.low, other.low, this.lowClosed, !other.lowClosed); - } else if (ola === true && olb === false) { - return new Interval(other.high, this.high, !other.highClosed, this.highClosed); - } else { - return null; - } - } else if (ol === false) { - return this; - } else { - // ol is null - return null; - } - } - }, { - key: "sameAs", - value: function sameAs(other, precision) { - // This large if and else if block handles the scenarios where there is an open ended null - // If both lows or highs exists, it can be determined that intervals are not Same As - if (this.low != null && other.low != null && this.high == null && other.high != null && !this.highClosed || this.low != null && other.low != null && this.high != null && other.high == null && !other.highClosed || this.low != null && other.low != null && this.high == null && other.high == null && !other.highClosed && !this.highClosed) { - if (typeof this.low === 'number') { - if (!(this.start() === other.start())) { - return false; - } - } else { - if (!this.start().sameAs(other.start(), precision)) { - return false; - } - } - } else if (this.low != null && other.low == null && this.high != null && other.high != null || this.low == null && other.low != null && this.high != null && other.high != null || this.low == null && other.low == null && this.high != null && other.high != null) { - if (typeof this.high === 'number') { - if (!(this.end() === other.end())) { - return false; - } - } else { - if (!this.end().sameAs(other.end(), precision)) { - return false; - } - } - } // Checks to see if any of the Intervals have a open, null boundary - - - if (this.low == null && !this.lowClosed || this.high == null && !this.highClosed || other.low == null && !other.lowClosed || other.high == null && !other.highClosed) { - return null; - } // For the special cases where @ is Interval[null,null] - - - if (this.lowClosed && this.low == null && this.highClosed && this.high == null) { - return other.lowClosed && other.low == null && other.highClosed && other.high == null; - } // For the special case where Interval[...] same as Interval[null,null] should return false. - // This accounts for the inverse of the if statement above: where the second Interval is - // [null,null] and not the first Interval. - // The reason why this isn't caught below is due to how start() and end() work. - // There is no way to tell the datatype for MIN and MAX if both boundaries are null. - - - if (other.lowClosed && other.low == null && other.highClosed && other.high == null) { - return false; - } - - if (typeof this.low === 'number') { - return this.start() === other.start() && this.end() === other.end(); - } else { - return this.start().sameAs(other.start(), precision) && this.end().sameAs(other.end(), precision); - } - } - }, { - key: "sameOrBefore", - value: function sameOrBefore(other, precision) { - if (this.end() == null || other == null || other.start() == null) { - return null; - } else { - return cmp.lessThanOrEquals(this.end(), other.start(), precision); - } - } - }, { - key: "sameOrAfter", - value: function sameOrAfter(other, precision) { - if (this.start() == null || other == null || other.end() == null) { - return null; - } else { - return cmp.greaterThanOrEquals(this.start(), other.end(), precision); - } - } - }, { - key: "equals", - value: function equals(other) { - if (other != null && other.isInterval) { - var _ref25 = [this.toClosed(), other.toClosed()], - a = _ref25[0], - b = _ref25[1]; - return ThreeValuedLogic.and(cmp.equals(a.low, b.low), cmp.equals(a.high, b.high)); - } else { - return false; - } - } - }, { - key: "after", - value: function after(other, precision) { - var closed = this.toClosed(); // Meets spec, but not 100% correct (e.g., (null, 5] after [6, 10] --> null) - // Simple way to fix it: and w/ not overlaps - - if (other.toClosed) { - return cmp.greaterThan(closed.low, other.toClosed().high, precision); - } else { - return cmp.greaterThan(closed.low, other, precision); - } - } - }, { - key: "before", - value: function before(other, precision) { - var closed = this.toClosed(); // Meets spec, but not 100% correct (e.g., (null, 5] after [6, 10] --> null) - // Simple way to fix it: and w/ not overlaps - - if (other.toClosed) { - return cmp.lessThan(closed.high, other.toClosed().low, precision); - } else { - return cmp.lessThan(closed.high, other, precision); - } - } - }, { - key: "meets", - value: function meets(other, precision) { - return ThreeValuedLogic.or(this.meetsBefore(other, precision), this.meetsAfter(other, precision)); - } - }, { - key: "meetsAfter", - value: function meetsAfter(other, precision) { - try { - if (precision != null && this.low != null && this.low.isDateTime) { - return this.toClosed().low.sameAs(other.toClosed().high != null ? other.toClosed().high.add(1, precision) : null, precision); - } else { - return cmp.equals(this.toClosed().low, successor(other.toClosed().high)); - } - } catch (error) { - return false; - } - } - }, { - key: "meetsBefore", - value: function meetsBefore(other, precision) { - try { - if (precision != null && this.high != null && this.high.isDateTime) { - return this.toClosed().high.sameAs(other.toClosed().low != null ? other.toClosed().low.add(-1, precision) : null, precision); - } else { - return cmp.equals(this.toClosed().high, predecessor(other.toClosed().low)); - } - } catch (error) { - return false; - } - } - }, { - key: "start", - value: function start() { - if (this.low == null) { - if (this.lowClosed) { - return minValueForInstance(this.high); - } else { - return this.low; - } - } - - return this.toClosed().low; - } - }, { - key: "end", - value: function end() { - if (this.high == null) { - if (this.highClosed) { - return maxValueForInstance(this.low); - } else { - return this.high; - } - } - - return this.toClosed().high; - } - }, { - key: "starts", - value: function starts(other, precision) { - var startEqual; - - if (precision != null && this.low != null && this.low.isDateTime) { - startEqual = this.low.sameAs(other.low, precision); - } else { - startEqual = cmp.equals(this.low, other.low); - } - - var endLessThanOrEqual = cmp.lessThanOrEquals(this.high, other.high, precision); - return startEqual && endLessThanOrEqual; - } - }, { - key: "ends", - value: function ends(other, precision) { - var endEqual; - var startGreaterThanOrEqual = cmp.greaterThanOrEquals(this.low, other.low, precision); - - if (precision != null && (this.low != null ? this.low.isDateTime : undefined)) { - endEqual = this.high.sameAs(other.high, precision); - } else { - endEqual = cmp.equals(this.high, other.high); - } - - return startGreaterThanOrEqual && endEqual; - } - }, { - key: "width", - value: function width() { - if (this.low != null && (this.low.isDateTime || this.low.isDate) || this.high != null && (this.high.isDateTime || this.high.isDate)) { - throw new Error('Width of Date, DateTime, and Time intervals is not supported'); - } - - var closed = this.toClosed(); - - if (closed.low != null && closed.low.isUncertainty || closed.high != null && closed.high.isUncertainty) { - return null; - } else if (closed.low.isQuantity) { - if (closed.low.unit !== closed.high.unit) { - throw new Error('Cannot calculate width of Quantity Interval with different units'); - } - - var lowValue = closed.low.value; - var highValue = closed.high.value; - var diff = Math.abs(highValue - lowValue); - diff = Math.round(diff * Math.pow(10, 8)) / Math.pow(10, 8); - return new Quantity(diff, closed.low.unit); - } else { - // TODO: Fix precision to 8 decimals in other places that return numbers - var _diff = Math.abs(closed.high - closed.low); - - return Math.round(_diff * Math.pow(10, 8)) / Math.pow(10, 8); - } - } - }, { - key: "size", - value: function size() { - var pointSize = this.getPointSize(); - - if (this.low != null && (this.low.isDateTime || this.low.isDate) || this.high != null && (this.high.isDateTime || this.high.isDate)) { - throw new Error('Size of Date, DateTime, and Time intervals is not supported'); - } - - var closed = this.toClosed(); - - if (closed.low != null && closed.low.isUncertainty || closed.high != null && closed.high.isUncertainty) { - return null; - } else if (closed.low.isQuantity) { - if (closed.low.unit !== closed.high.unit) { - throw new Error('Cannot calculate size of Quantity Interval with different units'); - } - - var lowValue = closed.low.value; - var highValue = closed.high.value; - var diff = Math.abs(highValue - lowValue) + pointSize.value; - Math.round(diff * Math.pow(10, 8)) / Math.pow(10, 8); - return new Quantity(diff, closed.low.unit); - } else { - var _diff2 = Math.abs(closed.high - closed.low) + pointSize.value; - - return Math.round(_diff2 * Math.pow(10, 8)) / Math.pow(10, 8); - } - } - }, { - key: "getPointSize", - value: function getPointSize() { - var pointSize; - - if (this.low != null) { - if (this.low.isDateTime || this.low.isDate || this.low.isTime) { - pointSize = new Quantity(1, this.low.getPrecision()); - } else if (this.low.isQuantity) { - pointSize = doSubtraction(successor(this.low), this.low); - } else { - pointSize = successor(this.low) - this.low; + else if (this.isDate && other.isDateTime) { + return this.getDateTime().sameOrAfter(other, precision); } - } else if (this.high != null) { - if (this.high.isDateTime || this.high.isDate || this.high.isTime) { - pointSize = new Quantity(1, this.high.getPrecision()); - } else if (this.high.isQuantity) { - pointSize = doSubtraction(successor(this.high), this.high); - } else { - pointSize = successor(this.high) - this.high; - } - } else { - throw new Error('Point type of intervals cannot be determined.'); - } - - if (typeof pointSize === 'number') { - pointSize = new Quantity(pointSize, '1'); - } - - return pointSize; - } - }, { - key: "toClosed", - value: function toClosed() { - // Calculate the closed flags. Despite the name of this function, if a boundary is null open, - // we cannot close the boundary because that changes its meaning from "unknown" to "max/min value" - var lowClosed = this.lowClosed || this.low != null; - var highClosed = this.highClosed || this.high != null; - - if (this.pointType != null) { - var low; - - if (this.lowClosed && this.low == null) { - low = minValueForType(this.pointType); - } else if (!this.lowClosed && this.low != null) { - low = successor(this.low); - } else { - low = this.low; - } - - var high; - - if (this.highClosed && this.high == null) { - high = maxValueForType(this.pointType); - } else if (!this.highClosed && this.high != null) { - high = predecessor(this.high); - } else { - high = this.high; + else if (this.isDateTime && other.isDate) { + other = other.getDateTime(); } - - if (low == null) { - low = new Uncertainty(minValueForType(this.pointType), high); + // @ts-ignore + if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { + throw new Error("Invalid precision: ".concat(precision)); } - - if (high == null) { - high = new Uncertainty(low, maxValueForType(this.pointType)); + // make a copy of other in the correct timezone offset if they don't match. + if (this.timezoneOffset !== other.timezoneOffset) { + other = other.convertToTimezoneOffset(this.timezoneOffset); } - - return new Interval(low, high, lowClosed, highClosed); - } else { - return new Interval(this.low, this.high, lowClosed, highClosed); - } - } - }, { - key: "toString", - value: function toString() { - var start = this.lowClosed ? '[' : '('; - var end = this.highClosed ? ']' : ')'; - return start + this.low.toString() + ', ' + this.high.toString() + end; - } - }]); - - return Interval; -}(); - -function areDateTimes(x, y) { - return [x, y].every(function (z) { - return z != null && z.isDateTime; - }); -} - -function areNumeric(x, y) { - return [x, y].every(function (z) { - return typeof z === 'number' || z != null && z.isUncertainty && typeof z.low === 'number'; - }); -} - -function lowestNumericUncertainty(x, y) { - if (x == null || !x.isUncertainty) { - x = new Uncertainty(x); - } - - if (y == null || !y.isUncertainty) { - y = new Uncertainty(y); - } - - var low = x.low < y.low ? x.low : y.low; - var high = x.high < y.high ? x.high : y.high; - - if (low !== high) { - return new Uncertainty(low, high); - } else { - return low; - } -} - -function highestNumericUncertainty(x, y) { - if (x == null || !x.isUncertainty) { - x = new Uncertainty(x); - } - - if (y == null || !y.isUncertainty) { - y = new Uncertainty(y); - } - - var low = x.low > y.low ? x.low : y.low; - var high = x.high > y.high ? x.high : y.high; - - if (low !== high) { - return new Uncertainty(low, high); - } else { - return low; - } -} - -module.exports = { - Interval: Interval -}; -},{"../datatypes/quantity":11,"../util/comparison":47,"../util/math":48,"./logic":10,"./uncertainty":13}],10:[function(require,module,exports){ -"use strict"; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var ThreeValuedLogic = /*#__PURE__*/function () { - function ThreeValuedLogic() { - _classCallCheck(this, ThreeValuedLogic); - } - - _createClass(ThreeValuedLogic, null, [{ - key: "and", - value: function and() { - for (var _len = arguments.length, val = new Array(_len), _key = 0; _key < _len; _key++) { - val[_key] = arguments[_key]; - } - - if (val.includes(false)) { - return false; - } else if (val.includes(null)) { - return null; - } else { - return true; - } - } - }, { - key: "or", - value: function or() { - for (var _len2 = arguments.length, val = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - val[_key2] = arguments[_key2]; - } - - if (val.includes(true)) { - return true; - } else if (val.includes(null)) { - return null; - } else { - return false; - } - } - }, { - key: "xor", - value: function xor() { - for (var _len3 = arguments.length, val = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - val[_key3] = arguments[_key3]; - } - - if (val.includes(null)) { - return null; - } else { - return val.reduce(function (a, b) { - return (!a ^ !b) === 1; - }); - } - } - }, { - key: "not", - value: function not(val) { - if (val != null) { - return !val; - } else { - return null; - } - } - }]); - - return ThreeValuedLogic; -}(); - -module.exports = { - ThreeValuedLogic: ThreeValuedLogic -}; -},{}],11:[function(require,module,exports){ -"use strict"; - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('../util/math'), - decimalAdjust = _require.decimalAdjust, - isValidDecimal = _require.isValidDecimal, - overflowsOrUnderflows = _require.overflowsOrUnderflows; - -var _require2 = require('../util/units'), - checkUnit = _require2.checkUnit, - _convertUnit = _require2.convertUnit, - normalizeUnitsWhenPossible = _require2.normalizeUnitsWhenPossible, - convertToCQLDateUnit = _require2.convertToCQLDateUnit, - getProductOfUnits = _require2.getProductOfUnits, - getQuotientOfUnits = _require2.getQuotientOfUnits; - -var Quantity = /*#__PURE__*/function () { - function Quantity(value, unit) { - _classCallCheck(this, Quantity); - - this.value = value; - this.unit = unit; - - if (this.value == null || isNaN(this.value)) { - throw new Error('Cannot create a quantity with an undefined value'); - } else if (!isValidDecimal(this.value)) { - throw new Error('Cannot create a quantity with an invalid decimal value'); - } // Attempt to parse the unit with UCUM. If it fails, throw a friendly error. - - - if (this.unit != null) { - var validation = checkUnit(this.unit); - - if (!validation.valid) { - throw new Error(validation.message); - } - } - } - - _createClass(Quantity, [{ - key: "isQuantity", - get: function get() { - return true; - } - }, { - key: "clone", - value: function clone() { - return new Quantity(this.value, this.unit); - } - }, { - key: "toString", - value: function toString() { - return "".concat(this.value, " '").concat(this.unit, "'"); - } - }, { - key: "sameOrBefore", - value: function sameOrBefore(other) { - if (other != null && other.isQuantity) { - var otherVal = _convertUnit(other.value, other.unit, this.unit); - - if (otherVal == null) { - return null; - } else { - return this.value <= otherVal; - } - } - } - }, { - key: "sameOrAfter", - value: function sameOrAfter(other) { - if (other != null && other.isQuantity) { - var otherVal = _convertUnit(other.value, other.unit, this.unit); - - if (otherVal == null) { - return null; - } else { - return this.value >= otherVal; - } - } - } - }, { - key: "after", - value: function after(other) { - if (other != null && other.isQuantity) { - var otherVal = _convertUnit(other.value, other.unit, this.unit); - - if (otherVal == null) { - return null; - } else { - return this.value > otherVal; - } - } - } - }, { - key: "before", - value: function before(other) { - if (other != null && other.isQuantity) { - var otherVal = _convertUnit(other.value, other.unit, this.unit); - - if (otherVal == null) { - return null; - } else { - return this.value < otherVal; - } - } - } - }, { - key: "equals", - value: function equals(other) { - if (other != null && other.isQuantity) { - if (!this.unit && other.unit || this.unit && !other.unit) { - return false; - } else if (!this.unit && !other.unit) { - return this.value === other.value; - } else { - var otherVal = _convertUnit(other.value, other.unit, this.unit); - - if (otherVal == null) { - return null; - } else { - return decimalAdjust('round', this.value, -8) === otherVal; - } - } - } - } - }, { - key: "convertUnit", - value: function convertUnit(toUnit) { - var value = _convertUnit(this.value, this.unit, toUnit); // Need to pass through constructor again to catch invalid units - - - return new Quantity(value, toUnit); - } - }, { - key: "dividedBy", - value: function dividedBy(other) { - if (other == null || other === 0 || other.value === 0) { - return null; - } else if (!other.isQuantity) { - // convert it to a quantity w/ unit 1 - other = new Quantity(other, '1'); - } - - var _normalizeUnitsWhenPo = normalizeUnitsWhenPossible(this.value, this.unit, other.value, other.unit), - _normalizeUnitsWhenPo2 = _slicedToArray(_normalizeUnitsWhenPo, 4), - val1 = _normalizeUnitsWhenPo2[0], - unit1 = _normalizeUnitsWhenPo2[1], - val2 = _normalizeUnitsWhenPo2[2], - unit2 = _normalizeUnitsWhenPo2[3]; - - var resultValue = val1 / val2; - var resultUnit = getQuotientOfUnits(unit1, unit2); // Check for invalid unit or value - - if (resultUnit == null || overflowsOrUnderflows(resultValue)) { - return null; - } - - return new Quantity(decimalAdjust('round', resultValue, -8), resultUnit); - } - }, { - key: "multiplyBy", - value: function multiplyBy(other) { - if (other == null) { - return null; - } else if (!other.isQuantity) { - // convert it to a quantity w/ unit 1 - other = new Quantity(other, '1'); - } - - var _normalizeUnitsWhenPo3 = normalizeUnitsWhenPossible(this.value, this.unit, other.value, other.unit), - _normalizeUnitsWhenPo4 = _slicedToArray(_normalizeUnitsWhenPo3, 4), - val1 = _normalizeUnitsWhenPo4[0], - unit1 = _normalizeUnitsWhenPo4[1], - val2 = _normalizeUnitsWhenPo4[2], - unit2 = _normalizeUnitsWhenPo4[3]; - - var resultValue = val1 * val2; - var resultUnit = getProductOfUnits(unit1, unit2); // Check for invalid unit or value - - if (resultUnit == null || overflowsOrUnderflows(resultValue)) { - return null; - } - - return new Quantity(decimalAdjust('round', resultValue, -8), resultUnit); - } - }]); - - return Quantity; -}(); - -function parseQuantity(str) { - var components = /([+|-]?\d+\.?\d*)\s*('(.+)')?/.exec(str); - - if (components != null && components[1] != null) { - var value = parseFloat(components[1]); - - if (!isValidDecimal(value)) { - return null; - } - - var unit; - - if (components[3] != null) { - unit = components[3].trim(); - } else { - unit = ''; - } - - return new Quantity(value, unit); - } else { - return null; - } -} - -function doScaledAddition(a, b, scaleForB) { - if (a != null && a.isQuantity && b != null && b.isQuantity) { - var _normalizeUnitsWhenPo5 = normalizeUnitsWhenPossible(a.value, a.unit, b.value * scaleForB, b.unit), - _normalizeUnitsWhenPo6 = _slicedToArray(_normalizeUnitsWhenPo5, 4), - val1 = _normalizeUnitsWhenPo6[0], - unit1 = _normalizeUnitsWhenPo6[1], - val2 = _normalizeUnitsWhenPo6[2], - unit2 = _normalizeUnitsWhenPo6[3]; - - if (unit1 !== unit2) { - // not compatible units, so we can't do addition - return null; - } - - var sum = val1 + val2; - - if (overflowsOrUnderflows(sum)) { - return null; - } - - return new Quantity(sum, unit1); - } else if (a.copy && a.add) { - // Date / DateTime require a CQL time unit - var cqlUnitB = convertToCQLDateUnit(b.unit) || b.unit; - return a.copy().add(b.value * scaleForB, cqlUnitB); - } else { - throw new Error('Unsupported argument types.'); - } -} - -function doAddition(a, b) { - return doScaledAddition(a, b, 1); -} - -function doSubtraction(a, b) { - return doScaledAddition(a, b, -1); -} - -function doDivision(a, b) { - if (a != null && a.isQuantity) { - return a.dividedBy(b); - } -} - -function doMultiplication(a, b) { - if (a != null && a.isQuantity) { - return a.multiplyBy(b); - } else { - return b.multiplyBy(a); - } -} - -module.exports = { - Quantity: Quantity, - parseQuantity: parseQuantity, - doAddition: doAddition, - doSubtraction: doSubtraction, - doDivision: doDivision, - doMultiplication: doMultiplication -}; -},{"../util/math":48,"../util/units":49}],12:[function(require,module,exports){ -"use strict"; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var Ratio = /*#__PURE__*/function () { - function Ratio(numerator, denominator) { - _classCallCheck(this, Ratio); - - this.numerator = numerator; - this.denominator = denominator; - - if (this.numerator == null) { - throw new Error('Cannot create a ratio with an undefined numerator'); - } - - if (this.denominator == null) { - throw new Error('Cannot create a ratio with an undefined denominator'); - } - } - - _createClass(Ratio, [{ - key: "isRatio", - get: function get() { - return true; - } - }, { - key: "clone", - value: function clone() { - return new Ratio(this.numerator.clone(), this.denominator.clone()); - } - }, { - key: "toString", - value: function toString() { - return "".concat(this.numerator.toString(), " : ").concat(this.denominator.toString()); - } - }, { - key: "equals", - value: function equals(other) { - if (other != null && other.isRatio) { - var divided_this = this.numerator.dividedBy(this.denominator); - var divided_other = other.numerator.dividedBy(other.denominator); - return divided_this.equals(divided_other); - } else { - return false; - } - } - }, { - key: "equivalent", - value: function equivalent(other) { - var equal = this.equals(other); - return equal != null ? equal : false; - } - }]); - - return Ratio; -}(); - -module.exports = { - Ratio: Ratio -}; -},{}],13:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('./logic'), - ThreeValuedLogic = _require.ThreeValuedLogic; - -var Uncertainty = /*#__PURE__*/function () { - function Uncertainty() { - var low = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var high = arguments.length > 1 ? arguments[1] : undefined; - - _classCallCheck(this, Uncertainty); - - this.low = low; - this.high = high; - - var gt = function gt(a, b) { - if (_typeof(a) !== _typeof(b)) { - // TODO: This should probably throw rather than return false. - // Uncertainties with different types probably shouldn't be supported. - return false; - } - - if (typeof a.after === 'function') { - return a.after(b); - } else { - return a > b; - } - }; - - var isNonEnumerable = function isNonEnumerable(val) { - return val != null && (val.isCode || val.isConcept || val.isValueSet); - }; - - if (typeof this.high === 'undefined') { - this.high = this.low; - } - - if (isNonEnumerable(this.low) || isNonEnumerable(this.high)) { - this.low = this.high = null; - } - - if (this.low != null && this.high != null && gt(this.low, this.high)) { - var _ref = [this.high, this.low]; - this.low = _ref[0]; - this.high = _ref[1]; - } - } - - _createClass(Uncertainty, [{ - key: "isUncertainty", - get: function get() { - return true; - } - }, { - key: "copy", - value: function copy() { - var newLow = this.low; - var newHigh = this.high; - - if (typeof this.low.copy === 'function') { - newLow = this.low.copy(); - } - - if (typeof this.high.copy === 'function') { - newHigh = this.high.copy(); - } - - return new Uncertainty(newLow, newHigh); - } - }, { - key: "isPoint", - value: function isPoint() { - // Note: Can't use normal equality, as that fails for Javascript dates - // TODO: Fix after we don't need to support Javascript date uncertainties anymore - var lte = function lte(a, b) { - if (_typeof(a) !== _typeof(b)) { - return false; - } - - if (typeof a.sameOrBefore === 'function') { - return a.sameOrBefore(b); - } else { - return a <= b; - } - }; - - var gte = function gte(a, b) { - if (_typeof(a) !== _typeof(b)) { - return false; - } - - if (typeof a.sameOrBefore === 'function') { - return a.sameOrAfter(b); - } else { - return a >= b; - } - }; - - return this.low != null && this.high != null && lte(this.low, this.high) && gte(this.low, this.high); - } - }, { - key: "equals", - value: function equals(other) { - other = Uncertainty.from(other); - return ThreeValuedLogic.not(ThreeValuedLogic.or(this.lessThan(other), this.greaterThan(other))); - } - }, { - key: "lessThan", - value: function lessThan(other) { - var lt = function lt(a, b) { - if (_typeof(a) !== _typeof(b)) { - return false; - } - - if (typeof a.before === 'function') { - return a.before(b); - } else { - return a < b; - } - }; - - other = Uncertainty.from(other); - var bestCase = this.low == null || other.high == null || lt(this.low, other.high); - var worstCase = this.high != null && other.low != null && lt(this.high, other.low); - - if (bestCase === worstCase) { - return bestCase; - } else { - return null; - } - } - }, { - key: "greaterThan", - value: function greaterThan(other) { - return Uncertainty.from(other).lessThan(this); - } - }, { - key: "lessThanOrEquals", - value: function lessThanOrEquals(other) { - return ThreeValuedLogic.not(this.greaterThan(Uncertainty.from(other))); - } - }, { - key: "greaterThanOrEquals", - value: function greaterThanOrEquals(other) { - return ThreeValuedLogic.not(this.lessThan(Uncertainty.from(other))); - } - }], [{ - key: "from", - value: function from(obj) { - if (obj != null && obj.isUncertainty) { - return obj; - } else { - return new Uncertainty(obj); - } - } - }]); - - return Uncertainty; -}(); - -module.exports = { - Uncertainty: Uncertainty -}; -},{"./logic":10}],14:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('../util/util'), - typeIsArray = _require2.typeIsArray, - allTrue = _require2.allTrue, - anyTrue = _require2.anyTrue, - removeNulls = _require2.removeNulls, - numerical_sort = _require2.numerical_sort; - -var _require3 = require('./builder'), - build = _require3.build; - -var _require4 = require('../datatypes/exception'), - Exception = _require4.Exception; - -var _require5 = require('../util/comparison'), - greaterThan = _require5.greaterThan, - lessThan = _require5.lessThan; - -var _require6 = require('../datatypes/quantity'), - Quantity = _require6.Quantity; - -var AggregateExpression = /*#__PURE__*/function (_Expression) { - _inherits(AggregateExpression, _Expression); - - var _super = _createSuper(AggregateExpression); - - function AggregateExpression(json) { - var _this; - - _classCallCheck(this, AggregateExpression); - - _this = _super.call(this, json); - _this.source = build(json.source); - return _this; - } - - return AggregateExpression; -}(Expression); - -var Count = /*#__PURE__*/function (_AggregateExpression) { - _inherits(Count, _AggregateExpression); - - var _super2 = _createSuper(Count); - - function Count(json) { - _classCallCheck(this, Count); - - return _super2.call(this, json); - } - - _createClass(Count, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - - if (typeIsArray(items)) { - return removeNulls(items).length; - } - - return 0; - } - }]); - - return Count; -}(AggregateExpression); - -var Sum = /*#__PURE__*/function (_AggregateExpression2) { - _inherits(Sum, _AggregateExpression2); - - var _super3 = _createSuper(Sum); - - function Sum(json) { - _classCallCheck(this, Sum); - - return _super3.call(this, json); - } - - _createClass(Sum, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - - if (!typeIsArray(items)) { - return null; - } - - try { - items = processQuantities(items); - } catch (e) { - return null; - } - - if (items.length === 0) { - return null; - } - - if (hasOnlyQuantities(items)) { - var values = getValuesFromQuantities(items); - var sum = values.reduce(function (x, y) { - return x + y; - }); - return new Quantity(sum, items[0].unit); - } else { - return items.reduce(function (x, y) { - return x + y; - }); - } - } - }]); - - return Sum; -}(AggregateExpression); - -var Min = /*#__PURE__*/function (_AggregateExpression3) { - _inherits(Min, _AggregateExpression3); - - var _super4 = _createSuper(Min); - - function Min(json) { - _classCallCheck(this, Min); - - return _super4.call(this, json); - } - - _createClass(Min, [{ - key: "exec", - value: function exec(ctx) { - var list = this.source.execute(ctx); - - if (list == null) { - return null; - } - - var listWithoutNulls = removeNulls(list); // Check for incompatible units and return null. We don't want to convert - // the units for Min/Max, so we throw away the converted array if it succeeds - - try { - processQuantities(list); - } catch (e) { - return null; - } - - if (listWithoutNulls.length === 0) { - return null; - } // We assume the list is an array of all the same type. - - - var minimum = listWithoutNulls[0]; - - var _iterator = _createForOfIteratorHelper(listWithoutNulls), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var element = _step.value; - - if (lessThan(element, minimum)) { - minimum = element; - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return minimum; - } - }]); - - return Min; -}(AggregateExpression); - -var Max = /*#__PURE__*/function (_AggregateExpression4) { - _inherits(Max, _AggregateExpression4); - - var _super5 = _createSuper(Max); - - function Max(json) { - _classCallCheck(this, Max); - - return _super5.call(this, json); - } - - _createClass(Max, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - - if (items == null) { - return null; - } - - var listWithoutNulls = removeNulls(items); // Check for incompatible units and return null. We don't want to convert - // the units for Min/Max, so we throw away the converted array if it succeeds - - try { - processQuantities(items); - } catch (e) { - return null; - } - - if (listWithoutNulls.length === 0) { - return null; - } // We assume the list is an array of all the same type. - - - var maximum = listWithoutNulls[0]; - - var _iterator2 = _createForOfIteratorHelper(listWithoutNulls), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var element = _step2.value; - - if (greaterThan(element, maximum)) { - maximum = element; - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - - return maximum; - } - }]); - - return Max; -}(AggregateExpression); - -var Avg = /*#__PURE__*/function (_AggregateExpression5) { - _inherits(Avg, _AggregateExpression5); - - var _super6 = _createSuper(Avg); - - function Avg(json) { - _classCallCheck(this, Avg); - - return _super6.call(this, json); - } - - _createClass(Avg, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - - if (!typeIsArray(items)) { - return null; - } - - try { - items = processQuantities(items); - } catch (e) { - return null; - } - - if (items.length === 0) { - return null; - } - - if (hasOnlyQuantities(items)) { - var values = getValuesFromQuantities(items); - var sum = values.reduce(function (x, y) { - return x + y; - }); - return new Quantity(sum / values.length, items[0].unit); - } else { - var _sum = items.reduce(function (x, y) { - return x + y; - }); - - return _sum / items.length; - } - } - }]); - - return Avg; -}(AggregateExpression); - -var Median = /*#__PURE__*/function (_AggregateExpression6) { - _inherits(Median, _AggregateExpression6); - - var _super7 = _createSuper(Median); - - function Median(json) { - _classCallCheck(this, Median); - - return _super7.call(this, json); - } - - _createClass(Median, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - - if (!typeIsArray(items)) { - return null; - } - - if (items.length === 0) { - return null; - } - - try { - items = processQuantities(items); - } catch (e) { - return null; - } - - if (!hasOnlyQuantities(items)) { - return medianOfNumbers(items); - } - - var values = getValuesFromQuantities(items); - var median = medianOfNumbers(values); - return new Quantity(median, items[0].unit); - } - }]); - - return Median; -}(AggregateExpression); - -var Mode = /*#__PURE__*/function (_AggregateExpression7) { - _inherits(Mode, _AggregateExpression7); - - var _super8 = _createSuper(Mode); - - function Mode(json) { - _classCallCheck(this, Mode); - - return _super8.call(this, json); - } - - _createClass(Mode, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - - if (!typeIsArray(items)) { - return null; - } - - if (items.length === 0) { - return null; - } - - var filtered; - - try { - filtered = processQuantities(items); - } catch (e) { - return null; - } - - if (hasOnlyQuantities(filtered)) { - var values = getValuesFromQuantities(filtered); - var mode = this.mode(values); - - if (mode.length === 1) { - mode = mode[0]; - } - - return new Quantity(mode, items[0].unit); - } else { - var _mode = this.mode(filtered); - - if (_mode.length === 1) { - return _mode[0]; - } else { - return _mode; - } - } - } - }, { - key: "mode", - value: function mode(arr) { - var max = 0; - var counts = {}; - var results = []; - - var _iterator3 = _createForOfIteratorHelper(arr), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var elem = _step3.value; - var cnt = counts[elem] = (counts[elem] != null ? counts[elem] : 0) + 1; - - if (cnt === max && !results.includes(elem)) { - results.push(elem); - } else if (cnt > max) { - results = [elem]; - max = cnt; - } - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - - return results; - } - }]); - - return Mode; -}(AggregateExpression); - -var StdDev = /*#__PURE__*/function (_AggregateExpression8) { - _inherits(StdDev, _AggregateExpression8); - - var _super9 = _createSuper(StdDev); - - // TODO: This should be a derived class of an abstract base class 'Statistic' - // rather than the base class - function StdDev(json) { - var _this2; - - _classCallCheck(this, StdDev); - - _this2 = _super9.call(this, json); - _this2.type = 'standard_deviation'; - return _this2; - } - - _createClass(StdDev, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - - if (!typeIsArray(items)) { - return null; - } - - try { - items = processQuantities(items); - } catch (e) { - return null; - } - - if (items.length === 0) { - return null; - } - - if (hasOnlyQuantities(items)) { - var values = getValuesFromQuantities(items); - var stdDev = this.standardDeviation(values); - return new Quantity(stdDev, items[0].unit); - } else { - return this.standardDeviation(items); - } - } - }, { - key: "standardDeviation", - value: function standardDeviation(list) { - var val = this.stats(list); - - if (val) { - return val[this.type]; - } - } - }, { - key: "stats", - value: function stats(list) { - var sum = list.reduce(function (x, y) { - return x + y; - }); - var mean = sum / list.length; - var sumOfSquares = 0; - - var _iterator4 = _createForOfIteratorHelper(list), - _step4; - - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { - var sq = _step4.value; - sumOfSquares += Math.pow(sq - mean, 2); - } - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - - var std_var = 1 / (list.length - 1) * sumOfSquares; - var pop_var = 1 / list.length * sumOfSquares; - var std_dev = Math.sqrt(std_var); - var pop_dev = Math.sqrt(pop_var); - return { - standard_variance: std_var, - population_variance: pop_var, - standard_deviation: std_dev, - population_deviation: pop_dev - }; - } - }]); - - return StdDev; -}(AggregateExpression); - -var Product = /*#__PURE__*/function (_AggregateExpression9) { - _inherits(Product, _AggregateExpression9); - - var _super10 = _createSuper(Product); - - function Product(json) { - _classCallCheck(this, Product); - - return _super10.call(this, json); - } - - _createClass(Product, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - - if (!typeIsArray(items)) { - return null; - } - - try { - items = processQuantities(items); - } catch (e) { - return null; - } - - if (items.length === 0) { - return null; - } - - if (hasOnlyQuantities(items)) { - var values = getValuesFromQuantities(items); - var product = values.reduce(function (x, y) { - return x * y; - }); // Units are not multiplied for the geometric product - - return new Quantity(product, items[0].unit); - } else { - return items.reduce(function (x, y) { - return x * y; - }); - } - } - }]); - - return Product; -}(AggregateExpression); - -var GeometricMean = /*#__PURE__*/function (_AggregateExpression10) { - _inherits(GeometricMean, _AggregateExpression10); - - var _super11 = _createSuper(GeometricMean); - - function GeometricMean(json) { - _classCallCheck(this, GeometricMean); - - return _super11.call(this, json); - } - - _createClass(GeometricMean, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - - if (!typeIsArray(items)) { - return null; - } - - try { - items = processQuantities(items); - } catch (e) { - return null; - } - - if (items.length === 0) { - return null; - } - - if (hasOnlyQuantities(items)) { - var values = getValuesFromQuantities(items); - var product = values.reduce(function (x, y) { - return x * y; - }); - var geoMean = Math.pow(product, 1.0 / items.length); - return new Quantity(geoMean, items[0].unit); - } else { - var _product = items.reduce(function (x, y) { - return x * y; - }); - - return Math.pow(_product, 1.0 / items.length); - } - } - }]); - - return GeometricMean; -}(AggregateExpression); - -var PopulationStdDev = /*#__PURE__*/function (_StdDev) { - _inherits(PopulationStdDev, _StdDev); - - var _super12 = _createSuper(PopulationStdDev); - - function PopulationStdDev(json) { - var _this3; - - _classCallCheck(this, PopulationStdDev); - - _this3 = _super12.call(this, json); - _this3.type = 'population_deviation'; - return _this3; - } - - return PopulationStdDev; -}(StdDev); - -var Variance = /*#__PURE__*/function (_StdDev2) { - _inherits(Variance, _StdDev2); - - var _super13 = _createSuper(Variance); - - function Variance(json) { - var _this4; - - _classCallCheck(this, Variance); - - _this4 = _super13.call(this, json); - _this4.type = 'standard_variance'; - return _this4; - } - - return Variance; -}(StdDev); - -var PopulationVariance = /*#__PURE__*/function (_StdDev3) { - _inherits(PopulationVariance, _StdDev3); - - var _super14 = _createSuper(PopulationVariance); - - function PopulationVariance(json) { - var _this5; - - _classCallCheck(this, PopulationVariance); - - _this5 = _super14.call(this, json); - _this5.type = 'population_variance'; - return _this5; - } - - return PopulationVariance; -}(StdDev); - -var AllTrue = /*#__PURE__*/function (_AggregateExpression11) { - _inherits(AllTrue, _AggregateExpression11); - - var _super15 = _createSuper(AllTrue); - - function AllTrue(json) { - _classCallCheck(this, AllTrue); - - return _super15.call(this, json); - } - - _createClass(AllTrue, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - return allTrue(removeNulls(items)); - } - }]); - - return AllTrue; -}(AggregateExpression); - -var AnyTrue = /*#__PURE__*/function (_AggregateExpression12) { - _inherits(AnyTrue, _AggregateExpression12); - - var _super16 = _createSuper(AnyTrue); - - function AnyTrue(json) { - _classCallCheck(this, AnyTrue); - - return _super16.call(this, json); - } - - _createClass(AnyTrue, [{ - key: "exec", - value: function exec(ctx) { - var items = this.source.execute(ctx); - return anyTrue(items); - } - }]); - - return AnyTrue; -}(AggregateExpression); - -function processQuantities(values) { - var items = removeNulls(values); - - if (hasOnlyQuantities(items)) { - return convertAllUnits(items); - } else if (hasSomeQuantities(items)) { - throw new Exception('Cannot perform aggregate operations on mixed values of Quantities and non Quantities'); - } else { - return items; - } -} - -function getValuesFromQuantities(quantities) { - return quantities.map(function (quantity) { - return quantity.value; - }); -} - -function hasOnlyQuantities(arr) { - return arr.every(function (x) { - return x.isQuantity; - }); -} - -function hasSomeQuantities(arr) { - return arr.some(function (x) { - return x.isQuantity; - }); -} - -function convertAllUnits(arr) { - // convert all quantities in array to match the unit of the first item - return arr.map(function (q) { - return q.convertUnit(arr[0].unit); - }); -} - -function medianOfNumbers(numbers) { - var items = numerical_sort(numbers, 'asc'); - - if (items.length % 2 === 1) { - // Odd number of items - return items[(items.length - 1) / 2]; - } else { - // Even number of items - return (items[items.length / 2 - 1] + items[items.length / 2]) / 2; - } -} - -module.exports = { - Count: Count, - Sum: Sum, - Min: Min, - Max: Max, - Avg: Avg, - Median: Median, - Mode: Mode, - StdDev: StdDev, - Product: Product, - GeometricMean: GeometricMean, - PopulationStdDev: PopulationStdDev, - Variance: Variance, - PopulationVariance: PopulationVariance, - AllTrue: AllTrue, - AnyTrue: AnyTrue -}; -},{"../datatypes/exception":8,"../datatypes/quantity":11,"../util/comparison":47,"../util/util":50,"./builder":16,"./expression":22}],15:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('./builder'), - build = _require2.build; - -var MathUtil = require('../util/math'); - -var _require3 = require('../datatypes/quantity'), - Quantity = _require3.Quantity, - doAddition = _require3.doAddition, - doSubtraction = _require3.doSubtraction, - doMultiplication = _require3.doMultiplication, - doDivision = _require3.doDivision; - -var _require4 = require('../datatypes/uncertainty'), - Uncertainty = _require4.Uncertainty; - -var Add = /*#__PURE__*/function (_Expression) { - _inherits(Add, _Expression); - - var _super = _createSuper(Add); - - function Add(json) { - _classCallCheck(this, Add); - - return _super.call(this, json); - } - - _createClass(Add, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args == null || args.some(function (x) { - return x == null; - })) { - return null; - } - - var sum = args.reduce(function (x, y) { - if (x.isUncertainty && !y.isUncertainty) { - y = new Uncertainty(y, y); - } else if (y.isUncertainty && !x.isUncertainty) { - x = new Uncertainty(x, x); - } - - if (x.isQuantity || x.isDateTime || x.isDate || x.isTime && x.isTime()) { - return doAddition(x, y); - } else if (x.isUncertainty && y.isUncertainty) { - if (x.low.isQuantity || x.low.isDateTime || x.low.isDate || x.low.isTime && x.low.isTime()) { - return new Uncertainty(doAddition(x.low, y.low), doAddition(x.high, y.high)); - } else { - return new Uncertainty(x.low + y.low, x.high + y.high); - } - } else { - return x + y; - } - }); - - if (MathUtil.overflowsOrUnderflows(sum)) { - return null; - } - - return sum; - } - }]); - - return Add; -}(Expression); - -var Subtract = /*#__PURE__*/function (_Expression2) { - _inherits(Subtract, _Expression2); - - var _super2 = _createSuper(Subtract); - - function Subtract(json) { - _classCallCheck(this, Subtract); - - return _super2.call(this, json); - } - - _createClass(Subtract, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args == null || args.some(function (x) { - return x == null; - })) { - return null; - } - - var difference = args.reduce(function (x, y) { - if (x.isUncertainty && !y.isUncertainty) { - y = new Uncertainty(y, y); - } else if (y.isUncertainty && !x.isUncertainty) { - x = new Uncertainty(x, x); - } - - if (x.isQuantity || x.isDateTime || x.isDate) { - return doSubtraction(x, y); - } else if (x.isUncertainty && y.isUncertainty) { - if (x.low.isQuantity || x.low.isDateTime || x.low.isDate) { - return new Uncertainty(doSubtraction(x.low, y.high), doSubtraction(x.high, y.low)); - } else { - return new Uncertainty(x.low - y.high, x.high - y.low); - } - } else { - return x - y; - } - }); - - if (MathUtil.overflowsOrUnderflows(difference)) { - return null; - } - - return difference; - } - }]); - - return Subtract; -}(Expression); - -var Multiply = /*#__PURE__*/function (_Expression3) { - _inherits(Multiply, _Expression3); - - var _super3 = _createSuper(Multiply); - - function Multiply(json) { - _classCallCheck(this, Multiply); - - return _super3.call(this, json); - } - - _createClass(Multiply, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args == null || args.some(function (x) { - return x == null; - })) { - return null; - } - - var product = args.reduce(function (x, y) { - if (x.isUncertainty && !y.isUncertainty) { - y = new Uncertainty(y, y); - } else if (y.isUncertainty && !x.isUncertainty) { - x = new Uncertainty(x, x); - } - - if (x.isQuantity || y.isQuantity) { - return doMultiplication(x, y); - } else if (x.isUncertainty && y.isUncertainty) { - if (x.low.isQuantity) { - return new Uncertainty(doMultiplication(x.low, y.low), doMultiplication(x.high, y.high)); - } else { - return new Uncertainty(x.low * y.low, x.high * y.high); - } - } else { - return x * y; - } - }); - - if (MathUtil.overflowsOrUnderflows(product)) { - return null; - } - - return product; - } - }]); - - return Multiply; -}(Expression); - -var Divide = /*#__PURE__*/function (_Expression4) { - _inherits(Divide, _Expression4); - - var _super4 = _createSuper(Divide); - - function Divide(json) { - _classCallCheck(this, Divide); - - return _super4.call(this, json); - } - - _createClass(Divide, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args == null || args.some(function (x) { - return x == null; - })) { - return null; - } - - var quotient = args.reduce(function (x, y) { - if (x.isUncertainty && !y.isUncertainty) { - y = new Uncertainty(y, y); - } else if (y.isUncertainty && !x.isUncertainty) { - x = new Uncertainty(x, x); - } - - if (x.isQuantity) { - return doDivision(x, y); - } else if (x.isUncertainty && y.isUncertainty) { - if (x.low.isQuantity) { - return new Uncertainty(doDivision(x.low, y.high), doDivision(x.high, y.low)); - } else { - return new Uncertainty(x.low / y.high, x.high / y.low); - } - } else { - return x / y; - } - }); // Note, anything divided by 0 is Infinity in Javascript, which will be - // considered as overflow by this check. - - if (MathUtil.overflowsOrUnderflows(quotient)) { - return null; - } - - return quotient; - } - }]); - - return Divide; -}(Expression); - -var TruncatedDivide = /*#__PURE__*/function (_Expression5) { - _inherits(TruncatedDivide, _Expression5); - - var _super5 = _createSuper(TruncatedDivide); - - function TruncatedDivide(json) { - _classCallCheck(this, TruncatedDivide); - - return _super5.call(this, json); - } - - _createClass(TruncatedDivide, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args == null || args.some(function (x) { - return x == null; - })) { - return null; - } - - var quotient = args.reduce(function (x, y) { - return x / y; - }); - var truncatedQuotient = quotient >= 0 ? Math.floor(quotient) : Math.ceil(quotient); - - if (MathUtil.overflowsOrUnderflows(truncatedQuotient)) { - return null; - } - - return truncatedQuotient; - } - }]); - - return TruncatedDivide; -}(Expression); - -var Modulo = /*#__PURE__*/function (_Expression6) { - _inherits(Modulo, _Expression6); - - var _super6 = _createSuper(Modulo); - - function Modulo(json) { - _classCallCheck(this, Modulo); - - return _super6.call(this, json); - } - - _createClass(Modulo, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args == null || args.some(function (x) { - return x == null; - })) { - return null; - } - - var modulo = args.reduce(function (x, y) { - return x % y; - }); - return MathUtil.decimalOrNull(modulo); - } - }]); - - return Modulo; -}(Expression); - -var Ceiling = /*#__PURE__*/function (_Expression7) { - _inherits(Ceiling, _Expression7); - - var _super7 = _createSuper(Ceiling); - - function Ceiling(json) { - _classCallCheck(this, Ceiling); - - return _super7.call(this, json); - } - - _createClass(Ceiling, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } - - return Math.ceil(arg); - } - }]); - - return Ceiling; -}(Expression); - -var Floor = /*#__PURE__*/function (_Expression8) { - _inherits(Floor, _Expression8); - - var _super8 = _createSuper(Floor); - - function Floor(json) { - _classCallCheck(this, Floor); - - return _super8.call(this, json); - } - - _createClass(Floor, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } - - return Math.floor(arg); - } - }]); - - return Floor; -}(Expression); - -var Truncate = /*#__PURE__*/function (_Expression9) { - _inherits(Truncate, _Expression9); - - var _super9 = _createSuper(Truncate); - - function Truncate(json) { - _classCallCheck(this, Truncate); - - return _super9.call(this, json); - } - - _createClass(Truncate, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } - - return arg >= 0 ? Math.floor(arg) : Math.ceil(arg); - } - }]); - - return Truncate; -}(Expression); - -var Abs = /*#__PURE__*/function (_Expression10) { - _inherits(Abs, _Expression10); - - var _super10 = _createSuper(Abs); - - function Abs(json) { - _classCallCheck(this, Abs); - - return _super10.call(this, json); - } - - _createClass(Abs, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } else if (arg.isQuantity) { - return new Quantity(Math.abs(arg.value), arg.unit); - } else { - return Math.abs(arg); - } - } - }]); - - return Abs; -}(Expression); - -var Negate = /*#__PURE__*/function (_Expression11) { - _inherits(Negate, _Expression11); - - var _super11 = _createSuper(Negate); - - function Negate(json) { - _classCallCheck(this, Negate); - - return _super11.call(this, json); - } - - _createClass(Negate, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } else if (arg.isQuantity) { - return new Quantity(arg.value * -1, arg.unit); - } else { - return arg * -1; - } - } - }]); - - return Negate; -}(Expression); - -var Round = /*#__PURE__*/function (_Expression12) { - _inherits(Round, _Expression12); - - var _super12 = _createSuper(Round); - - function Round(json) { - var _this; - - _classCallCheck(this, Round); - - _this = _super12.call(this, json); - _this.precision = build(json.precision); - return _this; - } - - _createClass(Round, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } - - var dec = this.precision != null ? this.precision.execute(ctx) : 0; - return Math.round(arg * Math.pow(10, dec)) / Math.pow(10, dec); - } - }]); - - return Round; -}(Expression); - -var Ln = /*#__PURE__*/function (_Expression13) { - _inherits(Ln, _Expression13); - - var _super13 = _createSuper(Ln); - - function Ln(json) { - _classCallCheck(this, Ln); - - return _super13.call(this, json); - } - - _createClass(Ln, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } - - var ln = Math.log(arg); - return MathUtil.decimalOrNull(ln); - } - }]); - - return Ln; -}(Expression); - -var Exp = /*#__PURE__*/function (_Expression14) { - _inherits(Exp, _Expression14); - - var _super14 = _createSuper(Exp); - - function Exp(json) { - _classCallCheck(this, Exp); - - return _super14.call(this, json); - } - - _createClass(Exp, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } - - var power = Math.exp(arg); - - if (MathUtil.overflowsOrUnderflows(power)) { - return null; - } - - return power; - } - }]); - - return Exp; -}(Expression); - -var Log = /*#__PURE__*/function (_Expression15) { - _inherits(Log, _Expression15); - - var _super15 = _createSuper(Log); - - function Log(json) { - _classCallCheck(this, Log); - - return _super15.call(this, json); - } - - _createClass(Log, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args == null || args.some(function (x) { - return x == null; - })) { - return null; - } - - var log = args.reduce(function (x, y) { - return Math.log(x) / Math.log(y); - }); - return MathUtil.decimalOrNull(log); - } - }]); - - return Log; -}(Expression); - -var Power = /*#__PURE__*/function (_Expression16) { - _inherits(Power, _Expression16); - - var _super16 = _createSuper(Power); - - function Power(json) { - _classCallCheck(this, Power); - - return _super16.call(this, json); - } - - _createClass(Power, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args == null || args.some(function (x) { - return x == null; - })) { - return null; - } - - var power = args.reduce(function (x, y) { - return Math.pow(x, y); - }); - - if (MathUtil.overflowsOrUnderflows(power)) { - return null; - } - - return power; - } - }]); - - return Power; -}(Expression); - -var MinValue = /*#__PURE__*/function (_Expression17) { - _inherits(MinValue, _Expression17); - - var _super17 = _createSuper(MinValue); - - function MinValue(json) { - var _this2; - - _classCallCheck(this, MinValue); - - _this2 = _super17.call(this, json); - _this2.valueType = json.valueType; - return _this2; - } - - _createClass(MinValue, [{ - key: "exec", - value: function exec(ctx) { - if (MinValue.MIN_VALUES[this.valueType]) { - if (this.valueType === '{urn:hl7-org:elm-types:r1}DateTime') { - var minDateTime = MinValue.MIN_VALUES[this.valueType].copy(); - minDateTime.timezoneOffset = ctx.getTimezoneOffset(); - return minDateTime; - } else { - return MinValue.MIN_VALUES[this.valueType]; - } - } else { - throw new Error("Minimum not supported for ".concat(this.valueType)); - } - } - }]); - - return MinValue; -}(Expression); - -MinValue.MIN_VALUES = {}; -MinValue.MIN_VALUES['{urn:hl7-org:elm-types:r1}Integer'] = MathUtil.MIN_INT_VALUE; -MinValue.MIN_VALUES['{urn:hl7-org:elm-types:r1}Decimal'] = MathUtil.MIN_FLOAT_VALUE; -MinValue.MIN_VALUES['{urn:hl7-org:elm-types:r1}DateTime'] = MathUtil.MIN_DATETIME_VALUE; -MinValue.MIN_VALUES['{urn:hl7-org:elm-types:r1}Date'] = MathUtil.MIN_DATE_VALUE; -MinValue.MIN_VALUES['{urn:hl7-org:elm-types:r1}Time'] = MathUtil.MIN_TIME_VALUE; - -var MaxValue = /*#__PURE__*/function (_Expression18) { - _inherits(MaxValue, _Expression18); - - var _super18 = _createSuper(MaxValue); - - function MaxValue(json) { - var _this3; - - _classCallCheck(this, MaxValue); - - _this3 = _super18.call(this, json); - _this3.valueType = json.valueType; - return _this3; - } - - _createClass(MaxValue, [{ - key: "exec", - value: function exec(ctx) { - if (MaxValue.MAX_VALUES[this.valueType] != null) { - if (this.valueType === '{urn:hl7-org:elm-types:r1}DateTime') { - var maxDateTime = MaxValue.MAX_VALUES[this.valueType].copy(); - maxDateTime.timezoneOffset = ctx.getTimezoneOffset(); - return maxDateTime; - } else { - return MaxValue.MAX_VALUES[this.valueType]; - } - } else { - throw new Error("Maximum not supported for ".concat(this.valueType)); - } - } - }]); - - return MaxValue; -}(Expression); - -MaxValue.MAX_VALUES = {}; -MaxValue.MAX_VALUES['{urn:hl7-org:elm-types:r1}Integer'] = MathUtil.MAX_INT_VALUE; -MaxValue.MAX_VALUES['{urn:hl7-org:elm-types:r1}Decimal'] = MathUtil.MAX_FLOAT_VALUE; -MaxValue.MAX_VALUES['{urn:hl7-org:elm-types:r1}DateTime'] = MathUtil.MAX_DATETIME_VALUE; -MaxValue.MAX_VALUES['{urn:hl7-org:elm-types:r1}Date'] = MathUtil.MAX_DATE_VALUE; -MaxValue.MAX_VALUES['{urn:hl7-org:elm-types:r1}Time'] = MathUtil.MAX_TIME_VALUE; - -var Successor = /*#__PURE__*/function (_Expression19) { - _inherits(Successor, _Expression19); - - var _super19 = _createSuper(Successor); - - function Successor(json) { - _classCallCheck(this, Successor); - - return _super19.call(this, json); - } - - _createClass(Successor, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } - - var successor = null; - - try { - // MathUtil.successor throws on overflow, and the exception is used in - // the logic for evaluating `meets`, so it can't be changed to just return null - successor = MathUtil.successor(arg); - } catch (e) { - if (e instanceof MathUtil.OverFlowException) { - return null; - } - } - - if (MathUtil.overflowsOrUnderflows(successor)) { - return null; - } - - return successor; - } - }]); - - return Successor; -}(Expression); - -var Predecessor = /*#__PURE__*/function (_Expression20) { - _inherits(Predecessor, _Expression20); - - var _super20 = _createSuper(Predecessor); - - function Predecessor(json) { - _classCallCheck(this, Predecessor); - - return _super20.call(this, json); - } - - _createClass(Predecessor, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } - - var predecessor = null; - - try { - // MathUtil.predecessor throws on underflow, and the exception is used in - // the logic for evaluating `meets`, so it can't be changed to just return null - predecessor = MathUtil.predecessor(arg); - } catch (e) { - if (e instanceof MathUtil.OverFlowException) { - return null; - } - } - - if (MathUtil.overflowsOrUnderflows(predecessor)) { - return null; - } - - return predecessor; - } - }]); - - return Predecessor; -}(Expression); - -module.exports = { - Abs: Abs, - Add: Add, - Ceiling: Ceiling, - Divide: Divide, - Exp: Exp, - Floor: Floor, - Ln: Ln, - Log: Log, - MaxValue: MaxValue, - MinValue: MinValue, - Modulo: Modulo, - Multiply: Multiply, - Negate: Negate, - Power: Power, - Predecessor: Predecessor, - Round: Round, - Subtract: Subtract, - Successor: Successor, - Truncate: Truncate, - TruncatedDivide: TruncatedDivide -}; -},{"../datatypes/quantity":11,"../datatypes/uncertainty":13,"../util/math":48,"./builder":16,"./expression":22}],16:[function(require,module,exports){ -"use strict"; - -var E = require('./expressions'); - -var _require = require('../util/util'), - typeIsArray = _require.typeIsArray; - -function build(json) { - if (json == null) { - return json; - } - - if (typeIsArray(json)) { - return json.map(function (child) { - return build(child); - }); - } - - if (json.type === 'FunctionRef') { - return new E.FunctionRef(json); - } else if (json.type === 'Literal') { - return E.Literal.from(json); - } else if (functionExists(json.type)) { - return constructByName(json.type, json); - } else { - return null; - } -} - -function functionExists(name) { - return typeof E[name] === 'function'; -} - -function constructByName(name, json) { - return new E[name](json); -} - -module.exports = { - build: build -}; -},{"../util/util":50,"./expressions":23}],17:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var dt = require('../datatypes/datatypes'); - -var _require2 = require('./builder'), - build = _require2.build; - -var ValueSetDef = /*#__PURE__*/function (_Expression) { - _inherits(ValueSetDef, _Expression); - - var _super = _createSuper(ValueSetDef); - - function ValueSetDef(json) { - var _this; - - _classCallCheck(this, ValueSetDef); - - _this = _super.call(this, json); - _this.name = json.name; - _this.id = json.id; - _this.version = json.version; - return _this; - } //todo: code systems and versions - - - _createClass(ValueSetDef, [{ - key: "exec", - value: function exec(ctx) { - var valueset = ctx.codeService.findValueSet(this.id, this.version) || new dt.ValueSet(this.id, this.version); - ctx.rootContext().set(this.name, valueset); - return valueset; - } - }]); - - return ValueSetDef; -}(Expression); - -var ValueSetRef = /*#__PURE__*/function (_Expression2) { - _inherits(ValueSetRef, _Expression2); - - var _super2 = _createSuper(ValueSetRef); - - function ValueSetRef(json) { - var _this2; - - _classCallCheck(this, ValueSetRef); - - _this2 = _super2.call(this, json); - _this2.name = json.name; - _this2.libraryName = json.libraryName; - return _this2; - } - - _createClass(ValueSetRef, [{ - key: "exec", - value: function exec(ctx) { - // TODO: This calls the code service every time-- should be optimized - var valueset = ctx.getValueSet(this.name, this.libraryName); - - if (valueset instanceof Expression) { - valueset = valueset.execute(ctx); - } - - return valueset; - } - }]); - - return ValueSetRef; -}(Expression); - -var AnyInValueSet = /*#__PURE__*/function (_Expression3) { - _inherits(AnyInValueSet, _Expression3); - - var _super3 = _createSuper(AnyInValueSet); - - function AnyInValueSet(json) { - var _this3; - - _classCallCheck(this, AnyInValueSet); - - _this3 = _super3.call(this, json); - _this3.codes = build(json.codes); - _this3.valueset = new ValueSetRef(json.valueset); - return _this3; - } - - _createClass(AnyInValueSet, [{ - key: "exec", - value: function exec(ctx) { - var valueset = this.valueset.execute(ctx); // If the value set reference cannot be resolved, a run-time error is thrown. - - if (valueset == null || !valueset.isValueSet) { - throw new Error('ValueSet must be provided to InValueSet function'); - } - - var codes = this.codes.exec(ctx); - return codes != null && codes.some(function (code) { - return valueset.hasMatch(code); - }); - } - }]); - - return AnyInValueSet; -}(Expression); - -var InValueSet = /*#__PURE__*/function (_Expression4) { - _inherits(InValueSet, _Expression4); - - var _super4 = _createSuper(InValueSet); - - function InValueSet(json) { - var _this4; - - _classCallCheck(this, InValueSet); - - _this4 = _super4.call(this, json); - _this4.code = build(json.code); - _this4.valueset = new ValueSetRef(json.valueset); - return _this4; - } - - _createClass(InValueSet, [{ - key: "exec", - value: function exec(ctx) { - // If the code argument is null, the result is false - if (this.code == null) { - return false; - } - - if (this.valueset == null) { - throw new Error('ValueSet must be provided to InValueSet function'); - } - - var code = this.code.execute(ctx); // spec indicates to return false if code is null, throw error if value set cannot be resolved - - if (code == null) { - return false; - } - - var valueset = this.valueset.execute(ctx); - - if (valueset == null || !valueset.isValueSet) { - throw new Error('ValueSet must be provided to InValueSet function'); - } // If there is a code and valueset return whether or not the valueset has the code - - - return valueset.hasMatch(code); - } - }]); - - return InValueSet; -}(Expression); - -var CodeSystemDef = /*#__PURE__*/function (_Expression5) { - _inherits(CodeSystemDef, _Expression5); - - var _super5 = _createSuper(CodeSystemDef); - - function CodeSystemDef(json) { - var _this5; - - _classCallCheck(this, CodeSystemDef); - - _this5 = _super5.call(this, json); - _this5.name = json.name; - _this5.id = json.id; - _this5.version = json.version; - return _this5; - } - - _createClass(CodeSystemDef, [{ - key: "exec", - value: function exec(ctx) { - return new dt.CodeSystem(this.id, this.version); - } - }]); - - return CodeSystemDef; -}(Expression); - -var CodeDef = /*#__PURE__*/function (_Expression6) { - _inherits(CodeDef, _Expression6); - - var _super6 = _createSuper(CodeDef); - - function CodeDef(json) { - var _this6; - - _classCallCheck(this, CodeDef); - - _this6 = _super6.call(this, json); - _this6.name = json.name; - _this6.id = json.id; - _this6.systemName = json.codeSystem.name; - _this6.display = json.display; - return _this6; - } - - _createClass(CodeDef, [{ - key: "exec", - value: function exec(ctx) { - var system = ctx.getCodeSystem(this.systemName).execute(ctx); - return new dt.Code(this.id, system.id, system.version, this.display); - } - }]); - - return CodeDef; -}(Expression); - -var CodeRef = /*#__PURE__*/function (_Expression7) { - _inherits(CodeRef, _Expression7); - - var _super7 = _createSuper(CodeRef); - - function CodeRef(json) { - var _this7; - - _classCallCheck(this, CodeRef); - - _this7 = _super7.call(this, json); - _this7.name = json.name; - _this7.library = json.libraryName; - return _this7; - } - - _createClass(CodeRef, [{ - key: "exec", - value: function exec(ctx) { - ctx = this.library ? ctx.getLibraryContext(this.library) : ctx; - var codeDef = ctx.getCode(this.name); - return codeDef ? codeDef.execute(ctx) : undefined; - } - }]); - - return CodeRef; -}(Expression); - -var Code = /*#__PURE__*/function (_Expression8) { - _inherits(Code, _Expression8); - - var _super8 = _createSuper(Code); - - function Code(json) { - var _this8; - - _classCallCheck(this, Code); - - _this8 = _super8.call(this, json); - _this8.code = json.code; - _this8.systemName = json.system.name; - _this8.version = json.version; - _this8.display = json.display; - return _this8; - } // Define a simple getter to allow type-checking of this class without instanceof - // and in a way that survives minification (as opposed to checking constructor.name) - - - _createClass(Code, [{ - key: "isCode", - get: function get() { - return true; - } - }, { - key: "exec", - value: function exec(ctx) { - var system = ctx.getCodeSystem(this.systemName) || {}; - return new dt.Code(this.code, system.id, this.version, this.display); - } - }]); - - return Code; -}(Expression); - -var ConceptDef = /*#__PURE__*/function (_Expression9) { - _inherits(ConceptDef, _Expression9); - - var _super9 = _createSuper(ConceptDef); - - function ConceptDef(json) { - var _this9; - - _classCallCheck(this, ConceptDef); - - _this9 = _super9.call(this, json); - _this9.name = json.name; - _this9.display = json.display; - _this9.codes = json.code; - return _this9; - } - - _createClass(ConceptDef, [{ - key: "exec", - value: function exec(ctx) { - var codes = this.codes.map(function (code) { - var codeDef = ctx.getCode(code.name); - return codeDef ? codeDef.execute(ctx) : undefined; - }); - return new dt.Concept(codes, this.display); - } - }]); - - return ConceptDef; -}(Expression); - -var ConceptRef = /*#__PURE__*/function (_Expression10) { - _inherits(ConceptRef, _Expression10); - - var _super10 = _createSuper(ConceptRef); - - function ConceptRef(json) { - var _this10; - - _classCallCheck(this, ConceptRef); - - _this10 = _super10.call(this, json); - _this10.name = json.name; - return _this10; - } - - _createClass(ConceptRef, [{ - key: "exec", - value: function exec(ctx) { - var conceptDef = ctx.getConcept(this.name); - return conceptDef ? conceptDef.execute(ctx) : undefined; - } - }]); - - return ConceptRef; -}(Expression); - -var Concept = /*#__PURE__*/function (_Expression11) { - _inherits(Concept, _Expression11); - - var _super11 = _createSuper(Concept); - - function Concept(json) { - var _this11; - - _classCallCheck(this, Concept); - - _this11 = _super11.call(this, json); - _this11.codes = json.code; - _this11.display = json.display; - return _this11; - } // Define a simple getter to allow type-checking of this class without instanceof - // and in a way that survives minification (as opposed to checking constructor.name) - - - _createClass(Concept, [{ - key: "isConcept", - get: function get() { - return true; - } - }, { - key: "toCode", - value: function toCode(ctx, code) { - var system = ctx.getCodeSystem(code.system.name) || {}; - return new dt.Code(code.code, system.id, code.version, code.display); - } - }, { - key: "exec", - value: function exec(ctx) { - var _this12 = this; - - var codes = this.codes.map(function (code) { - return _this12.toCode(ctx, code); - }); - return new dt.Concept(codes, this.display); - } - }]); - - return Concept; -}(Expression); - -var CalculateAge = /*#__PURE__*/function (_Expression12) { - _inherits(CalculateAge, _Expression12); - - var _super12 = _createSuper(CalculateAge); - - function CalculateAge(json) { - var _this13; - - _classCallCheck(this, CalculateAge); - - _this13 = _super12.call(this, json); - _this13.precision = json.precision; - return _this13; - } - - _createClass(CalculateAge, [{ - key: "exec", - value: function exec(ctx) { - var date1 = this.execArgs(ctx); - var date2 = dt.DateTime.fromJSDate(ctx.getExecutionDateTime()); - var result = date1 != null ? date1.durationBetween(date2, this.precision.toLowerCase()) : undefined; - - if (result != null && result.isPoint()) { - return result.low; - } else { - return result; - } - } - }]); - - return CalculateAge; -}(Expression); - -var CalculateAgeAt = /*#__PURE__*/function (_Expression13) { - _inherits(CalculateAgeAt, _Expression13); - - var _super13 = _createSuper(CalculateAgeAt); - - function CalculateAgeAt(json) { - var _this14; - - _classCallCheck(this, CalculateAgeAt); - - _this14 = _super13.call(this, json); - _this14.precision = json.precision; - return _this14; - } - - _createClass(CalculateAgeAt, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs = this.execArgs(ctx), - _this$execArgs2 = _slicedToArray(_this$execArgs, 2), - date1 = _this$execArgs2[0], - date2 = _this$execArgs2[1]; - - if (date1 != null && date2 != null) { - // date1 is the birthdate, convert it to date if date2 is a date (to support ignoring time) - if (date2.isDate && date1.isDateTime) { - date1 = date1.getDate(); - } - - var result = date1.durationBetween(date2, this.precision.toLowerCase()); - - if (result != null && result.isPoint()) { - return result.low; - } else { - return result; - } - } - - return null; - } - }]); - - return CalculateAgeAt; -}(Expression); - -module.exports = { - AnyInValueSet: AnyInValueSet, - CalculateAge: CalculateAge, - CalculateAgeAt: CalculateAgeAt, - Code: Code, - CodeDef: CodeDef, - CodeRef: CodeRef, - CodeSystemDef: CodeSystemDef, - Concept: Concept, - ConceptDef: ConceptDef, - ConceptRef: ConceptRef, - InValueSet: InValueSet, - ValueSetDef: ValueSetDef, - ValueSetRef: ValueSetRef -}; -},{"../datatypes/datatypes":6,"./builder":16,"./expression":22}],18:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('../datatypes/datatypes'), - Uncertainty = _require2.Uncertainty; // Equal is completely handled by overloaded#Equal -// NotEqual is completely handled by overloaded#Equal - - -var Less = /*#__PURE__*/function (_Expression) { - _inherits(Less, _Expression); - - var _super = _createSuper(Less); - - function Less(json) { - _classCallCheck(this, Less); - - return _super.call(this, json); - } - - _createClass(Less, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx).map(function (x) { - return Uncertainty.from(x); - }); - - if (args[0] == null || args[1] == null) { - return null; - } - - return args[0].lessThan(args[1]); - } - }]); - - return Less; -}(Expression); - -var LessOrEqual = /*#__PURE__*/function (_Expression2) { - _inherits(LessOrEqual, _Expression2); - - var _super2 = _createSuper(LessOrEqual); - - function LessOrEqual(json) { - _classCallCheck(this, LessOrEqual); - - return _super2.call(this, json); - } - - _createClass(LessOrEqual, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx).map(function (x) { - return Uncertainty.from(x); - }); - - if (args[0] == null || args[1] == null) { - return null; - } - - return args[0].lessThanOrEquals(args[1]); - } - }]); - - return LessOrEqual; -}(Expression); - -var Greater = /*#__PURE__*/function (_Expression3) { - _inherits(Greater, _Expression3); - - var _super3 = _createSuper(Greater); - - function Greater(json) { - _classCallCheck(this, Greater); - - return _super3.call(this, json); - } - - _createClass(Greater, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx).map(function (x) { - return Uncertainty.from(x); - }); - - if (args[0] == null || args[1] == null) { - return null; - } - - return args[0].greaterThan(args[1]); - } - }]); - - return Greater; -}(Expression); - -var GreaterOrEqual = /*#__PURE__*/function (_Expression4) { - _inherits(GreaterOrEqual, _Expression4); - - var _super4 = _createSuper(GreaterOrEqual); - - function GreaterOrEqual(json) { - _classCallCheck(this, GreaterOrEqual); - - return _super4.call(this, json); - } - - _createClass(GreaterOrEqual, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx).map(function (x) { - return Uncertainty.from(x); - }); - - if (args[0] == null || args[1] == null) { - return null; - } - - return args[0].greaterThanOrEquals(args[1]); - } - }]); - - return GreaterOrEqual; -}(Expression); - -module.exports = { - Greater: Greater, - GreaterOrEqual: GreaterOrEqual, - Less: Less, - LessOrEqual: LessOrEqual -}; -},{"../datatypes/datatypes":6,"./expression":22}],19:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('./builder'), - build = _require2.build; - -var _require3 = require('../util/comparison'), - equals = _require3.equals; // TODO: Spec lists "Conditional", but it's "If" in the XSD - - -var If = /*#__PURE__*/function (_Expression) { - _inherits(If, _Expression); - - var _super = _createSuper(If); - - function If(json) { - var _this; - - _classCallCheck(this, If); - - _this = _super.call(this, json); - _this.condition = build(json.condition); - _this.th = build(json.then); - _this.els = build(json.else); - return _this; - } - - _createClass(If, [{ - key: "exec", - value: function exec(ctx) { - if (this.condition.execute(ctx)) { - return this.th.execute(ctx); - } else { - return this.els.execute(ctx); - } - } - }]); - - return If; -}(Expression); - -var CaseItem = function CaseItem(json) { - _classCallCheck(this, CaseItem); - - this.when = build(json.when); - this.then = build(json.then); -}; - -var Case = /*#__PURE__*/function (_Expression2) { - _inherits(Case, _Expression2); - - var _super2 = _createSuper(Case); - - function Case(json) { - var _this2; - - _classCallCheck(this, Case); - - _this2 = _super2.call(this, json); - _this2.comparand = build(json.comparand); - _this2.caseItems = json.caseItem.map(function (ci) { - return new CaseItem(ci); - }); - _this2.els = build(json.else); - return _this2; - } - - _createClass(Case, [{ - key: "exec", - value: function exec(ctx) { - if (this.comparand) { - return this.exec_selected(ctx); - } else { - return this.exec_standard(ctx); - } - } - }, { - key: "exec_selected", - value: function exec_selected(ctx) { - var val = this.comparand.execute(ctx); - - var _iterator = _createForOfIteratorHelper(this.caseItems), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var ci = _step.value; - - if (equals(ci.when.execute(ctx), val)) { - return ci.then.execute(ctx); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return this.els.execute(ctx); - } - }, { - key: "exec_standard", - value: function exec_standard(ctx) { - var _iterator2 = _createForOfIteratorHelper(this.caseItems), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var ci = _step2.value; - - if (ci.when.execute(ctx)) { - return ci.then.execute(ctx); - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - - return this.els.execute(ctx); - } - }]); - - return Case; -}(Expression); - -module.exports = { - Case: Case, - CaseItem: CaseItem, - If: If -}; -},{"../util/comparison":47,"./builder":16,"./expression":22}],20:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('./builder'), - build = _require2.build; - -var _require3 = require('./literal'), - Literal = _require3.Literal; - -var DT = require('../datatypes/datatypes'); - -var DateTime = /*#__PURE__*/function (_Expression) { - _inherits(DateTime, _Expression); - - var _super = _createSuper(DateTime); - - function DateTime(json) { - var _this; - - _classCallCheck(this, DateTime); - - _this = _super.call(this, json); - _this.json = json; - return _this; - } - - _createClass(DateTime, [{ - key: "exec", - value: function exec(ctx) { - var _this2 = this; - - var _iterator = _createForOfIteratorHelper(DateTime.PROPERTIES), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var property = _step.value; - - // if json does not contain 'timezoneOffset' set it to the executionDateTime from the context - if (this.json[property] != null) { - this[property] = build(this.json[property]); - } else if (property === 'timezoneOffset' && ctx.getTimezoneOffset() != null) { - this[property] = Literal.from({ - type: 'Literal', - value: ctx.getTimezoneOffset(), - valueType: '{urn:hl7-org:elm-types:r1}Integer' - }); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - var args = DateTime.PROPERTIES.map(function (p) { - return _this2[p] != null ? _this2[p].execute(ctx) : undefined; - }); - return _construct(DT.DateTime, _toConsumableArray(args)); - } - }]); - - return DateTime; -}(Expression); - -DateTime.PROPERTIES = ['year', 'month', 'day', 'hour', 'minute', 'second', 'millisecond', 'timezoneOffset']; - -var Date = /*#__PURE__*/function (_Expression2) { - _inherits(Date, _Expression2); - - var _super2 = _createSuper(Date); - - function Date(json) { - var _this3; - - _classCallCheck(this, Date); - - _this3 = _super2.call(this, json); - _this3.json = json; - return _this3; - } - - _createClass(Date, [{ - key: "exec", - value: function exec(ctx) { - var _this4 = this; - - var _iterator2 = _createForOfIteratorHelper(Date.PROPERTIES), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var property = _step2.value; - - if (this.json[property] != null) { - this[property] = build(this.json[property]); - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - - var args = Date.PROPERTIES.map(function (p) { - return _this4[p] != null ? _this4[p].execute(ctx) : undefined; - }); - return _construct(DT.Date, _toConsumableArray(args)); - } - }]); - - return Date; -}(Expression); - -Date.PROPERTIES = ['year', 'month', 'day']; - -var Time = /*#__PURE__*/function (_Expression3) { - _inherits(Time, _Expression3); - - var _super3 = _createSuper(Time); - - function Time(json) { - var _this5; - - _classCallCheck(this, Time); - - _this5 = _super3.call(this, json); - - var _iterator3 = _createForOfIteratorHelper(Time.PROPERTIES), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var property = _step3.value; - - if (json[property] != null) { - _this5[property] = build(json[property]); - } - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - - return _this5; - } - - _createClass(Time, [{ - key: "exec", - value: function exec(ctx) { - var _this6 = this; - - var args = Time.PROPERTIES.map(function (p) { - return _this6[p] != null ? _this6[p].execute(ctx) : undefined; - }); - return _construct(DT.DateTime, [0, 1, 1].concat(_toConsumableArray(args))).getTime(); - } - }]); - - return Time; -}(Expression); - -Time.PROPERTIES = ['hour', 'minute', 'second', 'millisecond']; - -var Today = /*#__PURE__*/function (_Expression4) { - _inherits(Today, _Expression4); - - var _super4 = _createSuper(Today); - - function Today(json) { - _classCallCheck(this, Today); - - return _super4.call(this, json); - } - - _createClass(Today, [{ - key: "exec", - value: function exec(ctx) { - return ctx.getExecutionDateTime().getDate(); - } - }]); - - return Today; -}(Expression); - -var Now = /*#__PURE__*/function (_Expression5) { - _inherits(Now, _Expression5); - - var _super5 = _createSuper(Now); - - function Now(json) { - _classCallCheck(this, Now); - - return _super5.call(this, json); - } - - _createClass(Now, [{ - key: "exec", - value: function exec(ctx) { - return ctx.getExecutionDateTime(); - } - }]); - - return Now; -}(Expression); - -var TimeOfDay = /*#__PURE__*/function (_Expression6) { - _inherits(TimeOfDay, _Expression6); - - var _super6 = _createSuper(TimeOfDay); - - function TimeOfDay(json) { - _classCallCheck(this, TimeOfDay); - - return _super6.call(this, json); - } - - _createClass(TimeOfDay, [{ - key: "exec", - value: function exec(ctx) { - return ctx.getExecutionDateTime().getTime(); - } - }]); - - return TimeOfDay; -}(Expression); - -var DateTimeComponentFrom = /*#__PURE__*/function (_Expression7) { - _inherits(DateTimeComponentFrom, _Expression7); - - var _super7 = _createSuper(DateTimeComponentFrom); - - function DateTimeComponentFrom(json) { - var _this7; - - _classCallCheck(this, DateTimeComponentFrom); - - _this7 = _super7.call(this, json); - _this7.precision = json.precision; - return _this7; - } - - _createClass(DateTimeComponentFrom, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - return arg[this.precision.toLowerCase()]; - } else { - return null; - } - } - }]); - - return DateTimeComponentFrom; -}(Expression); - -var DateFrom = /*#__PURE__*/function (_Expression8) { - _inherits(DateFrom, _Expression8); - - var _super8 = _createSuper(DateFrom); - - function DateFrom(json) { - _classCallCheck(this, DateFrom); - - return _super8.call(this, json); - } - - _createClass(DateFrom, [{ - key: "exec", - value: function exec(ctx) { - var date = this.execArgs(ctx); - - if (date != null) { - return date.getDate(); - } else { - return null; - } - } - }]); - - return DateFrom; -}(Expression); - -var TimeFrom = /*#__PURE__*/function (_Expression9) { - _inherits(TimeFrom, _Expression9); - - var _super9 = _createSuper(TimeFrom); - - function TimeFrom(json) { - _classCallCheck(this, TimeFrom); - - return _super9.call(this, json); - } - - _createClass(TimeFrom, [{ - key: "exec", - value: function exec(ctx) { - var date = this.execArgs(ctx); - - if (date != null) { - return date.getTime(); - } else { - return null; - } - } - }]); - - return TimeFrom; -}(Expression); - -var TimezoneOffsetFrom = /*#__PURE__*/function (_Expression10) { - _inherits(TimezoneOffsetFrom, _Expression10); - - var _super10 = _createSuper(TimezoneOffsetFrom); - - function TimezoneOffsetFrom(json) { - _classCallCheck(this, TimezoneOffsetFrom); - - return _super10.call(this, json); - } - - _createClass(TimezoneOffsetFrom, [{ - key: "exec", - value: function exec(ctx) { - var date = this.execArgs(ctx); - - if (date != null) { - return date.timezoneOffset; - } else { - return null; - } - } - }]); - - return TimezoneOffsetFrom; -}(Expression); // Delegated to by overloaded#After - - -function doAfter(a, b, precision) { - return a.after(b, precision); -} // Delegated to by overloaded#Before - - -function doBefore(a, b, precision) { - return a.before(b, precision); -} - -var DifferenceBetween = /*#__PURE__*/function (_Expression11) { - _inherits(DifferenceBetween, _Expression11); - - var _super11 = _createSuper(DifferenceBetween); - - function DifferenceBetween(json) { - var _this8; - - _classCallCheck(this, DifferenceBetween); - - _this8 = _super11.call(this, json); - _this8.precision = json.precision; - return _this8; - } - - _createClass(DifferenceBetween, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); // Check to make sure args exist and that they have differenceBetween functions so that they can be compared to one another - - if (args[0] == null || args[1] == null || typeof args[0].differenceBetween !== 'function' || typeof args[1].differenceBetween !== 'function') { - return null; - } - - var result = args[0].differenceBetween(args[1], this.precision != null ? this.precision.toLowerCase() : undefined); - - if (result != null && result.isPoint()) { - return result.low; - } else { - return result; - } - } - }]); - - return DifferenceBetween; -}(Expression); - -var DurationBetween = /*#__PURE__*/function (_Expression12) { - _inherits(DurationBetween, _Expression12); - - var _super12 = _createSuper(DurationBetween); - - function DurationBetween(json) { - var _this9; - - _classCallCheck(this, DurationBetween); - - _this9 = _super12.call(this, json); - _this9.precision = json.precision; - return _this9; - } - - _createClass(DurationBetween, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); // Check to make sure args exist and that they have durationBetween functions so that they can be compared to one another - - if (args[0] == null || args[1] == null || typeof args[0].durationBetween !== 'function' || typeof args[1].durationBetween !== 'function') { - return null; - } - - var result = args[0].durationBetween(args[1], this.precision != null ? this.precision.toLowerCase() : undefined); - - if (result != null && result.isPoint()) { - return result.low; - } else { - return result; - } - } - }]); - - return DurationBetween; -}(Expression); - -module.exports = { - Date: Date, - DateFrom: DateFrom, - DateTime: DateTime, - DateTimeComponentFrom: DateTimeComponentFrom, - DifferenceBetween: DifferenceBetween, - DurationBetween: DurationBetween, - Now: Now, - Time: Time, - TimeFrom: TimeFrom, - TimeOfDay: TimeOfDay, - TimezoneOffsetFrom: TimezoneOffsetFrom, - Today: Today, - doAfter: doAfter, - doBefore: doBefore -}; -},{"../datatypes/datatypes":6,"./builder":16,"./expression":22,"./literal":29}],21:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - UnimplementedExpression = _require.UnimplementedExpression; - -var UsingDef = /*#__PURE__*/function (_UnimplementedExpress) { - _inherits(UsingDef, _UnimplementedExpress); - - var _super = _createSuper(UsingDef); - - function UsingDef() { - _classCallCheck(this, UsingDef); - - return _super.apply(this, arguments); - } - - return UsingDef; -}(UnimplementedExpression); - -var IncludeDef = /*#__PURE__*/function (_UnimplementedExpress2) { - _inherits(IncludeDef, _UnimplementedExpress2); - - var _super2 = _createSuper(IncludeDef); - - function IncludeDef() { - _classCallCheck(this, IncludeDef); - - return _super2.apply(this, arguments); - } - - return IncludeDef; -}(UnimplementedExpression); - -var VersionedIdentifier = /*#__PURE__*/function (_UnimplementedExpress3) { - _inherits(VersionedIdentifier, _UnimplementedExpress3); - - var _super3 = _createSuper(VersionedIdentifier); - - function VersionedIdentifier() { - _classCallCheck(this, VersionedIdentifier); - - return _super3.apply(this, arguments); - } - - return VersionedIdentifier; -}(UnimplementedExpression); - -module.exports = { - UsingDef: UsingDef, - IncludeDef: IncludeDef, - VersionedIdentifier: VersionedIdentifier -}; -},{"./expression":22}],22:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('./builder'), - build = _require.build; - -var _require2 = require('../util/util'), - typeIsArray = _require2.typeIsArray; - -var Expression = /*#__PURE__*/function () { - function Expression(json) { - _classCallCheck(this, Expression); - - if (json.operand != null) { - var op = build(json.operand); - - if (typeIsArray(json.operand)) { - this.args = op; - } else { - this.arg = op; - } - } - - if (json.localId != null) { - this.localId = json.localId; - } - } - - _createClass(Expression, [{ - key: "execute", - value: function execute(ctx) { - if (this.localId != null) { - // Store the localId and result on the root context of this library - var execValue = this.exec(ctx); - ctx.rootContext().setLocalIdWithResult(this.localId, execValue); - return execValue; - } else { - return this.exec(ctx); - } - } - }, { - key: "exec", - value: function exec(ctx) { - return this; - } - }, { - key: "execArgs", - value: function execArgs(ctx) { - switch (false) { - case this.args == null: - return this.args.map(function (arg) { - return arg.execute(ctx); - }); - - case this.arg == null: - return this.arg.execute(ctx); - - default: - return null; - } - } - }]); - - return Expression; -}(); - -var UnimplementedExpression = /*#__PURE__*/function (_Expression) { - _inherits(UnimplementedExpression, _Expression); - - var _super = _createSuper(UnimplementedExpression); - - function UnimplementedExpression(json) { - var _this; - - _classCallCheck(this, UnimplementedExpression); - - _this = _super.call(this, json); - _this.json = json; - return _this; - } - - _createClass(UnimplementedExpression, [{ - key: "exec", - value: function exec(ctx) { - throw new Error("Unimplemented Expression: ".concat(this.json.type)); - } - }]); - - return UnimplementedExpression; -}(Expression); - -module.exports = { - Expression: Expression, - UnimplementedExpression: UnimplementedExpression -}; -},{"../util/util":50,"./builder":16}],23:[function(require,module,exports){ -"use strict"; - -var expression = require('./expression'); - -var aggregate = require('./aggregate'); - -var arithmetic = require('./arithmetic'); - -var clinical = require('./clinical'); - -var comparison = require('./comparison'); - -var conditional = require('./conditional'); - -var datetime = require('./datetime'); - -var declaration = require('./declaration'); - -var external = require('./external'); - -var instance = require('./instance'); - -var interval = require('./interval'); - -var list = require('./list'); - -var literal = require('./literal'); - -var logical = require('./logical'); - -var message = require('./message'); - -var nullological = require('./nullological'); - -var parameters = require('./parameters'); - -var quantity = require('./quantity'); - -var query = require('./query'); - -var ratio = require('./ratio'); - -var reusable = require('./reusable'); - -var string = require('./string'); - -var structured = require('./structured'); - -var type = require('./type'); - -var overloaded = require('./overloaded'); - -var libs = [expression, aggregate, arithmetic, clinical, comparison, conditional, datetime, declaration, external, instance, interval, list, literal, logical, message, nullological, parameters, query, quantity, ratio, reusable, string, structured, type, overloaded]; - -for (var _i = 0, _libs = libs; _i < _libs.length; _i++) { - var lib = _libs[_i]; - - for (var _i2 = 0, _Object$keys = Object.keys(lib); _i2 < _Object$keys.length; _i2++) { - var element = _Object$keys[_i2]; - module.exports[element] = lib[element]; - } -} -},{"./aggregate":14,"./arithmetic":15,"./clinical":17,"./comparison":18,"./conditional":19,"./datetime":20,"./declaration":21,"./expression":22,"./external":24,"./instance":25,"./interval":26,"./list":28,"./literal":29,"./logical":30,"./message":31,"./nullological":32,"./overloaded":33,"./parameters":34,"./quantity":35,"./query":36,"./ratio":37,"./reusable":38,"./string":39,"./structured":40,"./type":41}],24:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('./builder'), - build = _require2.build; - -var _require3 = require('../util/util'), - typeIsArray = _require3.typeIsArray; - -var Retrieve = /*#__PURE__*/function (_Expression) { - _inherits(Retrieve, _Expression); - - var _super = _createSuper(Retrieve); - - function Retrieve(json) { - var _this; - - _classCallCheck(this, Retrieve); - - _this = _super.call(this, json); - _this.datatype = json.dataType; - _this.templateId = json.templateId; - _this.codeProperty = json.codeProperty; - _this.codes = build(json.codes); - _this.dateProperty = json.dateProperty; - _this.dateRange = build(json.dateRange); - return _this; - } - - _createClass(Retrieve, [{ - key: "exec", - value: function exec(ctx) { - var _this2 = this; - - var records = ctx.findRecords(this.templateId != null ? this.templateId : this.datatype); - var codes = this.codes; - - if (this.codes && typeof this.codes.exec === 'function') { - codes = this.codes.execute(ctx); - - if (codes == null) { - return []; - } - } - - if (codes) { - records = records.filter(function (r) { - return _this2.recordMatchesCodesOrVS(r, codes); - }); - } // TODO: Added @dateProperty check due to previous fix in cql4browsers in cql_qdm_patient_api hash: ddbc57 - - - if (this.dateRange && this.dateProperty) { - var range = this.dateRange.execute(ctx); - records = records.filter(function (r) { - return range.includes(r.getDateOrInterval(_this2.dateProperty)); - }); - } - - if (Array.isArray(records)) { - var _ctx$evaluatedRecords; - - (_ctx$evaluatedRecords = ctx.evaluatedRecords).push.apply(_ctx$evaluatedRecords, _toConsumableArray(records)); - } else { - ctx.evaluatedRecords.push(records); - } - - return records; - } - }, { - key: "recordMatchesCodesOrVS", - value: function recordMatchesCodesOrVS(record, codes) { - var _this3 = this; - - if (typeIsArray(codes)) { - return codes.some(function (c) { - return c.hasMatch(record.getCode(_this3.codeProperty)); - }); - } else { - return codes.hasMatch(record.getCode(this.codeProperty)); - } - } - }]); - - return Retrieve; -}(Expression); - -module.exports = { - Retrieve: Retrieve -}; -},{"../util/util":50,"./builder":16,"./expression":22}],25:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('./builder'), - build = _require2.build; - -var _require3 = require('../datatypes/quantity'), - Quantity = _require3.Quantity; - -var _require4 = require('../datatypes/datatypes'), - Code = _require4.Code, - Concept = _require4.Concept; - -var Element = /*#__PURE__*/function () { - function Element(json) { - _classCallCheck(this, Element); - - this.name = json.name; - this.value = build(json.value); - } - - _createClass(Element, [{ - key: "exec", - value: function exec(ctx) { - return this.value != null ? this.value.execute(ctx) : undefined; - } - }]); - - return Element; -}(); - -var Instance = /*#__PURE__*/function (_Expression) { - _inherits(Instance, _Expression); - - var _super = _createSuper(Instance); - - function Instance(json) { - var _this; - - _classCallCheck(this, Instance); - - _this = _super.call(this, json); - _this.classType = json.classType; - _this.element = json.element.map(function (child) { - return new Element(child); - }); - return _this; - } - - _createClass(Instance, [{ - key: "exec", - value: function exec(ctx) { - var obj = {}; - - var _iterator = _createForOfIteratorHelper(this.element), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var el = _step.value; - obj[el.name] = el.exec(ctx); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - switch (this.classType) { - case '{urn:hl7-org:elm-types:r1}Quantity': - return new Quantity(obj.value, obj.unit); - - case '{urn:hl7-org:elm-types:r1}Code': - return new Code(obj.code, obj.system, obj.version, obj.display); - - case '{urn:hl7-org:elm-types:r1}Concept': - return new Concept(obj.codes, obj.display); - - default: - return obj; - } - } - }]); - - return Instance; -}(Expression); - -module.exports = { - Instance: Instance -}; -},{"../datatypes/datatypes":6,"../datatypes/quantity":11,"./builder":16,"./expression":22}],26:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('./builder'), - build = _require2.build; - -var _require3 = require('../datatypes/quantity'), - Quantity = _require3.Quantity, - doAddition = _require3.doAddition; - -var _require4 = require('../util/math'), - successor = _require4.successor, - predecessor = _require4.predecessor, - MAX_DATETIME_VALUE = _require4.MAX_DATETIME_VALUE, - MIN_DATETIME_VALUE = _require4.MIN_DATETIME_VALUE; - -var _require5 = require('../util/units'), - convertUnit = _require5.convertUnit, - compareUnits = _require5.compareUnits, - convertToCQLDateUnit = _require5.convertToCQLDateUnit; - -var dtivl = require('../datatypes/interval'); - -var Interval = /*#__PURE__*/function (_Expression) { - _inherits(Interval, _Expression); - - var _super = _createSuper(Interval); - - function Interval(json) { - var _this; - - _classCallCheck(this, Interval); - - _this = _super.call(this, json); - _this.lowClosed = json.lowClosed; - _this.lowClosedExpression = build(json.lowClosedExpression); - _this.highClosed = json.highClosed; - _this.highClosedExpression = build(json.highClosedExpression); - _this.low = build(json.low); - _this.high = build(json.high); - return _this; - } // Define a simple getter to allow type-checking of this class without instanceof - // and in a way that survives minification (as opposed to checking constructor.name) - - - _createClass(Interval, [{ - key: "isInterval", - get: function get() { - return true; - } - }, { - key: "exec", - value: function exec(ctx) { - var lowValue = this.low.execute(ctx); - var highValue = this.high.execute(ctx); - var lowClosed = this.lowClosed != null ? this.lowClosed : this.lowClosedExpression && this.lowClosedExpression.execute(ctx); - var highClosed = this.highClosed != null ? this.highClosed : this.highClosedExpression && this.highClosedExpression.execute(ctx); - var defaultPointType; - - if (lowValue == null && highValue == null) { - // try to get the default point type from a cast - if (this.low.asTypeSpecifier && this.low.asTypeSpecifier.type === 'NamedTypeSpecifier') { - defaultPointType = this.low.asTypeSpecifier.name; - } else if (this.high.asTypeSpecifier && this.high.asTypeSpecifier.type === 'NamedTypeSpecifier') { - defaultPointType = this.high.asTypeSpecifier.name; - } - } - - return new dtivl.Interval(lowValue, highValue, lowClosed, highClosed, defaultPointType); - } - }]); - - return Interval; -}(Expression); // Equal is completely handled by overloaded#Equal -// NotEqual is completely handled by overloaded#Equal -// Delegated to by overloaded#Contains and overloaded#In - - -function doContains(interval, item, precision) { - return interval.contains(item, precision); -} // Delegated to by overloaded#Includes and overloaded#IncludedIn - - -function doIncludes(interval, subinterval, precision) { - return interval.includes(subinterval, precision); -} // Delegated to by overloaded#ProperIncludes and overloaded@ProperIncludedIn - - -function doProperIncludes(interval, subinterval, precision) { - return interval.properlyIncludes(subinterval, precision); -} // Delegated to by overloaded#After - - -function doAfter(a, b, precision) { - return a.after(b, precision); -} // Delegated to by overloaded#Before - - -function doBefore(a, b, precision) { - return a.before(b, precision); -} - -var Meets = /*#__PURE__*/function (_Expression2) { - _inherits(Meets, _Expression2); - - var _super2 = _createSuper(Meets); - - function Meets(json) { - var _this2; - - _classCallCheck(this, Meets); - - _this2 = _super2.call(this, json); - _this2.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this2; - } - - _createClass(Meets, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs = this.execArgs(ctx), - _this$execArgs2 = _slicedToArray(_this$execArgs, 2), - a = _this$execArgs2[0], - b = _this$execArgs2[1]; - - if (a != null && b != null) { - return a.meets(b, this.precision); - } else { - return null; - } - } - }]); - - return Meets; -}(Expression); - -var MeetsAfter = /*#__PURE__*/function (_Expression3) { - _inherits(MeetsAfter, _Expression3); - - var _super3 = _createSuper(MeetsAfter); - - function MeetsAfter(json) { - var _this3; - - _classCallCheck(this, MeetsAfter); - - _this3 = _super3.call(this, json); - _this3.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this3; - } - - _createClass(MeetsAfter, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs3 = this.execArgs(ctx), - _this$execArgs4 = _slicedToArray(_this$execArgs3, 2), - a = _this$execArgs4[0], - b = _this$execArgs4[1]; - - if (a != null && b != null) { - return a.meetsAfter(b, this.precision); - } else { - return null; - } - } - }]); - - return MeetsAfter; -}(Expression); - -var MeetsBefore = /*#__PURE__*/function (_Expression4) { - _inherits(MeetsBefore, _Expression4); - - var _super4 = _createSuper(MeetsBefore); - - function MeetsBefore(json) { - var _this4; - - _classCallCheck(this, MeetsBefore); - - _this4 = _super4.call(this, json); - _this4.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this4; - } - - _createClass(MeetsBefore, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs5 = this.execArgs(ctx), - _this$execArgs6 = _slicedToArray(_this$execArgs5, 2), - a = _this$execArgs6[0], - b = _this$execArgs6[1]; - - if (a != null && b != null) { - return a.meetsBefore(b, this.precision); - } else { - return null; - } - } - }]); - - return MeetsBefore; -}(Expression); - -var Overlaps = /*#__PURE__*/function (_Expression5) { - _inherits(Overlaps, _Expression5); - - var _super5 = _createSuper(Overlaps); - - function Overlaps(json) { - var _this5; - - _classCallCheck(this, Overlaps); - - _this5 = _super5.call(this, json); - _this5.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this5; - } - - _createClass(Overlaps, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs7 = this.execArgs(ctx), - _this$execArgs8 = _slicedToArray(_this$execArgs7, 2), - a = _this$execArgs8[0], - b = _this$execArgs8[1]; - - if (a != null && b != null) { - return a.overlaps(b, this.precision); - } else { - return null; - } - } - }]); - - return Overlaps; -}(Expression); - -var OverlapsAfter = /*#__PURE__*/function (_Expression6) { - _inherits(OverlapsAfter, _Expression6); - - var _super6 = _createSuper(OverlapsAfter); - - function OverlapsAfter(json) { - var _this6; - - _classCallCheck(this, OverlapsAfter); - - _this6 = _super6.call(this, json); - _this6.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this6; - } - - _createClass(OverlapsAfter, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs9 = this.execArgs(ctx), - _this$execArgs10 = _slicedToArray(_this$execArgs9, 2), - a = _this$execArgs10[0], - b = _this$execArgs10[1]; - - if (a != null && b != null) { - return a.overlapsAfter(b, this.precision); - } else { - return null; - } - } - }]); - - return OverlapsAfter; -}(Expression); - -var OverlapsBefore = /*#__PURE__*/function (_Expression7) { - _inherits(OverlapsBefore, _Expression7); - - var _super7 = _createSuper(OverlapsBefore); - - function OverlapsBefore(json) { - var _this7; - - _classCallCheck(this, OverlapsBefore); - - _this7 = _super7.call(this, json); - _this7.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this7; - } - - _createClass(OverlapsBefore, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs11 = this.execArgs(ctx), - _this$execArgs12 = _slicedToArray(_this$execArgs11, 2), - a = _this$execArgs12[0], - b = _this$execArgs12[1]; - - if (a != null && b != null) { - return a.overlapsBefore(b, this.precision); - } else { - return null; - } - } - }]); - - return OverlapsBefore; -}(Expression); // Delegated to by overloaded#Union - - -function doUnion(a, b) { - return a.union(b); -} // Delegated to by overloaded#Except - - -function doExcept(a, b) { - if (a != null && b != null) { - return a.except(b); - } else { - return null; - } -} // Delegated to by overloaded#Intersect - - -function doIntersect(a, b) { - if (a != null && b != null) { - return a.intersect(b); - } else { - return null; - } -} - -var Width = /*#__PURE__*/function (_Expression8) { - _inherits(Width, _Expression8); - - var _super8 = _createSuper(Width); - - function Width(json) { - _classCallCheck(this, Width); - - return _super8.call(this, json); - } - - _createClass(Width, [{ - key: "exec", - value: function exec(ctx) { - var interval = this.arg.execute(ctx); - - if (interval == null) { - return null; - } - - return interval.width(); - } - }]); - - return Width; -}(Expression); - -var Size = /*#__PURE__*/function (_Expression9) { - _inherits(Size, _Expression9); - - var _super9 = _createSuper(Size); - - function Size(json) { - _classCallCheck(this, Size); - - return _super9.call(this, json); - } - - _createClass(Size, [{ - key: "exec", - value: function exec(ctx) { - var interval = this.arg.execute(ctx); - - if (interval == null) { - return null; - } - - return interval.size(); - } - }]); - - return Size; -}(Expression); - -var Start = /*#__PURE__*/function (_Expression10) { - _inherits(Start, _Expression10); - - var _super10 = _createSuper(Start); - - function Start(json) { - _classCallCheck(this, Start); - - return _super10.call(this, json); - } - - _createClass(Start, [{ - key: "exec", - value: function exec(ctx) { - var interval = this.arg.execute(ctx); - - if (interval == null) { - return null; - } - - var start = interval.start(); // fix the timezoneOffset of minimum Datetime to match context offset - - if (start && start.isDateTime && start.equals(MIN_DATETIME_VALUE)) { - start.timezoneOffset = ctx.getTimezoneOffset(); - } - - return start; - } - }]); - - return Start; -}(Expression); - -var End = /*#__PURE__*/function (_Expression11) { - _inherits(End, _Expression11); - - var _super11 = _createSuper(End); - - function End(json) { - _classCallCheck(this, End); - - return _super11.call(this, json); - } - - _createClass(End, [{ - key: "exec", - value: function exec(ctx) { - var interval = this.arg.execute(ctx); - - if (interval == null) { - return null; - } - - var end = interval.end(); // fix the timezoneOffset of maximum Datetime to match context offset - - if (end && end.isDateTime && end.equals(MAX_DATETIME_VALUE)) { - end.timezoneOffset = ctx.getTimezoneOffset(); - } - - return end; - } - }]); - - return End; -}(Expression); - -var Starts = /*#__PURE__*/function (_Expression12) { - _inherits(Starts, _Expression12); - - var _super12 = _createSuper(Starts); - - function Starts(json) { - var _this8; - - _classCallCheck(this, Starts); - - _this8 = _super12.call(this, json); - _this8.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this8; - } - - _createClass(Starts, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs13 = this.execArgs(ctx), - _this$execArgs14 = _slicedToArray(_this$execArgs13, 2), - a = _this$execArgs14[0], - b = _this$execArgs14[1]; - - if (a != null && b != null) { - return a.starts(b, this.precision); - } else { - return null; - } - } - }]); - - return Starts; -}(Expression); - -var Ends = /*#__PURE__*/function (_Expression13) { - _inherits(Ends, _Expression13); - - var _super13 = _createSuper(Ends); - - function Ends(json) { - var _this9; - - _classCallCheck(this, Ends); - - _this9 = _super13.call(this, json); - _this9.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this9; - } - - _createClass(Ends, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs15 = this.execArgs(ctx), - _this$execArgs16 = _slicedToArray(_this$execArgs15, 2), - a = _this$execArgs16[0], - b = _this$execArgs16[1]; - - if (a != null && b != null) { - return a.ends(b, this.precision); - } else { - return null; - } - } - }]); - - return Ends; -}(Expression); - -function intervalListType(intervals) { - // Returns one of null, 'time', 'date', 'datetime', 'quantity', 'integer', 'decimal' or 'mismatch' - var type = null; - - var _iterator = _createForOfIteratorHelper(intervals), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var itvl = _step.value; - - if (itvl == null) { - continue; - } - - if (itvl.low == null && itvl.high == null) { - //can't really determine type from this - continue; - } // if one end is null (but not both), the type can be determined from the other end - - - var low = itvl.low != null ? itvl.low : itvl.high; - var high = itvl.high != null ? itvl.high : itvl.low; - - if (low.isTime && low.isTime() && high.isTime && high.isTime()) { - if (type == null) { - type = 'time'; - } else if (type === 'time') { - continue; - } else { - return 'mismatch'; - } // if an interval mixes date and datetime, type is datetime (for implicit conversion) - - } else if ((low.isDateTime || high.isDateTime) && (low.isDateTime || low.isDate) && (high.isDateTime || high.isDate)) { - if (type == null || type === 'date') { - type = 'datetime'; - } else if (type === 'datetime') { - continue; - } else { - return 'mismatch'; - } - } else if (low.isDate && high.isDate) { - if (type == null) { - type = 'date'; - } else if (type === 'date' || type === 'datetime') { - continue; - } else { - return 'mismatch'; - } - } else if (low.isQuantity && high.isQuantity) { - if (type == null) { - type = 'quantity'; - } else if (type === 'quantity') { - continue; - } else { - return 'mismatch'; - } - } else if (Number.isInteger(low) && Number.isInteger(high)) { - if (type == null) { - type = 'integer'; - } else if (type === 'integer' || type === 'decimal') { - continue; - } else { - return 'mismatch'; - } - } else if (typeof low === 'number' && typeof high === 'number') { - if (type == null || type === 'integer') { - type = 'decimal'; - } else if (type === 'decimal') { - continue; - } else { - return 'mismatch'; - } //if we are here ends are mismatched - - } else { - return 'mismatch'; - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return type; -} - -var Expand = /*#__PURE__*/function (_Expression14) { - _inherits(Expand, _Expression14); - - var _super14 = _createSuper(Expand); - - function Expand(json) { - _classCallCheck(this, Expand); - - return _super14.call(this, json); - } - - _createClass(Expand, [{ - key: "exec", - value: function exec(ctx) { - // expand(argument List>, per Quantity) List> - var defaultPer, expandFunction; - - var _this$execArgs17 = this.execArgs(ctx), - _this$execArgs18 = _slicedToArray(_this$execArgs17, 2), - intervals = _this$execArgs18[0], - per = _this$execArgs18[1]; // CQL 1.5 introduced an overload to allow singular intervals; make it a list so we can use the same logic for either overload - - - if (!Array.isArray(intervals)) { - intervals = [intervals]; - } - - var type = intervalListType(intervals); - - if (type === 'mismatch') { - throw new Error('List of intervals contains mismatched types.'); - } - - if (type == null) { - return null; - } // this step collapses overlaps, and also returns a clone of intervals so we can feel free to mutate - - - intervals = collapseIntervals(intervals, per); - - if (intervals.length === 0) { - return []; - } - - if (['time', 'date', 'datetime'].includes(type)) { - expandFunction = this.expandDTishInterval; - - defaultPer = function defaultPer(interval) { - return new Quantity(1, interval.low.getPrecision()); - }; - } else if (['quantity'].includes(type)) { - expandFunction = this.expandQuantityInterval; - - defaultPer = function defaultPer(interval) { - return new Quantity(1, interval.low.unit); - }; - } else if (['integer', 'decimal'].includes(type)) { - expandFunction = this.expandNumericInterval; - - defaultPer = function defaultPer(interval) { - return new Quantity(1, '1'); - }; - } else { - throw new Error('Interval list type not yet supported.'); - } - - var results = []; - - var _iterator2 = _createForOfIteratorHelper(intervals), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var interval = _step2.value; - - if (interval == null) { - continue; - } // We do not support open ended intervals since result would likely be too long - - - if (interval.low == null || interval.high == null) { - return null; - } - - if (type === 'datetime') { - //support for implicitly converting dates to datetime - interval.low = interval.low.getDateTime(); - interval.high = interval.high.getDateTime(); - } - - per = per != null ? per : defaultPer(interval); - var items = expandFunction.call(this, interval, per); - - if (items === null) { - return null; - } - - results.push.apply(results, _toConsumableArray(items || [])); - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - - return results; - } - }, { - key: "expandDTishInterval", - value: function expandDTishInterval(interval, per) { - per.unit = convertToCQLDateUnit(per.unit); - - if (per.unit === 'week') { - per.value *= 7; - per.unit = 'day'; - } // Precision Checks - // return null if precision not applicable (e.g. gram, or minutes for dates) - - - if (!interval.low.constructor.FIELDS.includes(per.unit)) { - return null; - } // open interval with null boundaries do not contribute to output - // closed interval with null boundaries are not allowed for performance reasons - - - if (interval.low == null || interval.high == null) { - return null; - } - - var low = interval.lowClosed ? interval.low : interval.low.successor(); - var high = interval.highClosed ? interval.high : interval.high.predecessor(); - - if (low.after(high)) { - return []; - } - - if (interval.low.isLessPrecise(per.unit) || interval.high.isLessPrecise(per.unit)) { - return []; - } - - var current_low = low; - var results = []; - low = this.truncateToPrecision(low, per.unit); - high = this.truncateToPrecision(high, per.unit); - var current_high = current_low.add(per.value, per.unit).predecessor(); - var intervalToAdd = new dtivl.Interval(current_low, current_high, true, true); - - while (intervalToAdd.high.sameOrBefore(high)) { - results.push(intervalToAdd); - current_low = current_low.add(per.value, per.unit); - current_high = current_low.add(per.value, per.unit).predecessor(); - intervalToAdd = new dtivl.Interval(current_low, current_high, true, true); - } - - return results; - } - }, { - key: "truncateToPrecision", - value: function truncateToPrecision(value, unit) { - // If interval boundaries are more precise than per quantity, truncate to - // the precision specified by the per - var shouldTruncate = false; - - var _iterator3 = _createForOfIteratorHelper(value.constructor.FIELDS), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var field = _step3.value; - - if (shouldTruncate) { - value[field] = null; - } - - if (field === unit) { - // Start truncating after this unit - shouldTruncate = true; - } - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - - return value; - } - }, { - key: "expandQuantityInterval", - value: function expandQuantityInterval(interval, per) { - // we want to convert everything to the more precise of the interval.low or per - var result_units; - - if (compareUnits(interval.low.unit, per.unit) > 0) { - //interval.low.unit is 'bigger' aka les precise - result_units = per.unit; - } else { - result_units = interval.low.unit; - } - - var low_value = convertUnit(interval.low.value, interval.low.unit, result_units); - var high_value = convertUnit(interval.high.value, interval.high.unit, result_units); - var per_value = convertUnit(per.value, per.unit, result_units); // return null if unit conversion failed, must have mismatched units - - if (!(low_value != null && high_value != null && per_value != null)) { - return null; - } - - var results = this.makeNumericIntervalList(low_value, high_value, interval.lowClosed, interval.highClosed, per_value); - - var _iterator4 = _createForOfIteratorHelper(results), - _step4; - - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { - var itvl = _step4.value; - itvl.low = new Quantity(itvl.low, result_units); - itvl.high = new Quantity(itvl.high, result_units); - } - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - - return results; - } - }, { - key: "expandNumericInterval", - value: function expandNumericInterval(interval, per) { - if (per.unit !== '1' && per.unit !== '') { - return null; - } - - return this.makeNumericIntervalList(interval.low, interval.high, interval.lowClosed, interval.highClosed, per.value); - } - }, { - key: "makeNumericIntervalList", - value: function makeNumericIntervalList(low, high, lowClosed, highClosed, perValue) { - // If the per value is a Decimal (has a .), 8 decimal places are appropriate - // Integers should have 0 Decimal places - var perIsDecimal = perValue.toString().includes('.'); - var decimalPrecision = perIsDecimal ? 8 : 0; - low = lowClosed ? low : successor(low); - high = highClosed ? high : predecessor(high); // If the interval boundaries are more precise than the per quantity, the - // more precise values will be truncated to the precision specified by the - // per quantity. - - low = truncateDecimal(low, decimalPrecision); - high = truncateDecimal(high, decimalPrecision); - - if (low > high) { - return []; - } - - if (low == null || high == null) { - return []; - } - - var perUnitSize = perIsDecimal ? 0.00000001 : 1; - - if (low === high && Number.isInteger(low) && Number.isInteger(high) && !Number.isInteger(perValue)) { - high = parseFloat((high + 1).toFixed(decimalPrecision)); - } - - var current_low = low; - var results = []; - - if (perValue > high - low + perUnitSize) { - return []; - } - - var current_high = parseFloat((current_low + perValue - perUnitSize).toFixed(decimalPrecision)); - var intervalToAdd = new dtivl.Interval(current_low, current_high, true, true); - - while (intervalToAdd.high <= high) { - results.push(intervalToAdd); - current_low = parseFloat((current_low + perValue).toFixed(decimalPrecision)); - current_high = parseFloat((current_low + perValue - perUnitSize).toFixed(decimalPrecision)); - intervalToAdd = new dtivl.Interval(current_low, current_high, true, true); - } - - return results; - } - }]); - - return Expand; -}(Expression); - -var Collapse = /*#__PURE__*/function (_Expression15) { - _inherits(Collapse, _Expression15); - - var _super15 = _createSuper(Collapse); - - function Collapse(json) { - _classCallCheck(this, Collapse); - - return _super15.call(this, json); - } - - _createClass(Collapse, [{ - key: "exec", - value: function exec(ctx) { - // collapse(argument List>, per Quantity) List> - var _this$execArgs19 = this.execArgs(ctx), - _this$execArgs20 = _slicedToArray(_this$execArgs19, 2), - intervals = _this$execArgs20[0], - perWidth = _this$execArgs20[1]; - - return collapseIntervals(intervals, perWidth); - } - }]); - - return Collapse; -}(Expression); - -function collapseIntervals(intervals, perWidth) { - // Clone intervals so this function remains idempotent - var intervalsClone = []; - - var _iterator5 = _createForOfIteratorHelper(intervals), - _step5; - - try { - for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { - var interval = _step5.value; - - // The spec says to ignore null intervals - if (interval != null) { - intervalsClone.push(interval.copy()); - } - } // If the list is null, return null - - } catch (err) { - _iterator5.e(err); - } finally { - _iterator5.f(); - } - - if (intervals == null) { - return null; - } else if (intervalsClone.length <= 1) { - return intervalsClone; - } else { - // If the per argument is null, the default unit interval for the point type - // of the intervals involved will be used (i.e. the interval that has a - // width equal to the result of the successor function for the point type). - if (perWidth == null) { - perWidth = intervalsClone[0].getPointSize(); - } // sort intervalsClone by start - - - intervalsClone.sort(function (a, b) { - if (a.low && typeof a.low.before === 'function') { - if (b.low != null && a.low.before(b.low)) { - return -1; - } - - if (b.low == null || a.low.after(b.low)) { - return 1; - } - } else if (a.low != null && b.low != null) { - if (a.low < b.low) { - return -1; - } - - if (a.low > b.low) { - return 1; - } - } else if (a.low != null && b.low == null) { - return 1; - } else if (a.low == null && b.low != null) { - return -1; - } // if both lows are undefined, sort by high - - - if (a.high && typeof a.high.before === 'function') { - if (b.high == null || a.high.before(b.high)) { - return -1; - } - - if (a.high.after(b.high)) { - return 1; - } - } else if (a.high != null && b.high != null) { - if (a.high < b.high) { - return -1; - } - - if (a.high > b.high) { - return 1; - } - } else if (a.high != null && b.high == null) { - return -1; - } else if (a.high == null && b.high != null) { - return 1; - } - - return 0; - }); // collapse intervals as necessary - - var collapsedIntervals = []; - var a = intervalsClone.shift(); - var b = intervalsClone.shift(); - - while (b) { - if (b.low && typeof b.low.durationBetween === 'function') { - // handle DateTimes using durationBetween - if (a.high != null ? a.high.sameOrAfter(b.low) : undefined) { - // overlap - if (b.high == null || b.high.after(a.high)) { - a.high = b.high; - } - } else if ((a.high != null ? a.high.durationBetween(b.low, perWidth.unit).high : undefined) <= perWidth.value) { - a.high = b.high; - } else { - collapsedIntervals.push(a); - a = b; - } - } else if (b.low && typeof b.low.sameOrBefore === 'function') { - if (a.high != null && b.low.sameOrBefore(doAddition(a.high, perWidth))) { - if (b.high == null || b.high.after(a.high)) { - a.high = b.high; - } - } else { - collapsedIntervals.push(a); - a = b; - } - } else { - if (b.low - a.high <= perWidth.value) { - if (b.high > a.high || b.high == null) { - a.high = b.high; - } - } else { - collapsedIntervals.push(a); - a = b; - } - } - - b = intervalsClone.shift(); - } - - collapsedIntervals.push(a); - return collapsedIntervals; - } -} - -function truncateDecimal(decimal, decimalPlaces) { - // like parseFloat().toFixed() but floor rather than round - // Needed for when per precision is less than the interval input precision - var re = new RegExp('^-?\\d+(?:.\\d{0,' + (decimalPlaces || -1) + '})?'); - return parseFloat(decimal.toString().match(re)[0]); -} - -module.exports = { - Collapse: Collapse, - End: End, - Ends: Ends, - Expand: Expand, - Interval: Interval, - Meets: Meets, - MeetsAfter: MeetsAfter, - MeetsBefore: MeetsBefore, - Overlaps: Overlaps, - OverlapsAfter: OverlapsAfter, - OverlapsBefore: OverlapsBefore, - Size: Size, - Start: Start, - Starts: Starts, - Width: Width, - doContains: doContains, - doIncludes: doIncludes, - doProperIncludes: doProperIncludes, - doAfter: doAfter, - doBefore: doBefore, - doUnion: doUnion, - doExcept: doExcept, - doIntersect: doIntersect -}; -},{"../datatypes/interval":9,"../datatypes/quantity":11,"../util/math":48,"../util/units":49,"./builder":16,"./expression":22}],27:[function(require,module,exports){ -"use strict"; - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var Library = /*#__PURE__*/function () { - function Library(json, libraryManager) { - _classCallCheck(this, Library); - - this.source = json; // usings - - var usingDefs = json.library.usings && json.library.usings.def || []; - this.usings = usingDefs.filter(function (u) { - return u.localIdentifier !== 'System'; - }).map(function (u) { - return { - name: u.localIdentifier, - version: u.version - }; - }); // parameters - - var paramDefs = json.library.parameters && json.library.parameters.def || []; - this.parameters = {}; - - var _iterator = _createForOfIteratorHelper(paramDefs), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var param = _step.value; - this.parameters[param.name] = new ParameterDef(param); - } // code systems - - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - var csDefs = json.library.codeSystems && json.library.codeSystems.def || []; - this.codesystems = {}; - - var _iterator2 = _createForOfIteratorHelper(csDefs), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var codesystem = _step2.value; - this.codesystems[codesystem.name] = new CodeSystemDef(codesystem); - } // value sets - - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - - var vsDefs = json.library.valueSets && json.library.valueSets.def || []; - this.valuesets = {}; - - var _iterator3 = _createForOfIteratorHelper(vsDefs), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var valueset = _step3.value; - this.valuesets[valueset.name] = new ValueSetDef(valueset); - } // codes - - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - - var codeDefs = json.library.codes && json.library.codes.def || []; - this.codes = {}; - - var _iterator4 = _createForOfIteratorHelper(codeDefs), - _step4; - - try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { - var code = _step4.value; - this.codes[code.name] = new CodeDef(code); - } // concepts - - } catch (err) { - _iterator4.e(err); - } finally { - _iterator4.f(); - } - - var conceptDefs = json.library.concepts && json.library.concepts.def || []; - this.concepts = {}; - - var _iterator5 = _createForOfIteratorHelper(conceptDefs), - _step5; - - try { - for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { - var concept = _step5.value; - this.concepts[concept.name] = new ConceptDef(concept); - } // expressions - - } catch (err) { - _iterator5.e(err); - } finally { - _iterator5.f(); - } - - var exprDefs = json.library.statements && json.library.statements.def || []; - this.expressions = {}; - this.functions = {}; - - var _iterator6 = _createForOfIteratorHelper(exprDefs), - _step6; - - try { - for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { - var expr = _step6.value; - - if (expr.type === 'FunctionDef') { - if (!this.functions[expr.name]) { - this.functions[expr.name] = []; - } - - this.functions[expr.name].push(new FunctionDef(expr)); - } else { - this.expressions[expr.name] = new ExpressionDef(expr); - } - } // includes - - } catch (err) { - _iterator6.e(err); - } finally { - _iterator6.f(); - } - - var inclDefs = json.library.includes && json.library.includes.def || []; - this.includes = {}; - - var _iterator7 = _createForOfIteratorHelper(inclDefs), - _step7; - - try { - for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { - var incl = _step7.value; - - if (libraryManager) { - this.includes[incl.localIdentifier] = libraryManager.resolve(incl.path, incl.version); - } - } // Include codesystems from includes - - } catch (err) { - _iterator7.e(err); - } finally { - _iterator7.f(); - } - - for (var iProperty in this.includes) { - if (this.includes[iProperty] && this.includes[iProperty].codesystems) { - for (var csProperty in this.includes[iProperty].codesystems) { - this.codesystems[csProperty] = this.includes[iProperty].codesystems[csProperty]; - } - } - } - } - - _createClass(Library, [{ - key: "getFunction", - value: function getFunction(identifier) { - return this.functions[identifier]; - } - }, { - key: "get", - value: function get(identifier) { - return this.expressions[identifier] || this.includes[identifier] || this.getFunction(identifier); - } - }, { - key: "getValueSet", - value: function getValueSet(identifier, libraryName) { - if (this.valuesets[identifier] != null) { - return this.valuesets[identifier]; - } - - return this.includes[libraryName] != null ? this.includes[libraryName].valuesets[identifier] : undefined; - } - }, { - key: "getCodeSystem", - value: function getCodeSystem(identifier) { - return this.codesystems[identifier]; - } - }, { - key: "getCode", - value: function getCode(identifier) { - return this.codes[identifier]; - } - }, { - key: "getConcept", - value: function getConcept(identifier) { - return this.concepts[identifier]; - } - }, { - key: "getParameter", - value: function getParameter(name) { - return this.parameters[name]; - } - }]); - - return Library; -}(); // These requires are at the end of the file because having them first in the -// file creates errors due to the order that the libraries are loaded. - - -var _require = require('./expressions'), - ExpressionDef = _require.ExpressionDef, - FunctionDef = _require.FunctionDef, - ParameterDef = _require.ParameterDef, - ValueSetDef = _require.ValueSetDef, - CodeSystemDef = _require.CodeSystemDef, - CodeDef = _require.CodeDef, - ConceptDef = _require.ConceptDef; - -module.exports = { - Library: Library -}; -},{"./expressions":23}],28:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression, - UnimplementedExpression = _require.UnimplementedExpression; - -var _require2 = require('./builder'), - build = _require2.build; - -var _require3 = require('../util/util'), - typeIsArray = _require3.typeIsArray; - -var _require4 = require('../util/comparison'), - equals = _require4.equals; - -var List = /*#__PURE__*/function (_Expression) { - _inherits(List, _Expression); - - var _super = _createSuper(List); - - function List(json) { - var _this; - - _classCallCheck(this, List); - - _this = _super.call(this, json); - _this.elements = build(json.element) || []; - return _this; - } - - _createClass(List, [{ - key: "isList", - get: function get() { - return true; - } - }, { - key: "exec", - value: function exec(ctx) { - return this.elements.map(function (item) { - return item.execute(ctx); - }); - } - }]); - - return List; -}(Expression); - -var Exists = /*#__PURE__*/function (_Expression2) { - _inherits(Exists, _Expression2); - - var _super2 = _createSuper(Exists); - - function Exists(json) { - _classCallCheck(this, Exists); - - return _super2.call(this, json); - } - - _createClass(Exists, [{ - key: "exec", - value: function exec(ctx) { - var list = this.execArgs(ctx); // if list exists and has non empty length we need to make sure it isnt just full of nulls - - if (list) { - return list.some(function (item) { - return item != null; - }); - } - - return false; - } - }]); - - return Exists; -}(Expression); // Equal is completely handled by overloaded#Equal -// NotEqual is completely handled by overloaded#Equal -// Delegated to by overloaded#Union - - -function doUnion(a, b) { - var distinct = doDistinct(a.concat(b)); - return removeDuplicateNulls(distinct); -} // Delegated to by overloaded#Except - - -function doExcept(a, b) { - var distinct = doDistinct(a); - var setList = removeDuplicateNulls(distinct); - return setList.filter(function (item) { - return !doContains(b, item, true); - }); -} // Delegated to by overloaded#Intersect - - -function doIntersect(a, b) { - var distinct = doDistinct(a); - var setList = removeDuplicateNulls(distinct); - return setList.filter(function (item) { - return doContains(b, item, true); - }); -} // ELM-only, not a product of CQL - - -var Times = /*#__PURE__*/function (_UnimplementedExpress) { - _inherits(Times, _UnimplementedExpress); - - var _super3 = _createSuper(Times); - - function Times() { - _classCallCheck(this, Times); - - return _super3.apply(this, arguments); - } - - return Times; -}(UnimplementedExpression); // ELM-only, not a product of CQL - - -var Filter = /*#__PURE__*/function (_UnimplementedExpress2) { - _inherits(Filter, _UnimplementedExpress2); - - var _super4 = _createSuper(Filter); - - function Filter() { - _classCallCheck(this, Filter); - - return _super4.apply(this, arguments); - } - - return Filter; -}(UnimplementedExpression); - -var SingletonFrom = /*#__PURE__*/function (_Expression3) { - _inherits(SingletonFrom, _Expression3); - - var _super5 = _createSuper(SingletonFrom); - - function SingletonFrom(json) { - _classCallCheck(this, SingletonFrom); - - return _super5.call(this, json); - } - - _createClass(SingletonFrom, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null && arg.length > 1) { - throw new Error("IllegalArgument: 'SingletonFrom' requires a 0 or 1 arg array"); - } else if (arg != null && arg.length === 1) { - return arg[0]; - } else { - return null; - } - } - }]); - - return SingletonFrom; -}(Expression); - -var ToList = /*#__PURE__*/function (_Expression4) { - _inherits(ToList, _Expression4); - - var _super6 = _createSuper(ToList); - - function ToList(json) { - _classCallCheck(this, ToList); - - return _super6.call(this, json); - } - - _createClass(ToList, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - return [arg]; - } else { - return []; - } - } - }]); - - return ToList; -}(Expression); - -var IndexOf = /*#__PURE__*/function (_Expression5) { - _inherits(IndexOf, _Expression5); - - var _super7 = _createSuper(IndexOf); - - function IndexOf(json) { - var _this2; - - _classCallCheck(this, IndexOf); - - _this2 = _super7.call(this, json); - _this2.source = build(json.source); - _this2.element = build(json.element); - return _this2; - } - - _createClass(IndexOf, [{ - key: "exec", - value: function exec(ctx) { - var index; - var src = this.source.execute(ctx); - var el = this.element.execute(ctx); - - if (src == null || el == null) { - return null; - } - - for (var i = 0; i < src.length; i++) { - var itm = src[i]; - - if (equals(itm, el)) { - index = i; - break; - } - } - - if (index != null) { - return index; - } else { - return -1; - } - } - }]); - - return IndexOf; -}(Expression); // Indexer is completely handled by overloaded#Indexer -// Delegated to by overloaded#Contains and overloaded#In - - -function doContains(container, item) { - var nullEquivalence = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - return container.some(function (element) { - return equals(element, item) || nullEquivalence && element == null && item == null; - }); -} // Delegated to by overloaded#Includes and overloaded@IncludedIn - - -function doIncludes(list, sublist) { - return sublist.every(function (x) { - return doContains(list, x); - }); -} // Delegated to by overloaded#ProperIncludes and overloaded@ProperIncludedIn - - -function doProperIncludes(list, sublist) { - return list.length > sublist.length && doIncludes(list, sublist); -} // ELM-only, not a product of CQL - - -var ForEach = /*#__PURE__*/function (_UnimplementedExpress3) { - _inherits(ForEach, _UnimplementedExpress3); - - var _super8 = _createSuper(ForEach); - - function ForEach() { - _classCallCheck(this, ForEach); - - return _super8.apply(this, arguments); - } - - return ForEach; -}(UnimplementedExpression); - -var Flatten = /*#__PURE__*/function (_Expression6) { - _inherits(Flatten, _Expression6); - - var _super9 = _createSuper(Flatten); - - function Flatten(json) { - _classCallCheck(this, Flatten); - - return _super9.call(this, json); - } - - _createClass(Flatten, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (typeIsArray(arg) && arg.every(function (x) { - return typeIsArray(x); - })) { - return arg.reduce(function (x, y) { - return x.concat(y); - }, []); - } else { - return arg; - } - } - }]); - - return Flatten; -}(Expression); - -var Distinct = /*#__PURE__*/function (_Expression7) { - _inherits(Distinct, _Expression7); - - var _super10 = _createSuper(Distinct); - - function Distinct(json) { - _classCallCheck(this, Distinct); - - return _super10.call(this, json); - } - - _createClass(Distinct, [{ - key: "exec", - value: function exec(ctx) { - var result = this.execArgs(ctx); - - if (result == null) { - return null; - } - - return doDistinct(result); - } - }]); - - return Distinct; -}(Expression); - -function doDistinct(list) { - var distinct = []; - list.forEach(function (item) { - var isNew = distinct.every(function (seenItem) { - return !equals(item, seenItem); - }); - - if (isNew) { - distinct.push(item); - } - }); - return removeDuplicateNulls(distinct); -} - -function removeDuplicateNulls(list) { - // Remove duplicate null elements - var firstNullFound = false; - var setList = []; - - var _iterator = _createForOfIteratorHelper(list), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var item = _step.value; - - if (item !== null) { - setList.push(item); - } else if (item === null && !firstNullFound) { - setList.push(item); - firstNullFound = true; - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return setList; -} // ELM-only, not a product of CQL - - -var Current = /*#__PURE__*/function (_UnimplementedExpress4) { - _inherits(Current, _UnimplementedExpress4); - - var _super11 = _createSuper(Current); - - function Current() { - _classCallCheck(this, Current); - - return _super11.apply(this, arguments); - } - - return Current; -}(UnimplementedExpression); - -var First = /*#__PURE__*/function (_Expression8) { - _inherits(First, _Expression8); - - var _super12 = _createSuper(First); - - function First(json) { - var _this3; - - _classCallCheck(this, First); - - _this3 = _super12.call(this, json); - _this3.source = build(json.source); - return _this3; - } - - _createClass(First, [{ - key: "exec", - value: function exec(ctx) { - var src = this.source.exec(ctx); - - if (src != null && typeIsArray(src) && src.length > 0) { - return src[0]; - } else { - return null; - } - } - }]); - - return First; -}(Expression); - -var Last = /*#__PURE__*/function (_Expression9) { - _inherits(Last, _Expression9); - - var _super13 = _createSuper(Last); - - function Last(json) { - var _this4; - - _classCallCheck(this, Last); - - _this4 = _super13.call(this, json); - _this4.source = build(json.source); - return _this4; - } - - _createClass(Last, [{ - key: "exec", - value: function exec(ctx) { - var src = this.source.exec(ctx); - - if (src != null && typeIsArray(src) && src.length > 0) { - return src[src.length - 1]; - } else { - return null; - } - } - }]); - - return Last; -}(Expression); - -var Slice = /*#__PURE__*/function (_Expression10) { - _inherits(Slice, _Expression10); - - var _super14 = _createSuper(Slice); - - function Slice(json) { - var _this5; - - _classCallCheck(this, Slice); - - _this5 = _super14.call(this, json); - _this5.source = build(json.source); - _this5.startIndex = build(json.startIndex); - _this5.endIndex = build(json.endIndex); - return _this5; - } - - _createClass(Slice, [{ - key: "exec", - value: function exec(ctx) { - var src = this.source.exec(ctx); - - if (src != null && typeIsArray(src)) { - var startIndex = this.startIndex.exec(ctx); - var endIndex = this.endIndex.exec(ctx); - var start = startIndex != null ? startIndex : 0; - var end = endIndex != null ? endIndex : src.length; - - if (src.length === 0 || start < 0 || end < 0 || end < start) { - return []; - } - - return src.slice(start, end); - } - - return null; - } - }]); - - return Slice; -}(Expression); // Length is completely handled by overloaded#Length - - -module.exports = { - Current: Current, - Distinct: Distinct, - Exists: Exists, - Filter: Filter, - First: First, - Flatten: Flatten, - ForEach: ForEach, - IndexOf: IndexOf, - Last: Last, - List: List, - SingletonFrom: SingletonFrom, - Slice: Slice, - Times: Times, - ToList: ToList, - doContains: doContains, - doIncludes: doIncludes, - doProperIncludes: doProperIncludes, - doUnion: doUnion, - doExcept: doExcept, - doIntersect: doIntersect -}; -},{"../util/comparison":47,"../util/util":50,"./builder":16,"./expression":22}],29:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var Literal = /*#__PURE__*/function (_Expression) { - _inherits(Literal, _Expression); - - var _super = _createSuper(Literal); - - function Literal(json) { - var _this; - - _classCallCheck(this, Literal); - - _this = _super.call(this, json); - _this.valueType = json.valueType; - _this.value = json.value; - return _this; - } - - _createClass(Literal, [{ - key: "exec", - value: function exec(ctx) { - return this.value; - } - }], [{ - key: "from", - value: function from(json) { - switch (json.valueType) { - case '{urn:hl7-org:elm-types:r1}Boolean': - return new BooleanLiteral(json); - - case '{urn:hl7-org:elm-types:r1}Integer': - return new IntegerLiteral(json); - - case '{urn:hl7-org:elm-types:r1}Decimal': - return new DecimalLiteral(json); - - case '{urn:hl7-org:elm-types:r1}String': - return new StringLiteral(json); - - default: - return new Literal(json); - } - } - }]); - - return Literal; -}(Expression); // The following are not defined in ELM, but helpful for execution - - -var BooleanLiteral = /*#__PURE__*/function (_Literal) { - _inherits(BooleanLiteral, _Literal); - - var _super2 = _createSuper(BooleanLiteral); - - function BooleanLiteral(json) { - var _this2; - - _classCallCheck(this, BooleanLiteral); - - _this2 = _super2.call(this, json); - _this2.value = _this2.value === 'true'; - return _this2; - } // Define a simple getter to allow type-checking of this class without instanceof - // and in a way that survives minification (as opposed to checking constructor.name) - - - _createClass(BooleanLiteral, [{ - key: "isBooleanLiteral", - get: function get() { - return true; - } - }, { - key: "exec", - value: function exec(ctx) { - return this.value; - } - }]); - - return BooleanLiteral; -}(Literal); - -var IntegerLiteral = /*#__PURE__*/function (_Literal2) { - _inherits(IntegerLiteral, _Literal2); - - var _super3 = _createSuper(IntegerLiteral); - - function IntegerLiteral(json) { - var _this3; - - _classCallCheck(this, IntegerLiteral); - - _this3 = _super3.call(this, json); - _this3.value = parseInt(_this3.value, 10); - return _this3; - } // Define a simple getter to allow type-checking of this class without instanceof - // and in a way that survives minification (as opposed to checking constructor.name) - - - _createClass(IntegerLiteral, [{ - key: "isIntegerLiteral", - get: function get() { - return true; - } - }, { - key: "exec", - value: function exec(ctx) { - return this.value; - } - }]); - - return IntegerLiteral; -}(Literal); - -var DecimalLiteral = /*#__PURE__*/function (_Literal3) { - _inherits(DecimalLiteral, _Literal3); - - var _super4 = _createSuper(DecimalLiteral); - - function DecimalLiteral(json) { - var _this4; - - _classCallCheck(this, DecimalLiteral); - - _this4 = _super4.call(this, json); - _this4.value = parseFloat(_this4.value); - return _this4; - } // Define a simple getter to allow type-checking of this class without instanceof - // and in a way that survives minification (as opposed to checking constructor.name) - - - _createClass(DecimalLiteral, [{ - key: "isDecimalLiteral", - get: function get() { - return true; - } - }, { - key: "exec", - value: function exec(ctx) { - return this.value; - } - }]); - - return DecimalLiteral; -}(Literal); - -var StringLiteral = /*#__PURE__*/function (_Literal4) { - _inherits(StringLiteral, _Literal4); - - var _super5 = _createSuper(StringLiteral); - - function StringLiteral(json) { - _classCallCheck(this, StringLiteral); - - return _super5.call(this, json); - } // Define a simple getter to allow type-checking of this class without instanceof - // and in a way that survives minification (as opposed to checking constructor.name) - - - _createClass(StringLiteral, [{ - key: "isStringLiteral", - get: function get() { - return true; - } - }, { - key: "exec", - value: function exec(ctx) { - // TODO: Remove these replacements when CQL-to-ELM fixes bug: https://github.com/cqframework/clinical_quality_language/issues/82 - return this.value.replace(/\\'/g, "'").replace(/\\"/g, '"'); - } - }]); - - return StringLiteral; -}(Literal); - -module.exports = { - BooleanLiteral: BooleanLiteral, - DecimalLiteral: DecimalLiteral, - IntegerLiteral: IntegerLiteral, - Literal: Literal, - StringLiteral: StringLiteral -}; -},{"./expression":22}],30:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('../datatypes/datatypes'), - ThreeValuedLogic = _require2.ThreeValuedLogic; - -var And = /*#__PURE__*/function (_Expression) { - _inherits(And, _Expression); - - var _super = _createSuper(And); - - function And(json) { - _classCallCheck(this, And); - - return _super.call(this, json); - } - - _createClass(And, [{ - key: "exec", - value: function exec(ctx) { - return ThreeValuedLogic.and.apply(ThreeValuedLogic, _toConsumableArray(this.execArgs(ctx))); - } - }]); - - return And; -}(Expression); - -var Or = /*#__PURE__*/function (_Expression2) { - _inherits(Or, _Expression2); - - var _super2 = _createSuper(Or); - - function Or(json) { - _classCallCheck(this, Or); - - return _super2.call(this, json); - } - - _createClass(Or, [{ - key: "exec", - value: function exec(ctx) { - return ThreeValuedLogic.or.apply(ThreeValuedLogic, _toConsumableArray(this.execArgs(ctx))); - } - }]); - - return Or; -}(Expression); - -var Not = /*#__PURE__*/function (_Expression3) { - _inherits(Not, _Expression3); - - var _super3 = _createSuper(Not); - - function Not(json) { - _classCallCheck(this, Not); - - return _super3.call(this, json); - } - - _createClass(Not, [{ - key: "exec", - value: function exec(ctx) { - return ThreeValuedLogic.not(this.execArgs(ctx)); - } - }]); - - return Not; -}(Expression); - -var Xor = /*#__PURE__*/function (_Expression4) { - _inherits(Xor, _Expression4); - - var _super4 = _createSuper(Xor); - - function Xor(json) { - _classCallCheck(this, Xor); - - return _super4.call(this, json); - } - - _createClass(Xor, [{ - key: "exec", - value: function exec(ctx) { - return ThreeValuedLogic.xor.apply(ThreeValuedLogic, _toConsumableArray(this.execArgs(ctx))); - } - }]); - - return Xor; -}(Expression); - -var IsTrue = /*#__PURE__*/function (_Expression5) { - _inherits(IsTrue, _Expression5); - - var _super5 = _createSuper(IsTrue); - - function IsTrue(json) { - _classCallCheck(this, IsTrue); - - return _super5.call(this, json); - } - - _createClass(IsTrue, [{ - key: "exec", - value: function exec(ctx) { - return true === this.execArgs(ctx); - } - }]); - - return IsTrue; -}(Expression); - -var IsFalse = /*#__PURE__*/function (_Expression6) { - _inherits(IsFalse, _Expression6); - - var _super6 = _createSuper(IsFalse); - - function IsFalse(json) { - _classCallCheck(this, IsFalse); - - return _super6.call(this, json); - } - - _createClass(IsFalse, [{ - key: "exec", - value: function exec(ctx) { - return false === this.execArgs(ctx); - } - }]); - - return IsFalse; -}(Expression); - -module.exports = { - And: And, - IsFalse: IsFalse, - IsTrue: IsTrue, - Not: Not, - Or: Or, - Xor: Xor -}; -},{"../datatypes/datatypes":6,"./expression":22}],31:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('./builder'), - build = _require2.build; - -var Message = /*#__PURE__*/function (_Expression) { - _inherits(Message, _Expression); - - var _super = _createSuper(Message); - - function Message(json) { - var _this; - - _classCallCheck(this, Message); - - _this = _super.call(this, json); - _this.source = build(json.source); - _this.condition = build(json.condition); - _this.code = build(json.code); - _this.severity = build(json.severity); - _this.message = build(json.message); - return _this; - } - - _createClass(Message, [{ - key: "exec", - value: function exec(ctx) { - var source = this.source.execute(ctx); - var condition = this.condition.execute(ctx); - - if (condition) { - var code = this.code.execute(ctx); - var severity = this.severity.execute(ctx); - var message = this.message.execute(ctx); - var listener = ctx.getMessageListener(); - - if (listener && typeof listener.onMessage === 'function') { - listener.onMessage(source, code, severity, message); - } - } - - return source; - } - }]); - - return Message; -}(Expression); - -module.exports = { - Message: Message -}; -},{"./builder":16,"./expression":22}],32:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var Null = /*#__PURE__*/function (_Expression) { - _inherits(Null, _Expression); - - var _super = _createSuper(Null); - - function Null(json) { - _classCallCheck(this, Null); - - return _super.call(this, json); - } - - _createClass(Null, [{ - key: "exec", - value: function exec(ctx) { - return null; - } - }]); - - return Null; -}(Expression); - -var IsNull = /*#__PURE__*/function (_Expression2) { - _inherits(IsNull, _Expression2); - - var _super2 = _createSuper(IsNull); - - function IsNull(json) { - _classCallCheck(this, IsNull); - - return _super2.call(this, json); - } - - _createClass(IsNull, [{ - key: "exec", - value: function exec(ctx) { - return this.execArgs(ctx) == null; - } - }]); - - return IsNull; -}(Expression); - -var Coalesce = /*#__PURE__*/function (_Expression3) { - _inherits(Coalesce, _Expression3); - - var _super3 = _createSuper(Coalesce); - - function Coalesce(json) { - _classCallCheck(this, Coalesce); - - return _super3.call(this, json); - } - - _createClass(Coalesce, [{ - key: "exec", - value: function exec(ctx) { - var _iterator = _createForOfIteratorHelper(this.args), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var arg = _step.value; - var result = arg.execute(ctx); // if a single arg that's a list, coalesce over the list - - if (this.args.length === 1 && Array.isArray(result)) { - var item = result.find(function (item) { - return item != null; - }); - - if (item != null) { - return item; - } - } else { - if (result != null) { - return result; - } - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return null; - } - }]); - - return Coalesce; -}(Expression); - -module.exports = { - Coalesce: Coalesce, - IsNull: IsNull, - Null: Null -}; -},{"./expression":22}],33:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('../datatypes/logic'), - ThreeValuedLogic = _require2.ThreeValuedLogic; - -var _require3 = require('../datatypes/datetime'), - DateTime = _require3.DateTime; - -var _require4 = require('../util/util'), - typeIsArray = _require4.typeIsArray; - -var _require5 = require('../util/comparison'), - equals = _require5.equals, - equivalent = _require5.equivalent; - -var DT = require('./datetime'); - -var LIST = require('./list'); - -var IVL = require('./interval'); - -var Equal = /*#__PURE__*/function (_Expression) { - _inherits(Equal, _Expression); - - var _super = _createSuper(Equal); - - function Equal(json) { - _classCallCheck(this, Equal); - - return _super.call(this, json); - } - - _createClass(Equal, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args[0] == null || args[1] == null) { - return null; - } - - return equals.apply(void 0, _toConsumableArray(args)); - } - }]); - - return Equal; -}(Expression); - -var Equivalent = /*#__PURE__*/function (_Expression2) { - _inherits(Equivalent, _Expression2); - - var _super2 = _createSuper(Equivalent); - - function Equivalent(json) { - _classCallCheck(this, Equivalent); - - return _super2.call(this, json); - } - - _createClass(Equivalent, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs = this.execArgs(ctx), - _this$execArgs2 = _slicedToArray(_this$execArgs, 2), - a = _this$execArgs2[0], - b = _this$execArgs2[1]; - - if (a == null && b == null) { - return true; - } else if (a == null || b == null) { - return false; - } else { - return equivalent(a, b); - } - } - }]); - - return Equivalent; -}(Expression); - -var NotEqual = /*#__PURE__*/function (_Expression3) { - _inherits(NotEqual, _Expression3); - - var _super3 = _createSuper(NotEqual); - - function NotEqual(json) { - _classCallCheck(this, NotEqual); - - return _super3.call(this, json); - } - - _createClass(NotEqual, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args[0] == null || args[1] == null) { - return null; - } - - return ThreeValuedLogic.not(equals.apply(void 0, _toConsumableArray(this.execArgs(ctx)))); - } - }]); - - return NotEqual; -}(Expression); - -var Union = /*#__PURE__*/function (_Expression4) { - _inherits(Union, _Expression4); - - var _super4 = _createSuper(Union); - - function Union(json) { - _classCallCheck(this, Union); - - return _super4.call(this, json); - } - - _createClass(Union, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs3 = this.execArgs(ctx), - _this$execArgs4 = _slicedToArray(_this$execArgs3, 2), - a = _this$execArgs4[0], - b = _this$execArgs4[1]; - - if (a == null && b == null) { - return this.listTypeArgs() ? [] : null; - } - - if (a == null || b == null) { - var notNull = a || b; - - if (typeIsArray(notNull)) { - return notNull; - } else { - return null; - } - } - - var lib = typeIsArray(a) ? LIST : IVL; - return lib.doUnion(a, b); - } - }, { - key: "listTypeArgs", - value: function listTypeArgs() { - return this.args.some(function (arg) { - return arg.asTypeSpecifier != null && arg.asTypeSpecifier.type === 'ListTypeSpecifier'; - }); - } - }]); - - return Union; -}(Expression); - -var Except = /*#__PURE__*/function (_Expression5) { - _inherits(Except, _Expression5); - - var _super5 = _createSuper(Except); - - function Except(json) { - _classCallCheck(this, Except); - - return _super5.call(this, json); - } - - _createClass(Except, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs5 = this.execArgs(ctx), - _this$execArgs6 = _slicedToArray(_this$execArgs5, 2), - a = _this$execArgs6[0], - b = _this$execArgs6[1]; - - if (a == null) { - return null; - } - - if (b == null) { - return typeIsArray(a) ? a : null; - } - - var lib = typeIsArray(a) ? LIST : IVL; - return lib.doExcept(a, b); - } - }]); - - return Except; -}(Expression); - -var Intersect = /*#__PURE__*/function (_Expression6) { - _inherits(Intersect, _Expression6); - - var _super6 = _createSuper(Intersect); - - function Intersect(json) { - _classCallCheck(this, Intersect); - - return _super6.call(this, json); - } - - _createClass(Intersect, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs7 = this.execArgs(ctx), - _this$execArgs8 = _slicedToArray(_this$execArgs7, 2), - a = _this$execArgs8[0], - b = _this$execArgs8[1]; - - if (a == null || b == null) { - return null; - } - - var lib = typeIsArray(a) ? LIST : IVL; - return lib.doIntersect(a, b); - } - }]); - - return Intersect; -}(Expression); - -var Indexer = /*#__PURE__*/function (_Expression7) { - _inherits(Indexer, _Expression7); - - var _super7 = _createSuper(Indexer); - - function Indexer(json) { - _classCallCheck(this, Indexer); - - return _super7.call(this, json); - } - - _createClass(Indexer, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs9 = this.execArgs(ctx), - _this$execArgs10 = _slicedToArray(_this$execArgs9, 2), - operand = _this$execArgs10[0], - index = _this$execArgs10[1]; - - if (operand == null || index == null) { - return null; - } - - if (index < 0 || index >= operand.length) { - return null; - } - - return operand[index]; - } - }]); - - return Indexer; -}(Expression); - -var In = /*#__PURE__*/function (_Expression8) { - _inherits(In, _Expression8); - - var _super8 = _createSuper(In); - - function In(json) { - var _this; - - _classCallCheck(this, In); - - _this = _super8.call(this, json); - _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this; - } - - _createClass(In, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs11 = this.execArgs(ctx), - _this$execArgs12 = _slicedToArray(_this$execArgs11, 2), - item = _this$execArgs12[0], - container = _this$execArgs12[1]; - - if (item == null) { - return null; - } - - if (container == null) { - return false; - } - - var lib = typeIsArray(container) ? LIST : IVL; - return lib.doContains(container, item, this.precision); - } - }]); - - return In; -}(Expression); - -var Contains = /*#__PURE__*/function (_Expression9) { - _inherits(Contains, _Expression9); - - var _super9 = _createSuper(Contains); - - function Contains(json) { - var _this2; - - _classCallCheck(this, Contains); - - _this2 = _super9.call(this, json); - _this2.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this2; - } - - _createClass(Contains, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs13 = this.execArgs(ctx), - _this$execArgs14 = _slicedToArray(_this$execArgs13, 2), - container = _this$execArgs14[0], - item = _this$execArgs14[1]; - - if (container == null) { - return false; - } - - if (item == null) { - return null; - } - - var lib = typeIsArray(container) ? LIST : IVL; - return lib.doContains(container, item, this.precision); - } - }]); - - return Contains; -}(Expression); - -var Includes = /*#__PURE__*/function (_Expression10) { - _inherits(Includes, _Expression10); - - var _super10 = _createSuper(Includes); - - function Includes(json) { - var _this3; - - _classCallCheck(this, Includes); - - _this3 = _super10.call(this, json); - _this3.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this3; - } - - _createClass(Includes, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs15 = this.execArgs(ctx), - _this$execArgs16 = _slicedToArray(_this$execArgs15, 2), - container = _this$execArgs16[0], - contained = _this$execArgs16[1]; - - if (container == null || contained == null) { - return null; - } - - var lib = typeIsArray(container) ? LIST : IVL; - return lib.doIncludes(container, contained, this.precision); - } - }]); - - return Includes; -}(Expression); - -var IncludedIn = /*#__PURE__*/function (_Expression11) { - _inherits(IncludedIn, _Expression11); - - var _super11 = _createSuper(IncludedIn); - - function IncludedIn(json) { - var _this4; - - _classCallCheck(this, IncludedIn); - - _this4 = _super11.call(this, json); - _this4.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this4; - } - - _createClass(IncludedIn, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs17 = this.execArgs(ctx), - _this$execArgs18 = _slicedToArray(_this$execArgs17, 2), - contained = _this$execArgs18[0], - container = _this$execArgs18[1]; - - if (container == null || contained == null) { - return null; - } - - var lib = typeIsArray(container) ? LIST : IVL; - return lib.doIncludes(container, contained, this.precision); - } - }]); - - return IncludedIn; -}(Expression); - -var ProperIncludes = /*#__PURE__*/function (_Expression12) { - _inherits(ProperIncludes, _Expression12); - - var _super12 = _createSuper(ProperIncludes); - - function ProperIncludes(json) { - var _this5; - - _classCallCheck(this, ProperIncludes); - - _this5 = _super12.call(this, json); - _this5.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this5; - } - - _createClass(ProperIncludes, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs19 = this.execArgs(ctx), - _this$execArgs20 = _slicedToArray(_this$execArgs19, 2), - container = _this$execArgs20[0], - contained = _this$execArgs20[1]; - - if (container == null || contained == null) { - return null; - } - - var lib = typeIsArray(container) ? LIST : IVL; - return lib.doProperIncludes(container, contained, this.precision); - } - }]); - - return ProperIncludes; -}(Expression); - -var ProperIncludedIn = /*#__PURE__*/function (_Expression13) { - _inherits(ProperIncludedIn, _Expression13); - - var _super13 = _createSuper(ProperIncludedIn); - - function ProperIncludedIn(json) { - var _this6; - - _classCallCheck(this, ProperIncludedIn); - - _this6 = _super13.call(this, json); - _this6.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this6; - } - - _createClass(ProperIncludedIn, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs21 = this.execArgs(ctx), - _this$execArgs22 = _slicedToArray(_this$execArgs21, 2), - contained = _this$execArgs22[0], - container = _this$execArgs22[1]; - - if (container == null || contained == null) { - return null; - } - - var lib = typeIsArray(container) ? LIST : IVL; - return lib.doProperIncludes(container, contained, this.precision); - } - }]); - - return ProperIncludedIn; -}(Expression); - -var Length = /*#__PURE__*/function (_Expression14) { - _inherits(Length, _Expression14); - - var _super14 = _createSuper(Length); - - function Length(json) { - _classCallCheck(this, Length); - - return _super14.call(this, json); - } - - _createClass(Length, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - return arg.length; - } else if (this.arg.asTypeSpecifier.type === 'ListTypeSpecifier') { - return 0; - } else { - return null; - } - } - }]); - - return Length; -}(Expression); - -var After = /*#__PURE__*/function (_Expression15) { - _inherits(After, _Expression15); - - var _super15 = _createSuper(After); - - function After(json) { - var _this7; - - _classCallCheck(this, After); - - _this7 = _super15.call(this, json); - _this7.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this7; - } - - _createClass(After, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs23 = this.execArgs(ctx), - _this$execArgs24 = _slicedToArray(_this$execArgs23, 2), - a = _this$execArgs24[0], - b = _this$execArgs24[1]; - - if (a == null || b == null) { - return null; - } - - var lib = a instanceof DateTime ? DT : IVL; - return lib.doAfter(a, b, this.precision); - } - }]); - - return After; -}(Expression); - -var Before = /*#__PURE__*/function (_Expression16) { - _inherits(Before, _Expression16); - - var _super16 = _createSuper(Before); - - function Before(json) { - var _this8; - - _classCallCheck(this, Before); - - _this8 = _super16.call(this, json); - _this8.precision = json.precision != null ? json.precision.toLowerCase() : undefined; - return _this8; - } - - _createClass(Before, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs25 = this.execArgs(ctx), - _this$execArgs26 = _slicedToArray(_this$execArgs25, 2), - a = _this$execArgs26[0], - b = _this$execArgs26[1]; - - if (a == null || b == null) { - return null; - } - - var lib = a instanceof DateTime ? DT : IVL; - return lib.doBefore(a, b, this.precision); - } - }]); - - return Before; -}(Expression); - -var SameAs = /*#__PURE__*/function (_Expression17) { - _inherits(SameAs, _Expression17); - - var _super17 = _createSuper(SameAs); - - function SameAs(json) { - var _this9; - - _classCallCheck(this, SameAs); - - _this9 = _super17.call(this, json); - _this9.precision = json.precision; - return _this9; - } - - _createClass(SameAs, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs27 = this.execArgs(ctx), - _this$execArgs28 = _slicedToArray(_this$execArgs27, 2), - a = _this$execArgs28[0], - b = _this$execArgs28[1]; - - if (a != null && b != null) { - return a.sameAs(b, this.precision != null ? this.precision.toLowerCase() : undefined); - } else { - return null; - } - } - }]); - - return SameAs; -}(Expression); - -var SameOrAfter = /*#__PURE__*/function (_Expression18) { - _inherits(SameOrAfter, _Expression18); - - var _super18 = _createSuper(SameOrAfter); - - function SameOrAfter(json) { - var _this10; - - _classCallCheck(this, SameOrAfter); - - _this10 = _super18.call(this, json); - _this10.precision = json.precision; - return _this10; - } - - _createClass(SameOrAfter, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs29 = this.execArgs(ctx), - _this$execArgs30 = _slicedToArray(_this$execArgs29, 2), - d1 = _this$execArgs30[0], - d2 = _this$execArgs30[1]; - - if (d1 != null && d2 != null) { - return d1.sameOrAfter(d2, this.precision != null ? this.precision.toLowerCase() : undefined); - } else { - return null; - } - } - }]); - - return SameOrAfter; -}(Expression); - -var SameOrBefore = /*#__PURE__*/function (_Expression19) { - _inherits(SameOrBefore, _Expression19); - - var _super19 = _createSuper(SameOrBefore); - - function SameOrBefore(json) { - var _this11; - - _classCallCheck(this, SameOrBefore); - - _this11 = _super19.call(this, json); - _this11.precision = json.precision; - return _this11; - } - - _createClass(SameOrBefore, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs31 = this.execArgs(ctx), - _this$execArgs32 = _slicedToArray(_this$execArgs31, 2), - d1 = _this$execArgs32[0], - d2 = _this$execArgs32[1]; - - if (d1 != null && d2 != null) { - return d1.sameOrBefore(d2, this.precision != null ? this.precision.toLowerCase() : undefined); - } else { - return null; - } - } - }]); - - return SameOrBefore; -}(Expression); // Implemented for DateTime, Date, and Time but not for Decimal yet - - -var Precision = /*#__PURE__*/function (_Expression20) { - _inherits(Precision, _Expression20); - - var _super20 = _createSuper(Precision); - - function Precision(json) { - _classCallCheck(this, Precision); - - return _super20.call(this, json); - } - - _createClass(Precision, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } // Since we can't extend UnimplementedExpression directly for this overloaded function, - // we have to copy the error to throw here if we are not using the correct type - - - if (!arg.getPrecisionValue) { - throw new Error("Unimplemented Expression: Precision"); - } - - return arg.getPrecisionValue(); - } - }]); - - return Precision; -}(Expression); - -module.exports = { - After: After, - Before: Before, - Contains: Contains, - Equal: Equal, - Equivalent: Equivalent, - Except: Except, - In: In, - IncludedIn: IncludedIn, - Includes: Includes, - Indexer: Indexer, - Intersect: Intersect, - Length: Length, - NotEqual: NotEqual, - Precision: Precision, - ProperIncludedIn: ProperIncludedIn, - ProperIncludes: ProperIncludes, - SameAs: SameAs, - SameOrAfter: SameOrAfter, - SameOrBefore: SameOrBefore, - Union: Union -}; -},{"../datatypes/datetime":7,"../datatypes/logic":10,"../util/comparison":47,"../util/util":50,"./datetime":20,"./expression":22,"./interval":26,"./list":28}],34:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('./builder'), - build = _require2.build; - -var ParameterDef = /*#__PURE__*/function (_Expression) { - _inherits(ParameterDef, _Expression); - - var _super = _createSuper(ParameterDef); - - function ParameterDef(json) { - var _this; - - _classCallCheck(this, ParameterDef); - - _this = _super.call(this, json); - _this.name = json.name; - _this.default = build(json.default); - _this.parameterTypeSpecifier = json.parameterTypeSpecifier; - return _this; - } - - _createClass(ParameterDef, [{ - key: "exec", - value: function exec(ctx) { - // If context parameters contains the name, return value. - if (ctx && ctx.parameters[this.name] !== undefined) { - return ctx.parameters[this.name]; // If the parent context contains the name, return that - } else if (ctx.getParentParameter(this.name) !== undefined) { - var parentParam = ctx.getParentParameter(this.name); - return parentParam.default != null ? parentParam.default.execute(ctx) : parentParam; // If default type exists, execute the default type - } else if (this.default != null) { - this.default.execute(ctx); - } - } - }]); - - return ParameterDef; -}(Expression); - -var ParameterRef = /*#__PURE__*/function (_Expression2) { - _inherits(ParameterRef, _Expression2); - - var _super2 = _createSuper(ParameterRef); - - function ParameterRef(json) { - var _this2; - - _classCallCheck(this, ParameterRef); - - _this2 = _super2.call(this, json); - _this2.name = json.name; - _this2.library = json.libraryName; - return _this2; - } - - _createClass(ParameterRef, [{ - key: "exec", - value: function exec(ctx) { - ctx = this.library ? ctx.getLibraryContext(this.library) : ctx; - var param = ctx.getParameter(this.name); - return param != null ? param.execute(ctx) : undefined; - } - }]); - - return ParameterRef; -}(Expression); - -module.exports = { - ParameterDef: ParameterDef, - ParameterRef: ParameterRef -}; -},{"./builder":16,"./expression":22}],35:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var DT = require('../datatypes/datatypes'); // Unit conversation is currently implemented on for time duration comparison operations -// TODO: Implement unit conversation for time duration mathematical operations - - -var Quantity = /*#__PURE__*/function (_Expression) { - _inherits(Quantity, _Expression); - - var _super = _createSuper(Quantity); - - function Quantity(json) { - var _this; - - _classCallCheck(this, Quantity); - - _this = _super.call(this, json); - _this.value = parseFloat(json.value); - _this.unit = json.unit; - return _this; - } - - _createClass(Quantity, [{ - key: "exec", - value: function exec(ctx) { - return new DT.Quantity(this.value, this.unit); - } - }]); - - return Quantity; -}(Expression); - -module.exports = { - Quantity: Quantity -}; -},{"../datatypes/datatypes":6,"./expression":22}],36:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } - -function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _require = require('./expression'), - Expression = _require.Expression, - UnimplementedExpression = _require.UnimplementedExpression; - -var _require2 = require('../runtime/context'), - Context = _require2.Context; - -var _require3 = require('./builder'), - build = _require3.build; - -var _require4 = require('../util/util'), - typeIsArray = _require4.typeIsArray, - allTrue = _require4.allTrue; - -var _require5 = require('../util/comparison'), - equals = _require5.equals; - -var AliasedQuerySource = function AliasedQuerySource(json) { - _classCallCheck(this, AliasedQuerySource); - - this.alias = json.alias; - this.expression = build(json.expression); -}; - -var LetClause = function LetClause(json) { - _classCallCheck(this, LetClause); - - this.identifier = json.identifier; - this.expression = build(json.expression); -}; - -var With = /*#__PURE__*/function (_Expression) { - _inherits(With, _Expression); - - var _super = _createSuper(With); - - function With(json) { - var _this; - - _classCallCheck(this, With); - - _this = _super.call(this, json); - _this.alias = json.alias; - _this.expression = build(json.expression); - _this.suchThat = build(json.suchThat); - return _this; - } - - _createClass(With, [{ - key: "exec", - value: function exec(ctx) { - var _this2 = this; - - var records = this.expression.execute(ctx); - - if (!typeIsArray(records)) { - records = [records]; - } - - var returns = records.map(function (rec) { - var childCtx = ctx.childContext(); - childCtx.set(_this2.alias, rec); - return _this2.suchThat.execute(childCtx); - }); - return returns.some(function (x) { - return x; - }); - } - }]); - - return With; -}(Expression); - -var Without = /*#__PURE__*/function (_With) { - _inherits(Without, _With); - - var _super2 = _createSuper(Without); - - function Without(json) { - _classCallCheck(this, Without); - - return _super2.call(this, json); - } - - _createClass(Without, [{ - key: "exec", - value: function exec(ctx) { - return !_get(_getPrototypeOf(Without.prototype), "exec", this).call(this, ctx); - } - }]); - - return Without; -}(With); // ELM-only, not a product of CQL - - -var Sort = /*#__PURE__*/function (_UnimplementedExpress) { - _inherits(Sort, _UnimplementedExpress); - - var _super3 = _createSuper(Sort); - - function Sort() { - _classCallCheck(this, Sort); - - return _super3.apply(this, arguments); - } - - return Sort; -}(UnimplementedExpression); - -var ByDirection = /*#__PURE__*/function (_Expression2) { - _inherits(ByDirection, _Expression2); - - var _super4 = _createSuper(ByDirection); - - function ByDirection(json) { - var _this3; - - _classCallCheck(this, ByDirection); - - _this3 = _super4.call(this, json); - _this3.direction = json.direction; - _this3.low_order = _this3.direction === 'asc' || _this3.direction === 'ascending' ? -1 : 1; - _this3.high_order = _this3.low_order * -1; - return _this3; - } - - _createClass(ByDirection, [{ - key: "exec", - value: function exec(ctx, a, b) { - if (a === b) { - return 0; - } else if (a.isQuantity && b.isQuantity) { - if (a.before(b)) { - return this.low_order; - } else { - return this.high_order; + // @ts-ignore + for (var _i = 0, _a = this.constructor.FIELDS; _i < _a.length; _i++) { + var field = _a[_i]; + // if both have this precision defined + // @ts-ignore + if (this[field] != null && other[field] != null) { + // if this value is greater than the other return with true. this is after other + // @ts-ignore + if (this[field] > other[field]) { + return true; + // if this value is greater than the other return with false. this is before + // @ts-ignore + } + else if (this[field] < other[field]) { + return false; + } + // execution continues if the values are the same + // if both dont have this precision, return true if precision is not defined + // @ts-ignore + } + else if (this[field] == null && other[field] == null) { + if (precision == null) { + return true; + } + else { + // we havent met precision yet + return null; + } + // otherwise they have inconclusive precision, return null + } + else { + return null; + } + // if precision is defined and we have reached expected precision, we can leave the loop + if (precision != null && precision === field) { + break; + } } - } else if (a < b) { - return this.low_order; - } else { - return this.high_order; - } - } - }]); - - return ByDirection; -}(Expression); - -var ByExpression = /*#__PURE__*/function (_Expression3) { - _inherits(ByExpression, _Expression3); - - var _super5 = _createSuper(ByExpression); - - function ByExpression(json) { - var _this4; - - _classCallCheck(this, ByExpression); - - _this4 = _super5.call(this, json); - _this4.expression = build(json.expression); - _this4.direction = json.direction; - _this4.low_order = _this4.direction === 'asc' || _this4.direction === 'ascending' ? -1 : 1; - _this4.high_order = _this4.low_order * -1; - return _this4; - } - - _createClass(ByExpression, [{ - key: "exec", - value: function exec(ctx, a, b) { - var sctx = ctx.childContext(a); - var a_val = this.expression.execute(sctx); - sctx = ctx.childContext(b); - var b_val = this.expression.execute(sctx); - - if (a_val === b_val || a_val == null && b_val == null) { - return 0; - } else if (a_val == null || b_val == null) { - return a_val == null ? this.low_order : this.high_order; - } else if (a_val.isQuantity && b_val.isQuantity) { - return a_val.before(b_val) ? this.low_order : this.high_order; - } else { - return a_val < b_val ? this.low_order : this.high_order; - } + // if we made it here, then all fields matched and they are same + return true; + }; + AbstractDate.prototype.before = function (other, precision) { + if (!(other.isDate || other.isDateTime)) { + return null; + } + else if (this.isDate && other.isDateTime) { + return this.getDateTime().before(other, precision); + } + else if (this.isDateTime && other.isDate) { + other = other.getDateTime(); + } + // @ts-ignore + if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { + throw new Error("Invalid precision: ".concat(precision)); + } + // make a copy of other in the correct timezone offset if they don't match. + if (this.timezoneOffset !== other.timezoneOffset) { + other = other.convertToTimezoneOffset(this.timezoneOffset); + } + // @ts-ignore + for (var _i = 0, _a = this.constructor.FIELDS; _i < _a.length; _i++) { + var field = _a[_i]; + // if both have this precision defined + // @ts-ignore + if (this[field] != null && other[field] != null) { + // if this value is less than the other return with true. this is before other + // @ts-ignore + if (this[field] < other[field]) { + return true; + // if this value is greater than the other return with false. this is after + // @ts-ignore + } + else if (this[field] > other[field]) { + return false; + } + // execution continues if the values are the same + // if both dont have this precision, return false if precision is not defined + // @ts-ignore + } + else if (this[field] == null && other[field] == null) { + if (precision == null) { + return false; + } + else { + // we havent met precision yet + return null; + } + // otherwise they have inconclusive precision, return null + } + else { + return null; + } + // if precision is defined and we have reached expected precision, we can leave the loop + if (precision != null && precision === field) { + break; + } + } + // if we made it here, then all fields matched and they are same + return false; + }; + AbstractDate.prototype.after = function (other, precision) { + if (!(other.isDate || other.isDateTime)) { + return null; + } + else if (this.isDate && other.isDateTime) { + return this.getDateTime().after(other, precision); + } + else if (this.isDateTime && other.isDate) { + other = other.getDateTime(); + } + // @ts-ignore + if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { + throw new Error("Invalid precision: ".concat(precision)); + } + // make a copy of other in the correct timezone offset if they don't match. + if (this.timezoneOffset !== other.timezoneOffset) { + other = other.convertToTimezoneOffset(this.timezoneOffset); + } + // @ts-ignore + for (var _i = 0, _a = this.constructor.FIELDS; _i < _a.length; _i++) { + var field = _a[_i]; + // if both have this precision defined + // @ts-ignore + if (this[field] != null && other[field] != null) { + // if this value is greater than the other return with true. this is after other + // @ts-ignore + if (this[field] > other[field]) { + return true; + // if this value is greater than the other return with false. this is before + // @ts-ignore + } + else if (this[field] < other[field]) { + return false; + } + // execution continues if the values are the same + // if both dont have this precision, return false if precision is not defined + // @ts-ignore + } + else if (this[field] == null && other[field] == null) { + if (precision == null) { + return false; + } + else { + // we havent met precision yet + return null; + } + // otherwise they have inconclusive precision, return null + } + else { + return null; + } + // if precision is defined and we have reached expected precision, we can leave the loop + if (precision != null && precision === field) { + break; + } + } + // if we made it here, then all fields matched and they are same + return false; + }; + AbstractDate.prototype.add = function (offset, field) { + var _a; + if (offset === 0 || this.year == null) { + return this.copy(); + } + // Use luxon to do the date math because it honors DST and it has the leap-year/end-of-month semantics we want. + // NOTE: The luxonDateTime will contain default values where this[unit] is null, but we'll account for that. + var luxonDateTime = this.toLuxonDateTime(); + // From the spec: "The operation is performed by converting the time-based quantity to the most precise value + // specified in the date/time (truncating any resulting decimal portion) and then adding it to the date/time value." + // However, since you can't really convert days to months, if "this" is less precise than the field being added, we can + // add to the earliest possible value of "this" or subtract from the latest possible value of "this" (depending on the + // sign of the offset), and then null out the imprecise fields again after doing the calculation. Due to the way + // luxonDateTime is constructed above, it is already at the earliest value, so only adjust if the offset is negative. + // @ts-ignore + var offsetIsMorePrecise = this[field] == null; //whether the quantity we are adding is more precise than "this". + if (offsetIsMorePrecise && offset < 0) { + luxonDateTime = luxonDateTime.endOf(this.getPrecision()); + } + // Now do the actual math and convert it back to a Date/DateTime w/ originally null fields nulled out again + var luxonResult = luxonDateTime.plus((_a = {}, _a[field] = offset, _a)); + var result = this.constructor + .fromLuxonDateTime(luxonResult) + .reducedPrecision(this.getPrecision()); + // Luxon never has a null offset, but sometimes "this" does, so reset to null if applicable + if (this.isDateTime && this.timezoneOffset == null) { + result.timezoneOffset = null; + } + // Can't use overflowsOrUnderflows from math.js due to circular dependencies when we require it + if (result.after(exports.MAX_DATETIME_VALUE || result.before(exports.MIN_DATETIME_VALUE))) { + return null; + } + else { + return result; + } + }; + AbstractDate.prototype.getFieldFloor = function (field) { + switch (field) { + case 'month': + return 1; + case 'day': + return 1; + case 'hour': + return 0; + case 'minute': + return 0; + case 'second': + return 0; + case 'millisecond': + return 0; + default: + throw new Error('Tried to floor a field that has no floor value: ' + field); + } + }; + AbstractDate.prototype.getFieldCieling = function (field) { + switch (field) { + case 'month': + return 12; + case 'day': + return daysInMonth(this.year, this.month); + case 'hour': + return 23; + case 'minute': + return 59; + case 'second': + return 59; + case 'millisecond': + return 999; + default: + throw new Error('Tried to clieling a field that has no cieling value: ' + field); + } + }; + return AbstractDate; +}()); +var DateTime = /** @class */ (function (_super) { + __extends(DateTime, _super); + function DateTime(year, month, day, hour, minute, second, millisecond, timezoneOffset) { + if (year === void 0) { year = null; } + if (month === void 0) { month = null; } + if (day === void 0) { day = null; } + if (hour === void 0) { hour = null; } + if (minute === void 0) { minute = null; } + if (second === void 0) { second = null; } + if (millisecond === void 0) { millisecond = null; } + var _this = + // from the spec: If no timezone is specified, the timezone of the evaluation request timestamp is used. + // NOTE: timezoneOffset will be explicitly null for the Time overload, whereas + // it will be undefined if simply unspecified + _super.call(this, year, month, day) || this; + _this.hour = hour; + _this.minute = minute; + _this.second = second; + _this.millisecond = millisecond; + if (timezoneOffset === undefined) { + _this.timezoneOffset = (new util_1.jsDate().getTimezoneOffset() / 60) * -1; + } + else { + _this.timezoneOffset = timezoneOffset; + } + return _this; } - }]); - - return ByExpression; -}(Expression); - -var ByColumn = /*#__PURE__*/function (_ByExpression) { - _inherits(ByColumn, _ByExpression); - - var _super6 = _createSuper(ByColumn); - - function ByColumn(json) { - var _this5; - - _classCallCheck(this, ByColumn); - - _this5 = _super6.call(this, json); - _this5.expression = build({ - name: json.path, - type: 'IdentifierRef' + DateTime.parse = function (string) { + if (string === null) { + return null; + } + var matches = /(\d{4})(-(\d{2}))?(-(\d{2}))?(T((\d{2})(:(\d{2})(:(\d{2})(\.(\d+))?)?)?)?(Z|(([+-])(\d{2})(:?(\d{2}))?))?)?/.exec(string); + if (matches == null) { + return null; + } + var years = matches[1]; + var months = matches[3]; + var days = matches[5]; + var hours = matches[8]; + var minutes = matches[10]; + var seconds = matches[12]; + var milliseconds = matches[14]; + if (milliseconds != null) { + milliseconds = (0, util_1.normalizeMillisecondsField)(milliseconds); + } + if (milliseconds != null) { + string = (0, util_1.normalizeMillisecondsFieldInString)(string, matches[14]); + } + if (!isValidDateTimeStringFormat(string)) { + return null; + } + // convert the args to integers + var args = [years, months, days, hours, minutes, seconds, milliseconds].map(function (arg) { + return arg != null ? parseInt(arg) : arg; + }); + // convert timezone offset to decimal and add it to arguments + if (matches[18] != null) { + var num = parseInt(matches[18]) + (matches[20] != null ? parseInt(matches[20]) / 60 : 0); + args.push(matches[17] === '+' ? num : num * -1); + } + else if (matches[15] === 'Z') { + args.push(0); + } + // @ts-ignore + return new (DateTime.bind.apply(DateTime, __spreadArray([void 0], args, false)))(); + }; + // TODO: Note: using the jsDate type causes issues, fix later + DateTime.fromJSDate = function (date, timezoneOffset) { + //This is from a JS Date, not a CQL Date + if (date instanceof DateTime) { + return date; + } + if (timezoneOffset != null) { + date = new util_1.jsDate(date.getTime() + timezoneOffset * 60 * 60 * 1000); + return new DateTime(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds(), timezoneOffset); + } + else { + return new DateTime(date.getFullYear(), date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()); + } + }; + DateTime.fromLuxonDateTime = function (luxonDT) { + if (luxonDT instanceof DateTime) { + return luxonDT; + } + return new DateTime(luxonDT.year, luxonDT.month, luxonDT.day, luxonDT.hour, luxonDT.minute, luxonDT.second, luxonDT.millisecond, luxonDT.offset / 60); + }; + Object.defineProperty(DateTime.prototype, "isDateTime", { + get: function () { + return true; + }, + enumerable: false, + configurable: true }); - return _this5; - } - - return ByColumn; -}(ByExpression); - -var ReturnClause = function ReturnClause(json) { - _classCallCheck(this, ReturnClause); - - this.expression = build(json.expression); - this.distinct = json.distinct != null ? json.distinct : true; -}; - -var SortClause = /*#__PURE__*/function () { - function SortClause(json) { - _classCallCheck(this, SortClause); - - this.by = build(json != null ? json.by : undefined); - } - - _createClass(SortClause, [{ - key: "sort", - value: function sort(ctx, values) { - var _this6 = this; - - if (this.by) { - return values.sort(function (a, b) { - var order = 0; - - var _iterator = _createForOfIteratorHelper(_this6.by), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var item = _step.value; - // Do not use execute here because the value of the sort order is not important. - order = item.exec(ctx, a, b); - - if (order !== 0) { - break; - } + Object.defineProperty(DateTime.prototype, "isDate", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + DateTime.prototype.copy = function () { + return new DateTime(this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond, this.timezoneOffset); + }; + DateTime.prototype.successor = function () { + if (this.millisecond != null) { + return this.add(1, DateTime.Unit.MILLISECOND); + } + else if (this.second != null) { + return this.add(1, DateTime.Unit.SECOND); + } + else if (this.minute != null) { + return this.add(1, DateTime.Unit.MINUTE); + } + else if (this.hour != null) { + return this.add(1, DateTime.Unit.HOUR); + } + else if (this.day != null) { + return this.add(1, DateTime.Unit.DAY); + } + else if (this.month != null) { + return this.add(1, DateTime.Unit.MONTH); + } + else if (this.year != null) { + return this.add(1, DateTime.Unit.YEAR); + } + }; + DateTime.prototype.predecessor = function () { + if (this.millisecond != null) { + return this.add(-1, DateTime.Unit.MILLISECOND); + } + else if (this.second != null) { + return this.add(-1, DateTime.Unit.SECOND); + } + else if (this.minute != null) { + return this.add(-1, DateTime.Unit.MINUTE); + } + else if (this.hour != null) { + return this.add(-1, DateTime.Unit.HOUR); + } + else if (this.day != null) { + return this.add(-1, DateTime.Unit.DAY); + } + else if (this.month != null) { + return this.add(-1, DateTime.Unit.MONTH); + } + else if (this.year != null) { + return this.add(-1, DateTime.Unit.YEAR); + } + }; + DateTime.prototype.convertToTimezoneOffset = function (timezoneOffset) { + if (timezoneOffset === void 0) { timezoneOffset = 0; } + var shiftedLuxonDT = this.toLuxonDateTime().setZone(luxon_1.FixedOffsetZone.instance(timezoneOffset * 60)); + var shiftedDT = DateTime.fromLuxonDateTime(shiftedLuxonDT); + return shiftedDT.reducedPrecision(this.getPrecision()); + }; + DateTime.prototype.differenceBetween = function (other, unitField) { + other = this._implicitlyConvert(other); + if (other == null || !other.isDateTime) { + return null; + } + // According to CQL spec: + // * "Difference calculations are performed by truncating the datetime values at the next precision, + // and then performing the corresponding duration calculation on the truncated values." + // * "When difference is calculated for hours or finer units, timezone offsets should be normalized + // prior to truncation to correctly consider real (actual elapsed) time. When difference is calculated + // for days or coarser units, however, the time components (including timezone offset) should be truncated + // without normalization to correctly reflect the difference in calendar days, months, and years." + var a = this.toLuxonUncertainty(); + var b = other.toLuxonUncertainty(); + // If unit is days or above, reset all the DateTimes to UTC since TZ offset should not be considered; + // Otherwise, we don't actually have to "normalize" to a common TZ because Luxon takes TZ into account. + if ([DateTime.Unit.YEAR, DateTime.Unit.MONTH, DateTime.Unit.WEEK, DateTime.Unit.DAY].includes(unitField)) { + a.low = a.low.toUTC(0, { keepLocalTime: true }); + a.high = a.high.toUTC(0, { keepLocalTime: true }); + b.low = b.low.toUTC(0, { keepLocalTime: true }); + b.high = b.high.toUTC(0, { keepLocalTime: true }); + } + // Truncate all dates at precision below specified unit + a.low = truncateLuxonDateTime(a.low, unitField); + a.high = truncateLuxonDateTime(a.high, unitField); + b.low = truncateLuxonDateTime(b.low, unitField); + b.high = truncateLuxonDateTime(b.high, unitField); + // Return the duration based on the normalize and truncated values + return new uncertainty_1.Uncertainty(wholeLuxonDuration(b.low.diff(a.high, unitField), unitField), wholeLuxonDuration(b.high.diff(a.low, unitField), unitField)); + }; + DateTime.prototype.durationBetween = function (other, unitField) { + other = this._implicitlyConvert(other); + if (other == null || !other.isDateTime) { + return null; + } + var a = this.toLuxonUncertainty(); + var b = other.toLuxonUncertainty(); + return new uncertainty_1.Uncertainty(wholeLuxonDuration(b.low.diff(a.high, unitField), unitField), wholeLuxonDuration(b.high.diff(a.low, unitField), unitField)); + }; + DateTime.prototype.isUTC = function () { + // A timezoneOffset of 0 indicates UTC time. + return !this.timezoneOffset; + }; + DateTime.prototype.getPrecision = function () { + var result = null; + if (this.year != null) { + result = DateTime.Unit.YEAR; + } + else { + return result; + } + if (this.month != null) { + result = DateTime.Unit.MONTH; + } + else { + return result; + } + if (this.day != null) { + result = DateTime.Unit.DAY; + } + else { + return result; + } + if (this.hour != null) { + result = DateTime.Unit.HOUR; + } + else { + return result; + } + if (this.minute != null) { + result = DateTime.Unit.MINUTE; + } + else { + return result; + } + if (this.second != null) { + result = DateTime.Unit.SECOND; + } + else { + return result; + } + if (this.millisecond != null) { + result = DateTime.Unit.MILLISECOND; + } + return result; + }; + DateTime.prototype.getPrecisionValue = function () { + return this.isTime() + ? TIME_PRECISION_VALUE_MAP.get(this.getPrecision()) + : DATETIME_PRECISION_VALUE_MAP.get(this.getPrecision()); + }; + DateTime.prototype.toLuxonDateTime = function () { + var _a, _b, _c, _d, _e, _f, _g; + var offsetMins = this.timezoneOffset != null + ? this.timezoneOffset * 60 + : new util_1.jsDate().getTimezoneOffset() * -1; + return luxon_1.DateTime.fromObject({ + year: (_a = this.year) !== null && _a !== void 0 ? _a : undefined, + month: (_b = this.month) !== null && _b !== void 0 ? _b : undefined, + day: (_c = this.day) !== null && _c !== void 0 ? _c : undefined, + hour: (_d = this.hour) !== null && _d !== void 0 ? _d : undefined, + minute: (_e = this.minute) !== null && _e !== void 0 ? _e : undefined, + second: (_f = this.second) !== null && _f !== void 0 ? _f : undefined, + millisecond: (_g = this.millisecond) !== null && _g !== void 0 ? _g : undefined, + zone: luxon_1.FixedOffsetZone.instance(offsetMins) + }); + }; + DateTime.prototype.toLuxonUncertainty = function () { + var low = this.toLuxonDateTime(); + var high = low.endOf(this.getPrecision()); + return new uncertainty_1.Uncertainty(low, high); + }; + DateTime.prototype.toJSDate = function (ignoreTimezone) { + if (ignoreTimezone === void 0) { ignoreTimezone = false; } + var luxonDT = this.toLuxonDateTime(); + // I don't know if anyone is using "ignoreTimezone" anymore (we aren't), but just in case + if (ignoreTimezone) { + var offset = new util_1.jsDate().getTimezoneOffset() * -1; + luxonDT = luxonDT.setZone(luxon_1.FixedOffsetZone.instance(offset), { keepLocalTime: true }); + } + return luxonDT.toJSDate(); + }; + DateTime.prototype.toJSON = function () { + return this.toString(); + }; + DateTime.prototype._pad = function (num) { + return String('0' + num).slice(-2); + }; + DateTime.prototype.toString = function () { + if (this.isTime()) { + return this.toStringTime(); + } + else { + return this.toStringDateTime(); + } + }; + DateTime.prototype.toStringTime = function () { + var str = ''; + if (this.hour != null) { + str += this._pad(this.hour); + if (this.minute != null) { + str += ':' + this._pad(this.minute); + if (this.second != null) { + str += ':' + this._pad(this.second); + if (this.millisecond != null) { + str += '.' + String('00' + this.millisecond).slice(-3); + } + } } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return order; + } + return str; + }; + DateTime.prototype.toStringDateTime = function () { + var str = ''; + if (this.year != null) { + str += this.year; + if (this.month != null) { + str += '-' + this._pad(this.month); + if (this.day != null) { + str += '-' + this._pad(this.day); + if (this.hour != null) { + str += 'T' + this._pad(this.hour); + if (this.minute != null) { + str += ':' + this._pad(this.minute); + if (this.second != null) { + str += ':' + this._pad(this.second); + if (this.millisecond != null) { + str += '.' + String('00' + this.millisecond).slice(-3); + } + } + } + } + } + } + } + if (str.indexOf('T') !== -1 && this.timezoneOffset != null) { + str += this.timezoneOffset < 0 ? '-' : '+'; + var offsetHours = Math.floor(Math.abs(this.timezoneOffset)); + str += this._pad(offsetHours); + var offsetMin = (Math.abs(this.timezoneOffset) - offsetHours) * 60; + str += ':' + this._pad(offsetMin); + } + return str; + }; + DateTime.prototype.getDateTime = function () { + return this; + }; + DateTime.prototype.getDate = function () { + return new Date(this.year, this.month, this.day); + }; + DateTime.prototype.getTime = function () { + // Times no longer have timezoneOffets, so we must explicitly set it to null + return new DateTime(0, 1, 1, this.hour, this.minute, this.second, this.millisecond, null); + }; + DateTime.prototype.isTime = function () { + return this.year === 0 && this.month === 1 && this.day === 1; + }; + DateTime.prototype._implicitlyConvert = function (other) { + if (other != null && other.isDate) { + return other.getDateTime(); + } + return other; + }; + DateTime.prototype.reducedPrecision = function (unitField) { + if (unitField === void 0) { unitField = DateTime.Unit.MILLISECOND; } + var reduced = this.copy(); + if (unitField != null && unitField !== DateTime.Unit.MILLISECOND) { + var fieldIndex = DateTime.FIELDS.indexOf(unitField); + var fieldsToRemove = DateTime.FIELDS.slice(fieldIndex + 1); + for (var _i = 0, fieldsToRemove_1 = fieldsToRemove; _i < fieldsToRemove_1.length; _i++) { + var field = fieldsToRemove_1[_i]; + // @ts-ignore + reduced[field] = null; + } + } + return reduced; + }; + DateTime.Unit = { + YEAR: 'year', + MONTH: 'month', + WEEK: 'week', + DAY: 'day', + HOUR: 'hour', + MINUTE: 'minute', + SECOND: 'second', + MILLISECOND: 'millisecond' + }; + DateTime.FIELDS = [ + DateTime.Unit.YEAR, + DateTime.Unit.MONTH, + DateTime.Unit.DAY, + DateTime.Unit.HOUR, + DateTime.Unit.MINUTE, + DateTime.Unit.SECOND, + DateTime.Unit.MILLISECOND + ]; + return DateTime; +}(AbstractDate)); +exports.DateTime = DateTime; +var Date = /** @class */ (function (_super) { + __extends(Date, _super); + function Date(year, month, day) { + if (year === void 0) { year = null; } + if (month === void 0) { month = null; } + if (day === void 0) { day = null; } + return _super.call(this, year, month, day) || this; + } + Date.parse = function (string) { + if (string === null) { + return null; + } + var matches = /(\d{4})(-(\d{2}))?(-(\d{2}))?/.exec(string); + if (matches == null) { + return null; + } + var years = matches[1]; + var months = matches[3]; + var days = matches[5]; + if (!isValidDateStringFormat(string)) { + return null; + } + // convert args to integers + var args = [years, months, days].map(function (arg) { return (arg != null ? parseInt(arg) : arg); }); + // @ts-ignore + return new (Date.bind.apply(Date, __spreadArray([void 0], args, false)))(); + }; + Object.defineProperty(Date.prototype, "isDate", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Date.prototype, "isDateTime", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Date.prototype.copy = function () { + return new Date(this.year, this.month, this.day); + }; + Date.prototype.successor = function () { + if (this.day != null) { + return this.add(1, Date.Unit.DAY); + } + else if (this.month != null) { + return this.add(1, Date.Unit.MONTH); + } + else if (this.year != null) { + return this.add(1, Date.Unit.YEAR); + } + }; + Date.prototype.predecessor = function () { + if (this.day != null) { + return this.add(-1, Date.Unit.DAY); + } + else if (this.month != null) { + return this.add(-1, Date.Unit.MONTH); + } + else if (this.year != null) { + return this.add(-1, Date.Unit.YEAR); + } + }; + Date.prototype.differenceBetween = function (other, unitField) { + if (other != null && other.isDateTime) { + return this.getDateTime().differenceBetween(other, unitField); + } + if (other == null || !other.isDate) { + return null; + } + // According to CQL spec: + // * "Difference calculations are performed by truncating the datetime values at the next precision, + // and then performing the corresponding duration calculation on the truncated values." + var a = this.toLuxonUncertainty(); + var b = other.toLuxonUncertainty(); + // Truncate all dates at precision below specified unit + a.low = truncateLuxonDateTime(a.low, unitField); + a.high = truncateLuxonDateTime(a.high, unitField); + b.low = truncateLuxonDateTime(b.low, unitField); + b.high = truncateLuxonDateTime(b.high, unitField); + // Return the duration based on the normalize and truncated values + return new uncertainty_1.Uncertainty(wholeLuxonDuration(b.low.diff(a.high, unitField), unitField), wholeLuxonDuration(b.high.diff(a.low, unitField), unitField)); + }; + Date.prototype.durationBetween = function (other, unitField) { + if (other != null && other.isDateTime) { + return this.getDateTime().durationBetween(other, unitField); + } + if (other == null || !other.isDate) { + return null; + } + var a = this.toLuxonUncertainty(); + var b = other.toLuxonUncertainty(); + return new uncertainty_1.Uncertainty(wholeLuxonDuration(b.low.diff(a.high, unitField), unitField), wholeLuxonDuration(b.high.diff(a.low, unitField), unitField)); + }; + Date.prototype.getPrecision = function () { + var result = null; + if (this.year != null) { + result = Date.Unit.YEAR; + } + else { + return result; + } + if (this.month != null) { + result = Date.Unit.MONTH; + } + else { + return result; + } + if (this.day != null) { + result = Date.Unit.DAY; + } + else { + return result; + } + return result; + }; + Date.prototype.getPrecisionValue = function () { + return DATETIME_PRECISION_VALUE_MAP.get(this.getPrecision()); + }; + Date.prototype.toLuxonDateTime = function () { + var _a, _b, _c; + return luxon_1.DateTime.fromObject({ + year: (_a = this.year) !== null && _a !== void 0 ? _a : undefined, + month: (_b = this.month) !== null && _b !== void 0 ? _b : undefined, + day: (_c = this.day) !== null && _c !== void 0 ? _c : undefined, + zone: luxon_1.FixedOffsetZone.utcInstance }); - } + }; + Date.prototype.toLuxonUncertainty = function () { + var low = this.toLuxonDateTime(); + var high = low.endOf(this.getPrecision()).startOf('day'); // Date type is always at T00:00:00.0 + return new uncertainty_1.Uncertainty(low, high); + }; + Date.prototype.toJSDate = function () { + var _a = [ + this.year, + this.month != null ? this.month - 1 : 0, + this.day != null ? this.day : 1 + ], y = _a[0], mo = _a[1], d = _a[2]; + return new util_1.jsDate(y, mo, d); + }; + Date.fromJSDate = function (date) { + if (date instanceof Date) { + return date; + } + return new Date(date.getFullYear(), date.getMonth() + 1, date.getDate()); + }; + Date.fromLuxonDateTime = function (luxonDT) { + if (luxonDT instanceof Date) { + return luxonDT; + } + return new Date(luxonDT.year, luxonDT.month, luxonDT.day); + }; + Date.prototype.toJSON = function () { + return this.toString(); + }; + Date.prototype.toString = function () { + var str = ''; + if (this.year != null) { + str += this.year.toString(); + if (this.month != null) { + str += '-' + this.month.toString().padStart(2, '0'); + if (this.day != null) { + str += '-' + this.day.toString().padStart(2, '0'); + } + } + } + return str; + }; + Date.prototype.getDateTime = function () { + // from the spec: the result will be a DateTime with the time components set to zero, + // except for the timezone offset, which will be set to the timezone offset of the evaluation + // request timestamp. (this last part is acheived by just not passing in timezone offset) + if (this.year != null && this.month != null && this.day != null) { + return new DateTime(this.year, this.month, this.day, 0, 0, 0, 0); + // from spec: no component may be specified at a precision below an unspecified precision. + // For example, hour may be null, but if it is, minute, second, and millisecond must all be null as well. + } + else { + return new DateTime(this.year, this.month, this.day); + } + }; + Date.prototype.reducedPrecision = function (unitField) { + if (unitField === void 0) { unitField = Date.Unit.DAY; } + var reduced = this.copy(); + if (unitField !== Date.Unit.DAY) { + var fieldIndex = Date.FIELDS.indexOf(unitField); + var fieldsToRemove = Date.FIELDS.slice(fieldIndex + 1); + for (var _i = 0, fieldsToRemove_2 = fieldsToRemove; _i < fieldsToRemove_2.length; _i++) { + var field = fieldsToRemove_2[_i]; + // @ts-ignore + reduced[field] = null; + } + } + return reduced; + }; + Date.Unit = { YEAR: 'year', MONTH: 'month', WEEK: 'week', DAY: 'day' }; + Date.FIELDS = [Date.Unit.YEAR, Date.Unit.MONTH, Date.Unit.DAY]; + return Date; +}(AbstractDate)); +exports.Date = Date; +// Require MIN/MAX here because math.js requires this file, and when we make this file require +// math.js before it exports DateTime and Date, it errors due to the circular dependency... +// const { MAX_DATETIME_VALUE, MIN_DATETIME_VALUE } = require('../util/math'); +exports.MIN_DATETIME_VALUE = DateTime.parse('0001-01-01T00:00:00.000'); +exports.MAX_DATETIME_VALUE = DateTime.parse('9999-12-31T23:59:59.999'); +exports.MIN_DATE_VALUE = Date.parse('0001-01-01'); +exports.MAX_DATE_VALUE = Date.parse('9999-12-31'); +exports.MIN_TIME_VALUE = (_a = DateTime.parse('0000-01-01T00:00:00.000')) === null || _a === void 0 ? void 0 : _a.getTime(); +exports.MAX_TIME_VALUE = (_b = DateTime.parse('0000-01-01T23:59:59.999')) === null || _b === void 0 ? void 0 : _b.getTime(); +var DATETIME_PRECISION_VALUE_MAP = (function () { + var dtpvMap = new Map(); + dtpvMap.set(DateTime.Unit.YEAR, 4); + dtpvMap.set(DateTime.Unit.MONTH, 6); + dtpvMap.set(DateTime.Unit.DAY, 8); + dtpvMap.set(DateTime.Unit.HOUR, 10); + dtpvMap.set(DateTime.Unit.MINUTE, 12); + dtpvMap.set(DateTime.Unit.SECOND, 14); + dtpvMap.set(DateTime.Unit.MILLISECOND, 17); + return dtpvMap; +})(); +var TIME_PRECISION_VALUE_MAP = (function () { + var tpvMap = new Map(); + tpvMap.set(DateTime.Unit.HOUR, 2); + tpvMap.set(DateTime.Unit.MINUTE, 4); + tpvMap.set(DateTime.Unit.SECOND, 6); + tpvMap.set(DateTime.Unit.MILLISECOND, 9); + return tpvMap; +})(); +function compareWithDefaultResult(a, b, defaultResult) { + // return false there is a type mismatch + if ((!a.isDate || !b.isDate) && (!a.isDateTime || !b.isDateTime)) { + return false; } - }]); - - return SortClause; -}(); - -var toDistinctList = function toDistinctList(xList) { - var yList = []; - xList.forEach(function (x) { - if (!yList.some(function (y) { - return equals(x, y); - })) { - yList.push(x); + // make a copy of other in the correct timezone offset if they don't match. + if (a.timezoneOffset !== b.timezoneOffset) { + b = b.convertToTimezoneOffset(a.timezoneOffset); + } + for (var _i = 0, _a = a.constructor.FIELDS; _i < _a.length; _i++) { + var field = _a[_i]; + // if both have this precision defined + if (a[field] != null && b[field] != null) { + // For the purposes of comparison, seconds and milliseconds are combined + // as a single precision using a decimal, with decimal equality semantics + if (field === 'second') { + // NOTE: if millisecond is null it will calcualte like this anyway, but + // if millisecond is undefined, using it will result in NaN calculations + var aMillisecond = a['millisecond'] != null ? a['millisecond'] : 0; + var aSecondAndMillisecond = a[field] + aMillisecond / 1000; + var bMillisecond = b['millisecond'] != null ? b['millisecond'] : 0; + var bSecondAndMillisecond = b[field] + bMillisecond / 1000; + // second/millisecond is the most precise comparison, so we can directly return + return aSecondAndMillisecond === bSecondAndMillisecond; + } + // if they are different then return with false + if (a[field] !== b[field]) { + return false; + } + // if both dont have this precision, return true + } + else if (a[field] == null && b[field] == null) { + return true; + // otherwise they have inconclusive precision, return defaultResult + } + else { + return defaultResult; + } } - }); - return yList; -}; - -var AggregateClause = /*#__PURE__*/function (_Expression4) { - _inherits(AggregateClause, _Expression4); - - var _super7 = _createSuper(AggregateClause); - - function AggregateClause(json) { - var _this7; - - _classCallCheck(this, AggregateClause); - - _this7 = _super7.call(this, json); - _this7.identifier = json.identifier; - _this7.expression = build(json.expression); - _this7.starting = json.starting ? build(json.starting) : null; - _this7.distinct = json.distinct != null ? json.distinct : true; - return _this7; - } - - _createClass(AggregateClause, [{ - key: "aggregate", - value: function aggregate(returnedValues, ctx) { - var _this8 = this; - - var aggregateValue = this.starting != null ? this.starting.exec(ctx) : null; - returnedValues.forEach(function (contextValues) { - var childContext = ctx.childContext(contextValues); - childContext.set(_this8.identifier, aggregateValue); - aggregateValue = _this8.expression.exec(childContext); - }); - return aggregateValue; + // if we made it here, then all fields matched. + return true; +} +function daysInMonth(year, month) { + if (year == null || month == null) { + throw new Error('daysInMonth requires year and month as arguments'); } - }]); - - return AggregateClause; -}(Expression); - -var Query = /*#__PURE__*/function (_Expression5) { - _inherits(Query, _Expression5); - - var _super8 = _createSuper(Query); - - function Query(json) { - var _this9; - - _classCallCheck(this, Query); - - _this9 = _super8.call(this, json); - _this9.sources = new MultiSource(json.source.map(function (s) { - return new AliasedQuerySource(s); - })); - _this9.letClauses = json.let != null ? json.let.map(function (d) { - return new LetClause(d); - }) : []; - _this9.relationship = json.relationship != null ? build(json.relationship) : []; - _this9.where = build(json.where); - _this9.returnClause = json.return != null ? new ReturnClause(json.return) : null; - _this9.aggregateClause = json.aggregate != null ? new AggregateClause(json.aggregate) : null; - _this9.aliases = _this9.sources.aliases(); - _this9.sortClause = json.sort != null ? new SortClause(json.sort) : null; - return _this9; - } - - _createClass(Query, [{ - key: "isDistinct", - value: function isDistinct() { - if (this.aggregateClause != null && this.aggregateClause.distinct != null) { - return this.aggregateClause.distinct; - } else if (this.returnClause != null && this.returnClause.distinct != null) { - return this.returnClause.distinct; - } - - return true; + // Month is 1-indexed here because of the 0 day + return new util_1.jsDate(year, month, 0).getDate(); +} +function isValidDateStringFormat(string) { + if (typeof string !== 'string') { + return false; } - }, { - key: "exec", - value: function exec(ctx) { - var _this10 = this; + var format = LENGTH_TO_DATE_FORMAT_MAP.get(string.length); + if (format == null) { + return false; + } + return luxon_1.DateTime.fromFormat(string, format).isValid; +} +function isValidDateTimeStringFormat(string) { + if (typeof string !== 'string') { + return false; + } + // Luxon doesn't support +hh offset, so change it to +hh:00 + if (/T[\d:.]*[+-]\d{2}$/.test(string)) { + string += ':00'; + } + var formats = LENGTH_TO_DATETIME_FORMATS_MAP.get(string.length); + if (formats == null) { + return false; + } + return formats.some(function (fmt) { return luxon_1.DateTime.fromFormat(string, fmt).isValid; }); +} - var returnedValues = []; - this.sources.forEach(ctx, function (rctx) { - var _iterator2 = _createForOfIteratorHelper(_this10.letClauses), - _step2; +},{"../util/util":55,"./uncertainty":13,"luxon":72}],8:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Exception = void 0; +var Exception = /** @class */ (function () { + function Exception(message, wrapped) { + this.message = message; + this.wrapped = wrapped; + } + return Exception; +}()); +exports.Exception = Exception; +},{}],9:[function(require,module,exports){ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Interval = void 0; +var uncertainty_1 = require("./uncertainty"); +var quantity_1 = require("./quantity"); +var logic_1 = require("./logic"); +var math_1 = require("../util/math"); +var cmp = __importStar(require("../util/comparison")); +var Interval = /** @class */ (function () { + function Interval(low, high, lowClosed, highClosed, defaultPointType // defaultPointType is used in the case that both endpoints are null + ) { + this.low = low; + this.high = high; + this.lowClosed = lowClosed; + this.highClosed = highClosed; + this.defaultPointType = defaultPointType; + this.lowClosed = lowClosed != null ? lowClosed : true; + this.highClosed = highClosed != null ? highClosed : true; + } + Object.defineProperty(Interval.prototype, "isInterval", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Interval.prototype, "pointType", { + get: function () { + var pointType = null; + var point = this.low != null ? this.low : this.high; + if (point != null) { + if (typeof point === 'number') { + pointType = Number.isInteger(point) + ? '{urn:hl7-org:elm-types:r1}Integer' + : '{urn:hl7-org:elm-types:r1}Decimal'; + } + else if (point.isTime && point.isTime()) { + pointType = '{urn:hl7-org:elm-types:r1}Time'; + } + else if (point.isDate) { + pointType = '{urn:hl7-org:elm-types:r1}Date'; + } + else if (point.isDateTime) { + pointType = '{urn:hl7-org:elm-types:r1}DateTime'; + } + else if (point.isQuantity) { + pointType = '{urn:hl7-org:elm-types:r1}Quantity'; + } + } + if (pointType == null && this.defaultPointType != null) { + pointType = this.defaultPointType; + } + return pointType; + }, + enumerable: false, + configurable: true + }); + Interval.prototype.copy = function () { + var newLow = this.low; + var newHigh = this.high; + if (this.low != null && typeof this.low.copy === 'function') { + newLow = this.low.copy(); + } + if (this.high != null && typeof this.high.copy === 'function') { + newHigh = this.high.copy(); + } + return new Interval(newLow, newHigh, this.lowClosed, this.highClosed); + }; + Interval.prototype.contains = function (item, precision) { + // These first two checks ensure correct handling of edge case where an item equals the closed boundary + if (this.lowClosed && this.low != null && cmp.equals(this.low, item)) { + return true; + } + if (this.highClosed && this.high != null && cmp.equals(this.high, item)) { + return true; + } + if (item != null && item.isInterval) { + throw new Error('Argument to contains must be a point'); + } + var lowFn; + if (this.lowClosed && this.low == null) { + lowFn = function () { return true; }; + } + else if (this.lowClosed) { + lowFn = cmp.lessThanOrEquals; + } + else { + lowFn = cmp.lessThan; + } + var highFn; + if (this.highClosed && this.high == null) { + highFn = function () { return true; }; + } + else if (this.highClosed) { + highFn = cmp.greaterThanOrEquals; + } + else { + highFn = cmp.greaterThan; + } + return logic_1.ThreeValuedLogic.and(lowFn(this.low, item, precision), highFn(this.high, item, precision)); + }; + Interval.prototype.properlyIncludes = function (other, precision) { + if (other == null || !other.isInterval) { + throw new Error('Argument to properlyIncludes must be an interval'); + } + return logic_1.ThreeValuedLogic.and(this.includes(other, precision), logic_1.ThreeValuedLogic.not(other.includes(this, precision))); + }; + Interval.prototype.includes = function (other, precision) { + if (other == null || !other.isInterval) { + return this.contains(other, precision); + } + var a = this.toClosed(); + var b = other.toClosed(); + return logic_1.ThreeValuedLogic.and(cmp.lessThanOrEquals(a.low, b.low, precision), cmp.greaterThanOrEquals(a.high, b.high, precision)); + }; + Interval.prototype.includedIn = function (other, precision) { + // For the point overload, this operator is a synonym for the in operator + if (other == null || !other.isInterval) { + return this.contains(other, precision); + } + else { + return other.includes(this); + } + }; + Interval.prototype.overlaps = function (item, precision) { + var closed = this.toClosed(); + var _a = (function () { + if (item != null && item.isInterval) { + var itemClosed = item.toClosed(); + return [itemClosed.low, itemClosed.high]; + } + else { + return [item, item]; + } + })(), low = _a[0], high = _a[1]; + return logic_1.ThreeValuedLogic.and(cmp.lessThanOrEquals(closed.low, high, precision), cmp.greaterThanOrEquals(closed.high, low, precision)); + }; + Interval.prototype.overlapsAfter = function (item, precision) { + var closed = this.toClosed(); + var high = item != null && item.isInterval ? item.toClosed().high : item; + return logic_1.ThreeValuedLogic.and(cmp.lessThanOrEquals(closed.low, high, precision), cmp.greaterThan(closed.high, high, precision)); + }; + Interval.prototype.overlapsBefore = function (item, precision) { + var closed = this.toClosed(); + var low = item != null && item.isInterval ? item.toClosed().low : item; + return logic_1.ThreeValuedLogic.and(cmp.lessThan(closed.low, low, precision), cmp.greaterThanOrEquals(closed.high, low, precision)); + }; + Interval.prototype.union = function (other) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + if (other == null || !other.isInterval) { + throw new Error('Argument to union must be an interval'); + } + // Note that interval union is only defined if the arguments overlap or meet. + if (this.overlaps(other) || this.meets(other)) { + var _l = [this.toClosed(), other.toClosed()], a = _l[0], b = _l[1]; + var l = void 0, lc = void 0; + if (cmp.lessThanOrEquals(a.low, b.low)) { + _a = [this.low, this.lowClosed], l = _a[0], lc = _a[1]; + } + else if (cmp.greaterThanOrEquals(a.low, b.low)) { + _b = [other.low, other.lowClosed], l = _b[0], lc = _b[1]; + } + else if (areNumeric(a.low, b.low)) { + _c = [lowestNumericUncertainty(a.low, b.low), true], l = _c[0], lc = _c[1]; + // TODO: Do we need to support quantities here? + } + else if (areDateTimes(a.low, b.low) && a.low.isMorePrecise(b.low)) { + _d = [other.low, other.lowClosed], l = _d[0], lc = _d[1]; + } + else { + _e = [this.low, this.lowClosed], l = _e[0], lc = _e[1]; + } + var h = void 0, hc = void 0; + if (cmp.greaterThanOrEquals(a.high, b.high)) { + _f = [this.high, this.highClosed], h = _f[0], hc = _f[1]; + } + else if (cmp.lessThanOrEquals(a.high, b.high)) { + _g = [other.high, other.highClosed], h = _g[0], hc = _g[1]; + } + else if (areNumeric(a.high, b.high)) { + _h = [highestNumericUncertainty(a.high, b.high), true], h = _h[0], hc = _h[1]; + // TODO: Do we need to support quantities here? + } + else if (areDateTimes(a.high, b.high) && a.high.isMorePrecise(b.high)) { + _j = [other.high, other.highClosed], h = _j[0], hc = _j[1]; + } + else { + _k = [this.high, this.highClosed], h = _k[0], hc = _k[1]; + } + return new Interval(l, h, lc, hc); + } + else { + return null; + } + }; + Interval.prototype.intersect = function (other) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + if (other == null || !other.isInterval) { + throw new Error('Argument to union must be an interval'); + } + // Note that interval union is only defined if the arguments overlap. + if (this.overlaps(other)) { + var _l = [this.toClosed(), other.toClosed()], a = _l[0], b = _l[1]; + var l = void 0, lc = void 0; + if (cmp.greaterThanOrEquals(a.low, b.low)) { + _a = [this.low, this.lowClosed], l = _a[0], lc = _a[1]; + } + else if (cmp.lessThanOrEquals(a.low, b.low)) { + _b = [other.low, other.lowClosed], l = _b[0], lc = _b[1]; + } + else if (areNumeric(a.low, b.low)) { + _c = [highestNumericUncertainty(a.low, b.low), true], l = _c[0], lc = _c[1]; + // TODO: Do we need to support quantities here? + } + else if (areDateTimes(a.low, b.low) && b.low.isMorePrecise(a.low)) { + _d = [other.low, other.lowClosed], l = _d[0], lc = _d[1]; + } + else { + _e = [this.low, this.lowClosed], l = _e[0], lc = _e[1]; + } + var h = void 0, hc = void 0; + if (cmp.lessThanOrEquals(a.high, b.high)) { + _f = [this.high, this.highClosed], h = _f[0], hc = _f[1]; + } + else if (cmp.greaterThanOrEquals(a.high, b.high)) { + _g = [other.high, other.highClosed], h = _g[0], hc = _g[1]; + } + else if (areNumeric(a.high, b.high)) { + _h = [lowestNumericUncertainty(a.high, b.high), true], h = _h[0], hc = _h[1]; + // TODO: Do we need to support quantities here? + } + else if (areDateTimes(a.high, b.high) && b.high.isMorePrecise(a.high)) { + _j = [other.high, other.highClosed], h = _j[0], hc = _j[1]; + } + else { + _k = [this.high, this.highClosed], h = _k[0], hc = _k[1]; + } + return new Interval(l, h, lc, hc); + } + else { + return null; + } + }; + Interval.prototype.except = function (other) { + if (other === null) { + return null; + } + if (other == null || !other.isInterval) { + throw new Error('Argument to except must be an interval'); + } + var ol = this.overlaps(other); + if (ol === true) { + var olb = this.overlapsBefore(other); + var ola = this.overlapsAfter(other); + if (olb === true && ola === false) { + return new Interval(this.low, other.low, this.lowClosed, !other.lowClosed); + } + else if (ola === true && olb === false) { + return new Interval(other.high, this.high, !other.highClosed, this.highClosed); + } + else { + return null; + } + } + else if (ol === false) { + return this; + } + else { + // ol is null + return null; + } + }; + Interval.prototype.sameAs = function (other, precision) { + // This large if and else if block handles the scenarios where there is an open ended null + // If both lows or highs exists, it can be determined that intervals are not Same As + if ((this.low != null && + other.low != null && + this.high == null && + other.high != null && + !this.highClosed) || + (this.low != null && + other.low != null && + this.high != null && + other.high == null && + !other.highClosed) || + (this.low != null && + other.low != null && + this.high == null && + other.high == null && + !other.highClosed && + !this.highClosed)) { + if (typeof this.low === 'number') { + if (!(this.start() === other.start())) { + return false; + } + } + else { + if (!this.start().sameAs(other.start(), precision)) { + return false; + } + } + } + else if ((this.low != null && other.low == null && this.high != null && other.high != null) || + (this.low == null && other.low != null && this.high != null && other.high != null) || + (this.low == null && other.low == null && this.high != null && other.high != null)) { + if (typeof this.high === 'number') { + if (!(this.end() === other.end())) { + return false; + } + } + else { + if (!this.end().sameAs(other.end(), precision)) { + return false; + } + } + } + // Checks to see if any of the Intervals have a open, null boundary + if ((this.low == null && !this.lowClosed) || + (this.high == null && !this.highClosed) || + (other.low == null && !other.lowClosed) || + (other.high == null && !other.highClosed)) { + return null; + } + // For the special cases where @ is Interval[null,null] + if (this.lowClosed && this.low == null && this.highClosed && this.high == null) { + return other.lowClosed && other.low == null && other.highClosed && other.high == null; + } + // For the special case where Interval[...] same as Interval[null,null] should return false. + // This accounts for the inverse of the if statement above: where the second Interval is + // [null,null] and not the first Interval. + // The reason why this isn't caught below is due to how start() and end() work. + // There is no way to tell the datatype for MIN and MAX if both boundaries are null. + if (other.lowClosed && other.low == null && other.highClosed && other.high == null) { + return false; + } + if (typeof this.low === 'number') { + return this.start() === other.start() && this.end() === other.end(); + } + else { + return (this.start().sameAs(other.start(), precision) && this.end().sameAs(other.end(), precision)); + } + }; + Interval.prototype.sameOrBefore = function (other, precision) { + if (this.end() == null || other == null || other.start() == null) { + return null; + } + else { + return cmp.lessThanOrEquals(this.end(), other.start(), precision); + } + }; + Interval.prototype.sameOrAfter = function (other, precision) { + if (this.start() == null || other == null || other.end() == null) { + return null; + } + else { + return cmp.greaterThanOrEquals(this.start(), other.end(), precision); + } + }; + Interval.prototype.equals = function (other) { + if (other != null && other.isInterval) { + var _a = [this.toClosed(), other.toClosed()], a = _a[0], b = _a[1]; + return logic_1.ThreeValuedLogic.and(cmp.equals(a.low, b.low), cmp.equals(a.high, b.high)); + } + else { + return false; + } + }; + Interval.prototype.after = function (other, precision) { + var closed = this.toClosed(); + // Meets spec, but not 100% correct (e.g., (null, 5] after [6, 10] --> null) + // Simple way to fix it: and w/ not overlaps + if (other.toClosed) { + return cmp.greaterThan(closed.low, other.toClosed().high, precision); + } + else { + return cmp.greaterThan(closed.low, other, precision); + } + }; + Interval.prototype.before = function (other, precision) { + var closed = this.toClosed(); + // Meets spec, but not 100% correct (e.g., (null, 5] after [6, 10] --> null) + // Simple way to fix it: and w/ not overlaps + if (other.toClosed) { + return cmp.lessThan(closed.high, other.toClosed().low, precision); + } + else { + return cmp.lessThan(closed.high, other, precision); + } + }; + Interval.prototype.meets = function (other, precision) { + return logic_1.ThreeValuedLogic.or(this.meetsBefore(other, precision), this.meetsAfter(other, precision)); + }; + Interval.prototype.meetsAfter = function (other, precision) { try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var def = _step2.value; - rctx.set(def.identifier, def.expression.execute(rctx)); - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); + if (precision != null && this.low != null && this.low.isDateTime) { + return this.toClosed().low.sameAs(other.toClosed().high != null ? other.toClosed().high.add(1, precision) : null, precision); + } + else { + return cmp.equals(this.toClosed().low, (0, math_1.successor)(other.toClosed().high)); + } + } + catch (error) { + return false; + } + }; + Interval.prototype.meetsBefore = function (other, precision) { + try { + if (precision != null && this.high != null && this.high.isDateTime) { + return this.toClosed().high.sameAs(other.toClosed().low != null ? other.toClosed().low.add(-1, precision) : null, precision); + } + else { + return cmp.equals(this.toClosed().high, (0, math_1.predecessor)(other.toClosed().low)); + } + } + catch (error) { + return false; + } + }; + Interval.prototype.start = function () { + if (this.low == null) { + if (this.lowClosed) { + return (0, math_1.minValueForInstance)(this.high); + } + else { + return this.low; + } + } + return this.toClosed().low; + }; + Interval.prototype.end = function () { + if (this.high == null) { + if (this.highClosed) { + return (0, math_1.maxValueForInstance)(this.low); + } + else { + return this.high; + } + } + return this.toClosed().high; + }; + Interval.prototype.starts = function (other, precision) { + var startEqual; + if (precision != null && this.low != null && this.low.isDateTime) { + startEqual = this.low.sameAs(other.low, precision); + } + else { + startEqual = cmp.equals(this.low, other.low); + } + var endLessThanOrEqual = cmp.lessThanOrEquals(this.high, other.high, precision); + return startEqual && endLessThanOrEqual; + }; + Interval.prototype.ends = function (other, precision) { + var endEqual; + var startGreaterThanOrEqual = cmp.greaterThanOrEquals(this.low, other.low, precision); + if (precision != null && (this.low != null ? this.low.isDateTime : undefined)) { + endEqual = this.high.sameAs(other.high, precision); + } + else { + endEqual = cmp.equals(this.high, other.high); } - - var relations = _this10.relationship.map(function (rel) { - var child_ctx = rctx.childContext(); - return rel.execute(child_ctx); - }); - - var passed = allTrue(relations) && (_this10.where ? _this10.where.execute(rctx) : true); - - if (passed) { - if (_this10.returnClause != null) { - var val = _this10.returnClause.expression.execute(rctx); - - returnedValues.push(val); - } else { - if (_this10.aliases.length === 1 && _this10.aggregateClause == null) { - returnedValues.push(rctx.get(_this10.aliases[0])); - } else { - returnedValues.push(rctx.context_values); + return startGreaterThanOrEqual && endEqual; + }; + Interval.prototype.width = function () { + if ((this.low != null && (this.low.isDateTime || this.low.isDate)) || + (this.high != null && (this.high.isDateTime || this.high.isDate))) { + throw new Error('Width of Date, DateTime, and Time intervals is not supported'); + } + var closed = this.toClosed(); + if ((closed.low != null && closed.low.isUncertainty) || + (closed.high != null && closed.high.isUncertainty)) { + return null; + } + else if (closed.low.isQuantity) { + if (closed.low.unit !== closed.high.unit) { + throw new Error('Cannot calculate width of Quantity Interval with different units'); } - } + var lowValue = closed.low.value; + var highValue = closed.high.value; + var diff = Math.abs(highValue - lowValue); + diff = Math.round(diff * Math.pow(10, 8)) / Math.pow(10, 8); + return new quantity_1.Quantity(diff, closed.low.unit); } - }); - - if (this.isDistinct()) { - returnedValues = toDistinctList(returnedValues); - } - - if (this.aggregateClause != null) { - returnedValues = this.aggregateClause.aggregate(returnedValues, ctx); - } - - if (this.sortClause != null) { - this.sortClause.sort(ctx, returnedValues); - } - - if (this.sources.returnsList() || this.aggregateClause != null) { - return returnedValues; - } else { - return returnedValues[0]; - } - } - }]); - - return Query; -}(Expression); - -var AliasRef = /*#__PURE__*/function (_Expression6) { - _inherits(AliasRef, _Expression6); - - var _super9 = _createSuper(AliasRef); - - function AliasRef(json) { - var _this11; - - _classCallCheck(this, AliasRef); - - _this11 = _super9.call(this, json); - _this11.name = json.name; - return _this11; - } - - _createClass(AliasRef, [{ - key: "exec", - value: function exec(ctx) { - return ctx != null ? ctx.get(this.name) : undefined; - } - }]); - - return AliasRef; -}(Expression); - -var QueryLetRef = /*#__PURE__*/function (_AliasRef) { - _inherits(QueryLetRef, _AliasRef); - - var _super10 = _createSuper(QueryLetRef); - - function QueryLetRef(json) { - _classCallCheck(this, QueryLetRef); - - return _super10.call(this, json); - } - - return QueryLetRef; -}(AliasRef); // The following is not defined by ELM but is helpful for execution - - -var MultiSource = /*#__PURE__*/function () { - function MultiSource(sources) { - _classCallCheck(this, MultiSource); - - this.sources = sources; - this.alias = this.sources[0].alias; - this.expression = this.sources[0].expression; - this.isList = true; - - if (this.sources.length > 1) { - this.rest = new MultiSource(this.sources.slice(1)); - } - } - - _createClass(MultiSource, [{ - key: "aliases", - value: function aliases() { - var a = [this.alias]; - - if (this.rest) { - a = a.concat(this.rest.aliases()); - } - - return a; - } - }, { - key: "returnsList", - value: function returnsList() { - return this.isList || this.rest && this.rest.returnsList(); - } - }, { - key: "forEach", - value: function forEach(ctx, func) { - var _this12 = this; - - var records = this.expression.execute(ctx); - this.isList = typeIsArray(records); - records = this.isList ? records : [records]; - return records.map(function (rec) { - var rctx = new Context(ctx); - rctx.set(_this12.alias, rec); - - if (_this12.rest) { - return _this12.rest.forEach(rctx, func); - } else { - return func(rctx); + else { + // TODO: Fix precision to 8 decimals in other places that return numbers + var diff = Math.abs(closed.high - closed.low); + return Math.round(diff * Math.pow(10, 8)) / Math.pow(10, 8); } - }); - } - }]); - - return MultiSource; -}(); - -module.exports = { - AliasedQuerySource: AliasedQuerySource, - AliasRef: AliasRef, - ByColumn: ByColumn, - ByDirection: ByDirection, - ByExpression: ByExpression, - LetClause: LetClause, - Query: Query, - QueryLetRef: QueryLetRef, - ReturnClause: ReturnClause, - Sort: Sort, - SortClause: SortClause, - With: With, - Without: Without -}; -},{"../runtime/context":42,"../util/comparison":47,"../util/util":50,"./builder":16,"./expression":22}],37:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('../datatypes/quantity'), - Quantity = _require2.Quantity; - -var DT = require('../datatypes/datatypes'); - -var Ratio = /*#__PURE__*/function (_Expression) { - _inherits(Ratio, _Expression); - - var _super = _createSuper(Ratio); - - function Ratio(json) { - var _this; - - _classCallCheck(this, Ratio); - - _this = _super.call(this, json); - - if (json.numerator == null) { - throw new Error('Cannot create a ratio with an undefined numerator value'); - } else { - _this.numerator = new Quantity(json.numerator.value, json.numerator.unit); - } - - if (json.denominator == null) { - throw new Error('Cannot create a ratio with an undefined denominator value'); - } else { - _this.denominator = new Quantity(json.denominator.value, json.denominator.unit); - } - - return _this; - } - - _createClass(Ratio, [{ - key: "exec", - value: function exec(ctx) { - return new DT.Ratio(this.numerator, this.denominator); - } - }]); - - return Ratio; -}(Expression); - -module.exports = { - Ratio: Ratio -}; -},{"../datatypes/datatypes":6,"../datatypes/quantity":11,"./expression":22}],38:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('./builder'), - build = _require2.build; - -var ExpressionDef = /*#__PURE__*/function (_Expression) { - _inherits(ExpressionDef, _Expression); - - var _super = _createSuper(ExpressionDef); - - function ExpressionDef(json) { - var _this; - - _classCallCheck(this, ExpressionDef); - - _this = _super.call(this, json); - _this.name = json.name; - _this.context = json.context; - _this.expression = build(json.expression); - return _this; - } - - _createClass(ExpressionDef, [{ - key: "exec", - value: function exec(ctx) { - var value = this.expression != null ? this.expression.execute(ctx) : undefined; - ctx.rootContext().set(this.name, value); - return value; - } - }]); - - return ExpressionDef; -}(Expression); - -var ExpressionRef = /*#__PURE__*/function (_Expression2) { - _inherits(ExpressionRef, _Expression2); - - var _super2 = _createSuper(ExpressionRef); - - function ExpressionRef(json) { - var _this2; - - _classCallCheck(this, ExpressionRef); - - _this2 = _super2.call(this, json); - _this2.name = json.name; - _this2.library = json.libraryName; - return _this2; - } - - _createClass(ExpressionRef, [{ - key: "exec", - value: function exec(ctx) { - ctx = this.library ? ctx.getLibraryContext(this.library) : ctx; - var value = ctx.get(this.name); - - if (value instanceof Expression) { - value = value.execute(ctx); - } - - return value; - } - }]); - - return ExpressionRef; -}(Expression); - -var FunctionDef = /*#__PURE__*/function (_Expression3) { - _inherits(FunctionDef, _Expression3); - - var _super3 = _createSuper(FunctionDef); - - function FunctionDef(json) { - var _this3; - - _classCallCheck(this, FunctionDef); - - _this3 = _super3.call(this, json); - _this3.name = json.name; - _this3.expression = build(json.expression); - _this3.parameters = json.operand; - return _this3; - } - - _createClass(FunctionDef, [{ - key: "exec", - value: function exec(ctx) { - return this; - } - }]); - - return FunctionDef; -}(Expression); - -var FunctionRef = /*#__PURE__*/function (_Expression4) { - _inherits(FunctionRef, _Expression4); - - var _super4 = _createSuper(FunctionRef); - - function FunctionRef(json) { - var _this4; - - _classCallCheck(this, FunctionRef); - - _this4 = _super4.call(this, json); - _this4.name = json.name; - _this4.library = json.libraryName; - return _this4; - } - - _createClass(FunctionRef, [{ - key: "exec", - value: function exec(ctx) { - var functionDefs, child_ctx; - - if (this.library) { - var lib = ctx.get(this.library); - functionDefs = lib ? lib.getFunction(this.name) : undefined; - var libCtx = ctx.getLibraryContext(this.library); - child_ctx = libCtx ? libCtx.childContext() : undefined; - } else { - functionDefs = ctx.get(this.name); - child_ctx = ctx.childContext(); - } - - var args = this.execArgs(ctx); // Filter out functions w/ wrong number of arguments. - - functionDefs = functionDefs.filter(function (f) { - return f.parameters.length === args.length; - }); // If there is still > 1 matching function, filter by argument types - - if (functionDefs.length > 1) { - functionDefs = functionDefs.filter(function (f) { - var match = true; - - for (var i = 0; i < args.length && match; i++) { - if (args[i] !== null) { - var operandTypeSpecifier = f.parameters[i].operandTypeSpecifier; - - if (operandTypeSpecifier == null && f.parameters[i].operandType != null) { - // convert it to a NamedTypedSpecifier - operandTypeSpecifier = { - name: f.parameters[i].operandType, - type: 'NamedTypeSpecifier' - }; - } - - match = ctx.matchesTypeSpecifier(args[i], operandTypeSpecifier); + }; + Interval.prototype.size = function () { + var pointSize = this.getPointSize(); + if ((this.low != null && (this.low.isDateTime || this.low.isDate)) || + (this.high != null && (this.high.isDateTime || this.high.isDate))) { + throw new Error('Size of Date, DateTime, and Time intervals is not supported'); + } + var closed = this.toClosed(); + if ((closed.low != null && closed.low.isUncertainty) || + (closed.high != null && closed.high.isUncertainty)) { + return null; + } + else if (closed.low.isQuantity) { + if (closed.low.unit !== closed.high.unit) { + throw new Error('Cannot calculate size of Quantity Interval with different units'); } - } - - return match; - }); - } // If there is still > 1 matching function, calculate a score based on quality of matches - - - if (functionDefs.length > 1) {// TODO - } - - if (functionDefs.length === 0) { - throw new Error('no function with matching signature could be found'); - } // By this point, we should have only one function, but until implementation is completed, - // use the last one (no matter how many still remain) - - - var functionDef = functionDefs[functionDefs.length - 1]; - - for (var i = 0; i < functionDef.parameters.length; i++) { - child_ctx.set(functionDef.parameters[i].name, args[i]); - } - - return functionDef.expression.execute(child_ctx); - } - }]); - - return FunctionRef; -}(Expression); - -var OperandRef = /*#__PURE__*/function (_Expression5) { - _inherits(OperandRef, _Expression5); - - var _super5 = _createSuper(OperandRef); - - function OperandRef(json) { - var _this5; - - _classCallCheck(this, OperandRef); - - _this5 = _super5.call(this, json); - _this5.name = json.name; - return _this5; - } - - _createClass(OperandRef, [{ - key: "exec", - value: function exec(ctx) { - return ctx.get(this.name); - } - }]); - - return OperandRef; -}(Expression); - -var IdentifierRef = /*#__PURE__*/function (_Expression6) { - _inherits(IdentifierRef, _Expression6); - - var _super6 = _createSuper(IdentifierRef); - - function IdentifierRef(json) { - var _this6; - - _classCallCheck(this, IdentifierRef); - - _this6 = _super6.call(this, json); - _this6.name = json.name; - _this6.library = json.libraryName; - return _this6; - } - - _createClass(IdentifierRef, [{ - key: "exec", - value: function exec(ctx) { - // TODO: Technically, the ELM Translator should never output one of these - // but this code is needed since it does, as a work-around to get queries - // to work properly when sorting by a field in a tuple - var lib = this.library ? ctx.get(this.library) : undefined; - var val = lib ? lib.get(this.name) : ctx.get(this.name); - - if (val == null) { - var parts = this.name.split('.'); - val = ctx.get(parts[0]); - - if (val != null && parts.length > 1) { - var curr_obj = val; - - var _iterator = _createForOfIteratorHelper(parts.slice(1)), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var part = _step.value; - - // _obj = curr_obj?[part] ? curr_obj?.get?(part) - // curr_obj = if _obj instanceof Function then _obj.call(curr_obj) else _obj - var _obj = void 0; - - if (curr_obj != null) { - _obj = curr_obj[part]; - - if (_obj === undefined && typeof curr_obj.get === 'function') { - _obj = curr_obj.get(part); - } - } - - curr_obj = _obj instanceof Function ? _obj.call(curr_obj) : _obj; + var lowValue = closed.low.value; + var highValue = closed.high.value; + var diff = Math.abs(highValue - lowValue) + pointSize.value; + Math.round(diff * Math.pow(10, 8)) / Math.pow(10, 8); + return new quantity_1.Quantity(diff, closed.low.unit); + } + else { + var diff = Math.abs(closed.high - closed.low) + pointSize.value; + return Math.round(diff * Math.pow(10, 8)) / Math.pow(10, 8); + } + }; + Interval.prototype.getPointSize = function () { + var pointSize; + if (this.low != null) { + if (this.low.isDateTime || this.low.isDate || this.low.isTime) { + pointSize = new quantity_1.Quantity(1, this.low.getPrecision()); + } + else if (this.low.isQuantity) { + pointSize = (0, quantity_1.doSubtraction)((0, math_1.successor)(this.low), this.low); + } + else { + pointSize = (0, math_1.successor)(this.low) - this.low; } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - val = curr_obj; } - } - - if (val instanceof Function) { - return val.call(ctx.context_values); - } else { - return val; - } + else if (this.high != null) { + if (this.high.isDateTime || this.high.isDate || this.high.isTime) { + pointSize = new quantity_1.Quantity(1, this.high.getPrecision()); + } + else if (this.high.isQuantity) { + pointSize = (0, quantity_1.doSubtraction)((0, math_1.successor)(this.high), this.high); + } + else { + pointSize = (0, math_1.successor)(this.high) - this.high; + } + } + else { + throw new Error('Point type of intervals cannot be determined.'); + } + if (typeof pointSize === 'number') { + pointSize = new quantity_1.Quantity(pointSize, '1'); + } + return pointSize; + }; + Interval.prototype.toClosed = function () { + // Calculate the closed flags. Despite the name of this function, if a boundary is null open, + // we cannot close the boundary because that changes its meaning from "unknown" to "max/min value" + var lowClosed = this.lowClosed || this.low != null; + var highClosed = this.highClosed || this.high != null; + if (this.pointType != null) { + var low = void 0; + if (this.lowClosed && this.low == null) { + low = (0, math_1.minValueForType)(this.pointType); + } + else if (!this.lowClosed && this.low != null) { + low = (0, math_1.successor)(this.low); + } + else { + low = this.low; + } + var high = void 0; + if (this.highClosed && this.high == null) { + high = (0, math_1.maxValueForType)(this.pointType); + } + else if (!this.highClosed && this.high != null) { + high = (0, math_1.predecessor)(this.high); + } + else { + high = this.high; + } + if (low == null) { + low = new uncertainty_1.Uncertainty((0, math_1.minValueForType)(this.pointType), high); + } + if (high == null) { + high = new uncertainty_1.Uncertainty(low, (0, math_1.maxValueForType)(this.pointType)); + } + return new Interval(low, high, lowClosed, highClosed); + } + else { + return new Interval(this.low, this.high, lowClosed, highClosed); + } + }; + Interval.prototype.toString = function () { + var start = this.lowClosed ? '[' : '('; + var end = this.highClosed ? ']' : ')'; + return start + this.low.toString() + ', ' + this.high.toString() + end; + }; + return Interval; +}()); +exports.Interval = Interval; +function areDateTimes(x, y) { + return [x, y].every(function (z) { return z != null && z.isDateTime; }); +} +function areNumeric(x, y) { + return [x, y].every(function (z) { + return typeof z === 'number' || (z != null && z.isUncertainty && typeof z.low === 'number'); + }); +} +function lowestNumericUncertainty(x, y) { + if (x == null || !x.isUncertainty) { + x = new uncertainty_1.Uncertainty(x); } - }]); - - return IdentifierRef; -}(Expression); - -module.exports = { - ExpressionDef: ExpressionDef, - ExpressionRef: ExpressionRef, - FunctionDef: FunctionDef, - FunctionRef: FunctionRef, - IdentifierRef: IdentifierRef, - OperandRef: OperandRef -}; -},{"./builder":16,"./expression":22}],39:[function(require,module,exports){ -"use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression; - -var _require2 = require('./builder'), - build = _require2.build; - -var Concatenate = /*#__PURE__*/function (_Expression) { - _inherits(Concatenate, _Expression); - - var _super = _createSuper(Concatenate); - - function Concatenate(json) { - _classCallCheck(this, Concatenate); - - return _super.call(this, json); - } - - _createClass(Concatenate, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args.some(function (x) { - return x == null; - })) { - return null; - } else { - return args.reduce(function (x, y) { - return x + y; - }); - } + if (y == null || !y.isUncertainty) { + y = new uncertainty_1.Uncertainty(y); } - }]); - - return Concatenate; -}(Expression); - -var Combine = /*#__PURE__*/function (_Expression2) { - _inherits(Combine, _Expression2); - - var _super2 = _createSuper(Combine); - - function Combine(json) { - var _this; - - _classCallCheck(this, Combine); - - _this = _super2.call(this, json); - _this.source = build(json.source); - _this.separator = build(json.separator); - return _this; - } - - _createClass(Combine, [{ - key: "exec", - value: function exec(ctx) { - var source = this.source.execute(ctx); - var separator = this.separator != null ? this.separator.execute(ctx) : ''; - - if (source == null) { - return null; - } else { - var filteredArray = source.filter(function (x) { - return x != null; - }); - - if (filteredArray.length === 0) { - return null; - } else { - return filteredArray.join(separator); - } - } + var low = x.low < y.low ? x.low : y.low; + var high = x.high < y.high ? x.high : y.high; + if (low !== high) { + return new uncertainty_1.Uncertainty(low, high); } - }]); - - return Combine; -}(Expression); - -var Split = /*#__PURE__*/function (_Expression3) { - _inherits(Split, _Expression3); - - var _super3 = _createSuper(Split); - - function Split(json) { - var _this2; - - _classCallCheck(this, Split); - - _this2 = _super3.call(this, json); - _this2.stringToSplit = build(json.stringToSplit); - _this2.separator = build(json.separator); - return _this2; - } - - _createClass(Split, [{ - key: "exec", - value: function exec(ctx) { - var stringToSplit = this.stringToSplit.execute(ctx); - var separator = this.separator.execute(ctx); - - if (stringToSplit && separator) { - return stringToSplit.split(separator); - } - - return stringToSplit ? [stringToSplit] : null; + else { + return low; } - }]); - - return Split; -}(Expression); - -var SplitOnMatches = /*#__PURE__*/function (_Expression4) { - _inherits(SplitOnMatches, _Expression4); - - var _super4 = _createSuper(SplitOnMatches); - - function SplitOnMatches(json) { - var _this3; - - _classCallCheck(this, SplitOnMatches); - - _this3 = _super4.call(this, json); - _this3.stringToSplit = build(json.stringToSplit); - _this3.separatorPattern = build(json.separatorPattern); - return _this3; - } - - _createClass(SplitOnMatches, [{ - key: "exec", - value: function exec(ctx) { - var stringToSplit = this.stringToSplit.execute(ctx); - var separatorPattern = this.separatorPattern.execute(ctx); - - if (stringToSplit && separatorPattern) { - return stringToSplit.split(new RegExp(separatorPattern)); - } - - return stringToSplit ? [stringToSplit] : null; +} +function highestNumericUncertainty(x, y) { + if (x == null || !x.isUncertainty) { + x = new uncertainty_1.Uncertainty(x); } - }]); - - return SplitOnMatches; -}(Expression); // Length is completely handled by overloaded#Length - - -var Upper = /*#__PURE__*/function (_Expression5) { - _inherits(Upper, _Expression5); - - var _super5 = _createSuper(Upper); - - function Upper(json) { - _classCallCheck(this, Upper); - - return _super5.call(this, json); - } - - _createClass(Upper, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - return arg.toUpperCase(); - } else { - return null; - } + if (y == null || !y.isUncertainty) { + y = new uncertainty_1.Uncertainty(y); } - }]); - - return Upper; -}(Expression); - -var Lower = /*#__PURE__*/function (_Expression6) { - _inherits(Lower, _Expression6); - - var _super6 = _createSuper(Lower); - - function Lower(json) { - _classCallCheck(this, Lower); - - return _super6.call(this, json); - } - - _createClass(Lower, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - return arg.toLowerCase(); - } else { - return null; - } + var low = x.low > y.low ? x.low : y.low; + var high = x.high > y.high ? x.high : y.high; + if (low !== high) { + return new uncertainty_1.Uncertainty(low, high); } - }]); - - return Lower; -}(Expression); // Indexer is completely handled by overloaded#Indexer - - -var PositionOf = /*#__PURE__*/function (_Expression7) { - _inherits(PositionOf, _Expression7); - - var _super7 = _createSuper(PositionOf); - - function PositionOf(json) { - var _this4; - - _classCallCheck(this, PositionOf); - - _this4 = _super7.call(this, json); - _this4.pattern = build(json.pattern); - _this4.string = build(json.string); - return _this4; - } - - _createClass(PositionOf, [{ - key: "exec", - value: function exec(ctx) { - var pattern = this.pattern.execute(ctx); - var string = this.string.execute(ctx); - - if (pattern == null || string == null) { - return null; - } else { - return string.indexOf(pattern); - } + else { + return low; } - }]); - - return PositionOf; -}(Expression); - -var LastPositionOf = /*#__PURE__*/function (_Expression8) { - _inherits(LastPositionOf, _Expression8); - - var _super8 = _createSuper(LastPositionOf); - - function LastPositionOf(json) { - var _this5; - - _classCallCheck(this, LastPositionOf); - - _this5 = _super8.call(this, json); - _this5.pattern = build(json.pattern); - _this5.string = build(json.string); - return _this5; - } +} - _createClass(LastPositionOf, [{ - key: "exec", - value: function exec(ctx) { - var pattern = this.pattern.execute(ctx); - var string = this.string.execute(ctx); +},{"../util/comparison":52,"../util/math":53,"./logic":10,"./quantity":11,"./uncertainty":13}],10:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ThreeValuedLogic = void 0; +var ThreeValuedLogic = /** @class */ (function () { + function ThreeValuedLogic() { + } + ThreeValuedLogic.and = function () { + var val = []; + for (var _i = 0; _i < arguments.length; _i++) { + val[_i] = arguments[_i]; + } + if (val.includes(false)) { + return false; + } + else if (val.includes(null)) { + return null; + } + else { + return true; + } + }; + ThreeValuedLogic.or = function () { + var val = []; + for (var _i = 0; _i < arguments.length; _i++) { + val[_i] = arguments[_i]; + } + if (val.includes(true)) { + return true; + } + else if (val.includes(null)) { + return null; + } + else { + return false; + } + }; + ThreeValuedLogic.xor = function () { + var val = []; + for (var _i = 0; _i < arguments.length; _i++) { + val[_i] = arguments[_i]; + } + if (val.includes(null)) { + return null; + } + else { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + return val.reduce(function (a, b) { return (!a ^ !b) === 1; }); + } + }; + ThreeValuedLogic.not = function (val) { + if (val != null) { + return !val; + } + else { + return null; + } + }; + return ThreeValuedLogic; +}()); +exports.ThreeValuedLogic = ThreeValuedLogic; - if (pattern == null || string == null) { - return null; - } else { - return string.lastIndexOf(pattern); - } +},{}],11:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.doMultiplication = exports.doDivision = exports.doSubtraction = exports.doAddition = exports.parseQuantity = exports.Quantity = void 0; +var math_1 = require("../util/math"); +var units_1 = require("../util/units"); +var Quantity = /** @class */ (function () { + function Quantity(value, unit) { + this.value = value; + this.unit = unit; + if (this.value == null || isNaN(this.value)) { + throw new Error('Cannot create a quantity with an undefined value'); + } + else if (!(0, math_1.isValidDecimal)(this.value)) { + throw new Error('Cannot create a quantity with an invalid decimal value'); + } + // Attempt to parse the unit with UCUM. If it fails, throw a friendly error. + if (this.unit != null) { + var validation = (0, units_1.checkUnit)(this.unit); + if (!validation.valid) { + throw new Error(validation.message); + } + } } - }]); - - return LastPositionOf; -}(Expression); - -var Matches = /*#__PURE__*/function (_Expression9) { - _inherits(Matches, _Expression9); - - var _super9 = _createSuper(Matches); - - function Matches(json) { - _classCallCheck(this, Matches); - - return _super9.call(this, json); - } - - _createClass(Matches, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs = this.execArgs(ctx), - _this$execArgs2 = _slicedToArray(_this$execArgs, 2), - string = _this$execArgs2[0], - pattern = _this$execArgs2[1]; - - if (string == null || pattern == null) { + Object.defineProperty(Quantity.prototype, "isQuantity", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Quantity.prototype.clone = function () { + return new Quantity(this.value, this.unit); + }; + Quantity.prototype.toString = function () { + return "".concat(this.value, " '").concat(this.unit, "'"); + }; + Quantity.prototype.sameOrBefore = function (other) { + if (other != null && other.isQuantity) { + var otherVal = (0, units_1.convertUnit)(other.value, other.unit, this.unit); + if (otherVal == null) { + return null; + } + else { + return this.value <= otherVal; + } + } + }; + Quantity.prototype.sameOrAfter = function (other) { + if (other != null && other.isQuantity) { + var otherVal = (0, units_1.convertUnit)(other.value, other.unit, this.unit); + if (otherVal == null) { + return null; + } + else { + return this.value >= otherVal; + } + } + }; + Quantity.prototype.after = function (other) { + if (other != null && other.isQuantity) { + var otherVal = (0, units_1.convertUnit)(other.value, other.unit, this.unit); + if (otherVal == null) { + return null; + } + else { + return this.value > otherVal; + } + } + }; + Quantity.prototype.before = function (other) { + if (other != null && other.isQuantity) { + var otherVal = (0, units_1.convertUnit)(other.value, other.unit, this.unit); + if (otherVal == null) { + return null; + } + else { + return this.value < otherVal; + } + } + }; + Quantity.prototype.equals = function (other) { + if (other != null && other.isQuantity) { + if ((!this.unit && other.unit) || (this.unit && !other.unit)) { + return false; + } + else if (!this.unit && !other.unit) { + return this.value === other.value; + } + else { + var otherVal = (0, units_1.convertUnit)(other.value, other.unit, this.unit); + if (otherVal == null) { + return null; + } + else { + return (0, math_1.decimalAdjust)('round', this.value, -8) === otherVal; + } + } + } + }; + Quantity.prototype.convertUnit = function (toUnit) { + var value = (0, units_1.convertUnit)(this.value, this.unit, toUnit); + // Need to pass through constructor again to catch invalid units + return new Quantity(value, toUnit); + }; + Quantity.prototype.dividedBy = function (other) { + if (other == null || other === 0 || other.value === 0) { + return null; + } + else if (!other.isQuantity) { + // convert it to a quantity w/ unit 1 + other = new Quantity(other, '1'); + } + var _a = (0, units_1.normalizeUnitsWhenPossible)(this.value, this.unit, other.value, other.unit), val1 = _a[0], unit1 = _a[1], val2 = _a[2], unit2 = _a[3]; + var resultValue = val1 / val2; + var resultUnit = (0, units_1.getQuotientOfUnits)(unit1, unit2); + // Check for invalid unit or value + if (resultUnit == null || (0, math_1.overflowsOrUnderflows)(resultValue)) { + return null; + } + return new Quantity((0, math_1.decimalAdjust)('round', resultValue, -8), resultUnit); + }; + Quantity.prototype.multiplyBy = function (other) { + if (other == null) { + return null; + } + else if (!other.isQuantity) { + // convert it to a quantity w/ unit 1 + other = new Quantity(other, '1'); + } + var _a = (0, units_1.normalizeUnitsWhenPossible)(this.value, this.unit, other.value, other.unit), val1 = _a[0], unit1 = _a[1], val2 = _a[2], unit2 = _a[3]; + var resultValue = val1 * val2; + var resultUnit = (0, units_1.getProductOfUnits)(unit1, unit2); + // Check for invalid unit or value + if (resultUnit == null || (0, math_1.overflowsOrUnderflows)(resultValue)) { + return null; + } + return new Quantity((0, math_1.decimalAdjust)('round', resultValue, -8), resultUnit); + }; + return Quantity; +}()); +exports.Quantity = Quantity; +function parseQuantity(str) { + var components = /([+|-]?\d+\.?\d*)\s*('(.+)')?/.exec(str); + if (components != null && components[1] != null) { + var value = parseFloat(components[1]); + if (!(0, math_1.isValidDecimal)(value)) { + return null; + } + var unit = void 0; + if (components[3] != null) { + unit = components[3].trim(); + } + else { + unit = ''; + } + return new Quantity(value, unit); + } + else { return null; - } - - return new RegExp('^' + pattern + '$').test(string); } - }]); - - return Matches; -}(Expression); - -var Substring = /*#__PURE__*/function (_Expression10) { - _inherits(Substring, _Expression10); - - var _super10 = _createSuper(Substring); - - function Substring(json) { - var _this6; - - _classCallCheck(this, Substring); - - _this6 = _super10.call(this, json); - _this6.stringToSub = build(json.stringToSub); - _this6.startIndex = build(json.startIndex); - _this6.length = build(json['length']); - return _this6; - } - - _createClass(Substring, [{ - key: "exec", - value: function exec(ctx) { - var stringToSub = this.stringToSub.execute(ctx); - var startIndex = this.startIndex.execute(ctx); - var length = this.length != null ? this.length.execute(ctx) : null; // According to spec: If stringToSub or startIndex is null, or startIndex is out of range, the result is null. - - if (stringToSub == null || startIndex == null || startIndex < 0 || startIndex >= stringToSub.length) { - return null; - } else if (length != null) { - return stringToSub.substr(startIndex, length); - } else { - return stringToSub.substr(startIndex); - } +} +exports.parseQuantity = parseQuantity; +function doScaledAddition(a, b, scaleForB) { + if (a != null && a.isQuantity && b != null && b.isQuantity) { + var _a = (0, units_1.normalizeUnitsWhenPossible)(a.value, a.unit, b.value * scaleForB, b.unit), val1 = _a[0], unit1 = _a[1], val2 = _a[2], unit2 = _a[3]; + if (unit1 !== unit2) { + // not compatible units, so we can't do addition + return null; + } + var sum = val1 + val2; + if ((0, math_1.overflowsOrUnderflows)(sum)) { + return null; + } + return new Quantity(sum, unit1); + } + else if (a.copy && a.add) { + // Date / DateTime require a CQL time unit + var cqlUnitB = (0, units_1.convertToCQLDateUnit)(b.unit) || b.unit; + return a.copy().add(b.value * scaleForB, cqlUnitB); + } + else { + throw new Error('Unsupported argument types.'); + } +} +function doAddition(a, b) { + return doScaledAddition(a, b, 1); +} +exports.doAddition = doAddition; +function doSubtraction(a, b) { + return doScaledAddition(a, b, -1); +} +exports.doSubtraction = doSubtraction; +function doDivision(a, b) { + if (a != null && a.isQuantity) { + return a.dividedBy(b); + } +} +exports.doDivision = doDivision; +function doMultiplication(a, b) { + if (a != null && a.isQuantity) { + return a.multiplyBy(b); } - }]); - - return Substring; -}(Expression); - -var StartsWith = /*#__PURE__*/function (_Expression11) { - _inherits(StartsWith, _Expression11); - - var _super11 = _createSuper(StartsWith); - - function StartsWith(json) { - _classCallCheck(this, StartsWith); - - return _super11.call(this, json); - } - - _createClass(StartsWith, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); - - if (args.some(function (x) { - return x == null; - })) { - return null; - } else { - return args[0].slice(0, args[1].length) === args[1]; - } + else { + return b.multiplyBy(a); } - }]); - - return StartsWith; -}(Expression); - -var EndsWith = /*#__PURE__*/function (_Expression12) { - _inherits(EndsWith, _Expression12); - - var _super12 = _createSuper(EndsWith); - - function EndsWith(json) { - _classCallCheck(this, EndsWith); - - return _super12.call(this, json); - } - - _createClass(EndsWith, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); +} +exports.doMultiplication = doMultiplication; - if (args.some(function (x) { - return x == null; - })) { - return null; - } else { - return args[1] === '' || args[0].slice(-args[1].length) === args[1]; - } +},{"../util/math":53,"../util/units":54}],12:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Ratio = void 0; +var Ratio = /** @class */ (function () { + function Ratio(numerator, denominator) { + this.numerator = numerator; + this.denominator = denominator; + if (numerator == null) { + throw new Error('Cannot create a ratio with an undefined numerator'); + } + if (denominator == null) { + throw new Error('Cannot create a ratio with an undefined denominator'); + } } - }]); - - return EndsWith; -}(Expression); - -var ReplaceMatches = /*#__PURE__*/function (_Expression13) { - _inherits(ReplaceMatches, _Expression13); - - var _super13 = _createSuper(ReplaceMatches); - - function ReplaceMatches(json) { - _classCallCheck(this, ReplaceMatches); - - return _super13.call(this, json); - } - - _createClass(ReplaceMatches, [{ - key: "exec", - value: function exec(ctx) { - var args = this.execArgs(ctx); + Object.defineProperty(Ratio.prototype, "isRatio", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Ratio.prototype.clone = function () { + return new Ratio(this.numerator.clone(), this.denominator.clone()); + }; + Ratio.prototype.toString = function () { + return "".concat(this.numerator.toString(), " : ").concat(this.denominator.toString()); + }; + Ratio.prototype.equals = function (other) { + if (other != null && other.isRatio) { + var divided_this = this.numerator.dividedBy(this.denominator); + var divided_other = other.numerator.dividedBy(other.denominator); + return divided_this === null || divided_this === void 0 ? void 0 : divided_this.equals(divided_other); + } + else { + return false; + } + }; + Ratio.prototype.equivalent = function (other) { + var equal = this.equals(other); + return equal != null ? equal : false; + }; + return Ratio; +}()); +exports.Ratio = Ratio; - if (args.some(function (x) { - return x == null; - })) { - return null; - } else { - return args[0].replace(new RegExp(args[1], 'g'), args[2]); - } +},{}],13:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Uncertainty = void 0; +var logic_1 = require("./logic"); +var Uncertainty = /** @class */ (function () { + function Uncertainty(low, high) { + var _a; + if (low === void 0) { low = null; } + this.low = low; + this.high = high; + var gt = function (a, b) { + if (typeof a !== typeof b) { + // TODO: This should probably throw rather than return false. + // Uncertainties with different types probably shouldn't be supported. + return false; + } + if (typeof a.after === 'function') { + return a.after(b); + } + else { + return a > b; + } + }; + var isNonEnumerable = function (val) { + return val != null && (val.isCode || val.isConcept || val.isValueSet); + }; + if (typeof this.high === 'undefined') { + this.high = this.low; + } + if (isNonEnumerable(this.low) || isNonEnumerable(this.high)) { + this.low = this.high = null; + } + if (this.low != null && this.high != null && gt(this.low, this.high)) { + _a = [this.high, this.low], this.low = _a[0], this.high = _a[1]; + } } - }]); + Uncertainty.from = function (obj) { + if (obj != null && obj.isUncertainty) { + return obj; + } + else { + return new Uncertainty(obj); + } + }; + Object.defineProperty(Uncertainty.prototype, "isUncertainty", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Uncertainty.prototype.copy = function () { + var newLow = this.low; + var newHigh = this.high; + if (typeof this.low.copy === 'function') { + newLow = this.low.copy(); + } + if (typeof this.high.copy === 'function') { + newHigh = this.high.copy(); + } + return new Uncertainty(newLow, newHigh); + }; + Uncertainty.prototype.isPoint = function () { + // Note: Can't use normal equality, as that fails for Javascript dates + // TODO: Fix after we don't need to support Javascript date uncertainties anymore + var lte = function (a, b) { + if (typeof a !== typeof b) { + return false; + } + if (typeof a.sameOrBefore === 'function') { + return a.sameOrBefore(b); + } + else { + return a <= b; + } + }; + var gte = function (a, b) { + if (typeof a !== typeof b) { + return false; + } + if (typeof a.sameOrBefore === 'function') { + return a.sameOrAfter(b); + } + else { + return a >= b; + } + }; + return (this.low != null && this.high != null && lte(this.low, this.high) && gte(this.low, this.high)); + }; + Uncertainty.prototype.equals = function (other) { + other = Uncertainty.from(other); + return logic_1.ThreeValuedLogic.not(logic_1.ThreeValuedLogic.or(this.lessThan(other), this.greaterThan(other))); + }; + Uncertainty.prototype.lessThan = function (other) { + var lt = function (a, b) { + if (typeof a !== typeof b) { + return false; + } + if (typeof a.before === 'function') { + return a.before(b); + } + else { + return a < b; + } + }; + other = Uncertainty.from(other); + var bestCase = this.low == null || other.high == null || lt(this.low, other.high); + var worstCase = this.high != null && other.low != null && lt(this.high, other.low); + if (bestCase === worstCase) { + return bestCase; + } + else { + return null; + } + }; + Uncertainty.prototype.greaterThan = function (other) { + return Uncertainty.from(other).lessThan(this); + }; + Uncertainty.prototype.lessThanOrEquals = function (other) { + return logic_1.ThreeValuedLogic.not(this.greaterThan(Uncertainty.from(other))); + }; + Uncertainty.prototype.greaterThanOrEquals = function (other) { + return logic_1.ThreeValuedLogic.not(this.lessThan(Uncertainty.from(other))); + }; + return Uncertainty; +}()); +exports.Uncertainty = Uncertainty; - return ReplaceMatches; -}(Expression); - -module.exports = { - Combine: Combine, - Concatenate: Concatenate, - EndsWith: EndsWith, - LastPositionOf: LastPositionOf, - Lower: Lower, - Matches: Matches, - PositionOf: PositionOf, - ReplaceMatches: ReplaceMatches, - Split: Split, - SplitOnMatches: SplitOnMatches, - StartsWith: StartsWith, - Substring: Substring, - Upper: Upper -}; -},{"./builder":16,"./expression":22}],40:[function(require,module,exports){ +},{"./logic":10}],14:[function(require,module,exports){ "use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression, - UnimplementedExpression = _require.UnimplementedExpression; - -var _require2 = require('./builder'), - build = _require2.build; - -var Property = /*#__PURE__*/function (_Expression) { - _inherits(Property, _Expression); - - var _super = _createSuper(Property); - - function Property(json) { - var _this; - - _classCallCheck(this, Property); - - _this = _super.call(this, json); - _this.scope = json.scope; - _this.source = build(json.source); - _this.path = json.path; - return _this; - } - - _createClass(Property, [{ - key: "exec", - value: function exec(ctx) { - var obj = this.scope != null ? ctx.get(this.scope) : this.source; - - if (obj instanceof Expression) { - obj = obj.execute(ctx); - } - - var val = getPropertyFromObject(obj, this.path); - - if (val == null) { - var parts = this.path.split('.'); - var curr_obj = obj; - - var _iterator = _createForOfIteratorHelper(parts), - _step; - +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnyTrue = exports.AllTrue = exports.PopulationVariance = exports.Variance = exports.PopulationStdDev = exports.GeometricMean = exports.Product = exports.StdDev = exports.Mode = exports.Median = exports.Avg = exports.Max = exports.Min = exports.Sum = exports.Count = void 0; +var expression_1 = require("./expression"); +var util_1 = require("../util/util"); +var datatypes_1 = require("../datatypes/datatypes"); +var exception_1 = require("../datatypes/exception"); +var comparison_1 = require("../util/comparison"); +var builder_1 = require("./builder"); +var AggregateExpression = /** @class */ (function (_super) { + __extends(AggregateExpression, _super); + function AggregateExpression(json) { + var _this = _super.call(this, json) || this; + _this.source = (0, builder_1.build)(json.source); + return _this; + } + return AggregateExpression; +}(expression_1.Expression)); +var Count = /** @class */ (function (_super) { + __extends(Count, _super); + function Count(json) { + return _super.call(this, json) || this; + } + Count.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + if ((0, util_1.typeIsArray)(items)) { + return (0, util_1.removeNulls)(items).length; + } + return 0; + }; + return Count; +}(AggregateExpression)); +exports.Count = Count; +var Sum = /** @class */ (function (_super) { + __extends(Sum, _super); + function Sum(json) { + return _super.call(this, json) || this; + } + Sum.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + if (!(0, util_1.typeIsArray)(items)) { + return null; + } + try { + items = processQuantities(items); + } + catch (e) { + return null; + } + if (items.length === 0) { + return null; + } + if (hasOnlyQuantities(items)) { + var values = getValuesFromQuantities(items); + var sum = values.reduce(function (x, y) { return x + y; }); + return new datatypes_1.Quantity(sum, items[0].unit); + } + else { + return items.reduce(function (x, y) { return x + y; }); + } + }; + return Sum; +}(AggregateExpression)); +exports.Sum = Sum; +var Min = /** @class */ (function (_super) { + __extends(Min, _super); + function Min(json) { + return _super.call(this, json) || this; + } + Min.prototype.exec = function (ctx) { + var list = this.source.execute(ctx); + if (list == null) { + return null; + } + var listWithoutNulls = (0, util_1.removeNulls)(list); + // Check for incompatible units and return null. We don't want to convert + // the units for Min/Max, so we throw away the converted array if it succeeds + try { + processQuantities(list); + } + catch (e) { + return null; + } + if (listWithoutNulls.length === 0) { + return null; + } + // We assume the list is an array of all the same type. + var minimum = listWithoutNulls[0]; + for (var _i = 0, listWithoutNulls_1 = listWithoutNulls; _i < listWithoutNulls_1.length; _i++) { + var element = listWithoutNulls_1[_i]; + if ((0, comparison_1.lessThan)(element, minimum)) { + minimum = element; + } + } + return minimum; + }; + return Min; +}(AggregateExpression)); +exports.Min = Min; +var Max = /** @class */ (function (_super) { + __extends(Max, _super); + function Max(json) { + return _super.call(this, json) || this; + } + Max.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + if (items == null) { + return null; + } + var listWithoutNulls = (0, util_1.removeNulls)(items); + // Check for incompatible units and return null. We don't want to convert + // the units for Min/Max, so we throw away the converted array if it succeeds + try { + processQuantities(items); + } + catch (e) { + return null; + } + if (listWithoutNulls.length === 0) { + return null; + } + // We assume the list is an array of all the same type. + var maximum = listWithoutNulls[0]; + for (var _i = 0, listWithoutNulls_2 = listWithoutNulls; _i < listWithoutNulls_2.length; _i++) { + var element = listWithoutNulls_2[_i]; + if ((0, comparison_1.greaterThan)(element, maximum)) { + maximum = element; + } + } + return maximum; + }; + return Max; +}(AggregateExpression)); +exports.Max = Max; +var Avg = /** @class */ (function (_super) { + __extends(Avg, _super); + function Avg(json) { + return _super.call(this, json) || this; + } + Avg.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + if (!(0, util_1.typeIsArray)(items)) { + return null; + } + try { + items = processQuantities(items); + } + catch (e) { + return null; + } + if (items.length === 0) { + return null; + } + if (hasOnlyQuantities(items)) { + var values = getValuesFromQuantities(items); + var sum = values.reduce(function (x, y) { return x + y; }); + return new datatypes_1.Quantity(sum / values.length, items[0].unit); + } + else { + var sum = items.reduce(function (x, y) { return x + y; }); + return sum / items.length; + } + }; + return Avg; +}(AggregateExpression)); +exports.Avg = Avg; +var Median = /** @class */ (function (_super) { + __extends(Median, _super); + function Median(json) { + return _super.call(this, json) || this; + } + Median.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + if (!(0, util_1.typeIsArray)(items)) { + return null; + } + if (items.length === 0) { + return null; + } + try { + items = processQuantities(items); + } + catch (e) { + return null; + } + if (!hasOnlyQuantities(items)) { + return medianOfNumbers(items); + } + var values = getValuesFromQuantities(items); + var median = medianOfNumbers(values); + return new datatypes_1.Quantity(median, items[0].unit); + }; + return Median; +}(AggregateExpression)); +exports.Median = Median; +var Mode = /** @class */ (function (_super) { + __extends(Mode, _super); + function Mode(json) { + return _super.call(this, json) || this; + } + Mode.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + if (!(0, util_1.typeIsArray)(items)) { + return null; + } + if (items.length === 0) { + return null; + } + var filtered; + try { + filtered = processQuantities(items); + } + catch (e) { + return null; + } + if (hasOnlyQuantities(filtered)) { + var values = getValuesFromQuantities(filtered); + var mode = this.mode(values); + if (mode.length === 1) { + mode = mode[0]; + } + return new datatypes_1.Quantity(mode, items[0].unit); + } + else { + var mode = this.mode(filtered); + if (mode.length === 1) { + return mode[0]; + } + else { + return mode; + } + } + }; + Mode.prototype.mode = function (arr) { + var max = 0; + var counts = {}; + var results = []; + for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) { + var elem = arr_1[_i]; + var cnt = (counts[elem] = (counts[elem] != null ? counts[elem] : 0) + 1); + if (cnt === max && !results.includes(elem)) { + results.push(elem); + } + else if (cnt > max) { + results = [elem]; + max = cnt; + } + } + return results; + }; + return Mode; +}(AggregateExpression)); +exports.Mode = Mode; +var StdDev = /** @class */ (function (_super) { + __extends(StdDev, _super); + function StdDev(json) { + var _this = _super.call(this, json) || this; + _this.type = 'standard_deviation'; + return _this; + } + StdDev.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + if (!(0, util_1.typeIsArray)(items)) { + return null; + } + try { + items = processQuantities(items); + } + catch (e) { + return null; + } + if (items.length === 0) { + return null; + } + if (hasOnlyQuantities(items)) { + var values = getValuesFromQuantities(items); + var stdDev = this.standardDeviation(values); + return new datatypes_1.Quantity(stdDev, items[0].unit); + } + else { + return this.standardDeviation(items); + } + }; + StdDev.prototype.standardDeviation = function (list) { + var val = this.stats(list); + if (val) { + return val[this.type]; + } + }; + StdDev.prototype.stats = function (list) { + var sum = list.reduce(function (x, y) { return x + y; }); + var mean = sum / list.length; + var sumOfSquares = 0; + for (var _i = 0, list_1 = list; _i < list_1.length; _i++) { + var sq = list_1[_i]; + sumOfSquares += Math.pow(sq - mean, 2); + } + var std_var = (1 / (list.length - 1)) * sumOfSquares; + var pop_var = (1 / list.length) * sumOfSquares; + var std_dev = Math.sqrt(std_var); + var pop_dev = Math.sqrt(pop_var); + return { + standard_variance: std_var, + population_variance: pop_var, + standard_deviation: std_dev, + population_deviation: pop_dev + }; + }; + return StdDev; +}(AggregateExpression)); +exports.StdDev = StdDev; +var Product = /** @class */ (function (_super) { + __extends(Product, _super); + function Product(json) { + return _super.call(this, json) || this; + } + Product.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + if (!(0, util_1.typeIsArray)(items)) { + return null; + } + try { + items = processQuantities(items); + } + catch (e) { + return null; + } + if (items.length === 0) { + return null; + } + if (hasOnlyQuantities(items)) { + var values = getValuesFromQuantities(items); + var product = values.reduce(function (x, y) { return x * y; }); + // Units are not multiplied for the geometric product + return new datatypes_1.Quantity(product, items[0].unit); + } + else { + return items.reduce(function (x, y) { return x * y; }); + } + }; + return Product; +}(AggregateExpression)); +exports.Product = Product; +var GeometricMean = /** @class */ (function (_super) { + __extends(GeometricMean, _super); + function GeometricMean(json) { + return _super.call(this, json) || this; + } + GeometricMean.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + if (!(0, util_1.typeIsArray)(items)) { + return null; + } try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var part = _step.value; - - var _obj = getPropertyFromObject(curr_obj, part); - - curr_obj = _obj instanceof Function ? _obj.call(curr_obj) : _obj; - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); + items = processQuantities(items); } - - val = curr_obj != null ? curr_obj : null; // convert undefined to null - } - - if (val instanceof Function) { - return val.call(obj); - } else { - return val; - } + catch (e) { + return null; + } + if (items.length === 0) { + return null; + } + if (hasOnlyQuantities(items)) { + var values = getValuesFromQuantities(items); + var product = values.reduce(function (x, y) { return x * y; }); + var geoMean = Math.pow(product, 1.0 / items.length); + return new datatypes_1.Quantity(geoMean, items[0].unit); + } + else { + var product = items.reduce(function (x, y) { return x * y; }); + return Math.pow(product, 1.0 / items.length); + } + }; + return GeometricMean; +}(AggregateExpression)); +exports.GeometricMean = GeometricMean; +var PopulationStdDev = /** @class */ (function (_super) { + __extends(PopulationStdDev, _super); + function PopulationStdDev(json) { + var _this = _super.call(this, json) || this; + _this.type = 'population_deviation'; + return _this; + } + return PopulationStdDev; +}(StdDev)); +exports.PopulationStdDev = PopulationStdDev; +var Variance = /** @class */ (function (_super) { + __extends(Variance, _super); + function Variance(json) { + var _this = _super.call(this, json) || this; + _this.type = 'standard_variance'; + return _this; + } + return Variance; +}(StdDev)); +exports.Variance = Variance; +var PopulationVariance = /** @class */ (function (_super) { + __extends(PopulationVariance, _super); + function PopulationVariance(json) { + var _this = _super.call(this, json) || this; + _this.type = 'population_variance'; + return _this; + } + return PopulationVariance; +}(StdDev)); +exports.PopulationVariance = PopulationVariance; +var AllTrue = /** @class */ (function (_super) { + __extends(AllTrue, _super); + function AllTrue(json) { + return _super.call(this, json) || this; + } + AllTrue.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + return (0, util_1.allTrue)((0, util_1.removeNulls)(items)); + }; + return AllTrue; +}(AggregateExpression)); +exports.AllTrue = AllTrue; +var AnyTrue = /** @class */ (function (_super) { + __extends(AnyTrue, _super); + function AnyTrue(json) { + return _super.call(this, json) || this; + } + AnyTrue.prototype.exec = function (ctx) { + var items = this.source.execute(ctx); + return (0, util_1.anyTrue)(items); + }; + return AnyTrue; +}(AggregateExpression)); +exports.AnyTrue = AnyTrue; +function processQuantities(values) { + var items = (0, util_1.removeNulls)(values); + if (hasOnlyQuantities(items)) { + return convertAllUnits(items); } - }]); - - return Property; -}(Expression); - -function getPropertyFromObject(obj, path) { - var val; - - if (obj != null) { - val = obj[path]; - - if (val === undefined && typeof obj.get === 'function') { - val = obj.get(path); + else if (hasSomeQuantities(items)) { + throw new exception_1.Exception('Cannot perform aggregate operations on mixed values of Quantities and non Quantities'); + } + else { + return items; } - } - - return val; } - -var Tuple = /*#__PURE__*/function (_Expression2) { - _inherits(Tuple, _Expression2); - - var _super2 = _createSuper(Tuple); - - function Tuple(json) { - var _this2; - - _classCallCheck(this, Tuple); - - _this2 = _super2.call(this, json); - var elements = json.element != null ? json.element : []; - _this2.elements = elements.map(function (el) { - return { - name: el.name, - value: build(el.value) - }; - }); - return _this2; - } - - _createClass(Tuple, [{ - key: "isTuple", - get: function get() { - return true; +function getValuesFromQuantities(quantities) { + return quantities.map(function (quantity) { return quantity.value; }); +} +function hasOnlyQuantities(arr) { + return arr.every(function (x) { return x.isQuantity; }); +} +function hasSomeQuantities(arr) { + return arr.some(function (x) { return x.isQuantity; }); +} +function convertAllUnits(arr) { + // convert all quantities in array to match the unit of the first item + return arr.map(function (q) { return q.convertUnit(arr[0].unit); }); +} +function medianOfNumbers(numbers) { + var items = (0, util_1.numerical_sort)(numbers, 'asc'); + if (items.length % 2 === 1) { + // Odd number of items + return items[(items.length - 1) / 2]; } - }, { - key: "exec", - value: function exec(ctx) { - var val = {}; - - var _iterator2 = _createForOfIteratorHelper(this.elements), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var el = _step2.value; - val[el.name] = el.value != null ? el.value.execute(ctx) : undefined; - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - - return val; + else { + // Even number of items + return (items[items.length / 2 - 1] + items[items.length / 2]) / 2; } - }]); - - return Tuple; -}(Expression); - -var TupleElement = /*#__PURE__*/function (_UnimplementedExpress) { - _inherits(TupleElement, _UnimplementedExpress); - - var _super3 = _createSuper(TupleElement); - - function TupleElement() { - _classCallCheck(this, TupleElement); - - return _super3.apply(this, arguments); - } - - return TupleElement; -}(UnimplementedExpression); - -var TupleElementDefinition = /*#__PURE__*/function (_UnimplementedExpress2) { - _inherits(TupleElementDefinition, _UnimplementedExpress2); - - var _super4 = _createSuper(TupleElementDefinition); - - function TupleElementDefinition() { - _classCallCheck(this, TupleElementDefinition); - - return _super4.apply(this, arguments); - } - - return TupleElementDefinition; -}(UnimplementedExpression); +} -module.exports = { - Property: Property, - Tuple: Tuple, - TupleElement: TupleElement, - TupleElementDefinition: TupleElementDefinition -}; -},{"./builder":16,"./expression":22}],41:[function(require,module,exports){ +},{"../datatypes/datatypes":6,"../datatypes/exception":8,"../util/comparison":52,"../util/util":55,"./builder":16,"./expression":22}],15:[function(require,module,exports){ "use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Predecessor = exports.Successor = exports.MaxValue = exports.MinValue = exports.Power = exports.Log = exports.Exp = exports.Ln = exports.Round = exports.Negate = exports.Abs = exports.Truncate = exports.Floor = exports.Ceiling = exports.Modulo = exports.TruncatedDivide = exports.Divide = exports.Multiply = exports.Subtract = exports.Add = void 0; +var expression_1 = require("./expression"); +var MathUtil = __importStar(require("../util/math")); +var quantity_1 = require("../datatypes/quantity"); +var uncertainty_1 = require("../datatypes/uncertainty"); +var builder_1 = require("./builder"); +var Add = /** @class */ (function (_super) { + __extends(Add, _super); + function Add(json) { + return _super.call(this, json) || this; + } + Add.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args == null || args.some(function (x) { return x == null; })) { + return null; + } + var sum = args.reduce(function (x, y) { + if (x.isUncertainty && !y.isUncertainty) { + y = new uncertainty_1.Uncertainty(y, y); + } + else if (y.isUncertainty && !x.isUncertainty) { + x = new uncertainty_1.Uncertainty(x, x); + } + if (x.isQuantity || x.isDateTime || x.isDate || (x.isTime && x.isTime())) { + return (0, quantity_1.doAddition)(x, y); + } + else if (x.isUncertainty && y.isUncertainty) { + if (x.low.isQuantity || + x.low.isDateTime || + x.low.isDate || + (x.low.isTime && x.low.isTime())) { + return new uncertainty_1.Uncertainty((0, quantity_1.doAddition)(x.low, y.low), (0, quantity_1.doAddition)(x.high, y.high)); + } + else { + return new uncertainty_1.Uncertainty(x.low + y.low, x.high + y.high); + } + } + else { + return x + y; + } + }); + if (MathUtil.overflowsOrUnderflows(sum)) { + return null; + } + return sum; + }; + return Add; +}(expression_1.Expression)); +exports.Add = Add; +var Subtract = /** @class */ (function (_super) { + __extends(Subtract, _super); + function Subtract(json) { + return _super.call(this, json) || this; + } + Subtract.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args == null || args.some(function (x) { return x == null; })) { + return null; + } + var difference = args.reduce(function (x, y) { + if (x.isUncertainty && !y.isUncertainty) { + y = new uncertainty_1.Uncertainty(y, y); + } + else if (y.isUncertainty && !x.isUncertainty) { + x = new uncertainty_1.Uncertainty(x, x); + } + if (x.isQuantity || x.isDateTime || x.isDate) { + return (0, quantity_1.doSubtraction)(x, y); + } + else if (x.isUncertainty && y.isUncertainty) { + if (x.low.isQuantity || x.low.isDateTime || x.low.isDate) { + return new uncertainty_1.Uncertainty((0, quantity_1.doSubtraction)(x.low, y.high), (0, quantity_1.doSubtraction)(x.high, y.low)); + } + else { + return new uncertainty_1.Uncertainty(x.low - y.high, x.high - y.low); + } + } + else { + return x - y; + } + }); + if (MathUtil.overflowsOrUnderflows(difference)) { + return null; + } + return difference; + }; + return Subtract; +}(expression_1.Expression)); +exports.Subtract = Subtract; +var Multiply = /** @class */ (function (_super) { + __extends(Multiply, _super); + function Multiply(json) { + return _super.call(this, json) || this; + } + Multiply.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args == null || args.some(function (x) { return x == null; })) { + return null; + } + var product = args.reduce(function (x, y) { + if (x.isUncertainty && !y.isUncertainty) { + y = new uncertainty_1.Uncertainty(y, y); + } + else if (y.isUncertainty && !x.isUncertainty) { + x = new uncertainty_1.Uncertainty(x, x); + } + if (x.isQuantity || y.isQuantity) { + return (0, quantity_1.doMultiplication)(x, y); + } + else if (x.isUncertainty && y.isUncertainty) { + if (x.low.isQuantity) { + return new uncertainty_1.Uncertainty((0, quantity_1.doMultiplication)(x.low, y.low), (0, quantity_1.doMultiplication)(x.high, y.high)); + } + else { + return new uncertainty_1.Uncertainty(x.low * y.low, x.high * y.high); + } + } + else { + return x * y; + } + }); + if (MathUtil.overflowsOrUnderflows(product)) { + return null; + } + return product; + }; + return Multiply; +}(expression_1.Expression)); +exports.Multiply = Multiply; +var Divide = /** @class */ (function (_super) { + __extends(Divide, _super); + function Divide(json) { + return _super.call(this, json) || this; + } + Divide.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args == null || args.some(function (x) { return x == null; })) { + return null; + } + var quotient = args.reduce(function (x, y) { + if (x.isUncertainty && !y.isUncertainty) { + y = new uncertainty_1.Uncertainty(y, y); + } + else if (y.isUncertainty && !x.isUncertainty) { + x = new uncertainty_1.Uncertainty(x, x); + } + if (x.isQuantity) { + return (0, quantity_1.doDivision)(x, y); + } + else if (x.isUncertainty && y.isUncertainty) { + if (x.low.isQuantity) { + return new uncertainty_1.Uncertainty((0, quantity_1.doDivision)(x.low, y.high), (0, quantity_1.doDivision)(x.high, y.low)); + } + else { + return new uncertainty_1.Uncertainty(x.low / y.high, x.high / y.low); + } + } + else { + return x / y; + } + }); + // Note, anything divided by 0 is Infinity in Javascript, which will be + // considered as overflow by this check. + if (MathUtil.overflowsOrUnderflows(quotient)) { + return null; + } + return quotient; + }; + return Divide; +}(expression_1.Expression)); +exports.Divide = Divide; +var TruncatedDivide = /** @class */ (function (_super) { + __extends(TruncatedDivide, _super); + function TruncatedDivide(json) { + return _super.call(this, json) || this; + } + TruncatedDivide.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args == null || args.some(function (x) { return x == null; })) { + return null; + } + var quotient = args.reduce(function (x, y) { return x / y; }); + var truncatedQuotient = quotient >= 0 ? Math.floor(quotient) : Math.ceil(quotient); + if (MathUtil.overflowsOrUnderflows(truncatedQuotient)) { + return null; + } + return truncatedQuotient; + }; + return TruncatedDivide; +}(expression_1.Expression)); +exports.TruncatedDivide = TruncatedDivide; +var Modulo = /** @class */ (function (_super) { + __extends(Modulo, _super); + function Modulo(json) { + return _super.call(this, json) || this; + } + Modulo.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args == null || args.some(function (x) { return x == null; })) { + return null; + } + var modulo = args.reduce(function (x, y) { return x % y; }); + return MathUtil.decimalOrNull(modulo); + }; + return Modulo; +}(expression_1.Expression)); +exports.Modulo = Modulo; +var Ceiling = /** @class */ (function (_super) { + __extends(Ceiling, _super); + function Ceiling(json) { + return _super.call(this, json) || this; + } + Ceiling.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + return Math.ceil(arg); + }; + return Ceiling; +}(expression_1.Expression)); +exports.Ceiling = Ceiling; +var Floor = /** @class */ (function (_super) { + __extends(Floor, _super); + function Floor(json) { + return _super.call(this, json) || this; + } + Floor.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + return Math.floor(arg); + }; + return Floor; +}(expression_1.Expression)); +exports.Floor = Floor; +var Truncate = /** @class */ (function (_super) { + __extends(Truncate, _super); + function Truncate(json) { + return _super.call(this, json) || this; + } + Truncate.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + return arg >= 0 ? Math.floor(arg) : Math.ceil(arg); + }; + return Truncate; +}(expression_1.Expression)); +exports.Truncate = Truncate; +var Abs = /** @class */ (function (_super) { + __extends(Abs, _super); + function Abs(json) { + return _super.call(this, json) || this; + } + Abs.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + else if (arg.isQuantity) { + return new quantity_1.Quantity(Math.abs(arg.value), arg.unit); + } + else { + return Math.abs(arg); + } + }; + return Abs; +}(expression_1.Expression)); +exports.Abs = Abs; +var Negate = /** @class */ (function (_super) { + __extends(Negate, _super); + function Negate(json) { + return _super.call(this, json) || this; + } + Negate.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + else if (arg.isQuantity) { + return new quantity_1.Quantity(arg.value * -1, arg.unit); + } + else { + return arg * -1; + } + }; + return Negate; +}(expression_1.Expression)); +exports.Negate = Negate; +var Round = /** @class */ (function (_super) { + __extends(Round, _super); + function Round(json) { + var _this = _super.call(this, json) || this; + _this.precision = (0, builder_1.build)(json.precision); + return _this; + } + Round.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + var dec = this.precision != null ? this.precision.execute(ctx) : 0; + return Math.round(arg * Math.pow(10, dec)) / Math.pow(10, dec); + }; + return Round; +}(expression_1.Expression)); +exports.Round = Round; +var Ln = /** @class */ (function (_super) { + __extends(Ln, _super); + function Ln(json) { + return _super.call(this, json) || this; + } + Ln.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + var ln = Math.log(arg); + return MathUtil.decimalOrNull(ln); + }; + return Ln; +}(expression_1.Expression)); +exports.Ln = Ln; +var Exp = /** @class */ (function (_super) { + __extends(Exp, _super); + function Exp(json) { + return _super.call(this, json) || this; + } + Exp.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + var power = Math.exp(arg); + if (MathUtil.overflowsOrUnderflows(power)) { + return null; + } + return power; + }; + return Exp; +}(expression_1.Expression)); +exports.Exp = Exp; +var Log = /** @class */ (function (_super) { + __extends(Log, _super); + function Log(json) { + return _super.call(this, json) || this; + } + Log.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args == null || args.some(function (x) { return x == null; })) { + return null; + } + var log = args.reduce(function (x, y) { return Math.log(x) / Math.log(y); }); + return MathUtil.decimalOrNull(log); + }; + return Log; +}(expression_1.Expression)); +exports.Log = Log; +var Power = /** @class */ (function (_super) { + __extends(Power, _super); + function Power(json) { + return _super.call(this, json) || this; + } + Power.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args == null || args.some(function (x) { return x == null; })) { + return null; + } + var power = args.reduce(function (x, y) { return Math.pow(x, y); }); + if (MathUtil.overflowsOrUnderflows(power)) { + return null; + } + return power; + }; + return Power; +}(expression_1.Expression)); +exports.Power = Power; +var MinValue = /** @class */ (function (_super) { + __extends(MinValue, _super); + function MinValue(json) { + var _this = _super.call(this, json) || this; + _this.valueType = json.valueType; + return _this; + } + MinValue.prototype.exec = function (ctx) { + if (MinValue.MIN_VALUES[this.valueType]) { + if (this.valueType === '{urn:hl7-org:elm-types:r1}DateTime') { + var minDateTime = MinValue.MIN_VALUES[this.valueType].copy(); + minDateTime.timezoneOffset = ctx.getTimezoneOffset(); + return minDateTime; + } + else { + return MinValue.MIN_VALUES[this.valueType]; + } + } + else { + throw new Error("Minimum not supported for ".concat(this.valueType)); + } + }; + MinValue.MIN_VALUES = { + '{urn:hl7-org:elm-types:r1}Integer': MathUtil.MIN_INT_VALUE, + '{urn:hl7-org:elm-types:r1}Decimal': MathUtil.MIN_FLOAT_VALUE, + '{urn:hl7-org:elm-types:r1}DateTime': MathUtil.MIN_DATETIME_VALUE, + '{urn:hl7-org:elm-types:r1}Date': MathUtil.MIN_DATE_VALUE, + '{urn:hl7-org:elm-types:r1}Time': MathUtil.MIN_TIME_VALUE + }; + return MinValue; +}(expression_1.Expression)); +exports.MinValue = MinValue; +var MaxValue = /** @class */ (function (_super) { + __extends(MaxValue, _super); + function MaxValue(json) { + var _this = _super.call(this, json) || this; + _this.valueType = json.valueType; + return _this; + } + MaxValue.prototype.exec = function (ctx) { + if (MaxValue.MAX_VALUES[this.valueType] != null) { + if (this.valueType === '{urn:hl7-org:elm-types:r1}DateTime') { + var maxDateTime = MaxValue.MAX_VALUES[this.valueType].copy(); + maxDateTime.timezoneOffset = ctx.getTimezoneOffset(); + return maxDateTime; + } + else { + return MaxValue.MAX_VALUES[this.valueType]; + } + } + else { + throw new Error("Maximum not supported for ".concat(this.valueType)); + } + }; + MaxValue.MAX_VALUES = { + '{urn:hl7-org:elm-types:r1}Integer': MathUtil.MAX_INT_VALUE, + '{urn:hl7-org:elm-types:r1}Decimal': MathUtil.MAX_FLOAT_VALUE, + '{urn:hl7-org:elm-types:r1}DateTime': MathUtil.MAX_DATETIME_VALUE, + '{urn:hl7-org:elm-types:r1}Date': MathUtil.MAX_DATE_VALUE, + '{urn:hl7-org:elm-types:r1}Time': MathUtil.MAX_TIME_VALUE + }; + return MaxValue; +}(expression_1.Expression)); +exports.MaxValue = MaxValue; +var Successor = /** @class */ (function (_super) { + __extends(Successor, _super); + function Successor(json) { + return _super.call(this, json) || this; + } + Successor.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + var successor = null; + try { + // MathUtil.successor throws on overflow, and the exception is used in + // the logic for evaluating `meets`, so it can't be changed to just return null + successor = MathUtil.successor(arg); + } + catch (e) { + if (e instanceof MathUtil.OverFlowException) { + return null; + } + } + if (MathUtil.overflowsOrUnderflows(successor)) { + return null; + } + return successor; + }; + return Successor; +}(expression_1.Expression)); +exports.Successor = Successor; +var Predecessor = /** @class */ (function (_super) { + __extends(Predecessor, _super); + function Predecessor(json) { + return _super.call(this, json) || this; + } + Predecessor.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + var predecessor = null; + try { + // MathUtil.predecessor throws on underflow, and the exception is used in + // the logic for evaluating `meets`, so it can't be changed to just return null + predecessor = MathUtil.predecessor(arg); + } + catch (e) { + if (e instanceof MathUtil.OverFlowException) { + return null; + } + } + if (MathUtil.overflowsOrUnderflows(predecessor)) { + return null; + } + return predecessor; + }; + return Predecessor; +}(expression_1.Expression)); +exports.Predecessor = Predecessor; -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('./expression'), - Expression = _require.Expression, - UnimplementedExpression = _require.UnimplementedExpression; - -var _require2 = require('../datatypes/datetime'), - DateTime = _require2.DateTime, - Date = _require2.Date; - -var _require3 = require('../datatypes/clinical'), - Concept = _require3.Concept; - -var _require4 = require('../datatypes/quantity'), - Quantity = _require4.Quantity, - parseQuantity = _require4.parseQuantity; - -var _require5 = require('../util/math'), - isValidDecimal = _require5.isValidDecimal, - isValidInteger = _require5.isValidInteger, - limitDecimalPrecision = _require5.limitDecimalPrecision; - -var _require6 = require('../util/util'), - normalizeMillisecondsField = _require6.normalizeMillisecondsField; - -var _require7 = require('../datatypes/ratio'), - Ratio = _require7.Ratio; - -var _require8 = require('../datatypes/uncertainty'), - Uncertainty = _require8.Uncertainty; // TODO: Casting and Conversion needs unit tests! - - -var As = /*#__PURE__*/function (_Expression) { - _inherits(As, _Expression); - - var _super = _createSuper(As); - - function As(json) { - var _this; - - _classCallCheck(this, As); - - _this = _super.call(this, json); - - if (json.asTypeSpecifier) { - _this.asTypeSpecifier = json.asTypeSpecifier; - } else if (json.asType) { - // convert it to a NamedTypedSpecifier - _this.asTypeSpecifier = { - name: json.asType, - type: 'NamedTypeSpecifier' - }; +},{"../datatypes/quantity":11,"../datatypes/uncertainty":13,"../util/math":53,"./builder":16,"./expression":22}],16:[function(require,module,exports){ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.build = void 0; +/* eslint-disable @typescript-eslint/ban-ts-comment */ +var E = __importStar(require("./expressions")); +var util_1 = require("../util/util"); +function build(json) { + if (json == null) { + return json; } - - _this.strict = json.strict != null ? json.strict : false; - return _this; - } - - _createClass(As, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); // If it is null, return null - - if (arg == null) { - return null; - } - - if (ctx.matchesTypeSpecifier(arg, this.asTypeSpecifier)) { - // TODO: request patient source to change type identification - return arg; - } else if (this.strict) { - var argTypeString = specifierToString(guessSpecifierType(arg)); - var asTypeString = specifierToString(this.asTypeSpecifier); - throw new Error("Cannot cast ".concat(argTypeString, " as ").concat(asTypeString)); - } else { - return null; - } + if ((0, util_1.typeIsArray)(json)) { + return json.map(function (child) { return build(child); }); } - }]); - - return As; -}(Expression); - -var ToBoolean = /*#__PURE__*/function (_Expression2) { - _inherits(ToBoolean, _Expression2); - - var _super2 = _createSuper(ToBoolean); - - function ToBoolean(json) { - _classCallCheck(this, ToBoolean); - - return _super2.call(this, json); - } - - _createClass(ToBoolean, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - var strArg = arg.toString().toLowerCase(); - - if (['true', 't', 'yes', 'y', '1'].includes(strArg)) { - return true; - } else if (['false', 'f', 'no', 'n', '0'].includes(strArg)) { - return false; - } - } - - return null; + if (json.type === 'FunctionRef') { + return new E.FunctionRef(json); } - }]); - - return ToBoolean; -}(Expression); - -var ToConcept = /*#__PURE__*/function (_Expression3) { - _inherits(ToConcept, _Expression3); - - var _super3 = _createSuper(ToConcept); - - function ToConcept(json) { - _classCallCheck(this, ToConcept); - - return _super3.call(this, json); - } - - _createClass(ToConcept, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - return new Concept([arg], arg.display); - } else { - return null; - } + else if (json.type === 'Literal') { + return E.Literal.from(json); } - }]); - - return ToConcept; -}(Expression); - -var ToDate = /*#__PURE__*/function (_Expression4) { - _inherits(ToDate, _Expression4); - - var _super4 = _createSuper(ToDate); - - function ToDate(json) { - _classCallCheck(this, ToDate); - - return _super4.call(this, json); - } - - _createClass(ToDate, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { - return null; - } else if (arg.isDateTime) { - return arg.getDate(); - } else { - return Date.parse(arg.toString()); - } + else if (functionExists(json.type)) { + return constructByName(json.type, json); } - }]); - - return ToDate; -}(Expression); - -var ToDateTime = /*#__PURE__*/function (_Expression5) { - _inherits(ToDateTime, _Expression5); - - var _super5 = _createSuper(ToDateTime); - - function ToDateTime(json) { - _classCallCheck(this, ToDateTime); - - return _super5.call(this, json); - } - - _createClass(ToDateTime, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg == null) { + else { return null; - } else if (arg.isDate) { - return arg.getDateTime(); - } else { - return DateTime.parse(arg.toString()); - } } - }]); - - return ToDateTime; -}(Expression); - -var ToDecimal = /*#__PURE__*/function (_Expression6) { - _inherits(ToDecimal, _Expression6); - - var _super6 = _createSuper(ToDecimal); - - function ToDecimal(json) { - _classCallCheck(this, ToDecimal); - - return _super6.call(this, json); - } - - _createClass(ToDecimal, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - if (arg.isUncertainty) { - var low = limitDecimalPrecision(parseFloat(arg.low.toString())); - var high = limitDecimalPrecision(parseFloat(arg.high.toString())); - return new Uncertainty(low, high); - } else { - var decimal = limitDecimalPrecision(parseFloat(arg.toString())); +} +exports.build = build; +function functionExists(name) { + // @ts-ignore + return typeof E[name] === 'function'; +} +function constructByName(name, json) { + // @ts-ignore + return new E[name](json); +} - if (isValidDecimal(decimal)) { - return decimal; - } +},{"../util/util":55,"./expressions":23}],17:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CalculateAgeAt = exports.CalculateAge = exports.Concept = exports.ConceptRef = exports.ConceptDef = exports.Code = exports.CodeRef = exports.CodeDef = exports.CodeSystemDef = exports.InValueSet = exports.AnyInValueSet = exports.ValueSetRef = exports.ValueSetDef = void 0; +var expression_1 = require("./expression"); +var dt = __importStar(require("../datatypes/datatypes")); +var builder_1 = require("./builder"); +var ValueSetDef = /** @class */ (function (_super) { + __extends(ValueSetDef, _super); + function ValueSetDef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.id = json.id; + _this.version = json.version; + return _this; + } + //todo: code systems and versions + ValueSetDef.prototype.exec = function (ctx) { + var valueset = ctx.codeService.findValueSet(this.id, this.version) || new dt.ValueSet(this.id, this.version); + ctx.rootContext().set(this.name, valueset); + return valueset; + }; + return ValueSetDef; +}(expression_1.Expression)); +exports.ValueSetDef = ValueSetDef; +var ValueSetRef = /** @class */ (function (_super) { + __extends(ValueSetRef, _super); + function ValueSetRef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.libraryName = json.libraryName; + return _this; + } + ValueSetRef.prototype.exec = function (ctx) { + // TODO: This calls the code service every time-- should be optimized + var valueset = ctx.getValueSet(this.name, this.libraryName); + if (valueset instanceof expression_1.Expression) { + valueset = valueset.execute(ctx); } - } - - return null; - } - }]); - - return ToDecimal; -}(Expression); - -var ToInteger = /*#__PURE__*/function (_Expression7) { - _inherits(ToInteger, _Expression7); - - var _super7 = _createSuper(ToInteger); - - function ToInteger(json) { - _classCallCheck(this, ToInteger); - - return _super7.call(this, json); - } - - _createClass(ToInteger, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); + return valueset; + }; + return ValueSetRef; +}(expression_1.Expression)); +exports.ValueSetRef = ValueSetRef; +var AnyInValueSet = /** @class */ (function (_super) { + __extends(AnyInValueSet, _super); + function AnyInValueSet(json) { + var _this = _super.call(this, json) || this; + _this.codes = (0, builder_1.build)(json.codes); + _this.valueset = new ValueSetRef(json.valueset); + return _this; + } + AnyInValueSet.prototype.exec = function (ctx) { + var valueset = this.valueset.execute(ctx); + // If the value set reference cannot be resolved, a run-time error is thrown. + if (valueset == null || !valueset.isValueSet) { + throw new Error('ValueSet must be provided to InValueSet function'); + } + var codes = this.codes.exec(ctx); + return codes != null && codes.some(function (code) { return valueset.hasMatch(code); }); + }; + return AnyInValueSet; +}(expression_1.Expression)); +exports.AnyInValueSet = AnyInValueSet; +var InValueSet = /** @class */ (function (_super) { + __extends(InValueSet, _super); + function InValueSet(json) { + var _this = _super.call(this, json) || this; + _this.code = (0, builder_1.build)(json.code); + _this.valueset = new ValueSetRef(json.valueset); + return _this; + } + InValueSet.prototype.exec = function (ctx) { + // If the code argument is null, the result is false + if (this.code == null) { + return false; + } + if (this.valueset == null) { + throw new Error('ValueSet must be provided to InValueSet function'); + } + var code = this.code.execute(ctx); + // spec indicates to return false if code is null, throw error if value set cannot be resolved + if (code == null) { + return false; + } + var valueset = this.valueset.execute(ctx); + if (valueset == null || !valueset.isValueSet) { + throw new Error('ValueSet must be provided to InValueSet function'); + } + // If there is a code and valueset return whether or not the valueset has the code + return valueset.hasMatch(code); + }; + return InValueSet; +}(expression_1.Expression)); +exports.InValueSet = InValueSet; +var CodeSystemDef = /** @class */ (function (_super) { + __extends(CodeSystemDef, _super); + function CodeSystemDef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.id = json.id; + _this.version = json.version; + return _this; + } + CodeSystemDef.prototype.exec = function (_ctx) { + return new dt.CodeSystem(this.id, this.version); + }; + return CodeSystemDef; +}(expression_1.Expression)); +exports.CodeSystemDef = CodeSystemDef; +var CodeDef = /** @class */ (function (_super) { + __extends(CodeDef, _super); + function CodeDef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.id = json.id; + _this.systemName = json.codeSystem.name; + _this.display = json.display; + return _this; + } + CodeDef.prototype.exec = function (ctx) { + var system = ctx.getCodeSystem(this.systemName).execute(ctx); + return new dt.Code(this.id, system.id, system.version, this.display); + }; + return CodeDef; +}(expression_1.Expression)); +exports.CodeDef = CodeDef; +var CodeRef = /** @class */ (function (_super) { + __extends(CodeRef, _super); + function CodeRef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.library = json.libraryName; + return _this; + } + CodeRef.prototype.exec = function (ctx) { + ctx = this.library ? ctx.getLibraryContext(this.library) : ctx; + var codeDef = ctx.getCode(this.name); + return codeDef ? codeDef.execute(ctx) : undefined; + }; + return CodeRef; +}(expression_1.Expression)); +exports.CodeRef = CodeRef; +var Code = /** @class */ (function (_super) { + __extends(Code, _super); + function Code(json) { + var _this = _super.call(this, json) || this; + _this.code = json.code; + _this.systemName = json.system.name; + _this.version = json.version; + _this.display = json.display; + return _this; + } + Object.defineProperty(Code.prototype, "isCode", { + // Define a simple getter to allow type-checking of this class without instanceof + // and in a way that survives minification (as opposed to checking constructor.name) + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Code.prototype.exec = function (ctx) { + var system = ctx.getCodeSystem(this.systemName) || {}; + return new dt.Code(this.code, system.id, this.version, this.display); + }; + return Code; +}(expression_1.Expression)); +exports.Code = Code; +var ConceptDef = /** @class */ (function (_super) { + __extends(ConceptDef, _super); + function ConceptDef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.display = json.display; + _this.codes = json.code; + return _this; + } + ConceptDef.prototype.exec = function (ctx) { + var codes = this.codes.map(function (code) { + var codeDef = ctx.getCode(code.name); + return codeDef ? codeDef.execute(ctx) : undefined; + }); + return new dt.Concept(codes, this.display); + }; + return ConceptDef; +}(expression_1.Expression)); +exports.ConceptDef = ConceptDef; +var ConceptRef = /** @class */ (function (_super) { + __extends(ConceptRef, _super); + function ConceptRef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + return _this; + } + ConceptRef.prototype.exec = function (ctx) { + var conceptDef = ctx.getConcept(this.name); + return conceptDef ? conceptDef.execute(ctx) : undefined; + }; + return ConceptRef; +}(expression_1.Expression)); +exports.ConceptRef = ConceptRef; +var Concept = /** @class */ (function (_super) { + __extends(Concept, _super); + function Concept(json) { + var _this = _super.call(this, json) || this; + _this.codes = json.code; + _this.display = json.display; + return _this; + } + Object.defineProperty(Concept.prototype, "isConcept", { + // Define a simple getter to allow type-checking of this class without instanceof + // and in a way that survives minification (as opposed to checking constructor.name) + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Concept.prototype.toCode = function (ctx, code) { + var system = ctx.getCodeSystem(code.system.name) || {}; + return new dt.Code(code.code, system.id, code.version, code.display); + }; + Concept.prototype.exec = function (ctx) { + var _this = this; + var codes = this.codes.map(function (code) { return _this.toCode(ctx, code); }); + return new dt.Concept(codes, this.display); + }; + return Concept; +}(expression_1.Expression)); +exports.Concept = Concept; +var CalculateAge = /** @class */ (function (_super) { + __extends(CalculateAge, _super); + function CalculateAge(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision; + return _this; + } + CalculateAge.prototype.exec = function (ctx) { + var date1 = this.execArgs(ctx); + var date2 = dt.DateTime.fromJSDate(ctx.getExecutionDateTime()); + var result = date1 != null ? date1.durationBetween(date2, this.precision.toLowerCase()) : undefined; + if (result != null && result.isPoint()) { + return result.low; + } + else { + return result; + } + }; + return CalculateAge; +}(expression_1.Expression)); +exports.CalculateAge = CalculateAge; +var CalculateAgeAt = /** @class */ (function (_super) { + __extends(CalculateAgeAt, _super); + function CalculateAgeAt(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision; + return _this; + } + CalculateAgeAt.prototype.exec = function (ctx) { + // eslint-disable-next-line prefer-const + var _a = this.execArgs(ctx), date1 = _a[0], date2 = _a[1]; + if (date1 != null && date2 != null) { + // date1 is the birthdate, convert it to date if date2 is a date (to support ignoring time) + if (date2.isDate && date1.isDateTime) { + date1 = date1.getDate(); + } + var result = date1.durationBetween(date2, this.precision.toLowerCase()); + if (result != null && result.isPoint()) { + return result.low; + } + else { + return result; + } + } + return null; + }; + return CalculateAgeAt; +}(expression_1.Expression)); +exports.CalculateAgeAt = CalculateAgeAt; - if (typeof arg === 'string') { - var integer = parseInt(arg.toString()); +},{"../datatypes/datatypes":6,"./builder":16,"./expression":22}],18:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.GreaterOrEqual = exports.Greater = exports.LessOrEqual = exports.Less = void 0; +var expression_1 = require("./expression"); +var datatypes_1 = require("../datatypes/datatypes"); +// Equal is completely handled by overloaded#Equal +// NotEqual is completely handled by overloaded#Equal +var Less = /** @class */ (function (_super) { + __extends(Less, _super); + function Less(json) { + return _super.call(this, json) || this; + } + Less.prototype.exec = function (ctx) { + var args = this.execArgs(ctx).map(function (x) { return datatypes_1.Uncertainty.from(x); }); + if (args[0] == null || args[1] == null) { + return null; + } + return args[0].lessThan(args[1]); + }; + return Less; +}(expression_1.Expression)); +exports.Less = Less; +var LessOrEqual = /** @class */ (function (_super) { + __extends(LessOrEqual, _super); + function LessOrEqual(json) { + return _super.call(this, json) || this; + } + LessOrEqual.prototype.exec = function (ctx) { + var args = this.execArgs(ctx).map(function (x) { return datatypes_1.Uncertainty.from(x); }); + if (args[0] == null || args[1] == null) { + return null; + } + return args[0].lessThanOrEquals(args[1]); + }; + return LessOrEqual; +}(expression_1.Expression)); +exports.LessOrEqual = LessOrEqual; +var Greater = /** @class */ (function (_super) { + __extends(Greater, _super); + function Greater(json) { + return _super.call(this, json) || this; + } + Greater.prototype.exec = function (ctx) { + var args = this.execArgs(ctx).map(function (x) { return datatypes_1.Uncertainty.from(x); }); + if (args[0] == null || args[1] == null) { + return null; + } + return args[0].greaterThan(args[1]); + }; + return Greater; +}(expression_1.Expression)); +exports.Greater = Greater; +var GreaterOrEqual = /** @class */ (function (_super) { + __extends(GreaterOrEqual, _super); + function GreaterOrEqual(json) { + return _super.call(this, json) || this; + } + GreaterOrEqual.prototype.exec = function (ctx) { + var args = this.execArgs(ctx).map(function (x) { return datatypes_1.Uncertainty.from(x); }); + if (args[0] == null || args[1] == null) { + return null; + } + return args[0].greaterThanOrEquals(args[1]); + }; + return GreaterOrEqual; +}(expression_1.Expression)); +exports.GreaterOrEqual = GreaterOrEqual; - if (isValidInteger(integer)) { - return integer; +},{"../datatypes/datatypes":6,"./expression":22}],19:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Case = exports.CaseItem = exports.If = void 0; +var expression_1 = require("./expression"); +var builder_1 = require("./builder"); +var comparison_1 = require("../util/comparison"); +// TODO: Spec lists "Conditional", but it's "If" in the XSD +var If = /** @class */ (function (_super) { + __extends(If, _super); + function If(json) { + var _this = _super.call(this, json) || this; + _this.condition = (0, builder_1.build)(json.condition); + _this.th = (0, builder_1.build)(json.then); + _this.els = (0, builder_1.build)(json.else); + return _this; + } + If.prototype.exec = function (ctx) { + if (this.condition.execute(ctx)) { + return this.th.execute(ctx); } - } else if (typeof arg === 'boolean') { - return arg ? 1 : 0; - } + else { + return this.els.execute(ctx); + } + }; + return If; +}(expression_1.Expression)); +exports.If = If; +var CaseItem = /** @class */ (function () { + function CaseItem(json) { + this.when = (0, builder_1.build)(json.when); + this.then = (0, builder_1.build)(json.then); + } + return CaseItem; +}()); +exports.CaseItem = CaseItem; +var Case = /** @class */ (function (_super) { + __extends(Case, _super); + function Case(json) { + var _this = _super.call(this, json) || this; + _this.comparand = (0, builder_1.build)(json.comparand); + _this.caseItems = json.caseItem.map(function (ci) { return new CaseItem(ci); }); + _this.els = (0, builder_1.build)(json.else); + return _this; + } + Case.prototype.exec = function (ctx) { + if (this.comparand) { + return this.exec_selected(ctx); + } + else { + return this.exec_standard(ctx); + } + }; + Case.prototype.exec_selected = function (ctx) { + var val = this.comparand.execute(ctx); + for (var _i = 0, _a = this.caseItems; _i < _a.length; _i++) { + var ci = _a[_i]; + if ((0, comparison_1.equals)(ci.when.execute(ctx), val)) { + return ci.then.execute(ctx); + } + } + return this.els.execute(ctx); + }; + Case.prototype.exec_standard = function (ctx) { + for (var _i = 0, _a = this.caseItems; _i < _a.length; _i++) { + var ci = _a[_i]; + if (ci.when.execute(ctx)) { + return ci.then.execute(ctx); + } + } + return this.els.execute(ctx); + }; + return Case; +}(expression_1.Expression)); +exports.Case = Case; - return null; +},{"../util/comparison":52,"./builder":16,"./expression":22}],20:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } } - }]); - - return ToInteger; -}(Expression); - -var ToQuantity = /*#__PURE__*/function (_Expression8) { - _inherits(ToQuantity, _Expression8); - - var _super8 = _createSuper(ToQuantity); - - function ToQuantity(json) { - _classCallCheck(this, ToQuantity); + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DurationBetween = exports.DifferenceBetween = exports.doBefore = exports.doAfter = exports.TimezoneOffsetFrom = exports.TimeFrom = exports.DateFrom = exports.DateTimeComponentFrom = exports.TimeOfDay = exports.Now = exports.Today = exports.Time = exports.Date = exports.DateTime = void 0; +/* eslint-disable @typescript-eslint/ban-ts-comment */ +var expression_1 = require("./expression"); +var builder_1 = require("./builder"); +var literal_1 = require("./literal"); +var DT = __importStar(require("../datatypes/datatypes")); +var DateTime = /** @class */ (function (_super) { + __extends(DateTime, _super); + function DateTime(json) { + var _this = _super.call(this, json) || this; + _this.json = json; + return _this; + } + DateTime.prototype.exec = function (ctx) { + var _a; + var _this = this; + for (var _i = 0, _b = DateTime.PROPERTIES; _i < _b.length; _i++) { + var property = _b[_i]; + // if json does not contain 'timezoneOffset' set it to the executionDateTime from the context + if (this.json[property] != null) { + // @ts-ignore + this[property] = (0, builder_1.build)(this.json[property]); + } + else if (property === 'timezoneOffset' && ctx.getTimezoneOffset() != null) { + // @ts-ignore + this[property] = literal_1.Literal.from({ + type: 'Literal', + value: ctx.getTimezoneOffset(), + valueType: '{urn:hl7-org:elm-types:r1}Integer' + }); + } + } + // @ts-ignore + var args = DateTime.PROPERTIES.map(function (p) { return (_this[p] != null ? _this[p].execute(ctx) : undefined); }); + return new ((_a = DT.DateTime).bind.apply(_a, __spreadArray([void 0], args, false)))(); + }; + DateTime.PROPERTIES = [ + 'year', + 'month', + 'day', + 'hour', + 'minute', + 'second', + 'millisecond', + 'timezoneOffset' + ]; + return DateTime; +}(expression_1.Expression)); +exports.DateTime = DateTime; +var Date = /** @class */ (function (_super) { + __extends(Date, _super); + function Date(json) { + var _this = _super.call(this, json) || this; + _this.json = json; + return _this; + } + Date.prototype.exec = function (ctx) { + var _a; + var _this = this; + for (var _i = 0, _b = Date.PROPERTIES; _i < _b.length; _i++) { + var property = _b[_i]; + if (this.json[property] != null) { + // @ts-ignore + this[property] = (0, builder_1.build)(this.json[property]); + } + } + // @ts-ignore + var args = Date.PROPERTIES.map(function (p) { return (_this[p] != null ? _this[p].execute(ctx) : undefined); }); + return new ((_a = DT.Date).bind.apply(_a, __spreadArray([void 0], args, false)))(); + }; + Date.PROPERTIES = ['year', 'month', 'day']; + return Date; +}(expression_1.Expression)); +exports.Date = Date; +var Time = /** @class */ (function (_super) { + __extends(Time, _super); + function Time(json) { + var _this = _super.call(this, json) || this; + for (var _i = 0, _a = Time.PROPERTIES; _i < _a.length; _i++) { + var property = _a[_i]; + if (json[property] != null) { + // @ts-ignore + _this[property] = (0, builder_1.build)(json[property]); + } + } + return _this; + } + Time.prototype.exec = function (ctx) { + var _a; + var _this = this; + // @ts-ignore + var args = Time.PROPERTIES.map(function (p) { return (_this[p] != null ? _this[p].execute(ctx) : undefined); }); + return new ((_a = DT.DateTime).bind.apply(_a, __spreadArray([void 0, 0, 1, 1], args, false)))().getTime(); + }; + Time.PROPERTIES = ['hour', 'minute', 'second', 'millisecond']; + return Time; +}(expression_1.Expression)); +exports.Time = Time; +var Today = /** @class */ (function (_super) { + __extends(Today, _super); + function Today(json) { + return _super.call(this, json) || this; + } + Today.prototype.exec = function (ctx) { + return ctx.getExecutionDateTime().getDate(); + }; + return Today; +}(expression_1.Expression)); +exports.Today = Today; +var Now = /** @class */ (function (_super) { + __extends(Now, _super); + function Now(json) { + return _super.call(this, json) || this; + } + Now.prototype.exec = function (ctx) { + return ctx.getExecutionDateTime(); + }; + return Now; +}(expression_1.Expression)); +exports.Now = Now; +var TimeOfDay = /** @class */ (function (_super) { + __extends(TimeOfDay, _super); + function TimeOfDay(json) { + return _super.call(this, json) || this; + } + TimeOfDay.prototype.exec = function (ctx) { + return ctx.getExecutionDateTime().getTime(); + }; + return TimeOfDay; +}(expression_1.Expression)); +exports.TimeOfDay = TimeOfDay; +var DateTimeComponentFrom = /** @class */ (function (_super) { + __extends(DateTimeComponentFrom, _super); + function DateTimeComponentFrom(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision; + return _this; + } + DateTimeComponentFrom.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + return arg[this.precision.toLowerCase()]; + } + else { + return null; + } + }; + return DateTimeComponentFrom; +}(expression_1.Expression)); +exports.DateTimeComponentFrom = DateTimeComponentFrom; +var DateFrom = /** @class */ (function (_super) { + __extends(DateFrom, _super); + function DateFrom(json) { + return _super.call(this, json) || this; + } + DateFrom.prototype.exec = function (ctx) { + var date = this.execArgs(ctx); + if (date != null) { + return date.getDate(); + } + else { + return null; + } + }; + return DateFrom; +}(expression_1.Expression)); +exports.DateFrom = DateFrom; +var TimeFrom = /** @class */ (function (_super) { + __extends(TimeFrom, _super); + function TimeFrom(json) { + return _super.call(this, json) || this; + } + TimeFrom.prototype.exec = function (ctx) { + var date = this.execArgs(ctx); + if (date != null) { + return date.getTime(); + } + else { + return null; + } + }; + return TimeFrom; +}(expression_1.Expression)); +exports.TimeFrom = TimeFrom; +var TimezoneOffsetFrom = /** @class */ (function (_super) { + __extends(TimezoneOffsetFrom, _super); + function TimezoneOffsetFrom(json) { + return _super.call(this, json) || this; + } + TimezoneOffsetFrom.prototype.exec = function (ctx) { + var date = this.execArgs(ctx); + if (date != null) { + return date.timezoneOffset; + } + else { + return null; + } + }; + return TimezoneOffsetFrom; +}(expression_1.Expression)); +exports.TimezoneOffsetFrom = TimezoneOffsetFrom; +// Delegated to by overloaded#After +function doAfter(a, b, precision) { + return a.after(b, precision); +} +exports.doAfter = doAfter; +// Delegated to by overloaded#Before +function doBefore(a, b, precision) { + return a.before(b, precision); +} +exports.doBefore = doBefore; +var DifferenceBetween = /** @class */ (function (_super) { + __extends(DifferenceBetween, _super); + function DifferenceBetween(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision; + return _this; + } + DifferenceBetween.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + // Check to make sure args exist and that they have differenceBetween functions so that they can be compared to one another + if (args[0] == null || + args[1] == null || + typeof args[0].differenceBetween !== 'function' || + typeof args[1].differenceBetween !== 'function') { + return null; + } + var result = args[0].differenceBetween(args[1], this.precision != null ? this.precision.toLowerCase() : undefined); + if (result != null && result.isPoint()) { + return result.low; + } + else { + return result; + } + }; + return DifferenceBetween; +}(expression_1.Expression)); +exports.DifferenceBetween = DifferenceBetween; +var DurationBetween = /** @class */ (function (_super) { + __extends(DurationBetween, _super); + function DurationBetween(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision; + return _this; + } + DurationBetween.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + // Check to make sure args exist and that they have durationBetween functions so that they can be compared to one another + if (args[0] == null || + args[1] == null || + typeof args[0].durationBetween !== 'function' || + typeof args[1].durationBetween !== 'function') { + return null; + } + var result = args[0].durationBetween(args[1], this.precision != null ? this.precision.toLowerCase() : undefined); + if (result != null && result.isPoint()) { + return result.low; + } + else { + return result; + } + }; + return DurationBetween; +}(expression_1.Expression)); +exports.DurationBetween = DurationBetween; - return _super8.call(this, json); - } +},{"../datatypes/datatypes":6,"./builder":16,"./expression":22,"./literal":29}],21:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VersionedIdentifier = exports.IncludeDef = exports.UsingDef = void 0; +var expression_1 = require("./expression"); +var UsingDef = /** @class */ (function (_super) { + __extends(UsingDef, _super); + function UsingDef() { + return _super !== null && _super.apply(this, arguments) || this; + } + return UsingDef; +}(expression_1.UnimplementedExpression)); +exports.UsingDef = UsingDef; +var IncludeDef = /** @class */ (function (_super) { + __extends(IncludeDef, _super); + function IncludeDef() { + return _super !== null && _super.apply(this, arguments) || this; + } + return IncludeDef; +}(expression_1.UnimplementedExpression)); +exports.IncludeDef = IncludeDef; +var VersionedIdentifier = /** @class */ (function (_super) { + __extends(VersionedIdentifier, _super); + function VersionedIdentifier() { + return _super !== null && _super.apply(this, arguments) || this; + } + return VersionedIdentifier; +}(expression_1.UnimplementedExpression)); +exports.VersionedIdentifier = VersionedIdentifier; - _createClass(ToQuantity, [{ - key: "exec", - value: function exec(ctx) { - return this.convertValue(this.execArgs(ctx)); - } - }, { - key: "convertValue", - value: function convertValue(val) { - if (val == null) { - return null; - } else if (typeof val === 'number') { - return new Quantity(val, '1'); - } else if (val.isRatio) { - // numerator and denominator are guaranteed non-null - return val.numerator.dividedBy(val.denominator); - } else if (val.isUncertainty) { - return new Uncertainty(this.convertValue(val.low), this.convertValue(val.high)); - } else { - // it's a string or something else we'll try to parse as a string - return parseQuantity(val.toString()); - } +},{"./expression":22}],22:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UnimplementedExpression = exports.Expression = void 0; +var util_1 = require("../util/util"); +var builder_1 = require("./builder"); +var Expression = /** @class */ (function () { + function Expression(json) { + if (json.operand != null) { + var op = (0, builder_1.build)(json.operand); + if ((0, util_1.typeIsArray)(json.operand)) { + this.args = op; + } + else { + this.arg = op; + } + } + if (json.localId != null) { + this.localId = json.localId; + } } - }]); - - return ToQuantity; -}(Expression); - -var ToRatio = /*#__PURE__*/function (_Expression9) { - _inherits(ToRatio, _Expression9); - - var _super9 = _createSuper(ToRatio); - - function ToRatio(json) { - _classCallCheck(this, ToRatio); - - return _super9.call(this, json); - } - - _createClass(ToRatio, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - // Argument will be of form ':' - var denominator, numerator; - - try { - // String will be split into an array. Numerator will be at index 1, Denominator will be at index 4 - var splitRatioString = arg.toString().match(/^(\d+(\.\d+)?\s*('.+')?)\s*:\s*(\d+(\.\d+)?\s*('.+')?)$/); - - if (splitRatioString == null) { + Expression.prototype.execute = function (ctx) { + if (this.localId != null) { + // Store the localId and result on the root context of this library + var execValue = this.exec(ctx); + ctx.rootContext().setLocalIdWithResult(this.localId, execValue); + return execValue; + } + else { + return this.exec(ctx); + } + }; + Expression.prototype.exec = function (_ctx) { + return this; + }; + Expression.prototype.execArgs = function (ctx) { + if (this.args != null) { + return this.args.map(function (arg) { return arg.execute(ctx); }); + } + else if (this.arg != null) { + return this.arg.execute(ctx); + } + else { return null; - } + } + }; + return Expression; +}()); +exports.Expression = Expression; +var UnimplementedExpression = /** @class */ (function (_super) { + __extends(UnimplementedExpression, _super); + function UnimplementedExpression(json) { + var _this = _super.call(this, json) || this; + _this.json = json; + return _this; + } + UnimplementedExpression.prototype.exec = function (_ctx) { + throw new Error("Unimplemented Expression: ".concat(this.json.type)); + }; + return UnimplementedExpression; +}(Expression)); +exports.UnimplementedExpression = UnimplementedExpression; - numerator = parseQuantity(splitRatioString[1]); - denominator = parseQuantity(splitRatioString[4]); - } catch (error) { - // If the input string is not formatted correctly, or cannot be - // interpreted as a valid Quantity value, the result is null. - return null; - } // The value element of a Quantity must be present. +},{"../util/util":55,"./builder":16}],23:[function(require,module,exports){ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.doContains = exports.doExcept = exports.doIncludes = exports.doIntersect = exports.doProperIncludes = exports.doAfter = exports.doUnion = exports.doBefore = void 0; +__exportStar(require("./expression"), exports); +__exportStar(require("./aggregate"), exports); +__exportStar(require("./arithmetic"), exports); +__exportStar(require("./clinical"), exports); +__exportStar(require("./comparison"), exports); +__exportStar(require("./conditional"), exports); +__exportStar(require("./datetime"), exports); +__exportStar(require("./declaration"), exports); +__exportStar(require("./external"), exports); +__exportStar(require("./instance"), exports); +__exportStar(require("./interval"), exports); +__exportStar(require("./list"), exports); +__exportStar(require("./literal"), exports); +__exportStar(require("./logical"), exports); +__exportStar(require("./message"), exports); +__exportStar(require("./nullological"), exports); +__exportStar(require("./parameters"), exports); +__exportStar(require("./quantity"), exports); +__exportStar(require("./query"), exports); +__exportStar(require("./ratio"), exports); +__exportStar(require("./reusable"), exports); +__exportStar(require("./string"), exports); +__exportStar(require("./structured"), exports); +__exportStar(require("./type"), exports); +__exportStar(require("./overloaded"), exports); +// Re-exporting interval functions as overrides to avoid ambiguity +// https://stackoverflow.com/questions/41293108/how-to-do-re-export-with-overrides +// TODO: we should improve this by perhaps renaming and reworking these functions +// it's a bit confusing right now giving the interval exports precedence over the others +var interval_1 = require("./interval"); +Object.defineProperty(exports, "doBefore", { enumerable: true, get: function () { return interval_1.doBefore; } }); +Object.defineProperty(exports, "doUnion", { enumerable: true, get: function () { return interval_1.doUnion; } }); +Object.defineProperty(exports, "doAfter", { enumerable: true, get: function () { return interval_1.doAfter; } }); +Object.defineProperty(exports, "doProperIncludes", { enumerable: true, get: function () { return interval_1.doProperIncludes; } }); +Object.defineProperty(exports, "doIntersect", { enumerable: true, get: function () { return interval_1.doIntersect; } }); +Object.defineProperty(exports, "doIncludes", { enumerable: true, get: function () { return interval_1.doIncludes; } }); +Object.defineProperty(exports, "doExcept", { enumerable: true, get: function () { return interval_1.doExcept; } }); +Object.defineProperty(exports, "doContains", { enumerable: true, get: function () { return interval_1.doContains; } }); +},{"./aggregate":14,"./arithmetic":15,"./clinical":17,"./comparison":18,"./conditional":19,"./datetime":20,"./declaration":21,"./expression":22,"./external":24,"./instance":25,"./interval":26,"./list":28,"./literal":29,"./logical":30,"./message":31,"./nullological":32,"./overloaded":33,"./parameters":34,"./quantity":35,"./query":36,"./ratio":37,"./reusable":38,"./string":39,"./structured":40,"./type":41}],24:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Retrieve = void 0; +var expression_1 = require("./expression"); +var util_1 = require("../util/util"); +var builder_1 = require("./builder"); +var Retrieve = /** @class */ (function (_super) { + __extends(Retrieve, _super); + function Retrieve(json) { + var _this = _super.call(this, json) || this; + _this.datatype = json.dataType; + _this.templateId = json.templateId; + _this.codeProperty = json.codeProperty; + _this.codes = (0, builder_1.build)(json.codes); + _this.dateProperty = json.dateProperty; + _this.dateRange = (0, builder_1.build)(json.dateRange); + return _this; + } + Retrieve.prototype.exec = function (ctx) { + var _a; + var _this = this; + var records = ctx.findRecords(this.templateId != null ? this.templateId : this.datatype); + var codes = this.codes; + if (this.codes && typeof this.codes.exec === 'function') { + codes = this.codes.execute(ctx); + if (codes == null) { + return []; + } + } + if (codes) { + records = records.filter(function (r) { return _this.recordMatchesCodesOrVS(r, codes); }); + } + // TODO: Added @dateProperty check due to previous fix in cql4browsers in cql_qdm_patient_api hash: ddbc57 + if (this.dateRange && this.dateProperty) { + var range_1 = this.dateRange.execute(ctx); + records = records.filter(function (r) { return range_1.includes(r.getDateOrInterval(_this.dateProperty)); }); + } + if (Array.isArray(records)) { + (_a = ctx.evaluatedRecords).push.apply(_a, records); + } + else { + ctx.evaluatedRecords.push(records); + } + return records; + }; + Retrieve.prototype.recordMatchesCodesOrVS = function (record, codes) { + var _this = this; + if ((0, util_1.typeIsArray)(codes)) { + return codes.some(function (c) { return c.hasMatch(record.getCode(_this.codeProperty)); }); + } + else { + return codes.hasMatch(record.getCode(this.codeProperty)); + } + }; + return Retrieve; +}(expression_1.Expression)); +exports.Retrieve = Retrieve; - if (numerator == null || denominator == null) { - return null; +},{"../util/util":55,"./builder":16,"./expression":22}],25:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Instance = void 0; +var expression_1 = require("./expression"); +var quantity_1 = require("../datatypes/quantity"); +var datatypes_1 = require("../datatypes/datatypes"); +var builder_1 = require("./builder"); +var Element = /** @class */ (function () { + function Element(json) { + this.name = json.name; + this.value = (0, builder_1.build)(json.value); + } + Element.prototype.exec = function (ctx) { + return this.value != null ? this.value.execute(ctx) : undefined; + }; + return Element; +}()); +var Instance = /** @class */ (function (_super) { + __extends(Instance, _super); + function Instance(json) { + var _this = _super.call(this, json) || this; + _this.classType = json.classType; + _this.element = json.element.map(function (child) { return new Element(child); }); + return _this; + } + Instance.prototype.exec = function (ctx) { + var obj = {}; + for (var _i = 0, _a = this.element; _i < _a.length; _i++) { + var el = _a[_i]; + obj[el.name] = el.exec(ctx); + } + switch (this.classType) { + case '{urn:hl7-org:elm-types:r1}Quantity': + return new quantity_1.Quantity(obj.value, obj.unit); + case '{urn:hl7-org:elm-types:r1}Code': + return new datatypes_1.Code(obj.code, obj.system, obj.version, obj.display); + case '{urn:hl7-org:elm-types:r1}Concept': + return new datatypes_1.Concept(obj.codes, obj.display); + default: + return obj; } + }; + return Instance; +}(expression_1.Expression)); +exports.Instance = Instance; - return new Ratio(numerator, denominator); - } else { +},{"../datatypes/datatypes":6,"../datatypes/quantity":11,"./builder":16,"./expression":22}],26:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Collapse = exports.Expand = exports.Ends = exports.Starts = exports.End = exports.Start = exports.Size = exports.Width = exports.doIntersect = exports.doExcept = exports.doUnion = exports.OverlapsBefore = exports.OverlapsAfter = exports.Overlaps = exports.MeetsBefore = exports.MeetsAfter = exports.Meets = exports.doBefore = exports.doAfter = exports.doProperIncludes = exports.doIncludes = exports.doContains = exports.Interval = void 0; +var expression_1 = require("./expression"); +var quantity_1 = require("../datatypes/quantity"); +var math_1 = require("../util/math"); +var units_1 = require("../util/units"); +var dtivl = __importStar(require("../datatypes/interval")); +var builder_1 = require("./builder"); +var Interval = /** @class */ (function (_super) { + __extends(Interval, _super); + function Interval(json) { + var _this = _super.call(this, json) || this; + _this.lowClosed = json.lowClosed; + _this.lowClosedExpression = (0, builder_1.build)(json.lowClosedExpression); + _this.highClosed = json.highClosed; + _this.highClosedExpression = (0, builder_1.build)(json.highClosedExpression); + _this.low = (0, builder_1.build)(json.low); + _this.high = (0, builder_1.build)(json.high); + return _this; + } + Object.defineProperty(Interval.prototype, "isInterval", { + // Define a simple getter to allow type-checking of this class without instanceof + // and in a way that survives minification (as opposed to checking constructor.name) + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Interval.prototype.exec = function (ctx) { + var lowValue = this.low.execute(ctx); + var highValue = this.high.execute(ctx); + var lowClosed = this.lowClosed != null + ? this.lowClosed + : this.lowClosedExpression && this.lowClosedExpression.execute(ctx); + var highClosed = this.highClosed != null + ? this.highClosed + : this.highClosedExpression && this.highClosedExpression.execute(ctx); + var defaultPointType; + if (lowValue == null && highValue == null) { + // try to get the default point type from a cast + if (this.low.asTypeSpecifier && this.low.asTypeSpecifier.type === 'NamedTypeSpecifier') { + defaultPointType = this.low.asTypeSpecifier.name; + } + else if (this.high.asTypeSpecifier && + this.high.asTypeSpecifier.type === 'NamedTypeSpecifier') { + defaultPointType = this.high.asTypeSpecifier.name; + } + } + return new dtivl.Interval(lowValue, highValue, lowClosed, highClosed, defaultPointType); + }; + return Interval; +}(expression_1.Expression)); +exports.Interval = Interval; +// Equal is completely handled by overloaded#Equal +// NotEqual is completely handled by overloaded#Equal +// Delegated to by overloaded#Contains and overloaded#In +function doContains(interval, item, precision) { + return interval.contains(item, precision); +} +exports.doContains = doContains; +// Delegated to by overloaded#Includes and overloaded#IncludedIn +function doIncludes(interval, subinterval, precision) { + return interval.includes(subinterval, precision); +} +exports.doIncludes = doIncludes; +// Delegated to by overloaded#ProperIncludes and overloaded@ProperIncludedIn +function doProperIncludes(interval, subinterval, precision) { + return interval.properlyIncludes(subinterval, precision); +} +exports.doProperIncludes = doProperIncludes; +// Delegated to by overloaded#After +function doAfter(a, b, precision) { + return a.after(b, precision); +} +exports.doAfter = doAfter; +// Delegated to by overloaded#Before +function doBefore(a, b, precision) { + return a.before(b, precision); +} +exports.doBefore = doBefore; +var Meets = /** @class */ (function (_super) { + __extends(Meets, _super); + function Meets(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + Meets.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a != null && b != null) { + return a.meets(b, this.precision); + } + else { + return null; + } + }; + return Meets; +}(expression_1.Expression)); +exports.Meets = Meets; +var MeetsAfter = /** @class */ (function (_super) { + __extends(MeetsAfter, _super); + function MeetsAfter(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + MeetsAfter.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a != null && b != null) { + return a.meetsAfter(b, this.precision); + } + else { + return null; + } + }; + return MeetsAfter; +}(expression_1.Expression)); +exports.MeetsAfter = MeetsAfter; +var MeetsBefore = /** @class */ (function (_super) { + __extends(MeetsBefore, _super); + function MeetsBefore(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + MeetsBefore.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a != null && b != null) { + return a.meetsBefore(b, this.precision); + } + else { + return null; + } + }; + return MeetsBefore; +}(expression_1.Expression)); +exports.MeetsBefore = MeetsBefore; +var Overlaps = /** @class */ (function (_super) { + __extends(Overlaps, _super); + function Overlaps(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + Overlaps.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a != null && b != null) { + return a.overlaps(b, this.precision); + } + else { + return null; + } + }; + return Overlaps; +}(expression_1.Expression)); +exports.Overlaps = Overlaps; +var OverlapsAfter = /** @class */ (function (_super) { + __extends(OverlapsAfter, _super); + function OverlapsAfter(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + OverlapsAfter.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a != null && b != null) { + return a.overlapsAfter(b, this.precision); + } + else { + return null; + } + }; + return OverlapsAfter; +}(expression_1.Expression)); +exports.OverlapsAfter = OverlapsAfter; +var OverlapsBefore = /** @class */ (function (_super) { + __extends(OverlapsBefore, _super); + function OverlapsBefore(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + OverlapsBefore.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a != null && b != null) { + return a.overlapsBefore(b, this.precision); + } + else { + return null; + } + }; + return OverlapsBefore; +}(expression_1.Expression)); +exports.OverlapsBefore = OverlapsBefore; +// Delegated to by overloaded#Union +function doUnion(a, b) { + return a.union(b); +} +exports.doUnion = doUnion; +// Delegated to by overloaded#Except +function doExcept(a, b) { + if (a != null && b != null) { + return a.except(b); + } + else { return null; - } } - }]); - - return ToRatio; -}(Expression); - -var ToString = /*#__PURE__*/function (_Expression10) { - _inherits(ToString, _Expression10); - - var _super10 = _createSuper(ToString); - - function ToString(json) { - _classCallCheck(this, ToString); - - return _super10.call(this, json); - } - - _createClass(ToString, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - return arg.toString(); - } else { +} +exports.doExcept = doExcept; +// Delegated to by overloaded#Intersect +function doIntersect(a, b) { + if (a != null && b != null) { + return a.intersect(b); + } + else { return null; - } } - }]); - - return ToString; -}(Expression); - -var ToTime = /*#__PURE__*/function (_Expression11) { - _inherits(ToTime, _Expression11); - - var _super11 = _createSuper(ToTime); - - function ToTime(json) { - _classCallCheck(this, ToTime); - - return _super11.call(this, json); - } - - _createClass(ToTime, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg != null) { - var timeString = arg.toString(); // Return null if string doesn't represent a valid ISO-8601 Time - // hh:mm:ss.fff or hh:mm:ss.fff - - var matches = /^T?((\d{2})(:(\d{2})(:(\d{2})(\.(\d+))?)?)?)?(Z|(([+-])(\d{2})(:?(\d{2}))?))?$/.exec(timeString); - - if (matches == null) { - return null; +} +exports.doIntersect = doIntersect; +var Width = /** @class */ (function (_super) { + __extends(Width, _super); + function Width(json) { + return _super.call(this, json) || this; + } + Width.prototype.exec = function (ctx) { + var interval = this.arg.execute(ctx); + if (interval == null) { + return null; } - - var hours = matches[2]; - var minutes = matches[4]; - var seconds = matches[6]; // Validate h/m/s if they exist, but allow null - - if (hours != null) { - if (hours < 0 || hours > 23) { + return interval.width(); + }; + return Width; +}(expression_1.Expression)); +exports.Width = Width; +var Size = /** @class */ (function (_super) { + __extends(Size, _super); + function Size(json) { + return _super.call(this, json) || this; + } + Size.prototype.exec = function (ctx) { + var interval = this.arg.execute(ctx); + if (interval == null) { + return null; + } + return interval.size(); + }; + return Size; +}(expression_1.Expression)); +exports.Size = Size; +var Start = /** @class */ (function (_super) { + __extends(Start, _super); + function Start(json) { + return _super.call(this, json) || this; + } + Start.prototype.exec = function (ctx) { + var interval = this.arg.execute(ctx); + if (interval == null) { + return null; + } + var start = interval.start(); + // fix the timezoneOffset of minimum Datetime to match context offset + if (start && start.isDateTime && start.equals(math_1.MIN_DATETIME_VALUE)) { + start.timezoneOffset = ctx.getTimezoneOffset(); + } + return start; + }; + return Start; +}(expression_1.Expression)); +exports.Start = Start; +var End = /** @class */ (function (_super) { + __extends(End, _super); + function End(json) { + return _super.call(this, json) || this; + } + End.prototype.exec = function (ctx) { + var interval = this.arg.execute(ctx); + if (interval == null) { + return null; + } + var end = interval.end(); + // fix the timezoneOffset of maximum Datetime to match context offset + if (end && end.isDateTime && end.equals(math_1.MAX_DATETIME_VALUE)) { + end.timezoneOffset = ctx.getTimezoneOffset(); + } + return end; + }; + return End; +}(expression_1.Expression)); +exports.End = End; +var Starts = /** @class */ (function (_super) { + __extends(Starts, _super); + function Starts(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + Starts.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a != null && b != null) { + return a.starts(b, this.precision); + } + else { + return null; + } + }; + return Starts; +}(expression_1.Expression)); +exports.Starts = Starts; +var Ends = /** @class */ (function (_super) { + __extends(Ends, _super); + function Ends(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + Ends.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a != null && b != null) { + return a.ends(b, this.precision); + } + else { + return null; + } + }; + return Ends; +}(expression_1.Expression)); +exports.Ends = Ends; +function intervalListType(intervals) { + // Returns one of null, 'time', 'date', 'datetime', 'quantity', 'integer', 'decimal' or 'mismatch' + var type = null; + for (var _i = 0, intervals_1 = intervals; _i < intervals_1.length; _i++) { + var itvl = intervals_1[_i]; + if (itvl == null) { + continue; + } + if (itvl.low == null && itvl.high == null) { + //can't really determine type from this + continue; + } + // if one end is null (but not both), the type can be determined from the other end + var low = itvl.low != null ? itvl.low : itvl.high; + var high = itvl.high != null ? itvl.high : itvl.low; + if (low.isTime && low.isTime() && high.isTime && high.isTime()) { + if (type == null) { + type = 'time'; + } + else if (type === 'time') { + continue; + } + else { + return 'mismatch'; + } + // if an interval mixes date and datetime, type is datetime (for implicit conversion) + } + else if ((low.isDateTime || high.isDateTime) && + (low.isDateTime || low.isDate) && + (high.isDateTime || high.isDate)) { + if (type == null || type === 'date') { + type = 'datetime'; + } + else if (type === 'datetime') { + continue; + } + else { + return 'mismatch'; + } + } + else if (low.isDate && high.isDate) { + if (type == null) { + type = 'date'; + } + else if (type === 'date' || type === 'datetime') { + continue; + } + else { + return 'mismatch'; + } + } + else if (low.isQuantity && high.isQuantity) { + if (type == null) { + type = 'quantity'; + } + else if (type === 'quantity') { + continue; + } + else { + return 'mismatch'; + } + } + else if (Number.isInteger(low) && Number.isInteger(high)) { + if (type == null) { + type = 'integer'; + } + else if (type === 'integer' || type === 'decimal') { + continue; + } + else { + return 'mismatch'; + } + } + else if (typeof low === 'number' && typeof high === 'number') { + if (type == null || type === 'integer') { + type = 'decimal'; + } + else if (type === 'decimal') { + continue; + } + else { + return 'mismatch'; + } + //if we are here ends are mismatched + } + else { + return 'mismatch'; + } + } + return type; +} +var Expand = /** @class */ (function (_super) { + __extends(Expand, _super); + function Expand(json) { + return _super.call(this, json) || this; + } + Expand.prototype.exec = function (ctx) { + // expand(argument List>, per Quantity) List> + var defaultPer, expandFunction; + var _a = this.execArgs(ctx), intervals = _a[0], per = _a[1]; + // CQL 1.5 introduced an overload to allow singular intervals; make it a list so we can use the same logic for either overload + if (!Array.isArray(intervals)) { + intervals = [intervals]; + } + var type = intervalListType(intervals); + if (type === 'mismatch') { + throw new Error('List of intervals contains mismatched types.'); + } + if (type == null) { + return null; + } + // this step collapses overlaps, and also returns a clone of intervals so we can feel free to mutate + intervals = collapseIntervals(intervals, per); + if (intervals.length === 0) { + return []; + } + if (['time', 'date', 'datetime'].includes(type)) { + expandFunction = this.expandDTishInterval; + defaultPer = function (interval) { return new quantity_1.Quantity(1, interval.low.getPrecision()); }; + } + else if (['quantity'].includes(type)) { + expandFunction = this.expandQuantityInterval; + defaultPer = function (interval) { return new quantity_1.Quantity(1, interval.low.unit); }; + } + else if (['integer', 'decimal'].includes(type)) { + expandFunction = this.expandNumericInterval; + defaultPer = function (_interval) { return new quantity_1.Quantity(1, '1'); }; + } + else { + throw new Error('Interval list type not yet supported.'); + } + var results = []; + for (var _i = 0, intervals_2 = intervals; _i < intervals_2.length; _i++) { + var interval = intervals_2[_i]; + if (interval == null) { + continue; + } + // We do not support open ended intervals since result would likely be too long + if (interval.low == null || interval.high == null) { + return null; + } + if (type === 'datetime') { + //support for implicitly converting dates to datetime + interval.low = interval.low.getDateTime(); + interval.high = interval.high.getDateTime(); + } + per = per != null ? per : defaultPer(interval); + var items = expandFunction.call(this, interval, per); + if (items === null) { + return null; + } + results.push.apply(results, (items || [])); + } + return results; + }; + Expand.prototype.expandDTishInterval = function (interval, per) { + per.unit = (0, units_1.convertToCQLDateUnit)(per.unit); + if (per.unit === 'week') { + per.value *= 7; + per.unit = 'day'; + } + // Precision Checks + // return null if precision not applicable (e.g. gram, or minutes for dates) + if (!interval.low.constructor.FIELDS.includes(per.unit)) { + return null; + } + // open interval with null boundaries do not contribute to output + // closed interval with null boundaries are not allowed for performance reasons + if (interval.low == null || interval.high == null) { return null; - } - - hours = parseInt(hours, 10); } - - if (minutes != null) { - if (minutes < 0 || minutes > 59) { + var low = interval.lowClosed ? interval.low : interval.low.successor(); + var high = interval.highClosed ? interval.high : interval.high.predecessor(); + if (low.after(high)) { + return []; + } + if (interval.low.isLessPrecise(per.unit) || interval.high.isLessPrecise(per.unit)) { + return []; + } + var current_low = low; + var results = []; + low = this.truncateToPrecision(low, per.unit); + high = this.truncateToPrecision(high, per.unit); + var current_high = current_low.add(per.value, per.unit).predecessor(); + var intervalToAdd = new dtivl.Interval(current_low, current_high, true, true); + while (intervalToAdd.high.sameOrBefore(high)) { + results.push(intervalToAdd); + current_low = current_low.add(per.value, per.unit); + current_high = current_low.add(per.value, per.unit).predecessor(); + intervalToAdd = new dtivl.Interval(current_low, current_high, true, true); + } + return results; + }; + Expand.prototype.truncateToPrecision = function (value, unit) { + // If interval boundaries are more precise than per quantity, truncate to + // the precision specified by the per + var shouldTruncate = false; + for (var _i = 0, _a = value.constructor.FIELDS; _i < _a.length; _i++) { + var field = _a[_i]; + if (shouldTruncate) { + value[field] = null; + } + if (field === unit) { + // Start truncating after this unit + shouldTruncate = true; + } + } + return value; + }; + Expand.prototype.expandQuantityInterval = function (interval, per) { + // we want to convert everything to the more precise of the interval.low or per + var result_units; + var res = (0, units_1.compareUnits)(interval.low.unit, per.unit); + if (res != null && res > 0) { + //interval.low.unit is 'bigger' aka les precise + result_units = per.unit; + } + else { + result_units = interval.low.unit; + } + var low_value = (0, units_1.convertUnit)(interval.low.value, interval.low.unit, result_units); + var high_value = (0, units_1.convertUnit)(interval.high.value, interval.high.unit, result_units); + var per_value = (0, units_1.convertUnit)(per.value, per.unit, result_units); + // return null if unit conversion failed, must have mismatched units + if (!(low_value != null && high_value != null && per_value != null)) { return null; - } - - minutes = parseInt(minutes, 10); } - - if (seconds != null) { - if (seconds < 0 || seconds > 59) { + var results = this.makeNumericIntervalList(low_value, high_value, interval.lowClosed, interval.highClosed, per_value); + for (var _i = 0, results_1 = results; _i < results_1.length; _i++) { + var itvl = results_1[_i]; + itvl.low = new quantity_1.Quantity(itvl.low, result_units); + itvl.high = new quantity_1.Quantity(itvl.high, result_units); + } + return results; + }; + Expand.prototype.expandNumericInterval = function (interval, per) { + if (per.unit !== '1' && per.unit !== '') { return null; - } - - seconds = parseInt(seconds, 10); } - - var milliseconds = matches[8]; - - if (milliseconds != null) { - milliseconds = parseInt(normalizeMillisecondsField(milliseconds)); - } // Time is implemented as Datetime with year 0, month 1, day 1 and null timezoneOffset - - - return new DateTime(0, 1, 1, hours, minutes, seconds, milliseconds, null); - } else { - return null; - } - } - }]); - - return ToTime; -}(Expression); - -var Convert = /*#__PURE__*/function (_Expression12) { - _inherits(Convert, _Expression12); - - var _super12 = _createSuper(Convert); - - function Convert(json) { - var _this2; - - _classCallCheck(this, Convert); - - _this2 = _super12.call(this, json); - _this2.operand = json.operand; - _this2.toType = json.toType; - return _this2; - } - - _createClass(Convert, [{ - key: "exec", - value: function exec(ctx) { - switch (this.toType) { - case '{urn:hl7-org:elm-types:r1}Boolean': - return new ToBoolean({ - type: 'ToBoolean', - operand: this.operand - }).execute(ctx); - - case '{urn:hl7-org:elm-types:r1}Concept': - return new ToConcept({ - type: 'ToConcept', - operand: this.operand - }).execute(ctx); - - case '{urn:hl7-org:elm-types:r1}Decimal': - return new ToDecimal({ - type: 'ToDecimal', - operand: this.operand - }).execute(ctx); - - case '{urn:hl7-org:elm-types:r1}Integer': - return new ToInteger({ - type: 'ToInteger', - operand: this.operand - }).execute(ctx); - - case '{urn:hl7-org:elm-types:r1}String': - return new ToString({ - type: 'ToString', - operand: this.operand - }).execute(ctx); - - case '{urn:hl7-org:elm-types:r1}Quantity': - return new ToQuantity({ - type: 'ToQuantity', - operand: this.operand - }).execute(ctx); - - case '{urn:hl7-org:elm-types:r1}DateTime': - return new ToDateTime({ - type: 'ToDateTime', - operand: this.operand - }).execute(ctx); - - case '{urn:hl7-org:elm-types:r1}Date': - return new ToDate({ - type: 'ToDate', - operand: this.operand - }).execute(ctx); - - case '{urn:hl7-org:elm-types:r1}Time': - return new ToTime({ - type: 'ToTime', - operand: this.operand - }).execute(ctx); - - default: - return this.execArgs(ctx); - } - } - }]); - - return Convert; -}(Expression); - -var ConvertsToBoolean = /*#__PURE__*/function (_Expression13) { - _inherits(ConvertsToBoolean, _Expression13); - - var _super13 = _createSuper(ConvertsToBoolean); - - function ConvertsToBoolean(json) { - var _this3; - - _classCallCheck(this, ConvertsToBoolean); - - _this3 = _super13.call(this, json); - _this3.operand = json.operand; - return _this3; - } - - _createClass(ConvertsToBoolean, [{ - key: "exec", - value: function exec(ctx) { - var operatorValue = this.execArgs(ctx); - - if (operatorValue === null) { - return null; - } else { - return canConvertToType(ToBoolean, this.operand, ctx); - } + return this.makeNumericIntervalList(interval.low, interval.high, interval.lowClosed, interval.highClosed, per.value); + }; + Expand.prototype.makeNumericIntervalList = function (low, high, lowClosed, highClosed, perValue) { + // If the per value is a Decimal (has a .), 8 decimal places are appropriate + // Integers should have 0 Decimal places + var perIsDecimal = perValue.toString().includes('.'); + var decimalPrecision = perIsDecimal ? 8 : 0; + low = lowClosed ? low : (0, math_1.successor)(low); + high = highClosed ? high : (0, math_1.predecessor)(high); + // If the interval boundaries are more precise than the per quantity, the + // more precise values will be truncated to the precision specified by the + // per quantity. + low = truncateDecimal(low, decimalPrecision); + high = truncateDecimal(high, decimalPrecision); + if (low > high) { + return []; + } + if (low == null || high == null) { + return []; + } + var perUnitSize = perIsDecimal ? 0.00000001 : 1; + if (low === high && + Number.isInteger(low) && + Number.isInteger(high) && + !Number.isInteger(perValue)) { + high = parseFloat((high + 1).toFixed(decimalPrecision)); + } + var current_low = low; + var results = []; + if (perValue > high - low + perUnitSize) { + return []; + } + var current_high = parseFloat((current_low + perValue - perUnitSize).toFixed(decimalPrecision)); + var intervalToAdd = new dtivl.Interval(current_low, current_high, true, true); + while (intervalToAdd.high <= high) { + results.push(intervalToAdd); + current_low = parseFloat((current_low + perValue).toFixed(decimalPrecision)); + current_high = parseFloat((current_low + perValue - perUnitSize).toFixed(decimalPrecision)); + intervalToAdd = new dtivl.Interval(current_low, current_high, true, true); + } + return results; + }; + return Expand; +}(expression_1.Expression)); +exports.Expand = Expand; +var Collapse = /** @class */ (function (_super) { + __extends(Collapse, _super); + function Collapse(json) { + return _super.call(this, json) || this; + } + Collapse.prototype.exec = function (ctx) { + // collapse(argument List>, per Quantity) List> + var _a = this.execArgs(ctx), intervals = _a[0], perWidth = _a[1]; + return collapseIntervals(intervals, perWidth); + }; + return Collapse; +}(expression_1.Expression)); +exports.Collapse = Collapse; +function collapseIntervals(intervals, perWidth) { + // Clone intervals so this function remains idempotent + var intervalsClone = []; + for (var _i = 0, intervals_3 = intervals; _i < intervals_3.length; _i++) { + var interval = intervals_3[_i]; + // The spec says to ignore null intervals + if (interval != null) { + intervalsClone.push(interval.copy()); + } } - }]); - - return ConvertsToBoolean; -}(Expression); - -var ConvertsToDate = /*#__PURE__*/function (_Expression14) { - _inherits(ConvertsToDate, _Expression14); - - var _super14 = _createSuper(ConvertsToDate); - - function ConvertsToDate(json) { - var _this4; - - _classCallCheck(this, ConvertsToDate); - - _this4 = _super14.call(this, json); - _this4.operand = json.operand; - return _this4; - } - - _createClass(ConvertsToDate, [{ - key: "exec", - value: function exec(ctx) { - var operatorValue = this.execArgs(ctx); - - if (operatorValue === null) { + // If the list is null, return null + if (intervals == null) { return null; - } else { - return canConvertToType(ToDate, this.operand, ctx); - } } - }]); - - return ConvertsToDate; -}(Expression); - -var ConvertsToDateTime = /*#__PURE__*/function (_Expression15) { - _inherits(ConvertsToDateTime, _Expression15); - - var _super15 = _createSuper(ConvertsToDateTime); - - function ConvertsToDateTime(json) { - var _this5; - - _classCallCheck(this, ConvertsToDateTime); - - _this5 = _super15.call(this, json); - _this5.operand = json.operand; - return _this5; - } - - _createClass(ConvertsToDateTime, [{ - key: "exec", - value: function exec(ctx) { - var operatorValue = this.execArgs(ctx); - - if (operatorValue === null) { - return null; - } else { - return canConvertToType(ToDateTime, this.operand, ctx); - } + else if (intervalsClone.length <= 1) { + return intervalsClone; } - }]); - - return ConvertsToDateTime; -}(Expression); - -var ConvertsToDecimal = /*#__PURE__*/function (_Expression16) { - _inherits(ConvertsToDecimal, _Expression16); - - var _super16 = _createSuper(ConvertsToDecimal); - - function ConvertsToDecimal(json) { - var _this6; - - _classCallCheck(this, ConvertsToDecimal); - - _this6 = _super16.call(this, json); - _this6.operand = json.operand; - return _this6; - } - - _createClass(ConvertsToDecimal, [{ - key: "exec", - value: function exec(ctx) { - var operatorValue = this.execArgs(ctx); - - if (operatorValue === null) { - return null; - } else { - return canConvertToType(ToDecimal, this.operand, ctx); - } + else { + // If the per argument is null, the default unit interval for the point type + // of the intervals involved will be used (i.e. the interval that has a + // width equal to the result of the successor function for the point type). + if (perWidth == null) { + perWidth = intervalsClone[0].getPointSize(); + } + // sort intervalsClone by start + intervalsClone.sort(function (a, b) { + if (a.low && typeof a.low.before === 'function') { + if (b.low != null && a.low.before(b.low)) { + return -1; + } + if (b.low == null || a.low.after(b.low)) { + return 1; + } + } + else if (a.low != null && b.low != null) { + if (a.low < b.low) { + return -1; + } + if (a.low > b.low) { + return 1; + } + } + else if (a.low != null && b.low == null) { + return 1; + } + else if (a.low == null && b.low != null) { + return -1; + } + // if both lows are undefined, sort by high + if (a.high && typeof a.high.before === 'function') { + if (b.high == null || a.high.before(b.high)) { + return -1; + } + if (a.high.after(b.high)) { + return 1; + } + } + else if (a.high != null && b.high != null) { + if (a.high < b.high) { + return -1; + } + if (a.high > b.high) { + return 1; + } + } + else if (a.high != null && b.high == null) { + return -1; + } + else if (a.high == null && b.high != null) { + return 1; + } + return 0; + }); + // collapse intervals as necessary + var collapsedIntervals = []; + var a = intervalsClone.shift(); + var b = intervalsClone.shift(); + while (b) { + if (b.low && typeof b.low.durationBetween === 'function') { + // handle DateTimes using durationBetween + if (a.high != null ? a.high.sameOrAfter(b.low) : undefined) { + // overlap + if (b.high == null || b.high.after(a.high)) { + a.high = b.high; + } + } + else if ((a.high != null ? a.high.durationBetween(b.low, perWidth.unit).high : undefined) <= + perWidth.value) { + a.high = b.high; + } + else { + collapsedIntervals.push(a); + a = b; + } + } + else if (b.low && typeof b.low.sameOrBefore === 'function') { + if (a.high != null && b.low.sameOrBefore((0, quantity_1.doAddition)(a.high, perWidth))) { + if (b.high == null || b.high.after(a.high)) { + a.high = b.high; + } + } + else { + collapsedIntervals.push(a); + a = b; + } + } + else { + if (b.low - a.high <= perWidth.value) { + if (b.high > a.high || b.high == null) { + a.high = b.high; + } + } + else { + collapsedIntervals.push(a); + a = b; + } + } + b = intervalsClone.shift(); + } + collapsedIntervals.push(a); + return collapsedIntervals; } - }]); - - return ConvertsToDecimal; -}(Expression); - -var ConvertsToInteger = /*#__PURE__*/function (_Expression17) { - _inherits(ConvertsToInteger, _Expression17); - - var _super17 = _createSuper(ConvertsToInteger); - - function ConvertsToInteger(json) { - var _this7; - - _classCallCheck(this, ConvertsToInteger); - - _this7 = _super17.call(this, json); - _this7.operand = json.operand; - return _this7; - } - - _createClass(ConvertsToInteger, [{ - key: "exec", - value: function exec(ctx) { - var operatorValue = this.execArgs(ctx); +} +function truncateDecimal(decimal, decimalPlaces) { + // like parseFloat().toFixed() but floor rather than round + // Needed for when per precision is less than the interval input precision + var re = new RegExp('^-?\\d+(?:.\\d{0,' + (decimalPlaces || -1) + '})?'); + return parseFloat(decimal.toString().match(re)[0]); +} - if (operatorValue === null) { - return null; - } else { - return canConvertToType(ToInteger, this.operand, ctx); - } +},{"../datatypes/interval":9,"../datatypes/quantity":11,"../util/math":53,"../util/units":54,"./builder":16,"./expression":22}],27:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Library = void 0; +var expressions_1 = require("./expressions"); +var Library = /** @class */ (function () { + function Library(json, libraryManager) { + this.source = json; + // usings + var usingDefs = (json.library.usings && json.library.usings.def) || []; + this.usings = usingDefs + .filter(function (u) { return u.localIdentifier !== 'System'; }) + .map(function (u) { + return { name: u.localIdentifier, version: u.version }; + }); + // parameters + var paramDefs = (json.library.parameters && json.library.parameters.def) || []; + this.parameters = {}; + for (var _i = 0, paramDefs_1 = paramDefs; _i < paramDefs_1.length; _i++) { + var param = paramDefs_1[_i]; + this.parameters[param.name] = new expressions_1.ParameterDef(param); + } + // code systems + var csDefs = (json.library.codeSystems && json.library.codeSystems.def) || []; + this.codesystems = {}; + for (var _a = 0, csDefs_1 = csDefs; _a < csDefs_1.length; _a++) { + var codesystem = csDefs_1[_a]; + this.codesystems[codesystem.name] = new expressions_1.CodeSystemDef(codesystem); + } + // value sets + var vsDefs = (json.library.valueSets && json.library.valueSets.def) || []; + this.valuesets = {}; + for (var _b = 0, vsDefs_1 = vsDefs; _b < vsDefs_1.length; _b++) { + var valueset = vsDefs_1[_b]; + this.valuesets[valueset.name] = new expressions_1.ValueSetDef(valueset); + } + // codes + var codeDefs = (json.library.codes && json.library.codes.def) || []; + this.codes = {}; + for (var _c = 0, codeDefs_1 = codeDefs; _c < codeDefs_1.length; _c++) { + var code = codeDefs_1[_c]; + this.codes[code.name] = new expressions_1.CodeDef(code); + } + // concepts + var conceptDefs = (json.library.concepts && json.library.concepts.def) || []; + this.concepts = {}; + for (var _d = 0, conceptDefs_1 = conceptDefs; _d < conceptDefs_1.length; _d++) { + var concept = conceptDefs_1[_d]; + this.concepts[concept.name] = new expressions_1.ConceptDef(concept); + } + // expressions + var exprDefs = (json.library.statements && json.library.statements.def) || []; + this.expressions = {}; + this.functions = {}; + for (var _e = 0, exprDefs_1 = exprDefs; _e < exprDefs_1.length; _e++) { + var expr = exprDefs_1[_e]; + if (expr.type === 'FunctionDef') { + if (!this.functions[expr.name]) { + this.functions[expr.name] = []; + } + this.functions[expr.name].push(new expressions_1.FunctionDef(expr)); + } + else { + this.expressions[expr.name] = new expressions_1.ExpressionDef(expr); + } + } + // includes + var inclDefs = (json.library.includes && json.library.includes.def) || []; + this.includes = {}; + for (var _f = 0, inclDefs_1 = inclDefs; _f < inclDefs_1.length; _f++) { + var incl = inclDefs_1[_f]; + if (libraryManager) { + this.includes[incl.localIdentifier] = libraryManager.resolve(incl.path, incl.version); + } + } + // Include codesystems from includes + for (var iProperty in this.includes) { + if (this.includes[iProperty] && this.includes[iProperty].codesystems) { + for (var csProperty in this.includes[iProperty].codesystems) { + this.codesystems[csProperty] = this.includes[iProperty].codesystems[csProperty]; + } + } + } } - }]); - - return ConvertsToInteger; -}(Expression); - -var ConvertsToQuantity = /*#__PURE__*/function (_Expression18) { - _inherits(ConvertsToQuantity, _Expression18); - - var _super18 = _createSuper(ConvertsToQuantity); - - function ConvertsToQuantity(json) { - var _this8; - - _classCallCheck(this, ConvertsToQuantity); - - _this8 = _super18.call(this, json); - _this8.operand = json.operand; - return _this8; - } - - _createClass(ConvertsToQuantity, [{ - key: "exec", - value: function exec(ctx) { - var operatorValue = this.execArgs(ctx); + Library.prototype.getFunction = function (identifier) { + return this.functions[identifier]; + }; + Library.prototype.get = function (identifier) { + return (this.expressions[identifier] || this.includes[identifier] || this.getFunction(identifier)); + }; + Library.prototype.getValueSet = function (identifier, libraryName) { + if (this.valuesets[identifier] != null) { + return this.valuesets[identifier]; + } + return this.includes[libraryName] != null + ? this.includes[libraryName].valuesets[identifier] + : undefined; + }; + Library.prototype.getCodeSystem = function (identifier) { + return this.codesystems[identifier]; + }; + Library.prototype.getCode = function (identifier) { + return this.codes[identifier]; + }; + Library.prototype.getConcept = function (identifier) { + return this.concepts[identifier]; + }; + Library.prototype.getParameter = function (name) { + return this.parameters[name]; + }; + return Library; +}()); +exports.Library = Library; - if (operatorValue === null) { - return null; - } else { - return canConvertToType(ToQuantity, this.operand, ctx); - } +},{"./expressions":23}],28:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Slice = exports.Last = exports.First = exports.Current = exports.Distinct = exports.Flatten = exports.ForEach = exports.doProperIncludes = exports.doIncludes = exports.doContains = exports.IndexOf = exports.ToList = exports.SingletonFrom = exports.Filter = exports.Times = exports.doIntersect = exports.doExcept = exports.doUnion = exports.Exists = exports.List = void 0; +var expression_1 = require("./expression"); +var builder_1 = require("./builder"); +var util_1 = require("../util/util"); +var comparison_1 = require("../util/comparison"); +var List = /** @class */ (function (_super) { + __extends(List, _super); + function List(json) { + var _this = _super.call(this, json) || this; + _this.elements = (0, builder_1.build)(json.element) || []; + return _this; + } + Object.defineProperty(List.prototype, "isList", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + List.prototype.exec = function (ctx) { + return this.elements.map(function (item) { return item.execute(ctx); }); + }; + return List; +}(expression_1.Expression)); +exports.List = List; +var Exists = /** @class */ (function (_super) { + __extends(Exists, _super); + function Exists(json) { + return _super.call(this, json) || this; + } + Exists.prototype.exec = function (ctx) { + var list = this.execArgs(ctx); + // if list exists and has non empty length we need to make sure it isnt just full of nulls + if (list) { + return list.some(function (item) { return item != null; }); + } + return false; + }; + return Exists; +}(expression_1.Expression)); +exports.Exists = Exists; +// Equal is completely handled by overloaded#Equal +// NotEqual is completely handled by overloaded#Equal +// Delegated to by overloaded#Union +function doUnion(a, b) { + var distinct = doDistinct(a.concat(b)); + return removeDuplicateNulls(distinct); +} +exports.doUnion = doUnion; +// Delegated to by overloaded#Except +function doExcept(a, b) { + var distinct = doDistinct(a); + var setList = removeDuplicateNulls(distinct); + return setList.filter(function (item) { return !doContains(b, item, true); }); +} +exports.doExcept = doExcept; +// Delegated to by overloaded#Intersect +function doIntersect(a, b) { + var distinct = doDistinct(a); + var setList = removeDuplicateNulls(distinct); + return setList.filter(function (item) { return doContains(b, item, true); }); +} +exports.doIntersect = doIntersect; +// ELM-only, not a product of CQL +var Times = /** @class */ (function (_super) { + __extends(Times, _super); + function Times() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Times; +}(expression_1.UnimplementedExpression)); +exports.Times = Times; +// ELM-only, not a product of CQL +var Filter = /** @class */ (function (_super) { + __extends(Filter, _super); + function Filter() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Filter; +}(expression_1.UnimplementedExpression)); +exports.Filter = Filter; +var SingletonFrom = /** @class */ (function (_super) { + __extends(SingletonFrom, _super); + function SingletonFrom(json) { + return _super.call(this, json) || this; + } + SingletonFrom.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null && arg.length > 1) { + throw new Error("IllegalArgument: 'SingletonFrom' requires a 0 or 1 arg array"); + } + else if (arg != null && arg.length === 1) { + return arg[0]; + } + else { + return null; + } + }; + return SingletonFrom; +}(expression_1.Expression)); +exports.SingletonFrom = SingletonFrom; +var ToList = /** @class */ (function (_super) { + __extends(ToList, _super); + function ToList(json) { + return _super.call(this, json) || this; + } + ToList.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + return [arg]; + } + else { + return []; + } + }; + return ToList; +}(expression_1.Expression)); +exports.ToList = ToList; +var IndexOf = /** @class */ (function (_super) { + __extends(IndexOf, _super); + function IndexOf(json) { + var _this = _super.call(this, json) || this; + _this.source = (0, builder_1.build)(json.source); + _this.element = (0, builder_1.build)(json.element); + return _this; + } + IndexOf.prototype.exec = function (ctx) { + var index; + var src = this.source.execute(ctx); + var el = this.element.execute(ctx); + if (src == null || el == null) { + return null; + } + for (var i = 0; i < src.length; i++) { + var itm = src[i]; + if ((0, comparison_1.equals)(itm, el)) { + index = i; + break; + } + } + if (index != null) { + return index; + } + else { + return -1; + } + }; + return IndexOf; +}(expression_1.Expression)); +exports.IndexOf = IndexOf; +// Indexer is completely handled by overloaded#Indexer +// Delegated to by overloaded#Contains and overloaded#In +function doContains(container, item, nullEquivalence) { + if (nullEquivalence === void 0) { nullEquivalence = false; } + return container.some(function (element) { return (0, comparison_1.equals)(element, item) || (nullEquivalence && element == null && item == null); }); +} +exports.doContains = doContains; +// Delegated to by overloaded#Includes and overloaded@IncludedIn +function doIncludes(list, sublist) { + return sublist.every(function (x) { return doContains(list, x); }); +} +exports.doIncludes = doIncludes; +// Delegated to by overloaded#ProperIncludes and overloaded@ProperIncludedIn +function doProperIncludes(list, sublist) { + return list.length > sublist.length && doIncludes(list, sublist); +} +exports.doProperIncludes = doProperIncludes; +// ELM-only, not a product of CQL +var ForEach = /** @class */ (function (_super) { + __extends(ForEach, _super); + function ForEach() { + return _super !== null && _super.apply(this, arguments) || this; + } + return ForEach; +}(expression_1.UnimplementedExpression)); +exports.ForEach = ForEach; +var Flatten = /** @class */ (function (_super) { + __extends(Flatten, _super); + function Flatten(json) { + return _super.call(this, json) || this; + } + Flatten.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if ((0, util_1.typeIsArray)(arg) && arg.every(function (x) { return (0, util_1.typeIsArray)(x); })) { + return arg.reduce(function (x, y) { return x.concat(y); }, []); + } + else { + return arg; + } + }; + return Flatten; +}(expression_1.Expression)); +exports.Flatten = Flatten; +var Distinct = /** @class */ (function (_super) { + __extends(Distinct, _super); + function Distinct(json) { + return _super.call(this, json) || this; + } + Distinct.prototype.exec = function (ctx) { + var result = this.execArgs(ctx); + if (result == null) { + return null; + } + return doDistinct(result); + }; + return Distinct; +}(expression_1.Expression)); +exports.Distinct = Distinct; +function doDistinct(list) { + var distinct = []; + list.forEach(function (item) { + var isNew = distinct.every(function (seenItem) { return !(0, comparison_1.equals)(item, seenItem); }); + if (isNew) { + distinct.push(item); + } + }); + return removeDuplicateNulls(distinct); +} +function removeDuplicateNulls(list) { + // Remove duplicate null elements + var firstNullFound = false; + var setList = []; + for (var _i = 0, list_1 = list; _i < list_1.length; _i++) { + var item = list_1[_i]; + if (item !== null) { + setList.push(item); + } + else if (item === null && !firstNullFound) { + setList.push(item); + firstNullFound = true; + } } - }]); - - return ConvertsToQuantity; -}(Expression); - -var ConvertsToRatio = /*#__PURE__*/function (_Expression19) { - _inherits(ConvertsToRatio, _Expression19); - - var _super19 = _createSuper(ConvertsToRatio); - - function ConvertsToRatio(json) { - var _this9; - - _classCallCheck(this, ConvertsToRatio); - - _this9 = _super19.call(this, json); - _this9.operand = json.operand; - return _this9; - } - - _createClass(ConvertsToRatio, [{ - key: "exec", - value: function exec(ctx) { - var operatorValue = this.execArgs(ctx); - - if (operatorValue === null) { + return setList; +} +// ELM-only, not a product of CQL +var Current = /** @class */ (function (_super) { + __extends(Current, _super); + function Current() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Current; +}(expression_1.UnimplementedExpression)); +exports.Current = Current; +var First = /** @class */ (function (_super) { + __extends(First, _super); + function First(json) { + var _this = _super.call(this, json) || this; + _this.source = (0, builder_1.build)(json.source); + return _this; + } + First.prototype.exec = function (ctx) { + var src = this.source.exec(ctx); + if (src != null && (0, util_1.typeIsArray)(src) && src.length > 0) { + return src[0]; + } + else { + return null; + } + }; + return First; +}(expression_1.Expression)); +exports.First = First; +var Last = /** @class */ (function (_super) { + __extends(Last, _super); + function Last(json) { + var _this = _super.call(this, json) || this; + _this.source = (0, builder_1.build)(json.source); + return _this; + } + Last.prototype.exec = function (ctx) { + var src = this.source.exec(ctx); + if (src != null && (0, util_1.typeIsArray)(src) && src.length > 0) { + return src[src.length - 1]; + } + else { + return null; + } + }; + return Last; +}(expression_1.Expression)); +exports.Last = Last; +var Slice = /** @class */ (function (_super) { + __extends(Slice, _super); + function Slice(json) { + var _this = _super.call(this, json) || this; + _this.source = (0, builder_1.build)(json.source); + _this.startIndex = (0, builder_1.build)(json.startIndex); + _this.endIndex = (0, builder_1.build)(json.endIndex); + return _this; + } + Slice.prototype.exec = function (ctx) { + var src = this.source.exec(ctx); + if (src != null && (0, util_1.typeIsArray)(src)) { + var startIndex = this.startIndex.exec(ctx); + var endIndex = this.endIndex.exec(ctx); + var start = startIndex != null ? startIndex : 0; + var end = endIndex != null ? endIndex : src.length; + if (src.length === 0 || start < 0 || end < 0 || end < start) { + return []; + } + return src.slice(start, end); + } return null; - } else { - return canConvertToType(ToRatio, this.operand, ctx); - } - } - }]); - - return ConvertsToRatio; -}(Expression); - -var ConvertsToString = /*#__PURE__*/function (_Expression20) { - _inherits(ConvertsToString, _Expression20); - - var _super20 = _createSuper(ConvertsToString); - - function ConvertsToString(json) { - var _this10; + }; + return Slice; +}(expression_1.Expression)); +exports.Slice = Slice; +// Length is completely handled by overloaded#Length - _classCallCheck(this, ConvertsToString); +},{"../util/comparison":52,"../util/util":55,"./builder":16,"./expression":22}],29:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StringLiteral = exports.DecimalLiteral = exports.IntegerLiteral = exports.BooleanLiteral = exports.Literal = void 0; +var expression_1 = require("./expression"); +var Literal = /** @class */ (function (_super) { + __extends(Literal, _super); + function Literal(json) { + var _this = _super.call(this, json) || this; + _this.valueType = json.valueType; + _this.value = json.value; + return _this; + } + Literal.from = function (json) { + switch (json.valueType) { + case '{urn:hl7-org:elm-types:r1}Boolean': + return new BooleanLiteral(json); + case '{urn:hl7-org:elm-types:r1}Integer': + return new IntegerLiteral(json); + case '{urn:hl7-org:elm-types:r1}Decimal': + return new DecimalLiteral(json); + case '{urn:hl7-org:elm-types:r1}String': + return new StringLiteral(json); + default: + return new Literal(json); + } + }; + Literal.prototype.exec = function (_ctx) { + return this.value; + }; + return Literal; +}(expression_1.Expression)); +exports.Literal = Literal; +// The following are not defined in ELM, but helpful for execution +var BooleanLiteral = /** @class */ (function (_super) { + __extends(BooleanLiteral, _super); + function BooleanLiteral(json) { + var _this = _super.call(this, json) || this; + _this.value = _this.value === 'true'; + return _this; + } + Object.defineProperty(BooleanLiteral.prototype, "isBooleanLiteral", { + // Define a simple getter to allow type-checking of this class without instanceof + // and in a way that survives minification (as opposed to checking constructor.name) + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + BooleanLiteral.prototype.exec = function (_ctx) { + return this.value; + }; + return BooleanLiteral; +}(Literal)); +exports.BooleanLiteral = BooleanLiteral; +var IntegerLiteral = /** @class */ (function (_super) { + __extends(IntegerLiteral, _super); + function IntegerLiteral(json) { + var _this = _super.call(this, json) || this; + _this.value = parseInt(_this.value, 10); + return _this; + } + Object.defineProperty(IntegerLiteral.prototype, "isIntegerLiteral", { + // Define a simple getter to allow type-checking of this class without instanceof + // and in a way that survives minification (as opposed to checking constructor.name) + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + IntegerLiteral.prototype.exec = function (_ctx) { + return this.value; + }; + return IntegerLiteral; +}(Literal)); +exports.IntegerLiteral = IntegerLiteral; +var DecimalLiteral = /** @class */ (function (_super) { + __extends(DecimalLiteral, _super); + function DecimalLiteral(json) { + var _this = _super.call(this, json) || this; + _this.value = parseFloat(_this.value); + return _this; + } + Object.defineProperty(DecimalLiteral.prototype, "isDecimalLiteral", { + // Define a simple getter to allow type-checking of this class without instanceof + // and in a way that survives minification (as opposed to checking constructor.name) + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + DecimalLiteral.prototype.exec = function (_ctx) { + return this.value; + }; + return DecimalLiteral; +}(Literal)); +exports.DecimalLiteral = DecimalLiteral; +var StringLiteral = /** @class */ (function (_super) { + __extends(StringLiteral, _super); + function StringLiteral(json) { + return _super.call(this, json) || this; + } + Object.defineProperty(StringLiteral.prototype, "isStringLiteral", { + // Define a simple getter to allow type-checking of this class without instanceof + // and in a way that survives minification (as opposed to checking constructor.name) + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + StringLiteral.prototype.exec = function (_ctx) { + // TODO: Remove these replacements when CQL-to-ELM fixes bug: https://github.com/cqframework/clinical_quality_language/issues/82 + return this.value.replace(/\\'/g, "'").replace(/\\"/g, '"'); + }; + return StringLiteral; +}(Literal)); +exports.StringLiteral = StringLiteral; - _this10 = _super20.call(this, json); - _this10.operand = json.operand; - return _this10; - } +},{"./expression":22}],30:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IsFalse = exports.IsTrue = exports.Xor = exports.Not = exports.Or = exports.And = void 0; +var expression_1 = require("./expression"); +var datatypes_1 = require("../datatypes/datatypes"); +var And = /** @class */ (function (_super) { + __extends(And, _super); + function And(json) { + return _super.call(this, json) || this; + } + And.prototype.exec = function (ctx) { + return datatypes_1.ThreeValuedLogic.and.apply(datatypes_1.ThreeValuedLogic, this.execArgs(ctx)); + }; + return And; +}(expression_1.Expression)); +exports.And = And; +var Or = /** @class */ (function (_super) { + __extends(Or, _super); + function Or(json) { + return _super.call(this, json) || this; + } + Or.prototype.exec = function (ctx) { + return datatypes_1.ThreeValuedLogic.or.apply(datatypes_1.ThreeValuedLogic, this.execArgs(ctx)); + }; + return Or; +}(expression_1.Expression)); +exports.Or = Or; +var Not = /** @class */ (function (_super) { + __extends(Not, _super); + function Not(json) { + return _super.call(this, json) || this; + } + Not.prototype.exec = function (ctx) { + return datatypes_1.ThreeValuedLogic.not(this.execArgs(ctx)); + }; + return Not; +}(expression_1.Expression)); +exports.Not = Not; +var Xor = /** @class */ (function (_super) { + __extends(Xor, _super); + function Xor(json) { + return _super.call(this, json) || this; + } + Xor.prototype.exec = function (ctx) { + return datatypes_1.ThreeValuedLogic.xor.apply(datatypes_1.ThreeValuedLogic, this.execArgs(ctx)); + }; + return Xor; +}(expression_1.Expression)); +exports.Xor = Xor; +var IsTrue = /** @class */ (function (_super) { + __extends(IsTrue, _super); + function IsTrue(json) { + return _super.call(this, json) || this; + } + IsTrue.prototype.exec = function (ctx) { + return true === this.execArgs(ctx); + }; + return IsTrue; +}(expression_1.Expression)); +exports.IsTrue = IsTrue; +var IsFalse = /** @class */ (function (_super) { + __extends(IsFalse, _super); + function IsFalse(json) { + return _super.call(this, json) || this; + } + IsFalse.prototype.exec = function (ctx) { + return false === this.execArgs(ctx); + }; + return IsFalse; +}(expression_1.Expression)); +exports.IsFalse = IsFalse; - _createClass(ConvertsToString, [{ - key: "exec", - value: function exec(ctx) { - var operatorValue = this.execArgs(ctx); +},{"../datatypes/datatypes":6,"./expression":22}],31:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Message = void 0; +var expression_1 = require("./expression"); +var builder_1 = require("./builder"); +var Message = /** @class */ (function (_super) { + __extends(Message, _super); + function Message(json) { + var _this = _super.call(this, json) || this; + _this.source = (0, builder_1.build)(json.source); + _this.condition = (0, builder_1.build)(json.condition); + _this.code = (0, builder_1.build)(json.code); + _this.severity = (0, builder_1.build)(json.severity); + _this.message = (0, builder_1.build)(json.message); + return _this; + } + Message.prototype.exec = function (ctx) { + var source = this.source.execute(ctx); + var condition = this.condition.execute(ctx); + if (condition) { + var code = this.code.execute(ctx); + var severity = this.severity.execute(ctx); + var message = this.message.execute(ctx); + var listener = ctx.getMessageListener(); + if (listener && typeof listener.onMessage === 'function') { + listener.onMessage(source, code, severity, message); + } + } + return source; + }; + return Message; +}(expression_1.Expression)); +exports.Message = Message; - if (operatorValue === null) { +},{"./builder":16,"./expression":22}],32:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Coalesce = exports.IsNull = exports.Null = void 0; +var expression_1 = require("./expression"); +var Null = /** @class */ (function (_super) { + __extends(Null, _super); + function Null(json) { + return _super.call(this, json) || this; + } + Null.prototype.exec = function (_ctx) { return null; - } else { - return canConvertToType(ToString, this.operand, ctx); - } - } - }]); - - return ConvertsToString; -}(Expression); - -var ConvertsToTime = /*#__PURE__*/function (_Expression21) { - _inherits(ConvertsToTime, _Expression21); - - var _super21 = _createSuper(ConvertsToTime); - - function ConvertsToTime(json) { - var _this11; - - _classCallCheck(this, ConvertsToTime); - - _this11 = _super21.call(this, json); - _this11.operand = json.operand; - return _this11; - } - - _createClass(ConvertsToTime, [{ - key: "exec", - value: function exec(ctx) { - var operatorValue = this.execArgs(ctx); - - if (operatorValue === null) { + }; + return Null; +}(expression_1.Expression)); +exports.Null = Null; +var IsNull = /** @class */ (function (_super) { + __extends(IsNull, _super); + function IsNull(json) { + return _super.call(this, json) || this; + } + IsNull.prototype.exec = function (ctx) { + return this.execArgs(ctx) == null; + }; + return IsNull; +}(expression_1.Expression)); +exports.IsNull = IsNull; +var Coalesce = /** @class */ (function (_super) { + __extends(Coalesce, _super); + function Coalesce(json) { + return _super.call(this, json) || this; + } + Coalesce.prototype.exec = function (ctx) { + if (this.args) { + for (var _i = 0, _a = this.args; _i < _a.length; _i++) { + var arg = _a[_i]; + var result = arg.execute(ctx); + // if a single arg that's a list, coalesce over the list + if (this.args.length === 1 && Array.isArray(result)) { + var item = result.find(function (item) { return item != null; }); + if (item != null) { + return item; + } + } + else { + if (result != null) { + return result; + } + } + } + } return null; - } else { - return canConvertToType(ToTime, this.operand, ctx); - } - } - }]); + }; + return Coalesce; +}(expression_1.Expression)); +exports.Coalesce = Coalesce; + +},{"./expression":22}],33:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Precision = exports.SameOrBefore = exports.SameOrAfter = exports.SameAs = exports.Before = exports.After = exports.Length = exports.ProperIncludedIn = exports.ProperIncludes = exports.IncludedIn = exports.Includes = exports.Contains = exports.In = exports.Indexer = exports.Intersect = exports.Except = exports.Union = exports.NotEqual = exports.Equivalent = exports.Equal = void 0; +/* eslint-disable @typescript-eslint/ban-ts-comment */ +var expression_1 = require("./expression"); +var logic_1 = require("../datatypes/logic"); +var datetime_1 = require("../datatypes/datetime"); +var util_1 = require("../util/util"); +var comparison_1 = require("../util/comparison"); +var DT = __importStar(require("./datetime")); +var LIST = __importStar(require("./list")); +var IVL = __importStar(require("./interval")); +var Equal = /** @class */ (function (_super) { + __extends(Equal, _super); + function Equal(json) { + return _super.call(this, json) || this; + } + Equal.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args[0] == null || args[1] == null) { + return null; + } + // @ts-ignore + return comparison_1.equals.apply(void 0, args); + }; + return Equal; +}(expression_1.Expression)); +exports.Equal = Equal; +var Equivalent = /** @class */ (function (_super) { + __extends(Equivalent, _super); + function Equivalent(json) { + return _super.call(this, json) || this; + } + Equivalent.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a == null && b == null) { + return true; + } + else if (a == null || b == null) { + return false; + } + else { + return (0, comparison_1.equivalent)(a, b); + } + }; + return Equivalent; +}(expression_1.Expression)); +exports.Equivalent = Equivalent; +var NotEqual = /** @class */ (function (_super) { + __extends(NotEqual, _super); + function NotEqual(json) { + return _super.call(this, json) || this; + } + NotEqual.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args[0] == null || args[1] == null) { + return null; + } + // @ts-ignore + return logic_1.ThreeValuedLogic.not(comparison_1.equals.apply(void 0, this.execArgs(ctx))); + }; + return NotEqual; +}(expression_1.Expression)); +exports.NotEqual = NotEqual; +var Union = /** @class */ (function (_super) { + __extends(Union, _super); + function Union(json) { + return _super.call(this, json) || this; + } + Union.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a == null && b == null) { + return this.listTypeArgs() ? [] : null; + } + if (a == null || b == null) { + var notNull = a || b; + if ((0, util_1.typeIsArray)(notNull)) { + return notNull; + } + else { + return null; + } + } + var lib = (0, util_1.typeIsArray)(a) ? LIST : IVL; + return lib.doUnion(a, b); + }; + Union.prototype.listTypeArgs = function () { + var _a; + return (_a = this.args) === null || _a === void 0 ? void 0 : _a.some(function (arg) { + return arg.asTypeSpecifier != null && arg.asTypeSpecifier.type === 'ListTypeSpecifier'; + }); + }; + return Union; +}(expression_1.Expression)); +exports.Union = Union; +var Except = /** @class */ (function (_super) { + __extends(Except, _super); + function Except(json) { + return _super.call(this, json) || this; + } + Except.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a == null) { + return null; + } + if (b == null) { + return (0, util_1.typeIsArray)(a) ? a : null; + } + var lib = (0, util_1.typeIsArray)(a) ? LIST : IVL; + return lib.doExcept(a, b); + }; + return Except; +}(expression_1.Expression)); +exports.Except = Except; +var Intersect = /** @class */ (function (_super) { + __extends(Intersect, _super); + function Intersect(json) { + return _super.call(this, json) || this; + } + Intersect.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a == null || b == null) { + return null; + } + var lib = (0, util_1.typeIsArray)(a) ? LIST : IVL; + return lib.doIntersect(a, b); + }; + return Intersect; +}(expression_1.Expression)); +exports.Intersect = Intersect; +var Indexer = /** @class */ (function (_super) { + __extends(Indexer, _super); + function Indexer(json) { + return _super.call(this, json) || this; + } + Indexer.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), operand = _a[0], index = _a[1]; + if (operand == null || index == null) { + return null; + } + if (index < 0 || index >= operand.length) { + return null; + } + return operand[index]; + }; + return Indexer; +}(expression_1.Expression)); +exports.Indexer = Indexer; +var In = /** @class */ (function (_super) { + __extends(In, _super); + function In(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + In.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), item = _a[0], container = _a[1]; + if (item == null) { + return null; + } + if (container == null) { + return false; + } + var lib = (0, util_1.typeIsArray)(container) ? LIST : IVL; + return lib.doContains(container, item, this.precision); + }; + return In; +}(expression_1.Expression)); +exports.In = In; +var Contains = /** @class */ (function (_super) { + __extends(Contains, _super); + function Contains(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + Contains.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), container = _a[0], item = _a[1]; + if (container == null) { + return false; + } + if (item == null) { + return null; + } + var lib = (0, util_1.typeIsArray)(container) ? LIST : IVL; + return lib.doContains(container, item, this.precision); + }; + return Contains; +}(expression_1.Expression)); +exports.Contains = Contains; +var Includes = /** @class */ (function (_super) { + __extends(Includes, _super); + function Includes(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + Includes.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), container = _a[0], contained = _a[1]; + if (container == null || contained == null) { + return null; + } + var lib = (0, util_1.typeIsArray)(container) ? LIST : IVL; + return lib.doIncludes(container, contained, this.precision); + }; + return Includes; +}(expression_1.Expression)); +exports.Includes = Includes; +var IncludedIn = /** @class */ (function (_super) { + __extends(IncludedIn, _super); + function IncludedIn(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + IncludedIn.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), contained = _a[0], container = _a[1]; + if (container == null || contained == null) { + return null; + } + var lib = (0, util_1.typeIsArray)(container) ? LIST : IVL; + return lib.doIncludes(container, contained, this.precision); + }; + return IncludedIn; +}(expression_1.Expression)); +exports.IncludedIn = IncludedIn; +var ProperIncludes = /** @class */ (function (_super) { + __extends(ProperIncludes, _super); + function ProperIncludes(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + ProperIncludes.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), container = _a[0], contained = _a[1]; + if (container == null || contained == null) { + return null; + } + var lib = (0, util_1.typeIsArray)(container) ? LIST : IVL; + return lib.doProperIncludes(container, contained, this.precision); + }; + return ProperIncludes; +}(expression_1.Expression)); +exports.ProperIncludes = ProperIncludes; +var ProperIncludedIn = /** @class */ (function (_super) { + __extends(ProperIncludedIn, _super); + function ProperIncludedIn(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + ProperIncludedIn.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), contained = _a[0], container = _a[1]; + if (container == null || contained == null) { + return null; + } + var lib = (0, util_1.typeIsArray)(container) ? LIST : IVL; + return lib.doProperIncludes(container, contained, this.precision); + }; + return ProperIncludedIn; +}(expression_1.Expression)); +exports.ProperIncludedIn = ProperIncludedIn; +var Length = /** @class */ (function (_super) { + __extends(Length, _super); + function Length(json) { + return _super.call(this, json) || this; + } + Length.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + return arg.length; + } + else if (this.arg.asTypeSpecifier.type === 'ListTypeSpecifier') { + return 0; + } + else { + return null; + } + }; + return Length; +}(expression_1.Expression)); +exports.Length = Length; +var After = /** @class */ (function (_super) { + __extends(After, _super); + function After(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + After.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a == null || b == null) { + return null; + } + var lib = a instanceof datetime_1.DateTime ? DT : IVL; + return lib.doAfter(a, b, this.precision); + }; + return After; +}(expression_1.Expression)); +exports.After = After; +var Before = /** @class */ (function (_super) { + __extends(Before, _super); + function Before(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; + return _this; + } + Before.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a == null || b == null) { + return null; + } + var lib = a instanceof datetime_1.DateTime ? DT : IVL; + return lib.doBefore(a, b, this.precision); + }; + return Before; +}(expression_1.Expression)); +exports.Before = Before; +var SameAs = /** @class */ (function (_super) { + __extends(SameAs, _super); + function SameAs(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision; + return _this; + } + SameAs.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), a = _a[0], b = _a[1]; + if (a != null && b != null) { + return a.sameAs(b, this.precision != null ? this.precision.toLowerCase() : undefined); + } + else { + return null; + } + }; + return SameAs; +}(expression_1.Expression)); +exports.SameAs = SameAs; +var SameOrAfter = /** @class */ (function (_super) { + __extends(SameOrAfter, _super); + function SameOrAfter(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision; + return _this; + } + SameOrAfter.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), d1 = _a[0], d2 = _a[1]; + if (d1 != null && d2 != null) { + return d1.sameOrAfter(d2, this.precision != null ? this.precision.toLowerCase() : undefined); + } + else { + return null; + } + }; + return SameOrAfter; +}(expression_1.Expression)); +exports.SameOrAfter = SameOrAfter; +var SameOrBefore = /** @class */ (function (_super) { + __extends(SameOrBefore, _super); + function SameOrBefore(json) { + var _this = _super.call(this, json) || this; + _this.precision = json.precision; + return _this; + } + SameOrBefore.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), d1 = _a[0], d2 = _a[1]; + if (d1 != null && d2 != null) { + return d1.sameOrBefore(d2, this.precision != null ? this.precision.toLowerCase() : undefined); + } + else { + return null; + } + }; + return SameOrBefore; +}(expression_1.Expression)); +exports.SameOrBefore = SameOrBefore; +// Implemented for DateTime, Date, and Time but not for Decimal yet +var Precision = /** @class */ (function (_super) { + __extends(Precision, _super); + function Precision(json) { + return _super.call(this, json) || this; + } + Precision.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + // Since we can't extend UnimplementedExpression directly for this overloaded function, + // we have to copy the error to throw here if we are not using the correct type + if (!arg.getPrecisionValue) { + throw new Error("Unimplemented Expression: Precision"); + } + return arg.getPrecisionValue(); + }; + return Precision; +}(expression_1.Expression)); +exports.Precision = Precision; - return ConvertsToTime; -}(Expression); +},{"../datatypes/datetime":7,"../datatypes/logic":10,"../util/comparison":52,"../util/util":55,"./datetime":20,"./expression":22,"./interval":26,"./list":28}],34:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ParameterRef = exports.ParameterDef = void 0; +var expression_1 = require("./expression"); +var builder_1 = require("./builder"); +var ParameterDef = /** @class */ (function (_super) { + __extends(ParameterDef, _super); + function ParameterDef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.default = (0, builder_1.build)(json.default); + _this.parameterTypeSpecifier = json.parameterTypeSpecifier; + return _this; + } + ParameterDef.prototype.exec = function (ctx) { + // If context parameters contains the name, return value. + if (ctx && ctx.parameters[this.name] !== undefined) { + return ctx.parameters[this.name]; + // If the parent context contains the name, return that + } + else if (ctx.getParentParameter(this.name) !== undefined) { + var parentParam = ctx.getParentParameter(this.name); + return parentParam.default != null ? parentParam.default.execute(ctx) : parentParam; + // If default type exists, execute the default type + } + else if (this.default != null) { + this.default.execute(ctx); + } + }; + return ParameterDef; +}(expression_1.Expression)); +exports.ParameterDef = ParameterDef; +var ParameterRef = /** @class */ (function (_super) { + __extends(ParameterRef, _super); + function ParameterRef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.library = json.libraryName; + return _this; + } + ParameterRef.prototype.exec = function (ctx) { + ctx = this.library ? ctx.getLibraryContext(this.library) : ctx; + var param = ctx.getParameter(this.name); + return param != null ? param.execute(ctx) : undefined; + }; + return ParameterRef; +}(expression_1.Expression)); +exports.ParameterRef = ParameterRef; -function canConvertToType(toFunction, operand, ctx) { - try { - var value = new toFunction({ - type: toFunction.name, - operand: operand - }).execute(ctx); +},{"./builder":16,"./expression":22}],35:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Quantity = void 0; +var expression_1 = require("./expression"); +var DT = __importStar(require("../datatypes/datatypes")); +// Unit conversation is currently implemented on for time duration comparison operations +// TODO: Implement unit conversation for time duration mathematical operations +var Quantity = /** @class */ (function (_super) { + __extends(Quantity, _super); + function Quantity(json) { + var _this = _super.call(this, json) || this; + _this.value = parseFloat(json.value); + _this.unit = json.unit; + return _this; + } + Quantity.prototype.exec = function (_ctx) { + return new DT.Quantity(this.value, this.unit); + }; + return Quantity; +}(expression_1.Expression)); +exports.Quantity = Quantity; - if (value != null) { - return true; - } else { - return false; +},{"../datatypes/datatypes":6,"./expression":22}],36:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QueryLetRef = exports.AliasRef = exports.Query = exports.SortClause = exports.ReturnClause = exports.ByColumn = exports.ByExpression = exports.ByDirection = exports.Sort = exports.Without = exports.With = exports.LetClause = exports.AliasedQuerySource = void 0; +var expression_1 = require("./expression"); +var context_1 = require("../runtime/context"); +var util_1 = require("../util/util"); +var comparison_1 = require("../util/comparison"); +var builder_1 = require("./builder"); +var AliasedQuerySource = /** @class */ (function () { + function AliasedQuerySource(json) { + this.alias = json.alias; + this.expression = (0, builder_1.build)(json.expression); + } + return AliasedQuerySource; +}()); +exports.AliasedQuerySource = AliasedQuerySource; +var LetClause = /** @class */ (function () { + function LetClause(json) { + this.identifier = json.identifier; + this.expression = (0, builder_1.build)(json.expression); + } + return LetClause; +}()); +exports.LetClause = LetClause; +var With = /** @class */ (function (_super) { + __extends(With, _super); + function With(json) { + var _this = _super.call(this, json) || this; + _this.alias = json.alias; + _this.expression = (0, builder_1.build)(json.expression); + _this.suchThat = (0, builder_1.build)(json.suchThat); + return _this; + } + With.prototype.exec = function (ctx) { + var _this = this; + var records = this.expression.execute(ctx); + if (!(0, util_1.typeIsArray)(records)) { + records = [records]; + } + var returns = records.map(function (rec) { + var childCtx = ctx.childContext(); + childCtx.set(_this.alias, rec); + return _this.suchThat.execute(childCtx); + }); + return returns.some(function (x) { return x; }); + }; + return With; +}(expression_1.Expression)); +exports.With = With; +var Without = /** @class */ (function (_super) { + __extends(Without, _super); + function Without(json) { + return _super.call(this, json) || this; + } + Without.prototype.exec = function (ctx) { + return !_super.prototype.exec.call(this, ctx); + }; + return Without; +}(With)); +exports.Without = Without; +// ELM-only, not a product of CQL +var Sort = /** @class */ (function (_super) { + __extends(Sort, _super); + function Sort() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Sort; +}(expression_1.UnimplementedExpression)); +exports.Sort = Sort; +var ByDirection = /** @class */ (function (_super) { + __extends(ByDirection, _super); + function ByDirection(json) { + var _this = _super.call(this, json) || this; + _this.direction = json.direction; + _this.low_order = _this.direction === 'asc' || _this.direction === 'ascending' ? -1 : 1; + _this.high_order = _this.low_order * -1; + return _this; + } + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + ByDirection.prototype.exec = function (ctx, a, b) { + if (a === b) { + return 0; + } + else if (a.isQuantity && b.isQuantity) { + if (a.before(b)) { + return this.low_order; + } + else { + return this.high_order; + } + } + else if (a < b) { + return this.low_order; + } + else { + return this.high_order; + } + }; + return ByDirection; +}(expression_1.Expression)); +exports.ByDirection = ByDirection; +var ByExpression = /** @class */ (function (_super) { + __extends(ByExpression, _super); + function ByExpression(json) { + var _this = _super.call(this, json) || this; + _this.expression = (0, builder_1.build)(json.expression); + _this.direction = json.direction; + _this.low_order = _this.direction === 'asc' || _this.direction === 'ascending' ? -1 : 1; + _this.high_order = _this.low_order * -1; + return _this; + } + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + ByExpression.prototype.exec = function (ctx, a, b) { + var sctx = ctx.childContext(a); + var a_val = this.expression.execute(sctx); + sctx = ctx.childContext(b); + var b_val = this.expression.execute(sctx); + if (a_val === b_val || (a_val == null && b_val == null)) { + return 0; + } + else if (a_val == null || b_val == null) { + return a_val == null ? this.low_order : this.high_order; + } + else if (a_val.isQuantity && b_val.isQuantity) { + return a_val.before(b_val) ? this.low_order : this.high_order; + } + else { + return a_val < b_val ? this.low_order : this.high_order; + } + }; + return ByExpression; +}(expression_1.Expression)); +exports.ByExpression = ByExpression; +var ByColumn = /** @class */ (function (_super) { + __extends(ByColumn, _super); + function ByColumn(json) { + var _this = _super.call(this, json) || this; + _this.expression = (0, builder_1.build)({ + name: json.path, + type: 'IdentifierRef' + }); + return _this; + } + return ByColumn; +}(ByExpression)); +exports.ByColumn = ByColumn; +var ReturnClause = /** @class */ (function () { + function ReturnClause(json) { + this.expression = (0, builder_1.build)(json.expression); + this.distinct = json.distinct != null ? json.distinct : true; + } + return ReturnClause; +}()); +exports.ReturnClause = ReturnClause; +var SortClause = /** @class */ (function () { + function SortClause(json) { + this.by = (0, builder_1.build)(json != null ? json.by : undefined); + } + SortClause.prototype.sort = function (ctx, values) { + var _this = this; + if (this.by) { + return values.sort(function (a, b) { + var order = 0; + for (var _i = 0, _a = _this.by; _i < _a.length; _i++) { + var item = _a[_i]; + // Do not use execute here because the value of the sort order is not important. + order = item.exec(ctx, a, b); + if (order !== 0) { + break; + } + } + return order; + }); + } + }; + return SortClause; +}()); +exports.SortClause = SortClause; +var toDistinctList = function (xList) { + var yList = []; + xList.forEach(function (x) { + if (!yList.some(function (y) { return (0, comparison_1.equals)(x, y); })) { + yList.push(x); + } + }); + return yList; +}; +var AggregateClause = /** @class */ (function (_super) { + __extends(AggregateClause, _super); + function AggregateClause(json) { + var _this = _super.call(this, json) || this; + _this.identifier = json.identifier; + _this.expression = (0, builder_1.build)(json.expression); + _this.starting = json.starting ? (0, builder_1.build)(json.starting) : null; + _this.distinct = json.distinct != null ? json.distinct : true; + return _this; + } + AggregateClause.prototype.aggregate = function (returnedValues, ctx) { + var _this = this; + var aggregateValue = this.starting != null ? this.starting.exec(ctx) : null; + returnedValues.forEach(function (contextValues) { + var childContext = ctx.childContext(contextValues); + childContext.set(_this.identifier, aggregateValue); + aggregateValue = _this.expression.exec(childContext); + }); + return aggregateValue; + }; + return AggregateClause; +}(expression_1.Expression)); +var Query = /** @class */ (function (_super) { + __extends(Query, _super); + function Query(json) { + var _this = _super.call(this, json) || this; + _this.sources = new MultiSource(json.source.map(function (s) { return new AliasedQuerySource(s); })); + _this.letClauses = json.let != null ? json.let.map(function (d) { return new LetClause(d); }) : []; + _this.relationship = json.relationship != null ? (0, builder_1.build)(json.relationship) : []; + _this.where = (0, builder_1.build)(json.where); + _this.returnClause = json.return != null ? new ReturnClause(json.return) : null; + _this.aggregateClause = json.aggregate != null ? new AggregateClause(json.aggregate) : null; + _this.aliases = _this.sources.aliases(); + _this.sortClause = json.sort != null ? new SortClause(json.sort) : null; + return _this; + } + Query.prototype.isDistinct = function () { + if (this.aggregateClause != null && this.aggregateClause.distinct != null) { + return this.aggregateClause.distinct; + } + else if (this.returnClause != null && this.returnClause.distinct != null) { + return this.returnClause.distinct; + } + return true; + }; + Query.prototype.exec = function (ctx) { + var _this = this; + var returnedValues = []; + this.sources.forEach(ctx, function (rctx) { + for (var _i = 0, _a = _this.letClauses; _i < _a.length; _i++) { + var def = _a[_i]; + rctx.set(def.identifier, def.expression.execute(rctx)); + } + var relations = _this.relationship.map(function (rel) { + var child_ctx = rctx.childContext(); + return rel.execute(child_ctx); + }); + var passed = (0, util_1.allTrue)(relations) && (_this.where ? _this.where.execute(rctx) : true); + if (passed) { + if (_this.returnClause != null) { + var val = _this.returnClause.expression.execute(rctx); + returnedValues.push(val); + } + else { + if (_this.aliases.length === 1 && _this.aggregateClause == null) { + returnedValues.push(rctx.get(_this.aliases[0])); + } + else { + returnedValues.push(rctx.context_values); + } + } + } + }); + if (this.isDistinct()) { + returnedValues = toDistinctList(returnedValues); + } + if (this.aggregateClause != null) { + returnedValues = this.aggregateClause.aggregate(returnedValues, ctx); + } + if (this.sortClause != null) { + this.sortClause.sort(ctx, returnedValues); + } + if (this.sources.returnsList() || this.aggregateClause != null) { + return returnedValues; + } + else { + return returnedValues[0]; + } + }; + return Query; +}(expression_1.Expression)); +exports.Query = Query; +var AliasRef = /** @class */ (function (_super) { + __extends(AliasRef, _super); + function AliasRef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + return _this; + } + AliasRef.prototype.exec = function (ctx) { + return ctx != null ? ctx.get(this.name) : undefined; + }; + return AliasRef; +}(expression_1.Expression)); +exports.AliasRef = AliasRef; +var QueryLetRef = /** @class */ (function (_super) { + __extends(QueryLetRef, _super); + function QueryLetRef(json) { + return _super.call(this, json) || this; + } + return QueryLetRef; +}(AliasRef)); +exports.QueryLetRef = QueryLetRef; +// The following is not defined by ELM but is helpful for execution +var MultiSource = /** @class */ (function () { + function MultiSource(sources) { + this.sources = sources; + this.alias = this.sources[0].alias; + this.expression = this.sources[0].expression; + this.isList = true; + if (this.sources.length > 1) { + this.rest = new MultiSource(this.sources.slice(1)); + } } - } catch (error) { - return false; - } -} - -var ConvertQuantity = /*#__PURE__*/function (_Expression22) { - _inherits(ConvertQuantity, _Expression22); - - var _super22 = _createSuper(ConvertQuantity); - - function ConvertQuantity(json) { - _classCallCheck(this, ConvertQuantity); - - return _super22.call(this, json); - } - - _createClass(ConvertQuantity, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs = this.execArgs(ctx), - _this$execArgs2 = _slicedToArray(_this$execArgs, 2), - quantity = _this$execArgs2[0], - newUnit = _this$execArgs2[1]; + MultiSource.prototype.aliases = function () { + var a = [this.alias]; + if (this.rest) { + a = a.concat(this.rest.aliases()); + } + return a; + }; + MultiSource.prototype.returnsList = function () { + return this.isList || (this.rest && this.rest.returnsList()); + }; + MultiSource.prototype.forEach = function (ctx, func) { + var _this = this; + var records = this.expression.execute(ctx); + this.isList = (0, util_1.typeIsArray)(records); + records = this.isList ? records : [records]; + return records.map(function (rec) { + var rctx = new context_1.Context(ctx); + rctx.set(_this.alias, rec); + if (_this.rest) { + return _this.rest.forEach(rctx, func); + } + else { + return func(rctx); + } + }); + }; + return MultiSource; +}()); - if (quantity != null && newUnit != null) { - try { - return quantity.convertUnit(newUnit); - } catch (error) { - // Cannot convert input to target unit, spec says to return null - return null; +},{"../runtime/context":42,"../util/comparison":52,"../util/util":55,"./builder":16,"./expression":22}],37:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Ratio = void 0; +var expression_1 = require("./expression"); +var quantity_1 = require("../datatypes/quantity"); +var DT = __importStar(require("../datatypes/datatypes")); +var Ratio = /** @class */ (function (_super) { + __extends(Ratio, _super); + function Ratio(json) { + var _this = _super.call(this, json) || this; + if (json.numerator == null) { + throw new Error('Cannot create a ratio with an undefined numerator value'); } - } + else { + _this.numerator = new quantity_1.Quantity(json.numerator.value, json.numerator.unit); + } + if (json.denominator == null) { + throw new Error('Cannot create a ratio with an undefined denominator value'); + } + else { + _this.denominator = new quantity_1.Quantity(json.denominator.value, json.denominator.unit); + } + return _this; } - }]); - - return ConvertQuantity; -}(Expression); - -var CanConvertQuantity = /*#__PURE__*/function (_Expression23) { - _inherits(CanConvertQuantity, _Expression23); - - var _super23 = _createSuper(CanConvertQuantity); - - function CanConvertQuantity(json) { - _classCallCheck(this, CanConvertQuantity); - - return _super23.call(this, json); - } + Ratio.prototype.exec = function (_ctx) { + return new DT.Ratio(this.numerator, this.denominator); + }; + return Ratio; +}(expression_1.Expression)); +exports.Ratio = Ratio; - _createClass(CanConvertQuantity, [{ - key: "exec", - value: function exec(ctx) { - var _this$execArgs3 = this.execArgs(ctx), - _this$execArgs4 = _slicedToArray(_this$execArgs3, 2), - quantity = _this$execArgs4[0], - newUnit = _this$execArgs4[1]; +},{"../datatypes/datatypes":6,"../datatypes/quantity":11,"./expression":22}],38:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IdentifierRef = exports.OperandRef = exports.FunctionRef = exports.FunctionDef = exports.ExpressionRef = exports.ExpressionDef = void 0; +var expression_1 = require("./expression"); +var builder_1 = require("./builder"); +var ExpressionDef = /** @class */ (function (_super) { + __extends(ExpressionDef, _super); + function ExpressionDef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.context = json.context; + _this.expression = (0, builder_1.build)(json.expression); + return _this; + } + ExpressionDef.prototype.exec = function (ctx) { + var value = this.expression != null ? this.expression.execute(ctx) : undefined; + ctx.rootContext().set(this.name, value); + return value; + }; + return ExpressionDef; +}(expression_1.Expression)); +exports.ExpressionDef = ExpressionDef; +var ExpressionRef = /** @class */ (function (_super) { + __extends(ExpressionRef, _super); + function ExpressionRef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.library = json.libraryName; + return _this; + } + ExpressionRef.prototype.exec = function (ctx) { + ctx = this.library ? ctx.getLibraryContext(this.library) : ctx; + var value = ctx.get(this.name); + if (value instanceof expression_1.Expression) { + value = value.execute(ctx); + } + return value; + }; + return ExpressionRef; +}(expression_1.Expression)); +exports.ExpressionRef = ExpressionRef; +var FunctionDef = /** @class */ (function (_super) { + __extends(FunctionDef, _super); + function FunctionDef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.expression = (0, builder_1.build)(json.expression); + _this.parameters = json.operand; + return _this; + } + FunctionDef.prototype.exec = function (_ctx) { + return this; + }; + return FunctionDef; +}(expression_1.Expression)); +exports.FunctionDef = FunctionDef; +var FunctionRef = /** @class */ (function (_super) { + __extends(FunctionRef, _super); + function FunctionRef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.library = json.libraryName; + return _this; + } + FunctionRef.prototype.exec = function (ctx) { + var functionDefs, child_ctx; + if (this.library) { + var lib = ctx.get(this.library); + functionDefs = lib ? lib.getFunction(this.name) : undefined; + var libCtx = ctx.getLibraryContext(this.library); + child_ctx = libCtx ? libCtx.childContext() : undefined; + } + else { + functionDefs = ctx.get(this.name); + child_ctx = ctx.childContext(); + } + var args = this.execArgs(ctx); + // Filter out functions w/ wrong number of arguments. + functionDefs = functionDefs.filter(function (f) { return f.parameters.length === args.length; }); + // If there is still > 1 matching function, filter by argument types + if (functionDefs.length > 1) { + functionDefs = functionDefs.filter(function (f) { + var match = true; + for (var i = 0; i < args.length && match; i++) { + if (args[i] !== null) { + var operandTypeSpecifier = f.parameters[i].operandTypeSpecifier; + if (operandTypeSpecifier == null && f.parameters[i].operandType != null) { + // convert it to a NamedTypedSpecifier + operandTypeSpecifier = { + name: f.parameters[i].operandType, + type: 'NamedTypeSpecifier' + }; + } + match = ctx.matchesTypeSpecifier(args[i], operandTypeSpecifier); + } + } + return match; + }); + } + // If there is still > 1 matching function, calculate a score based on quality of matches + if (functionDefs.length > 1) { + // TODO + } + if (functionDefs.length === 0) { + throw new Error('no function with matching signature could be found'); + } + // By this point, we should have only one function, but until implementation is completed, + // use the last one (no matter how many still remain) + var functionDef = functionDefs[functionDefs.length - 1]; + for (var i = 0; i < functionDef.parameters.length; i++) { + child_ctx.set(functionDef.parameters[i].name, args[i]); + } + return functionDef.expression.execute(child_ctx); + }; + return FunctionRef; +}(expression_1.Expression)); +exports.FunctionRef = FunctionRef; +var OperandRef = /** @class */ (function (_super) { + __extends(OperandRef, _super); + function OperandRef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + return _this; + } + OperandRef.prototype.exec = function (ctx) { + return ctx.get(this.name); + }; + return OperandRef; +}(expression_1.Expression)); +exports.OperandRef = OperandRef; +var IdentifierRef = /** @class */ (function (_super) { + __extends(IdentifierRef, _super); + function IdentifierRef(json) { + var _this = _super.call(this, json) || this; + _this.name = json.name; + _this.library = json.libraryName; + return _this; + } + IdentifierRef.prototype.exec = function (ctx) { + // TODO: Technically, the ELM Translator should never output one of these + // but this code is needed since it does, as a work-around to get queries + // to work properly when sorting by a field in a tuple + var lib = this.library ? ctx.get(this.library) : undefined; + var val = lib ? lib.get(this.name) : ctx.get(this.name); + if (val == null) { + var parts = this.name.split('.'); + val = ctx.get(parts[0]); + if (val != null && parts.length > 1) { + var curr_obj = val; + for (var _i = 0, _a = parts.slice(1); _i < _a.length; _i++) { + var part = _a[_i]; + // _obj = curr_obj?[part] ? curr_obj?.get?(part) + // curr_obj = if _obj instanceof Function then _obj.call(curr_obj) else _obj + var _obj = void 0; + if (curr_obj != null) { + _obj = curr_obj[part]; + if (_obj === undefined && typeof curr_obj.get === 'function') { + _obj = curr_obj.get(part); + } + } + curr_obj = _obj instanceof Function ? _obj.call(curr_obj) : _obj; + } + val = curr_obj; + } + } + if (val instanceof Function) { + return val.call(ctx.context_values); + } + else { + return val; + } + }; + return IdentifierRef; +}(expression_1.Expression)); +exports.IdentifierRef = IdentifierRef; - if (quantity != null && newUnit != null) { - try { - quantity.convertUnit(newUnit); - return true; - } catch (error) { - return false; +},{"./builder":16,"./expression":22}],39:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReplaceMatches = exports.EndsWith = exports.StartsWith = exports.Substring = exports.Matches = exports.LastPositionOf = exports.PositionOf = exports.Lower = exports.Upper = exports.SplitOnMatches = exports.Split = exports.Combine = exports.Concatenate = void 0; +var expression_1 = require("./expression"); +var builder_1 = require("./builder"); +var Concatenate = /** @class */ (function (_super) { + __extends(Concatenate, _super); + function Concatenate(json) { + return _super.call(this, json) || this; + } + Concatenate.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args.some(function (x) { return x == null; })) { + return null; } - } + else { + return args.reduce(function (x, y) { return x + y; }); + } + }; + return Concatenate; +}(expression_1.Expression)); +exports.Concatenate = Concatenate; +var Combine = /** @class */ (function (_super) { + __extends(Combine, _super); + function Combine(json) { + var _this = _super.call(this, json) || this; + _this.source = (0, builder_1.build)(json.source); + _this.separator = (0, builder_1.build)(json.separator); + return _this; + } + Combine.prototype.exec = function (ctx) { + var source = this.source.execute(ctx); + var separator = this.separator != null ? this.separator.execute(ctx) : ''; + if (source == null) { + return null; + } + else { + var filteredArray = source.filter(function (x) { return x != null; }); + if (filteredArray.length === 0) { + return null; + } + else { + return filteredArray.join(separator); + } + } + }; + return Combine; +}(expression_1.Expression)); +exports.Combine = Combine; +var Split = /** @class */ (function (_super) { + __extends(Split, _super); + function Split(json) { + var _this = _super.call(this, json) || this; + _this.stringToSplit = (0, builder_1.build)(json.stringToSplit); + _this.separator = (0, builder_1.build)(json.separator); + return _this; + } + Split.prototype.exec = function (ctx) { + var stringToSplit = this.stringToSplit.execute(ctx); + var separator = this.separator.execute(ctx); + if (stringToSplit && separator) { + return stringToSplit.split(separator); + } + return stringToSplit ? [stringToSplit] : null; + }; + return Split; +}(expression_1.Expression)); +exports.Split = Split; +var SplitOnMatches = /** @class */ (function (_super) { + __extends(SplitOnMatches, _super); + function SplitOnMatches(json) { + var _this = _super.call(this, json) || this; + _this.stringToSplit = (0, builder_1.build)(json.stringToSplit); + _this.separatorPattern = (0, builder_1.build)(json.separatorPattern); + return _this; + } + SplitOnMatches.prototype.exec = function (ctx) { + var stringToSplit = this.stringToSplit.execute(ctx); + var separatorPattern = this.separatorPattern.execute(ctx); + if (stringToSplit && separatorPattern) { + return stringToSplit.split(new RegExp(separatorPattern)); + } + return stringToSplit ? [stringToSplit] : null; + }; + return SplitOnMatches; +}(expression_1.Expression)); +exports.SplitOnMatches = SplitOnMatches; +// Length is completely handled by overloaded#Length +var Upper = /** @class */ (function (_super) { + __extends(Upper, _super); + function Upper(json) { + return _super.call(this, json) || this; + } + Upper.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + return arg.toUpperCase(); + } + else { + return null; + } + }; + return Upper; +}(expression_1.Expression)); +exports.Upper = Upper; +var Lower = /** @class */ (function (_super) { + __extends(Lower, _super); + function Lower(json) { + return _super.call(this, json) || this; + } + Lower.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + return arg.toLowerCase(); + } + else { + return null; + } + }; + return Lower; +}(expression_1.Expression)); +exports.Lower = Lower; +// Indexer is completely handled by overloaded#Indexer +var PositionOf = /** @class */ (function (_super) { + __extends(PositionOf, _super); + function PositionOf(json) { + var _this = _super.call(this, json) || this; + _this.pattern = (0, builder_1.build)(json.pattern); + _this.string = (0, builder_1.build)(json.string); + return _this; + } + PositionOf.prototype.exec = function (ctx) { + var pattern = this.pattern.execute(ctx); + var string = this.string.execute(ctx); + if (pattern == null || string == null) { + return null; + } + else { + return string.indexOf(pattern); + } + }; + return PositionOf; +}(expression_1.Expression)); +exports.PositionOf = PositionOf; +var LastPositionOf = /** @class */ (function (_super) { + __extends(LastPositionOf, _super); + function LastPositionOf(json) { + var _this = _super.call(this, json) || this; + _this.pattern = (0, builder_1.build)(json.pattern); + _this.string = (0, builder_1.build)(json.string); + return _this; + } + LastPositionOf.prototype.exec = function (ctx) { + var pattern = this.pattern.execute(ctx); + var string = this.string.execute(ctx); + if (pattern == null || string == null) { + return null; + } + else { + return string.lastIndexOf(pattern); + } + }; + return LastPositionOf; +}(expression_1.Expression)); +exports.LastPositionOf = LastPositionOf; +var Matches = /** @class */ (function (_super) { + __extends(Matches, _super); + function Matches(json) { + return _super.call(this, json) || this; + } + Matches.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), string = _a[0], pattern = _a[1]; + if (string == null || pattern == null) { + return null; + } + return new RegExp('^' + pattern + '$').test(string); + }; + return Matches; +}(expression_1.Expression)); +exports.Matches = Matches; +var Substring = /** @class */ (function (_super) { + __extends(Substring, _super); + function Substring(json) { + var _this = _super.call(this, json) || this; + _this.stringToSub = (0, builder_1.build)(json.stringToSub); + _this.startIndex = (0, builder_1.build)(json.startIndex); + _this.length = (0, builder_1.build)(json['length']); + return _this; + } + Substring.prototype.exec = function (ctx) { + var stringToSub = this.stringToSub.execute(ctx); + var startIndex = this.startIndex.execute(ctx); + var length = this.length != null ? this.length.execute(ctx) : null; + // According to spec: If stringToSub or startIndex is null, or startIndex is out of range, the result is null. + if (stringToSub == null || + startIndex == null || + startIndex < 0 || + startIndex >= stringToSub.length) { + return null; + } + else if (length != null) { + return stringToSub.substr(startIndex, length); + } + else { + return stringToSub.substr(startIndex); + } + }; + return Substring; +}(expression_1.Expression)); +exports.Substring = Substring; +var StartsWith = /** @class */ (function (_super) { + __extends(StartsWith, _super); + function StartsWith(json) { + return _super.call(this, json) || this; + } + StartsWith.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args.some(function (x) { return x == null; })) { + return null; + } + else { + return args[0].slice(0, args[1].length) === args[1]; + } + }; + return StartsWith; +}(expression_1.Expression)); +exports.StartsWith = StartsWith; +var EndsWith = /** @class */ (function (_super) { + __extends(EndsWith, _super); + function EndsWith(json) { + return _super.call(this, json) || this; + } + EndsWith.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args.some(function (x) { return x == null; })) { + return null; + } + else { + return args[1] === '' || args[0].slice(-args[1].length) === args[1]; + } + }; + return EndsWith; +}(expression_1.Expression)); +exports.EndsWith = EndsWith; +var ReplaceMatches = /** @class */ (function (_super) { + __extends(ReplaceMatches, _super); + function ReplaceMatches(json) { + return _super.call(this, json) || this; + } + ReplaceMatches.prototype.exec = function (ctx) { + var args = this.execArgs(ctx); + if (args.some(function (x) { return x == null; })) { + return null; + } + else { + return args[0].replace(new RegExp(args[1], 'g'), args[2]); + } + }; + return ReplaceMatches; +}(expression_1.Expression)); +exports.ReplaceMatches = ReplaceMatches; - return null; +},{"./builder":16,"./expression":22}],40:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TupleElementDefinition = exports.TupleElement = exports.Tuple = exports.Property = void 0; +var expression_1 = require("./expression"); +var builder_1 = require("./builder"); +var Property = /** @class */ (function (_super) { + __extends(Property, _super); + function Property(json) { + var _this = _super.call(this, json) || this; + _this.scope = json.scope; + _this.source = (0, builder_1.build)(json.source); + _this.path = json.path; + return _this; + } + Property.prototype.exec = function (ctx) { + var obj = this.scope != null ? ctx.get(this.scope) : this.source; + if (obj instanceof expression_1.Expression) { + obj = obj.execute(ctx); + } + var val = getPropertyFromObject(obj, this.path); + if (val == null) { + var parts = this.path.split('.'); + var curr_obj = obj; + for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { + var part = parts_1[_i]; + var _obj = getPropertyFromObject(curr_obj, part); + curr_obj = _obj instanceof Function ? _obj.call(curr_obj) : _obj; + } + val = curr_obj != null ? curr_obj : null; // convert undefined to null + } + if (val instanceof Function) { + return val.call(obj); + } + else { + return val; + } + }; + return Property; +}(expression_1.Expression)); +exports.Property = Property; +function getPropertyFromObject(obj, path) { + var val; + if (obj != null) { + val = obj[path]; + if (val === undefined && typeof obj.get === 'function') { + val = obj.get(path); + } } - }]); - - return CanConvertQuantity; -}(Expression); - -var Is = /*#__PURE__*/function (_Expression24) { - _inherits(Is, _Expression24); - - var _super24 = _createSuper(Is); - - function Is(json) { - var _this12; - - _classCallCheck(this, Is); - - _this12 = _super24.call(this, json); - - if (json.isTypeSpecifier) { - _this12.isTypeSpecifier = json.isTypeSpecifier; - } else if (json.isType) { - // Convert it to a NamedTypeSpecifier - _this12.isTypeSpecifier = { - name: json.isType, - type: 'NamedTypeSpecifier' - }; + return val; +} +var Tuple = /** @class */ (function (_super) { + __extends(Tuple, _super); + function Tuple(json) { + var _this = _super.call(this, json) || this; + var elements = json.element != null ? json.element : []; + _this.elements = elements.map(function (el) { + return { + name: el.name, + value: (0, builder_1.build)(el.value) + }; + }); + return _this; } + Object.defineProperty(Tuple.prototype, "isTuple", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Tuple.prototype.exec = function (ctx) { + var val = {}; + for (var _i = 0, _a = this.elements; _i < _a.length; _i++) { + var el = _a[_i]; + val[el.name] = el.value != null ? el.value.execute(ctx) : undefined; + } + return val; + }; + return Tuple; +}(expression_1.Expression)); +exports.Tuple = Tuple; +var TupleElement = /** @class */ (function (_super) { + __extends(TupleElement, _super); + function TupleElement() { + return _super !== null && _super.apply(this, arguments) || this; + } + return TupleElement; +}(expression_1.UnimplementedExpression)); +exports.TupleElement = TupleElement; +var TupleElementDefinition = /** @class */ (function (_super) { + __extends(TupleElementDefinition, _super); + function TupleElementDefinition() { + return _super !== null && _super.apply(this, arguments) || this; + } + return TupleElementDefinition; +}(expression_1.UnimplementedExpression)); +exports.TupleElementDefinition = TupleElementDefinition; - return _this12; - } - - _createClass(Is, [{ - key: "exec", - value: function exec(ctx) { - var arg = this.execArgs(ctx); - - if (arg === null) { - return false; - } - - if (typeof arg._is !== 'function' && !isSystemType(this.isTypeSpecifier)) { - // We need an _is implementation in order to check non System types - throw new Error("Patient Source does not support Is operation for localId: ".concat(this.localId)); - } - - return ctx.matchesTypeSpecifier(arg, this.isTypeSpecifier); +},{"./builder":16,"./expression":22}],41:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TupleTypeSpecifier = exports.NamedTypeSpecifier = exports.ListTypeSpecifier = exports.IntervalTypeSpecifier = exports.Is = exports.CanConvertQuantity = exports.ConvertQuantity = exports.ConvertsToTime = exports.ConvertsToString = exports.ConvertsToRatio = exports.ConvertsToQuantity = exports.ConvertsToInteger = exports.ConvertsToDecimal = exports.ConvertsToDateTime = exports.ConvertsToDate = exports.ConvertsToBoolean = exports.Convert = exports.ToTime = exports.ToString = exports.ToRatio = exports.ToQuantity = exports.ToInteger = exports.ToDecimal = exports.ToDateTime = exports.ToDate = exports.ToConcept = exports.ToBoolean = exports.As = void 0; +var expression_1 = require("./expression"); +var datetime_1 = require("../datatypes/datetime"); +var clinical_1 = require("../datatypes/clinical"); +var quantity_1 = require("../datatypes/quantity"); +var math_1 = require("../util/math"); +var util_1 = require("../util/util"); +var ratio_1 = require("../datatypes/ratio"); +var uncertainty_1 = require("../datatypes/uncertainty"); +// TODO: Casting and Conversion needs unit tests! +var As = /** @class */ (function (_super) { + __extends(As, _super); + function As(json) { + var _this = _super.call(this, json) || this; + if (json.asTypeSpecifier) { + _this.asTypeSpecifier = json.asTypeSpecifier; + } + else if (json.asType) { + // convert it to a NamedTypedSpecifier + _this.asTypeSpecifier = { + name: json.asType, + type: 'NamedTypeSpecifier' + }; + } + _this.strict = json.strict != null ? json.strict : false; + return _this; } - }]); - - return Is; -}(Expression); - -function isSystemType(spec) { - switch (spec.type) { - case 'NamedTypeSpecifier': - return spec.name.startsWith('{urn:hl7-org:elm-types:r1}'); - - case 'ListTypeSpecifier': - return isSystemType(spec.elementType); - - case 'TupleTypeSpecifier': - return spec.element.every(function (e) { - return isSystemType(e.elementType); - }); - - case 'IntervalTypeSpecifier': - return isSystemType(spec.pointType); - - case 'ChoiceTypeSpecifier': - return spec.choice.every(function (c) { - return isSystemType(c); - }); - - default: - return false; - } -} - -function specifierToString(spec) { - if (typeof spec === 'string') { - return spec; - } else if (spec == null || spec.type == null) { - return ''; - } - - switch (spec.type) { - case 'NamedTypeSpecifier': - return spec.name; - - case 'ListTypeSpecifier': - return "List<".concat(specifierToString(spec.elementType), ">"); - - case 'TupleTypeSpecifier': - return "Tuple<".concat(spec.element.map(function (e) { - return "".concat(e.name, " ").concat(specifierToString(e.elementType)); - }).join(', '), ">"); - - case 'IntervalTypeSpecifier': - return "Interval<".concat(specifierToString(spec.pointType), ">"); - - case 'ChoiceTypeSpecifier': - return "Choice<".concat(spec.choice.map(function (c) { - return specifierToString(c); - }).join(', '), ">"); - - default: - return JSON.stringify(spec); - } -} - -function guessSpecifierType(val) { - if (val == null) { - return 'Null'; - } - - var typeHierarchy = typeof val._typeHierarchy === 'function' && val._typeHierarchy(); - - if (typeHierarchy && typeHierarchy.length > 0) { - return typeHierarchy[0]; - } else if (typeof val === 'boolean') { - return { - type: 'NamedTypeSpecifier', - name: '{urn:hl7-org:elm-types:r1}Boolean' + As.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + // If it is null, return null + if (arg == null) { + return null; + } + if (ctx.matchesTypeSpecifier(arg, this.asTypeSpecifier)) { + // TODO: request patient source to change type identification + return arg; + } + else if (this.strict) { + var argTypeString = specifierToString(guessSpecifierType(arg)); + var asTypeString = specifierToString(this.asTypeSpecifier); + throw new Error("Cannot cast ".concat(argTypeString, " as ").concat(asTypeString)); + } + else { + return null; + } + }; + return As; +}(expression_1.Expression)); +exports.As = As; +var ToBoolean = /** @class */ (function (_super) { + __extends(ToBoolean, _super); + function ToBoolean(json) { + return _super.call(this, json) || this; + } + ToBoolean.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + var strArg = arg.toString().toLowerCase(); + if (['true', 't', 'yes', 'y', '1'].includes(strArg)) { + return true; + } + else if (['false', 'f', 'no', 'n', '0'].includes(strArg)) { + return false; + } + } + return null; + }; + return ToBoolean; +}(expression_1.Expression)); +exports.ToBoolean = ToBoolean; +var ToConcept = /** @class */ (function (_super) { + __extends(ToConcept, _super); + function ToConcept(json) { + return _super.call(this, json) || this; + } + ToConcept.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + return new clinical_1.Concept([arg], arg.display); + } + else { + return null; + } + }; + return ToConcept; +}(expression_1.Expression)); +exports.ToConcept = ToConcept; +var ToDate = /** @class */ (function (_super) { + __extends(ToDate, _super); + function ToDate(json) { + return _super.call(this, json) || this; + } + ToDate.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + else if (arg.isDateTime) { + return arg.getDate(); + } + else { + return datetime_1.Date.parse(arg.toString()); + } + }; + return ToDate; +}(expression_1.Expression)); +exports.ToDate = ToDate; +var ToDateTime = /** @class */ (function (_super) { + __extends(ToDateTime, _super); + function ToDateTime(json) { + return _super.call(this, json) || this; + } + ToDateTime.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg == null) { + return null; + } + else if (arg.isDate) { + return arg.getDateTime(); + } + else { + return datetime_1.DateTime.parse(arg.toString()); + } }; - } else if (typeof val === 'number' && Math.floor(val) === val) { - // it could still be a decimal, but we have to just take our best guess! - return { - type: 'NamedTypeSpecifier', - name: '{urn:hl7-org:elm-types:r1}Integer' + return ToDateTime; +}(expression_1.Expression)); +exports.ToDateTime = ToDateTime; +var ToDecimal = /** @class */ (function (_super) { + __extends(ToDecimal, _super); + function ToDecimal(json) { + return _super.call(this, json) || this; + } + ToDecimal.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + if (arg.isUncertainty) { + var low = (0, math_1.limitDecimalPrecision)(parseFloat(arg.low.toString())); + var high = (0, math_1.limitDecimalPrecision)(parseFloat(arg.high.toString())); + return new uncertainty_1.Uncertainty(low, high); + } + else { + var decimal = (0, math_1.limitDecimalPrecision)(parseFloat(arg.toString())); + if ((0, math_1.isValidDecimal)(decimal)) { + return decimal; + } + } + } + return null; }; - } else if (typeof val === 'number') { - return { - type: 'NamedTypeSpecifier', - name: '{urn:hl7-org:elm-types:r1}Decimal' + return ToDecimal; +}(expression_1.Expression)); +exports.ToDecimal = ToDecimal; +var ToInteger = /** @class */ (function (_super) { + __extends(ToInteger, _super); + function ToInteger(json) { + return _super.call(this, json) || this; + } + ToInteger.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (typeof arg === 'string') { + var integer = parseInt(arg); + if ((0, math_1.isValidInteger)(integer)) { + return integer; + } + } + else if (typeof arg === 'boolean') { + return arg ? 1 : 0; + } + return null; }; - } else if (typeof val === 'string') { - return { - type: 'NamedTypeSpecifier', - name: '{urn:hl7-org:elm-types:r1}String' + return ToInteger; +}(expression_1.Expression)); +exports.ToInteger = ToInteger; +var ToQuantity = /** @class */ (function (_super) { + __extends(ToQuantity, _super); + function ToQuantity(json) { + return _super.call(this, json) || this; + } + ToQuantity.prototype.exec = function (ctx) { + return this.convertValue(this.execArgs(ctx)); }; - } else if (val.isConcept) { - return { - type: 'NamedTypeSpecifier', - name: '{urn:hl7-org:elm-types:r1}Concept' + ToQuantity.prototype.convertValue = function (val) { + if (val == null) { + return null; + } + else if (typeof val === 'number') { + return new quantity_1.Quantity(val, '1'); + } + else if (val.isRatio) { + // numerator and denominator are guaranteed non-null + return val.numerator.dividedBy(val.denominator); + } + else if (val.isUncertainty) { + return new uncertainty_1.Uncertainty(this.convertValue(val.low), this.convertValue(val.high)); + } + else { + // it's a string or something else we'll try to parse as a string + return (0, quantity_1.parseQuantity)(val.toString()); + } }; - } else if (val.isCode) { - return { - type: 'NamedTypeSpecifier', - name: '{urn:hl7-org:elm-types:r1}Code' + return ToQuantity; +}(expression_1.Expression)); +exports.ToQuantity = ToQuantity; +var ToRatio = /** @class */ (function (_super) { + __extends(ToRatio, _super); + function ToRatio(json) { + return _super.call(this, json) || this; + } + ToRatio.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + // Argument will be of form ':' + var denominator = void 0, numerator = void 0; + try { + // String will be split into an array. Numerator will be at index 1, Denominator will be at index 4 + var splitRatioString = arg + .toString() + .match(/^(\d+(\.\d+)?\s*('.+')?)\s*:\s*(\d+(\.\d+)?\s*('.+')?)$/); + if (splitRatioString == null) { + return null; + } + numerator = (0, quantity_1.parseQuantity)(splitRatioString[1]); + denominator = (0, quantity_1.parseQuantity)(splitRatioString[4]); + } + catch (error) { + // If the input string is not formatted correctly, or cannot be + // interpreted as a valid Quantity value, the result is null. + return null; + } + // The value element of a Quantity must be present. + if (numerator == null || denominator == null) { + return null; + } + return new ratio_1.Ratio(numerator, denominator); + } + else { + return null; + } }; - } else if (val.isDate) { - return { - type: 'NamedTypeSpecifier', - name: '{urn:hl7-org:elm-types:r1}Date' + return ToRatio; +}(expression_1.Expression)); +exports.ToRatio = ToRatio; +var ToString = /** @class */ (function (_super) { + __extends(ToString, _super); + function ToString(json) { + return _super.call(this, json) || this; + } + ToString.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + return arg.toString(); + } + else { + return null; + } }; - } else if (val.isTime && val.isTime()) { - return { - type: 'NamedTypeSpecifier', - name: '{urn:hl7-org:elm-types:r1}Time' + return ToString; +}(expression_1.Expression)); +exports.ToString = ToString; +var ToTime = /** @class */ (function (_super) { + __extends(ToTime, _super); + function ToTime(json) { + return _super.call(this, json) || this; + } + ToTime.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg != null) { + var timeString = arg.toString(); + // Return null if string doesn't represent a valid ISO-8601 Time + // hh:mm:ss.fff or hh:mm:ss.fff + var matches = /^T?((\d{2})(:(\d{2})(:(\d{2})(\.(\d+))?)?)?)?(Z|(([+-])(\d{2})(:?(\d{2}))?))?$/.exec(timeString); + if (matches == null) { + return null; + } + var hours = matches[2]; + var minutes = matches[4]; + var seconds = matches[6]; + // Validate h/m/s if they exist, but allow null + if (hours != null) { + if (hours < 0 || hours > 23) { + return null; + } + hours = parseInt(hours, 10); + } + if (minutes != null) { + if (minutes < 0 || minutes > 59) { + return null; + } + minutes = parseInt(minutes, 10); + } + if (seconds != null) { + if (seconds < 0 || seconds > 59) { + return null; + } + seconds = parseInt(seconds, 10); + } + var milliseconds = matches[8]; + if (milliseconds != null) { + milliseconds = parseInt((0, util_1.normalizeMillisecondsField)(milliseconds)); + } + // Time is implemented as Datetime with year 0, month 1, day 1 and null timezoneOffset + return new datetime_1.DateTime(0, 1, 1, hours, minutes, seconds, milliseconds, null); + } + else { + return null; + } }; - } else if (val.isDateTime) { - return { - type: 'NamedTypeSpecifier', - name: '{urn:hl7-org:elm-types:r1}DateTime' + return ToTime; +}(expression_1.Expression)); +exports.ToTime = ToTime; +var Convert = /** @class */ (function (_super) { + __extends(Convert, _super); + function Convert(json) { + var _this = _super.call(this, json) || this; + _this.operand = json.operand; + _this.toType = json.toType; + return _this; + } + Convert.prototype.exec = function (ctx) { + switch (this.toType) { + case '{urn:hl7-org:elm-types:r1}Boolean': + return new ToBoolean({ type: 'ToBoolean', operand: this.operand }).execute(ctx); + case '{urn:hl7-org:elm-types:r1}Concept': + return new ToConcept({ type: 'ToConcept', operand: this.operand }).execute(ctx); + case '{urn:hl7-org:elm-types:r1}Decimal': + return new ToDecimal({ type: 'ToDecimal', operand: this.operand }).execute(ctx); + case '{urn:hl7-org:elm-types:r1}Integer': + return new ToInteger({ type: 'ToInteger', operand: this.operand }).execute(ctx); + case '{urn:hl7-org:elm-types:r1}String': + return new ToString({ type: 'ToString', operand: this.operand }).execute(ctx); + case '{urn:hl7-org:elm-types:r1}Quantity': + return new ToQuantity({ type: 'ToQuantity', operand: this.operand }).execute(ctx); + case '{urn:hl7-org:elm-types:r1}DateTime': + return new ToDateTime({ type: 'ToDateTime', operand: this.operand }).execute(ctx); + case '{urn:hl7-org:elm-types:r1}Date': + return new ToDate({ type: 'ToDate', operand: this.operand }).execute(ctx); + case '{urn:hl7-org:elm-types:r1}Time': + return new ToTime({ type: 'ToTime', operand: this.operand }).execute(ctx); + default: + return this.execArgs(ctx); + } }; - } else if (val.isQuantity) { - return { - type: 'NamedTypeSpecifier', - name: '{urn:hl7-org:elm-types:r1}DateTime' - }; - } else if (Array.isArray(val)) { - // Get unique types from the array (by converting to string and putting in a Set) - var typesAsStrings = Array.from(new Set(val.map(function (v) { - return JSON.stringify(guessSpecifierType(v)); - }))); - var types = typesAsStrings.map(function (ts) { - return /^{/.test(ts) ? JSON.parse(ts) : ts; - }); - return { - type: 'ListTypeSpecifier', - elementType: types.length == 1 ? types[0] : { - type: 'ChoiceTypeSpecifier', - choice: types - } + return Convert; +}(expression_1.Expression)); +exports.Convert = Convert; +var ConvertsToBoolean = /** @class */ (function (_super) { + __extends(ConvertsToBoolean, _super); + function ConvertsToBoolean(json) { + var _this = _super.call(this, json) || this; + _this.operand = json.operand; + return _this; + } + ConvertsToBoolean.prototype.exec = function (ctx) { + var operatorValue = this.execArgs(ctx); + if (operatorValue === null) { + return null; + } + else { + return canConvertToType(ToBoolean, this.operand, ctx); + } }; - } else if (val.isInterval) { - return { - type: 'IntervalTypeSpecifier', - pointType: val.pointType + return ConvertsToBoolean; +}(expression_1.Expression)); +exports.ConvertsToBoolean = ConvertsToBoolean; +var ConvertsToDate = /** @class */ (function (_super) { + __extends(ConvertsToDate, _super); + function ConvertsToDate(json) { + var _this = _super.call(this, json) || this; + _this.operand = json.operand; + return _this; + } + ConvertsToDate.prototype.exec = function (ctx) { + var operatorValue = this.execArgs(ctx); + if (operatorValue === null) { + return null; + } + else { + return canConvertToType(ToDate, this.operand, ctx); + } }; - } else if (_typeof(val) === 'object' && Object.keys(val).length > 0) { - return { - type: 'TupleTypeSpecifier', - element: Object.keys(val).map(function (k) { - return { - name: k, - elementType: guessSpecifierType(val[k]) - }; - }) + return ConvertsToDate; +}(expression_1.Expression)); +exports.ConvertsToDate = ConvertsToDate; +var ConvertsToDateTime = /** @class */ (function (_super) { + __extends(ConvertsToDateTime, _super); + function ConvertsToDateTime(json) { + var _this = _super.call(this, json) || this; + _this.operand = json.operand; + return _this; + } + ConvertsToDateTime.prototype.exec = function (ctx) { + var operatorValue = this.execArgs(ctx); + if (operatorValue === null) { + return null; + } + else { + return canConvertToType(ToDateTime, this.operand, ctx); + } }; - } - - return 'Unknown'; -} - -var IntervalTypeSpecifier = /*#__PURE__*/function (_UnimplementedExpress) { - _inherits(IntervalTypeSpecifier, _UnimplementedExpress); - - var _super25 = _createSuper(IntervalTypeSpecifier); - - function IntervalTypeSpecifier() { - _classCallCheck(this, IntervalTypeSpecifier); - - return _super25.apply(this, arguments); - } - - return IntervalTypeSpecifier; -}(UnimplementedExpression); - -var ListTypeSpecifier = /*#__PURE__*/function (_UnimplementedExpress2) { - _inherits(ListTypeSpecifier, _UnimplementedExpress2); - - var _super26 = _createSuper(ListTypeSpecifier); - - function ListTypeSpecifier() { - _classCallCheck(this, ListTypeSpecifier); - - return _super26.apply(this, arguments); - } - - return ListTypeSpecifier; -}(UnimplementedExpression); - -var NamedTypeSpecifier = /*#__PURE__*/function (_UnimplementedExpress3) { - _inherits(NamedTypeSpecifier, _UnimplementedExpress3); - - var _super27 = _createSuper(NamedTypeSpecifier); - - function NamedTypeSpecifier() { - _classCallCheck(this, NamedTypeSpecifier); - - return _super27.apply(this, arguments); - } - - return NamedTypeSpecifier; -}(UnimplementedExpression); - -var TupleTypeSpecifier = /*#__PURE__*/function (_UnimplementedExpress4) { - _inherits(TupleTypeSpecifier, _UnimplementedExpress4); - - var _super28 = _createSuper(TupleTypeSpecifier); - - function TupleTypeSpecifier() { - _classCallCheck(this, TupleTypeSpecifier); - - return _super28.apply(this, arguments); - } - - return TupleTypeSpecifier; -}(UnimplementedExpression); - -module.exports = { - As: As, - CanConvertQuantity: CanConvertQuantity, - Convert: Convert, - ConvertQuantity: ConvertQuantity, - ConvertsToBoolean: ConvertsToBoolean, - ConvertsToDate: ConvertsToDate, - ConvertsToDateTime: ConvertsToDateTime, - ConvertsToDecimal: ConvertsToDecimal, - ConvertsToInteger: ConvertsToInteger, - ConvertsToQuantity: ConvertsToQuantity, - ConvertsToRatio: ConvertsToRatio, - ConvertsToString: ConvertsToString, - ConvertsToTime: ConvertsToTime, - IntervalTypeSpecifier: IntervalTypeSpecifier, - Is: Is, - ListTypeSpecifier: ListTypeSpecifier, - NamedTypeSpecifier: NamedTypeSpecifier, - ToBoolean: ToBoolean, - ToConcept: ToConcept, - ToDate: ToDate, - ToDateTime: ToDateTime, - ToDecimal: ToDecimal, - ToInteger: ToInteger, - ToQuantity: ToQuantity, - ToRatio: ToRatio, - ToString: ToString, - ToTime: ToTime, - TupleTypeSpecifier: TupleTypeSpecifier -}; -},{"../datatypes/clinical":5,"../datatypes/datetime":7,"../datatypes/quantity":11,"../datatypes/ratio":12,"../datatypes/uncertainty":13,"../util/math":48,"../util/util":50,"./expression":22}],42:[function(require,module,exports){ -"use strict"; - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('../datatypes/exception'), - Exception = _require.Exception; - -var _require2 = require('../util/util'), - typeIsArray = _require2.typeIsArray; - -var _require3 = require('./messageListeners'), - NullMessageListener = _require3.NullMessageListener; - -var dt = require('../datatypes/datatypes'); - -var Context = /*#__PURE__*/function () { - function Context(parent, _codeService, _parameters, executionDateTime, messageListener) { - _classCallCheck(this, Context); - - this.parent = parent; - this._codeService = _codeService; - this.context_values = {}; - this.library_context = {}; - this.localId_context = {}; - this.evaluatedRecords = []; // TODO: If there is an issue with number of parameters look into cql4browsers fix: 387ea77538182833283af65e6341e7a05192304c - - this.checkParameters(_parameters); // not crazy about possibly throwing an error in a constructor, but... - - this._parameters = _parameters || {}; - this.executionDateTime = executionDateTime; - this.messageListener = messageListener; - } - - _createClass(Context, [{ - key: "parameters", - get: function get() { - return this._parameters || this.parent && this.parent.parameters; - }, - set: function set(params) { - this.checkParameters(params); - this._parameters = params; - } - }, { - key: "codeService", - get: function get() { - return this._codeService || this.parent && this.parent.codeService; - }, - set: function set(cs) { - this._codeService = cs; - } - }, { - key: "withParameters", - value: function withParameters(params) { - this.parameters = params || {}; - return this; - } - }, { - key: "withCodeService", - value: function withCodeService(cs) { - this.codeService = cs; - return this; - } - }, { - key: "rootContext", - value: function rootContext() { - if (this.parent) { - return this.parent.rootContext(); - } else { - return this; - } - } - }, { - key: "findRecords", - value: function findRecords(profile) { - return this.parent && this.parent.findRecords(profile); - } - }, { - key: "childContext", - value: function childContext() { - var context_values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var ctx = new Context(this); - ctx.context_values = context_values; - return ctx; - } - }, { - key: "getLibraryContext", - value: function getLibraryContext(library) { - return this.parent && this.parent.getLibraryContext(library); - } - }, { - key: "getLocalIdContext", - value: function getLocalIdContext(localId) { - return this.parent && this.parent.getLocalIdContext(localId); - } - }, { - key: "getParameter", - value: function getParameter(name) { - return this.parent && this.parent.getParameter(name); - } - }, { - key: "getParentParameter", - value: function getParentParameter(name) { - if (this.parent) { - if (this.parent.parameters[name] != null) { - return this.parent.parameters[name]; - } else { - return this.parent.getParentParameter(name); + return ConvertsToDateTime; +}(expression_1.Expression)); +exports.ConvertsToDateTime = ConvertsToDateTime; +var ConvertsToDecimal = /** @class */ (function (_super) { + __extends(ConvertsToDecimal, _super); + function ConvertsToDecimal(json) { + var _this = _super.call(this, json) || this; + _this.operand = json.operand; + return _this; + } + ConvertsToDecimal.prototype.exec = function (ctx) { + var operatorValue = this.execArgs(ctx); + if (operatorValue === null) { + return null; + } + else { + return canConvertToType(ToDecimal, this.operand, ctx); + } + }; + return ConvertsToDecimal; +}(expression_1.Expression)); +exports.ConvertsToDecimal = ConvertsToDecimal; +var ConvertsToInteger = /** @class */ (function (_super) { + __extends(ConvertsToInteger, _super); + function ConvertsToInteger(json) { + var _this = _super.call(this, json) || this; + _this.operand = json.operand; + return _this; + } + ConvertsToInteger.prototype.exec = function (ctx) { + var operatorValue = this.execArgs(ctx); + if (operatorValue === null) { + return null; + } + else { + return canConvertToType(ToInteger, this.operand, ctx); + } + }; + return ConvertsToInteger; +}(expression_1.Expression)); +exports.ConvertsToInteger = ConvertsToInteger; +var ConvertsToQuantity = /** @class */ (function (_super) { + __extends(ConvertsToQuantity, _super); + function ConvertsToQuantity(json) { + var _this = _super.call(this, json) || this; + _this.operand = json.operand; + return _this; + } + ConvertsToQuantity.prototype.exec = function (ctx) { + var operatorValue = this.execArgs(ctx); + if (operatorValue === null) { + return null; + } + else { + return canConvertToType(ToQuantity, this.operand, ctx); + } + }; + return ConvertsToQuantity; +}(expression_1.Expression)); +exports.ConvertsToQuantity = ConvertsToQuantity; +var ConvertsToRatio = /** @class */ (function (_super) { + __extends(ConvertsToRatio, _super); + function ConvertsToRatio(json) { + var _this = _super.call(this, json) || this; + _this.operand = json.operand; + return _this; + } + ConvertsToRatio.prototype.exec = function (ctx) { + var operatorValue = this.execArgs(ctx); + if (operatorValue === null) { + return null; + } + else { + return canConvertToType(ToRatio, this.operand, ctx); + } + }; + return ConvertsToRatio; +}(expression_1.Expression)); +exports.ConvertsToRatio = ConvertsToRatio; +var ConvertsToString = /** @class */ (function (_super) { + __extends(ConvertsToString, _super); + function ConvertsToString(json) { + var _this = _super.call(this, json) || this; + _this.operand = json.operand; + return _this; + } + ConvertsToString.prototype.exec = function (ctx) { + var operatorValue = this.execArgs(ctx); + if (operatorValue === null) { + return null; + } + else { + return canConvertToType(ToString, this.operand, ctx); + } + }; + return ConvertsToString; +}(expression_1.Expression)); +exports.ConvertsToString = ConvertsToString; +var ConvertsToTime = /** @class */ (function (_super) { + __extends(ConvertsToTime, _super); + function ConvertsToTime(json) { + var _this = _super.call(this, json) || this; + _this.operand = json.operand; + return _this; + } + ConvertsToTime.prototype.exec = function (ctx) { + var operatorValue = this.execArgs(ctx); + if (operatorValue === null) { + return null; + } + else { + return canConvertToType(ToTime, this.operand, ctx); + } + }; + return ConvertsToTime; +}(expression_1.Expression)); +exports.ConvertsToTime = ConvertsToTime; +function canConvertToType(toFunction, operand, ctx) { + try { + var value = new toFunction({ type: toFunction.name, operand: operand }).execute(ctx); + if (value != null) { + return true; + } + else { + return false; } - } - } - }, { - key: "getTimezoneOffset", - value: function getTimezoneOffset() { - if (this.executionDateTime != null) { - return this.executionDateTime.timezoneOffset; - } else if (this.parent && this.parent.getTimezoneOffset != null) { - return this.parent.getTimezoneOffset(); - } else { - throw new Exception('No Timezone Offset has been set'); - } - } - }, { - key: "getExecutionDateTime", - value: function getExecutionDateTime() { - if (this.executionDateTime != null) { - return this.executionDateTime; - } else if (this.parent && this.parent.getExecutionDateTime != null) { - return this.parent.getExecutionDateTime(); - } else { - throw new Exception('No Execution DateTime has been set'); - } - } - }, { - key: "getMessageListener", - value: function getMessageListener() { - if (this.messageListener != null) { - return this.messageListener; - } else if (this.parent && this.parent.getMessageListener != null) { - return this.parent.getMessageListener(); - } else { - return new NullMessageListener(); - } - } - }, { - key: "getValueSet", - value: function getValueSet(name, library) { - return this.parent && this.parent.getValueSet(name, library); - } - }, { - key: "getCodeSystem", - value: function getCodeSystem(name) { - return this.parent && this.parent.getCodeSystem(name); - } - }, { - key: "getCode", - value: function getCode(name) { - return this.parent && this.parent.getCode(name); - } - }, { - key: "getConcept", - value: function getConcept(name) { - return this.parent && this.parent.getConcept(name); - } - }, { - key: "get", - value: function get(identifier) { - // Check for undefined because if its null, we actually *do* want to return null (rather than - // looking at parent), but if it's really undefined, *then* look at the parent - if (typeof this.context_values[identifier] !== 'undefined') { - return this.context_values[identifier]; - } else if (identifier === '$this') { - return this.context_values; - } else { - return this.parent != null && this.parent.get(identifier); - } - } - }, { - key: "set", - value: function set(identifier, value) { - this.context_values[identifier] = value; } - }, { - key: "setLocalIdWithResult", - value: function setLocalIdWithResult(localId, value) { - // Temporary fix. Real fix will be to return a list of all result values for a given localId. - var ctx = this.localId_context[localId]; - - if (ctx === false || ctx === null || ctx === undefined || ctx.length === 0) { - this.localId_context[localId] = value; - } + catch (error) { + return false; } - }, { - key: "getLocalIdResult", - value: function getLocalIdResult(localId) { - return this.localId_context[localId]; - } // Returns an object of objects containing each library name - // with the localIds and result values - - }, { - key: "getAllLocalIds", - value: function getAllLocalIds() { - var localIdResults = {}; // Add the localIds and result values from the main library - - localIdResults[this.parent.source.library.identifier.id] = {}; - localIdResults[this.parent.source.library.identifier.id] = this.localId_context; // Iterate over support libraries and store localIds - - for (var libName in this.library_context) { - var lib = this.library_context[libName]; - this.supportLibraryLocalIds(lib, localIdResults); - } - - return localIdResults; - } // Recursive function that will grab nested support library localId results - - }, { - key: "supportLibraryLocalIds", - value: function supportLibraryLocalIds(lib, localIdResults) { - var _this = this; - - // Set library identifier name as the key and the object of localIds with their results as the value - // if it already exists then we need to merge the results instead of overwriting - if (localIdResults[lib.library.source.library.identifier.id] != null) { - this.mergeLibraryLocalIdResults(localIdResults, lib.library.source.library.identifier.id, lib.localId_context); - } else { - localIdResults[lib.library.source.library.identifier.id] = lib.localId_context; - } // Iterate over any support libraries in the current support library - - - Object.values(lib.library_context).forEach(function (supportLib) { - _this.supportLibraryLocalIds(supportLib, localIdResults); - }); - } // Merges the localId results for a library into the already collected results. The logic used for which result - // to keep is the same as the logic used above in setLocalIdWithResult, "falsey" results are always replaced. - - }, { - key: "mergeLibraryLocalIdResults", - value: function mergeLibraryLocalIdResults(localIdResults, libraryId, libraryResults) { - for (var localId in libraryResults) { - var localIdResult = libraryResults[localId]; - var existingResult = localIdResults[libraryId][localId]; // overwite this localid result if the existing result is "falsey". future work could track all results for each localid - - if (existingResult === false || existingResult === null || existingResult === undefined || existingResult.length === 0) { - localIdResults[libraryId][localId] = localIdResult; +} +var ConvertQuantity = /** @class */ (function (_super) { + __extends(ConvertQuantity, _super); + function ConvertQuantity(json) { + return _super.call(this, json) || this; + } + ConvertQuantity.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), quantity = _a[0], newUnit = _a[1]; + if (quantity != null && newUnit != null) { + try { + return quantity.convertUnit(newUnit); + } + catch (error) { + // Cannot convert input to target unit, spec says to return null + return null; + } } - } - } - }, { - key: "checkParameters", - value: function checkParameters(params) { - for (var pName in params) { - var pVal = params[pName]; - var pDef = this.getParameter(pName); - - if (pVal == null) { - return; // Null can theoretically be any type + }; + return ConvertQuantity; +}(expression_1.Expression)); +exports.ConvertQuantity = ConvertQuantity; +var CanConvertQuantity = /** @class */ (function (_super) { + __extends(CanConvertQuantity, _super); + function CanConvertQuantity(json) { + return _super.call(this, json) || this; + } + CanConvertQuantity.prototype.exec = function (ctx) { + var _a = this.execArgs(ctx), quantity = _a[0], newUnit = _a[1]; + if (quantity != null && newUnit != null) { + try { + quantity.convertUnit(newUnit); + return true; + } + catch (error) { + return false; + } } - - if (typeof pDef === 'undefined') { - return; // This will happen if the parameter is declared in a different (included) library - } else if (pDef.parameterTypeSpecifier != null && !this.matchesTypeSpecifier(pVal, pDef.parameterTypeSpecifier)) { - throw new Error("Passed in parameter '".concat(pName, "' is wrong type")); - } else if (pDef['default'] != null && !this.matchesInstanceType(pVal, pDef['default'])) { - throw new Error("Passed in parameter '".concat(pName, "' is wrong type")); + return null; + }; + return CanConvertQuantity; +}(expression_1.Expression)); +exports.CanConvertQuantity = CanConvertQuantity; +var Is = /** @class */ (function (_super) { + __extends(Is, _super); + function Is(json) { + var _this = _super.call(this, json) || this; + if (json.isTypeSpecifier) { + _this.isTypeSpecifier = json.isTypeSpecifier; } - } - - return true; + else if (json.isType) { + // Convert it to a NamedTypeSpecifier + _this.isTypeSpecifier = { + name: json.isType, + type: 'NamedTypeSpecifier' + }; + } + return _this; } - }, { - key: "matchesTypeSpecifier", - value: function matchesTypeSpecifier(val, spec) { - switch (spec.type) { + Is.prototype.exec = function (ctx) { + var arg = this.execArgs(ctx); + if (arg === null) { + return false; + } + if (typeof arg._is !== 'function' && !isSystemType(this.isTypeSpecifier)) { + // We need an _is implementation in order to check non System types + throw new Error("Patient Source does not support Is operation for localId: ".concat(this.localId)); + } + return ctx.matchesTypeSpecifier(arg, this.isTypeSpecifier); + }; + return Is; +}(expression_1.Expression)); +exports.Is = Is; +function isSystemType(spec) { + switch (spec.type) { case 'NamedTypeSpecifier': - return this.matchesNamedTypeSpecifier(val, spec); - + return spec.name.startsWith('{urn:hl7-org:elm-types:r1}'); case 'ListTypeSpecifier': - return this.matchesListTypeSpecifier(val, spec); - + return isSystemType(spec.elementType); case 'TupleTypeSpecifier': - return this.matchesTupleTypeSpecifier(val, spec); - + return spec.element.every(function (e) { return isSystemType(e.elementType); }); case 'IntervalTypeSpecifier': - return this.matchesIntervalTypeSpecifier(val, spec); - + return isSystemType(spec.pointType); case 'ChoiceTypeSpecifier': - return this.matchesChoiceTypeSpecifier(val, spec); - + return spec.choice.every(function (c) { return isSystemType(c); }); default: - return true; - // default to true when we don't know - } - } - }, { - key: "matchesListTypeSpecifier", - value: function matchesListTypeSpecifier(val, spec) { - var _this2 = this; - - return typeIsArray(val) && val.every(function (x) { - return _this2.matchesTypeSpecifier(x, spec.elementType); - }); - } - }, { - key: "matchesTupleTypeSpecifier", - value: function matchesTupleTypeSpecifier(val, spec) { - var _this3 = this; - - // TODO: Spec is not clear about exactly how tuples should be matched - return val != null && _typeof(val) === 'object' && !typeIsArray(val) && !val.isInterval && !val.isConcept && !val.isCode && !val.isDateTime && !val.isDate && !val.isQuantity && spec.element.every(function (x) { - return typeof val[x.name] === 'undefined' || _this3.matchesTypeSpecifier(val[x.name], x.elementType); - }); + return false; } - }, { - key: "matchesIntervalTypeSpecifier", - value: function matchesIntervalTypeSpecifier(val, spec) { - return val.isInterval && (val.low == null || this.matchesTypeSpecifier(val.low, spec.pointType)) && (val.high == null || this.matchesTypeSpecifier(val.high, spec.pointType)); +} +function specifierToString(spec) { + if (typeof spec === 'string') { + return spec; } - }, { - key: "matchesChoiceTypeSpecifier", - value: function matchesChoiceTypeSpecifier(val, spec) { - var _this4 = this; - - return spec.choice.some(function (c) { - return _this4.matchesTypeSpecifier(val, c); - }); + else if (spec == null || spec.type == null) { + return ''; } - }, { - key: "matchesNamedTypeSpecifier", - value: function matchesNamedTypeSpecifier(val, spec) { - if (val == null) { - return true; - } - - switch (spec.name) { - case '{urn:hl7-org:elm-types:r1}Boolean': - return typeof val === 'boolean'; - - case '{urn:hl7-org:elm-types:r1}Decimal': - return typeof val === 'number'; - - case '{urn:hl7-org:elm-types:r1}Integer': - return typeof val === 'number' && Math.floor(val) === val; - - case '{urn:hl7-org:elm-types:r1}String': - return typeof val === 'string'; - - case '{urn:hl7-org:elm-types:r1}Concept': - return val && val.isConcept; - - case '{urn:hl7-org:elm-types:r1}Code': - return val && val.isCode; - - case '{urn:hl7-org:elm-types:r1}DateTime': - return val && val.isDateTime; - - case '{urn:hl7-org:elm-types:r1}Date': - return val && val.isDate; - - case '{urn:hl7-org:elm-types:r1}Quantity': - return val && val.isQuantity; - - case '{urn:hl7-org:elm-types:r1}Time': - return val && val.isTime && val.isTime(); - + switch (spec.type) { + case 'NamedTypeSpecifier': + return spec.name; + case 'ListTypeSpecifier': + return "List<".concat(specifierToString(spec.elementType), ">"); + case 'TupleTypeSpecifier': + return "Tuple<".concat(spec.element + .map(function (e) { return "".concat(e.name, " ").concat(specifierToString(e.elementType)); }) + .join(', '), ">"); + case 'IntervalTypeSpecifier': + return "Interval<".concat(specifierToString(spec.pointType), ">"); + case 'ChoiceTypeSpecifier': + return "Choice<".concat(spec.choice.map(function (c) { return specifierToString(c); }).join(', '), ">"); default: - // Use the data model's implementation of _is, if it is available - if (typeof val._is === 'function') { - return val._is(spec); - } // If the value is an array or interval, then we assume it cannot be cast to a - // named type. Technically, this is not 100% true because a modelinfo can define - // a named type whose base type is a list or interval. But none of our models - // (FHIR, QDM, QICore) do that, so for those models, this approach will always be - // correct. - - - if (Array.isArray(val) || val.isInterval) { - return false; - } // Otherwise just default to true to match legacy behavior. - // - // NOTE: This is also where arbitrary tuples land because they will not have - // an "is" function and we don't encode the type information into the runtime - // objects so we can't easily determine their type. We can't reject them, - // else things like `Encounter{ id: "1" } is Encounter` would return false. - // So for now we allow false positives in order to avoid false negatives. - - - return true; - } + return JSON.stringify(spec); } - }, { - key: "matchesInstanceType", - value: function matchesInstanceType(val, inst) { - if (inst.isBooleanLiteral) { - return typeof val === 'boolean'; - } else if (inst.isDecimalLiteral) { - return typeof val === 'number'; - } else if (inst.isIntegerLiteral) { - return typeof val === 'number' && Math.floor(val) === val; - } else if (inst.isStringLiteral) { - return typeof val === 'string'; - } else if (inst.isCode) { - return val && val.isCode; - } else if (inst.isConcept) { - return val && val.isConcept; - } else if (inst.isTime && inst.isTime()) { - return val && val.isTime && val.isTime(); - } else if (inst.isDate) { - return val && val.isDate; - } else if (inst.isDateTime) { - return val && val.isDateTime; - } else if (inst.isQuantity) { - return val && val.isQuantity; - } else if (inst.isList) { - return this.matchesListInstanceType(val, inst); - } else if (inst.isTuple) { - return this.matchesTupleInstanceType(val, inst); - } else if (inst.isInterval) { - return this.matchesIntervalInstanceType(val, inst); - } - - return true; // default to true when we don't know for sure - } - }, { - key: "matchesListInstanceType", - value: function matchesListInstanceType(val, list) { - var _this5 = this; - - return typeIsArray(val) && val.every(function (x) { - return _this5.matchesInstanceType(x, list.elements[0]); - }); +} +function guessSpecifierType(val) { + if (val == null) { + return 'Null'; } - }, { - key: "matchesTupleInstanceType", - value: function matchesTupleInstanceType(val, tpl) { - var _this6 = this; - - return _typeof(val) === 'object' && !typeIsArray(val) && tpl.elements.every(function (x) { - return typeof val[x.name] === 'undefined' || _this6.matchesInstanceType(val[x.name], x.value); - }); + var typeHierarchy = typeof val._typeHierarchy === 'function' && val._typeHierarchy(); + if (typeHierarchy && typeHierarchy.length > 0) { + return typeHierarchy[0]; } - }, { - key: "matchesIntervalInstanceType", - value: function matchesIntervalInstanceType(val, ivl) { - var pointType = ivl.low != null ? ivl.low : ivl.high; - return val.isInterval && (val.low == null || this.matchesInstanceType(val.low, pointType)) && (val.high == null || this.matchesInstanceType(val.high, pointType)); + else if (typeof val === 'boolean') { + return { type: 'NamedTypeSpecifier', name: '{urn:hl7-org:elm-types:r1}Boolean' }; } - }]); - - return Context; -}(); - -var PatientContext = /*#__PURE__*/function (_Context) { - _inherits(PatientContext, _Context); - - var _super = _createSuper(PatientContext); - - function PatientContext(library, patient, codeService, parameters) { - var _this7; - - var executionDateTime = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : dt.DateTime.fromJSDate(new Date()); - var messageListener = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new NullMessageListener(); - - _classCallCheck(this, PatientContext); - - _this7 = _super.call(this, library, codeService, parameters, executionDateTime, messageListener); - _this7.library = library; - _this7.patient = patient; - return _this7; - } - - _createClass(PatientContext, [{ - key: "rootContext", - value: function rootContext() { - return this; + else if (typeof val === 'number' && Math.floor(val) === val) { + // it could still be a decimal, but we have to just take our best guess! + return { type: 'NamedTypeSpecifier', name: '{urn:hl7-org:elm-types:r1}Integer' }; } - }, { - key: "getLibraryContext", - value: function getLibraryContext(library) { - if (this.library_context[library] == null) { - this.library_context[library] = new PatientContext(this.get(library), this.patient, this.codeService, this.parameters, this.executionDateTime); - } - - return this.library_context[library]; + else if (typeof val === 'number') { + return { type: 'NamedTypeSpecifier', name: '{urn:hl7-org:elm-types:r1}Decimal' }; } - }, { - key: "getLocalIdContext", - value: function getLocalIdContext(localId) { - if (this.localId_context[localId] == null) { - this.localId_context[localId] = new PatientContext(this.get(localId), this.patient, this.codeService, this.parameters, this.executionDateTime); - } - - return this.localId_context[localId]; + else if (typeof val === 'string') { + return { type: 'NamedTypeSpecifier', name: '{urn:hl7-org:elm-types:r1}String' }; } - }, { - key: "findRecords", - value: function findRecords(profile) { - return this.patient && this.patient.findRecords(profile); + else if (val.isConcept) { + return { type: 'NamedTypeSpecifier', name: '{urn:hl7-org:elm-types:r1}Concept' }; } - }]); - - return PatientContext; -}(Context); - -var UnfilteredContext = /*#__PURE__*/function (_Context2) { - _inherits(UnfilteredContext, _Context2); - - var _super2 = _createSuper(UnfilteredContext); - - function UnfilteredContext(library, results, codeService, parameters) { - var _this8; - - var executionDateTime = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : dt.DateTime.fromJSDate(new Date()); - var messageListener = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new NullMessageListener(); - - _classCallCheck(this, UnfilteredContext); - - _this8 = _super2.call(this, library, codeService, parameters, executionDateTime, messageListener); - _this8.library = library; - _this8.results = results; - return _this8; - } - - _createClass(UnfilteredContext, [{ - key: "rootContext", - value: function rootContext() { - return this; + else if (val.isCode) { + return { type: 'NamedTypeSpecifier', name: '{urn:hl7-org:elm-types:r1}Code' }; } - }, { - key: "findRecords", - value: function findRecords(template) { - throw new Exception('Retreives are not currently supported in Unfiltered Context'); + else if (val.isDate) { + return { type: 'NamedTypeSpecifier', name: '{urn:hl7-org:elm-types:r1}Date' }; } - }, { - key: "getLibraryContext", - value: function getLibraryContext(library) { - throw new Exception('Library expressions are not currently supported in Unfiltered Context'); + else if (val.isTime && val.isTime()) { + return { type: 'NamedTypeSpecifier', name: '{urn:hl7-org:elm-types:r1}Time' }; } - }, { - key: "get", - value: function get(identifier) { - //First check to see if the identifier is a unfiltered context expression that has already been cached - if (this.context_values[identifier]) { - return this.context_values[identifier]; - } //if not look to see if the library has a unfiltered expression of that identifier - - - if (this.library[identifier] && this.library[identifier].context === 'Unfiltered') { - return this.library.expressions[identifier]; - } //lastley attempt to gather all patient level results that have that identifier - // should this compact null values before return ? - - - return Object.values(this.results.patientResults).map(function (pr) { - return pr[identifier]; - }); + else if (val.isDateTime) { + return { type: 'NamedTypeSpecifier', name: '{urn:hl7-org:elm-types:r1}DateTime' }; } - }]); - - return UnfilteredContext; -}(Context); - -module.exports = { - Context: Context, - PatientContext: PatientContext, - UnfilteredContext: UnfilteredContext -}; -},{"../datatypes/datatypes":6,"../datatypes/exception":8,"../util/util":50,"./messageListeners":44}],43:[function(require,module,exports){ -"use strict"; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('./messageListeners'), - NullMessageListener = _require.NullMessageListener; - -var _require2 = require('./results'), - Results = _require2.Results; - -var _require3 = require('./context'), - UnfilteredContext = _require3.UnfilteredContext, - PatientContext = _require3.PatientContext; - -var Executor = /*#__PURE__*/function () { - function Executor(library, codeService, parameters) { - var messageListener = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new NullMessageListener(); - - _classCallCheck(this, Executor); - - this.library = library; - this.codeService = codeService; - this.parameters = parameters; - this.messageListener = messageListener; - } - - _createClass(Executor, [{ - key: "withLibrary", - value: function withLibrary(lib) { - this.library = lib; - return this; + else if (val.isQuantity) { + return { type: 'NamedTypeSpecifier', name: '{urn:hl7-org:elm-types:r1}DateTime' }; } - }, { - key: "withParameters", - value: function withParameters(params) { - this.parameters = params != null ? params : {}; - return this; + else if (Array.isArray(val)) { + // Get unique types from the array (by converting to string and putting in a Set) + var typesAsStrings = Array.from(new Set(val.map(function (v) { return JSON.stringify(guessSpecifierType(v)); }))); + var types = typesAsStrings.map(function (ts) { return (/^{/.test(ts) ? JSON.parse(ts) : ts); }); + return { + type: 'ListTypeSpecifier', + elementType: types.length == 1 ? types[0] : { type: 'ChoiceTypeSpecifier', choice: types } + }; } - }, { - key: "withCodeService", - value: function withCodeService(cs) { - this.codeService = cs; - return this; + else if (val.isInterval) { + return { + type: 'IntervalTypeSpecifier', + pointType: val.pointType + }; } - }, { - key: "withMessageListener", - value: function withMessageListener(ml) { - this.messageListener = ml; - return this; + else if (typeof val === 'object' && Object.keys(val).length > 0) { + return { + type: 'TupleTypeSpecifier', + element: Object.keys(val).map(function (k) { return ({ name: k, elementType: guessSpecifierType(val[k]) }); }) + }; } - }, { - key: "exec_expression", - value: function exec_expression(expression, patientSource, executionDateTime) { - var r = new Results(); - var expr = this.library.expressions[expression]; - - if (expr != null) { - while (patientSource.currentPatient()) { - var patient_ctx = new PatientContext(this.library, patientSource.currentPatient(), this.codeService, this.parameters, executionDateTime, this.messageListener); - r.recordPatientResults(patient_ctx, _defineProperty({}, expression, expr.execute(patient_ctx))); - patientSource.nextPatient(); + return 'Unknown'; +} +var IntervalTypeSpecifier = /** @class */ (function (_super) { + __extends(IntervalTypeSpecifier, _super); + function IntervalTypeSpecifier() { + return _super !== null && _super.apply(this, arguments) || this; + } + return IntervalTypeSpecifier; +}(expression_1.UnimplementedExpression)); +exports.IntervalTypeSpecifier = IntervalTypeSpecifier; +var ListTypeSpecifier = /** @class */ (function (_super) { + __extends(ListTypeSpecifier, _super); + function ListTypeSpecifier() { + return _super !== null && _super.apply(this, arguments) || this; + } + return ListTypeSpecifier; +}(expression_1.UnimplementedExpression)); +exports.ListTypeSpecifier = ListTypeSpecifier; +var NamedTypeSpecifier = /** @class */ (function (_super) { + __extends(NamedTypeSpecifier, _super); + function NamedTypeSpecifier() { + return _super !== null && _super.apply(this, arguments) || this; + } + return NamedTypeSpecifier; +}(expression_1.UnimplementedExpression)); +exports.NamedTypeSpecifier = NamedTypeSpecifier; +var TupleTypeSpecifier = /** @class */ (function (_super) { + __extends(TupleTypeSpecifier, _super); + function TupleTypeSpecifier() { + return _super !== null && _super.apply(this, arguments) || this; + } + return TupleTypeSpecifier; +}(expression_1.UnimplementedExpression)); +exports.TupleTypeSpecifier = TupleTypeSpecifier; + +},{"../datatypes/clinical":5,"../datatypes/datetime":7,"../datatypes/quantity":11,"../datatypes/ratio":12,"../datatypes/uncertainty":13,"../util/math":53,"../util/util":55,"./expression":22}],42:[function(require,module,exports){ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UnfilteredContext = exports.PatientContext = exports.Context = void 0; +var exception_1 = require("../datatypes/exception"); +var util_1 = require("../util/util"); +var dt = __importStar(require("../datatypes/datatypes")); +var messageListeners_1 = require("./messageListeners"); +var Context = /** @class */ (function () { + function Context(parent, _codeService, _parameters, executionDateTime, messageListener) { + this.parent = parent; + this._codeService = _codeService; + this.context_values = {}; + this.library_context = {}; + this.localId_context = {}; + this.evaluatedRecords = []; + // TODO: If there is an issue with number of parameters look into cql4browsers fix: 387ea77538182833283af65e6341e7a05192304c + this.checkParameters(_parameters !== null && _parameters !== void 0 ? _parameters : {}); // not crazy about possibly throwing an error in a constructor, but... + this._parameters = _parameters || {}; + this.executionDateTime = executionDateTime; + this.messageListener = messageListener; + } + Object.defineProperty(Context.prototype, "parameters", { + get: function () { + return this._parameters || (this.parent && this.parent.parameters); + }, + set: function (params) { + this.checkParameters(params); + this._parameters = params; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Context.prototype, "codeService", { + get: function () { + return this._codeService || (this.parent && this.parent.codeService); + }, + set: function (cs) { + this._codeService = cs; + }, + enumerable: false, + configurable: true + }); + Context.prototype.withParameters = function (params) { + this.parameters = params || {}; + return this; + }; + Context.prototype.withCodeService = function (cs) { + this.codeService = cs; + return this; + }; + Context.prototype.rootContext = function () { + if (this.parent) { + return this.parent.rootContext(); + } + else { + return this; + } + }; + Context.prototype.findRecords = function (profile) { + return this.parent && this.parent.findRecords(profile); + }; + Context.prototype.childContext = function (context_values) { + if (context_values === void 0) { context_values = {}; } + var ctx = new Context(this); + ctx.context_values = context_values; + return ctx; + }; + Context.prototype.getLibraryContext = function (library) { + return this.parent && this.parent.getLibraryContext(library); + }; + Context.prototype.getLocalIdContext = function (localId) { + return this.parent && this.parent.getLocalIdContext(localId); + }; + Context.prototype.getParameter = function (name) { + return this.parent && this.parent.getParameter(name); + }; + Context.prototype.getParentParameter = function (name) { + if (this.parent) { + if (this.parent.parameters[name] != null) { + return this.parent.parameters[name]; + } + else { + return this.parent.getParentParameter(name); + } + } + }; + Context.prototype.getTimezoneOffset = function () { + if (this.executionDateTime != null) { + return this.executionDateTime.timezoneOffset; + } + else if (this.parent && this.parent.getTimezoneOffset != null) { + return this.parent.getTimezoneOffset(); + } + else { + throw new exception_1.Exception('No Timezone Offset has been set'); + } + }; + Context.prototype.getExecutionDateTime = function () { + if (this.executionDateTime != null) { + return this.executionDateTime; + } + else if (this.parent && this.parent.getExecutionDateTime != null) { + return this.parent.getExecutionDateTime(); + } + else { + throw new exception_1.Exception('No Execution DateTime has been set'); + } + }; + Context.prototype.getMessageListener = function () { + if (this.messageListener != null) { + return this.messageListener; + } + else if (this.parent && this.parent.getMessageListener != null) { + return this.parent.getMessageListener(); + } + else { + return new messageListeners_1.NullMessageListener(); + } + }; + Context.prototype.getValueSet = function (name, library) { + return this.parent && this.parent.getValueSet(name, library); + }; + Context.prototype.getCodeSystem = function (name) { + return this.parent && this.parent.getCodeSystem(name); + }; + Context.prototype.getCode = function (name) { + return this.parent && this.parent.getCode(name); + }; + Context.prototype.getConcept = function (name) { + return this.parent && this.parent.getConcept(name); + }; + Context.prototype.get = function (identifier) { + // Check for undefined because if its null, we actually *do* want to return null (rather than + // looking at parent), but if it's really undefined, *then* look at the parent + if (typeof this.context_values[identifier] !== 'undefined') { + return this.context_values[identifier]; + } + else if (identifier === '$this') { + return this.context_values; + } + else { + return this.parent != null && this.parent.get(identifier); + } + }; + Context.prototype.set = function (identifier, value) { + this.context_values[identifier] = value; + }; + Context.prototype.setLocalIdWithResult = function (localId, value) { + // Temporary fix. Real fix will be to return a list of all result values for a given localId. + var ctx = this.localId_context[localId]; + if (ctx === false || ctx === null || ctx === undefined || ctx.length === 0) { + this.localId_context[localId] = value; + } + }; + Context.prototype.getLocalIdResult = function (localId) { + return this.localId_context[localId]; + }; + // Returns an object of objects containing each library name + // with the localIds and result values + Context.prototype.getAllLocalIds = function () { + var localIdResults = {}; + // Add the localIds and result values from the main library + localIdResults[this.parent.source.library.identifier.id] = {}; + localIdResults[this.parent.source.library.identifier.id] = this.localId_context; + // Iterate over support libraries and store localIds + for (var libName in this.library_context) { + var lib = this.library_context[libName]; + this.supportLibraryLocalIds(lib, localIdResults); + } + return localIdResults; + }; + // Recursive function that will grab nested support library localId results + Context.prototype.supportLibraryLocalIds = function (lib, localIdResults) { + var _this = this; + // Set library identifier name as the key and the object of localIds with their results as the value + // if it already exists then we need to merge the results instead of overwriting + if (localIdResults[lib.library.source.library.identifier.id] != null) { + this.mergeLibraryLocalIdResults(localIdResults, lib.library.source.library.identifier.id, lib.localId_context); + } + else { + localIdResults[lib.library.source.library.identifier.id] = lib.localId_context; + } + // Iterate over any support libraries in the current support library + Object.values(lib.library_context).forEach(function (supportLib) { + _this.supportLibraryLocalIds(supportLib, localIdResults); + }); + }; + // Merges the localId results for a library into the already collected results. The logic used for which result + // to keep is the same as the logic used above in setLocalIdWithResult, "falsey" results are always replaced. + Context.prototype.mergeLibraryLocalIdResults = function (localIdResults, libraryId, libraryResults) { + for (var localId in libraryResults) { + var localIdResult = libraryResults[localId]; + var existingResult = localIdResults[libraryId][localId]; + // overwite this localid result if the existing result is "falsey". future work could track all results for each localid + if (existingResult === false || + existingResult === null || + existingResult === undefined || + existingResult.length === 0) { + localIdResults[libraryId][localId] = localIdResult; + } + } + }; + Context.prototype.checkParameters = function (params) { + for (var pName in params) { + var pVal = params[pName]; + var pDef = this.getParameter(pName); + if (pVal == null) { + return; // Null can theoretically be any type + } + if (typeof pDef === 'undefined') { + return; // This will happen if the parameter is declared in a different (included) library + } + else if (pDef.parameterTypeSpecifier != null && + !this.matchesTypeSpecifier(pVal, pDef.parameterTypeSpecifier)) { + throw new Error("Passed in parameter '".concat(pName, "' is wrong type")); + } + else if (pDef['default'] != null && !this.matchesInstanceType(pVal, pDef['default'])) { + throw new Error("Passed in parameter '".concat(pName, "' is wrong type")); + } + } + return true; + }; + Context.prototype.matchesTypeSpecifier = function (val, spec) { + switch (spec.type) { + case 'NamedTypeSpecifier': + return this.matchesNamedTypeSpecifier(val, spec); + case 'ListTypeSpecifier': + return this.matchesListTypeSpecifier(val, spec); + case 'TupleTypeSpecifier': + return this.matchesTupleTypeSpecifier(val, spec); + case 'IntervalTypeSpecifier': + return this.matchesIntervalTypeSpecifier(val, spec); + case 'ChoiceTypeSpecifier': + return this.matchesChoiceTypeSpecifier(val, spec); + default: + return true; // default to true when we don't know + } + }; + Context.prototype.matchesListTypeSpecifier = function (val, spec) { + var _this = this; + return ((0, util_1.typeIsArray)(val) && val.every(function (x) { return _this.matchesTypeSpecifier(x, spec.elementType); })); + }; + Context.prototype.matchesTupleTypeSpecifier = function (val, spec) { + var _this = this; + // TODO: Spec is not clear about exactly how tuples should be matched + return (val != null && + typeof val === 'object' && + !(0, util_1.typeIsArray)(val) && + !val.isInterval && + !val.isConcept && + !val.isCode && + !val.isDateTime && + !val.isDate && + !val.isQuantity && + spec.element.every(function (x) { + return typeof val[x.name] === 'undefined' || + _this.matchesTypeSpecifier(val[x.name], x.elementType); + })); + }; + Context.prototype.matchesIntervalTypeSpecifier = function (val, spec) { + return (val.isInterval && + (val.low == null || this.matchesTypeSpecifier(val.low, spec.pointType)) && + (val.high == null || this.matchesTypeSpecifier(val.high, spec.pointType))); + }; + Context.prototype.matchesChoiceTypeSpecifier = function (val, spec) { + var _this = this; + return spec.choice.some(function (c) { return _this.matchesTypeSpecifier(val, c); }); + }; + Context.prototype.matchesNamedTypeSpecifier = function (val, spec) { + if (val == null) { + return true; + } + switch (spec.name) { + case '{urn:hl7-org:elm-types:r1}Boolean': + return typeof val === 'boolean'; + case '{urn:hl7-org:elm-types:r1}Decimal': + return typeof val === 'number'; + case '{urn:hl7-org:elm-types:r1}Integer': + return typeof val === 'number' && Math.floor(val) === val; + case '{urn:hl7-org:elm-types:r1}String': + return typeof val === 'string'; + case '{urn:hl7-org:elm-types:r1}Concept': + return val && val.isConcept; + case '{urn:hl7-org:elm-types:r1}Code': + return val && val.isCode; + case '{urn:hl7-org:elm-types:r1}DateTime': + return val && val.isDateTime; + case '{urn:hl7-org:elm-types:r1}Date': + return val && val.isDate; + case '{urn:hl7-org:elm-types:r1}Quantity': + return val && val.isQuantity; + case '{urn:hl7-org:elm-types:r1}Time': + return val && val.isTime && val.isTime(); + default: + // Use the data model's implementation of _is, if it is available + if (typeof val._is === 'function') { + return val._is(spec); + } + // If the value is an array or interval, then we assume it cannot be cast to a + // named type. Technically, this is not 100% true because a modelinfo can define + // a named type whose base type is a list or interval. But none of our models + // (FHIR, QDM, QICore) do that, so for those models, this approach will always be + // correct. + if (Array.isArray(val) || val.isInterval) { + return false; + } + // Otherwise just default to true to match legacy behavior. + // + // NOTE: This is also where arbitrary tuples land because they will not have + // an "is" function and we don't encode the type information into the runtime + // objects so we can't easily determine their type. We can't reject them, + // else things like `Encounter{ id: "1" } is Encounter` would return false. + // So for now we allow false positives in order to avoid false negatives. + return true; + } + }; + Context.prototype.matchesInstanceType = function (val, inst) { + if (inst.isBooleanLiteral) { + return typeof val === 'boolean'; + } + else if (inst.isDecimalLiteral) { + return typeof val === 'number'; + } + else if (inst.isIntegerLiteral) { + return typeof val === 'number' && Math.floor(val) === val; + } + else if (inst.isStringLiteral) { + return typeof val === 'string'; + } + else if (inst.isCode) { + return val && val.isCode; + } + else if (inst.isConcept) { + return val && val.isConcept; + } + else if (inst.isTime && inst.isTime()) { + return val && val.isTime && val.isTime(); + } + else if (inst.isDate) { + return val && val.isDate; + } + else if (inst.isDateTime) { + return val && val.isDateTime; + } + else if (inst.isQuantity) { + return val && val.isQuantity; + } + else if (inst.isList) { + return this.matchesListInstanceType(val, inst); + } + else if (inst.isTuple) { + return this.matchesTupleInstanceType(val, inst); + } + else if (inst.isInterval) { + return this.matchesIntervalInstanceType(val, inst); + } + return true; // default to true when we don't know for sure + }; + Context.prototype.matchesListInstanceType = function (val, list) { + var _this = this; + return ((0, util_1.typeIsArray)(val) && val.every(function (x) { return _this.matchesInstanceType(x, list.elements[0]); })); + }; + Context.prototype.matchesTupleInstanceType = function (val, tpl) { + var _this = this; + return (typeof val === 'object' && + !(0, util_1.typeIsArray)(val) && + tpl.elements.every(function (x) { + return typeof val[x.name] === 'undefined' || _this.matchesInstanceType(val[x.name], x.value); + })); + }; + Context.prototype.matchesIntervalInstanceType = function (val, ivl) { + var pointType = ivl.low != null ? ivl.low : ivl.high; + return (val.isInterval && + (val.low == null || this.matchesInstanceType(val.low, pointType)) && + (val.high == null || this.matchesInstanceType(val.high, pointType))); + }; + return Context; +}()); +exports.Context = Context; +var PatientContext = /** @class */ (function (_super) { + __extends(PatientContext, _super); + function PatientContext(library, patient, codeService, parameters, executionDateTime, messageListener) { + if (executionDateTime === void 0) { executionDateTime = dt.DateTime.fromJSDate(new Date()); } + if (messageListener === void 0) { messageListener = new messageListeners_1.NullMessageListener(); } + var _this = _super.call(this, library, codeService, parameters, executionDateTime, messageListener) || this; + _this.library = library; + _this.patient = patient; + return _this; + } + PatientContext.prototype.rootContext = function () { + return this; + }; + PatientContext.prototype.getLibraryContext = function (library) { + if (this.library_context[library] == null) { + this.library_context[library] = new PatientContext(this.get(library), this.patient, this.codeService, this.parameters, this.executionDateTime); + } + return this.library_context[library]; + }; + PatientContext.prototype.getLocalIdContext = function (localId) { + if (this.localId_context[localId] == null) { + this.localId_context[localId] = new PatientContext(this.get(localId), this.patient, this.codeService, this.parameters, this.executionDateTime); + } + return this.localId_context[localId]; + }; + PatientContext.prototype.findRecords = function (profile) { + return this.patient && this.patient.findRecords(profile); + }; + return PatientContext; +}(Context)); +exports.PatientContext = PatientContext; +var UnfilteredContext = /** @class */ (function (_super) { + __extends(UnfilteredContext, _super); + function UnfilteredContext(library, results, codeService, parameters, executionDateTime, messageListener) { + if (executionDateTime === void 0) { executionDateTime = dt.DateTime.fromJSDate(new Date()); } + if (messageListener === void 0) { messageListener = new messageListeners_1.NullMessageListener(); } + var _this = _super.call(this, library, codeService, parameters, executionDateTime, messageListener) || this; + _this.library = library; + _this.results = results; + return _this; + } + UnfilteredContext.prototype.rootContext = function () { + return this; + }; + UnfilteredContext.prototype.findRecords = function (_template) { + throw new exception_1.Exception('Retreives are not currently supported in Unfiltered Context'); + }; + UnfilteredContext.prototype.getLibraryContext = function (_library) { + throw new exception_1.Exception('Library expressions are not currently supported in Unfiltered Context'); + }; + UnfilteredContext.prototype.get = function (identifier) { + //First check to see if the identifier is a unfiltered context expression that has already been cached + if (this.context_values[identifier]) { + return this.context_values[identifier]; } - } - - return r; - } - }, { - key: "exec", - value: function exec(patientSource, executionDateTime) { - var r = this.exec_patient_context(patientSource, executionDateTime); - var unfilteredContext = new UnfilteredContext(this.library, r, this.codeService, this.parameters, executionDateTime, this.messageListener); - var resultMap = {}; - - for (var key in this.library.expressions) { - var expr = this.library.expressions[key]; - - if (expr.context === 'Unfiltered') { - resultMap[key] = expr.exec(unfilteredContext); + //if not look to see if the library has a unfiltered expression of that identifier + if (this.library[identifier] && this.library[identifier].context === 'Unfiltered') { + return this.library.expressions[identifier]; } - } - - r.recordUnfilteredResults(resultMap); - return r; - } - }, { - key: "exec_patient_context", - value: function exec_patient_context(patientSource, executionDateTime) { - var r = new Results(); + //lastley attempt to gather all patient level results that have that identifier + // should this compact null values before return ? + return Object.values(this.results.patientResults).map(function (pr) { return pr[identifier]; }); + }; + return UnfilteredContext; +}(Context)); +exports.UnfilteredContext = UnfilteredContext; - while (patientSource.currentPatient()) { - var patient_ctx = new PatientContext(this.library, patientSource.currentPatient(), this.codeService, this.parameters, executionDateTime, this.messageListener); +},{"../datatypes/datatypes":6,"../datatypes/exception":8,"../util/util":55,"./messageListeners":44}],43:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Executor = void 0; +var messageListeners_1 = require("./messageListeners"); +var results_1 = require("./results"); +var context_1 = require("./context"); +var Executor = /** @class */ (function () { + function Executor(library, codeService, parameters, messageListener) { + if (messageListener === void 0) { messageListener = new messageListeners_1.NullMessageListener(); } + this.library = library; + this.codeService = codeService; + this.parameters = parameters; + this.messageListener = messageListener; + } + Executor.prototype.withLibrary = function (lib) { + this.library = lib; + return this; + }; + Executor.prototype.withParameters = function (params) { + this.parameters = params != null ? params : {}; + return this; + }; + Executor.prototype.withCodeService = function (cs) { + this.codeService = cs; + return this; + }; + Executor.prototype.withMessageListener = function (ml) { + this.messageListener = ml; + return this; + }; + Executor.prototype.exec_expression = function (expression, patientSource, executionDateTime) { + var _a; + var r = new results_1.Results(); + var expr = this.library.expressions[expression]; + if (expr != null) { + while (patientSource.currentPatient()) { + var patient_ctx = new context_1.PatientContext(this.library, patientSource.currentPatient(), this.codeService, this.parameters, executionDateTime, this.messageListener); + r.recordPatientResults(patient_ctx, (_a = {}, _a[expression] = expr.execute(patient_ctx), _a)); + patientSource.nextPatient(); + } + } + return r; + }; + Executor.prototype.exec = function (patientSource, executionDateTime) { + var r = this.exec_patient_context(patientSource, executionDateTime); + var unfilteredContext = new context_1.UnfilteredContext(this.library, r, this.codeService, this.parameters, executionDateTime, this.messageListener); var resultMap = {}; - for (var key in this.library.expressions) { - var expr = this.library.expressions[key]; - - if (expr.context === 'Patient') { - resultMap[key] = expr.execute(patient_ctx); - } + var expr = this.library.expressions[key]; + if (expr.context === 'Unfiltered') { + resultMap[key] = expr.exec(unfilteredContext); + } } + r.recordUnfilteredResults(resultMap); + return r; + }; + Executor.prototype.exec_patient_context = function (patientSource, executionDateTime) { + var r = new results_1.Results(); + while (patientSource.currentPatient()) { + var patient_ctx = new context_1.PatientContext(this.library, patientSource.currentPatient(), this.codeService, this.parameters, executionDateTime, this.messageListener); + var resultMap = {}; + for (var key in this.library.expressions) { + var expr = this.library.expressions[key]; + if (expr.context === 'Patient') { + resultMap[key] = expr.execute(patient_ctx); + } + } + r.recordPatientResults(patient_ctx, resultMap); + patientSource.nextPatient(); + } + return r; + }; + return Executor; +}()); +exports.Executor = Executor; - r.recordPatientResults(patient_ctx, resultMap); - patientSource.nextPatient(); - } - - return r; - } - }]); - - return Executor; -}(); - -module.exports = { - Executor: Executor -}; },{"./context":42,"./messageListeners":44,"./results":46}],44:[function(require,module,exports){ "use strict"; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var NullMessageListener = /*#__PURE__*/function () { - function NullMessageListener() { - _classCallCheck(this, NullMessageListener); - } - - _createClass(NullMessageListener, [{ - key: "onMessage", - value: function onMessage(source, code, severity, message) {// do nothing - } - }]); - - return NullMessageListener; -}(); - -var ConsoleMessageListener = /*#__PURE__*/function () { - function ConsoleMessageListener() { - var logSourceOnTrace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - _classCallCheck(this, ConsoleMessageListener); - - this.logSourceOnTrace = logSourceOnTrace; - } - - _createClass(ConsoleMessageListener, [{ - key: "onMessage", - value: function onMessage(source, code, severity, message) { - // eslint-disable-next-line no-console - var print = severity === 'Error' ? console.error : console.log; - var content = "".concat(severity, ": [").concat(code, "] ").concat(message); - - if (severity === 'Trace' && this.logSourceOnTrace) { - content += "\n<<<<< SOURCE:\n".concat(JSON.stringify(source), "\n>>>>>"); - } - - print(content); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ConsoleMessageListener = exports.NullMessageListener = void 0; +var NullMessageListener = /** @class */ (function () { + function NullMessageListener() { } - }]); - - return ConsoleMessageListener; -}(); + NullMessageListener.prototype.onMessage = function (_source, _code, _severity, _message) { + // do nothing + }; + return NullMessageListener; +}()); +exports.NullMessageListener = NullMessageListener; +var ConsoleMessageListener = /** @class */ (function () { + function ConsoleMessageListener(logSourceOnTrace) { + if (logSourceOnTrace === void 0) { logSourceOnTrace = false; } + this.logSourceOnTrace = logSourceOnTrace; + } + ConsoleMessageListener.prototype.onMessage = function (source, code, severity, message) { + // eslint-disable-next-line no-console + var print = severity === 'Error' ? console.error : console.log; + var content = "".concat(severity, ": [").concat(code, "] ").concat(message); + if (severity === 'Trace' && this.logSourceOnTrace) { + content += "\n<<<<< SOURCE:\n".concat(JSON.stringify(source), "\n>>>>>"); + } + print(content); + }; + return ConsoleMessageListener; +}()); +exports.ConsoleMessageListener = ConsoleMessageListener; -module.exports = { - NullMessageListener: NullMessageListener, - ConsoleMessageListener: ConsoleMessageListener -}; },{}],45:[function(require,module,exports){ "use strict"; - -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var _require = require('../elm/library'), - Library = _require.Library; - -var Repository = /*#__PURE__*/function () { - function Repository(data) { - _classCallCheck(this, Repository); - - this.data = data; - this.libraries = Array.from(Object.values(data)); - } - - _createClass(Repository, [{ - key: "resolve", - value: function resolve(path, version) { - var _iterator = _createForOfIteratorHelper(this.libraries), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var lib = _step.value; - - if (lib.library && lib.library.identifier) { - var _lib$library$identifi = lib.library.identifier, - id = _lib$library$identifi.id, - system = _lib$library$identifi.system, - libraryVersion = _lib$library$identifi.version; - var libraryUri = "".concat(system, "/").concat(id); - - if (path === libraryUri || path === id) { - if (version) { - if (libraryVersion === version) { - return new Library(lib, this); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Repository = void 0; +var library_1 = require("../elm/library"); +var Repository = /** @class */ (function () { + function Repository(data) { + this.data = data; + this.libraries = Array.from(Object.values(data)); + } + Repository.prototype.resolve = function (path, version) { + for (var _i = 0, _a = this.libraries; _i < _a.length; _i++) { + var lib = _a[_i]; + if (lib.library && lib.library.identifier) { + var _b = lib.library.identifier, id = _b.id, system = _b.system, libraryVersion = _b.version; + var libraryUri = "".concat(system, "/").concat(id); + if (path === libraryUri || path === id) { + if (version) { + if (libraryVersion === version) { + return new library_1.Library(lib, this); + } + } + else { + return new library_1.Library(lib, this); + } } - } else { - return new Library(lib, this); - } } - } } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } - }]); - - return Repository; -}(); + }; + return Repository; +}()); +exports.Repository = Repository; -module.exports = { - Repository: Repository -}; },{"../elm/library":27}],46:[function(require,module,exports){ "use strict"; - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var Results = /*#__PURE__*/function () { - function Results() { - _classCallCheck(this, Results); - - this.patientResults = {}; - this.unfilteredResults = {}; - this.localIdPatientResultsMap = {}; - this.patientEvaluatedRecords = {}; - } // Expose an evaluatedRecords array for backwards compatibility - - - _createClass(Results, [{ - key: "evaluatedRecords", - get: function get() { - var _ref; - - return (_ref = []).concat.apply(_ref, _toConsumableArray(Object.values(this.patientEvaluatedRecords))); - } - }, { - key: "recordPatientResults", - value: function recordPatientResults(patient_ctx, resultMap) { - var _this = this; - - var p = patient_ctx.patient; // NOTE: From now on prefer getId() over id() because some data models may have an id property - // that is not a string (e.g., FHIR) -- so reserve getId() for the API (and expect a string - // representation) but leave id() for data-model specific formats. - - var patientId = typeof p.getId === 'function' ? p.getId() : p.id(); // Record the results - - this.patientResults[patientId] = resultMap; // Record the local IDs - - this.localIdPatientResultsMap[patientId] = patient_ctx.getAllLocalIds(); // Record the evaluatedRecords, merging with an aggregated array across all libraries - - this.patientEvaluatedRecords[patientId] = _toConsumableArray(patient_ctx.evaluatedRecords); - Object.values(patient_ctx.library_context).forEach(function (ctx) { - var _this$patientEvaluate; - - (_this$patientEvaluate = _this.patientEvaluatedRecords[patientId]).push.apply(_this$patientEvaluate, _toConsumableArray(ctx.evaluatedRecords)); - }); - } - }, { - key: "recordUnfilteredResults", - value: function recordUnfilteredResults(resultMap) { - this.unfilteredResults = resultMap; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } } - }]); - - return Results; -}(); - -module.exports = { - Results: Results + return to.concat(ar || Array.prototype.slice.call(from)); }; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Results = void 0; +var Results = /** @class */ (function () { + function Results() { + this.patientResults = {}; + this.unfilteredResults = {}; + this.localIdPatientResultsMap = {}; + this.patientEvaluatedRecords = {}; + } + Object.defineProperty(Results.prototype, "evaluatedRecords", { + // Expose an evaluatedRecords array for backwards compatibility + get: function () { + return [].concat.apply([], Object.values(this.patientEvaluatedRecords)); + }, + enumerable: false, + configurable: true + }); + Results.prototype.recordPatientResults = function (patient_ctx, resultMap) { + var _this = this; + var p = patient_ctx.patient; + // NOTE: From now on prefer getId() over id() because some data models may have an id property + // that is not a string (e.g., FHIR) -- so reserve getId() for the API (and expect a string + // representation) but leave id() for data-model specific formats. + var patientId = typeof p.getId === 'function' ? p.getId() : p.id(); + // Record the results + this.patientResults[patientId] = resultMap; + // Record the local IDs + this.localIdPatientResultsMap[patientId] = patient_ctx.getAllLocalIds(); + // Record the evaluatedRecords, merging with an aggregated array across all libraries + this.patientEvaluatedRecords[patientId] = __spreadArray([], patient_ctx.evaluatedRecords, true); + Object.values(patient_ctx.library_context).forEach(function (ctx) { + var _a; + (_a = _this.patientEvaluatedRecords[patientId]).push.apply(_a, ctx.evaluatedRecords); + }); + }; + Results.prototype.recordUnfilteredResults = function (resultMap) { + this.unfilteredResults = resultMap; + }; + return Results; +}()); +exports.Results = Results; + },{}],47:[function(require,module,exports){ "use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +},{}],48:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +},{}],49:[function(require,module,exports){ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./cql-code-service.interfaces"), exports); +__exportStar(require("./cql-patient.interfaces"), exports); +__exportStar(require("./runtime.types"), exports); +__exportStar(require("./type-specifiers.interfaces"), exports); -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } +},{"./cql-code-service.interfaces":47,"./cql-patient.interfaces":48,"./runtime.types":50,"./type-specifiers.interfaces":51}],50:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); -var _require = require('../datatypes/uncertainty'), - Uncertainty = _require.Uncertainty; +},{}],51:[function(require,module,exports){ +"use strict"; +// Types derived from http://cql.hl7.org/04-logicalspecification.html#typespecifier +Object.defineProperty(exports, "__esModule", { value: true }); +},{}],52:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.equals = exports.equivalent = exports.greaterThanOrEquals = exports.greaterThan = exports.lessThanOrEquals = exports.lessThan = void 0; +var datatypes_1 = require("../datatypes/datatypes"); function areNumbers(a, b) { - return typeof a === 'number' && typeof b === 'number'; + return typeof a === 'number' && typeof b === 'number'; } - function areStrings(a, b) { - return typeof a === 'string' && typeof b === 'string'; + return typeof a === 'string' && typeof b === 'string'; } - function areDateTimesOrQuantities(a, b) { - return a && a.isDateTime && b && b.isDateTime || a && a.isDate && b && b.isDate || a && a.isQuantity && b && b.isQuantity; + return ((a && a.isDateTime && b && b.isDateTime) || + (a && a.isDate && b && b.isDate) || + (a && a.isQuantity && b && b.isQuantity)); } - function isUncertainty(x) { - return x instanceof Uncertainty; + return x instanceof datatypes_1.Uncertainty; } - function lessThan(a, b, precision) { - if (areNumbers(a, b) || areStrings(a, b)) { - return a < b; - } else if (areDateTimesOrQuantities(a, b)) { - return a.before(b, precision); - } else if (isUncertainty(a)) { - return a.lessThan(b); - } else if (isUncertainty(b)) { - return Uncertainty.from(a).lessThan(b); - } else { - return null; - } + if (areNumbers(a, b) || areStrings(a, b)) { + return a < b; + } + else if (areDateTimesOrQuantities(a, b)) { + return a.before(b, precision); + } + else if (isUncertainty(a)) { + return a.lessThan(b); + } + else if (isUncertainty(b)) { + return datatypes_1.Uncertainty.from(a).lessThan(b); + } + else { + return null; + } } - +exports.lessThan = lessThan; function lessThanOrEquals(a, b, precision) { - if (areNumbers(a, b) || areStrings(a, b)) { - return a <= b; - } else if (areDateTimesOrQuantities(a, b)) { - return a.sameOrBefore(b, precision); - } else if (isUncertainty(a)) { - return a.lessThanOrEquals(b); - } else if (isUncertainty(b)) { - return Uncertainty.from(a).lessThanOrEquals(b); - } else { - return null; - } + if (areNumbers(a, b) || areStrings(a, b)) { + return a <= b; + } + else if (areDateTimesOrQuantities(a, b)) { + return a.sameOrBefore(b, precision); + } + else if (isUncertainty(a)) { + return a.lessThanOrEquals(b); + } + else if (isUncertainty(b)) { + return datatypes_1.Uncertainty.from(a).lessThanOrEquals(b); + } + else { + return null; + } } - +exports.lessThanOrEquals = lessThanOrEquals; function greaterThan(a, b, precision) { - if (areNumbers(a, b) || areStrings(a, b)) { - return a > b; - } else if (areDateTimesOrQuantities(a, b)) { - return a.after(b, precision); - } else if (isUncertainty(a)) { - return a.greaterThan(b); - } else if (isUncertainty(b)) { - return Uncertainty.from(a).greaterThan(b); - } else { - return null; - } + if (areNumbers(a, b) || areStrings(a, b)) { + return a > b; + } + else if (areDateTimesOrQuantities(a, b)) { + return a.after(b, precision); + } + else if (isUncertainty(a)) { + return a.greaterThan(b); + } + else if (isUncertainty(b)) { + return datatypes_1.Uncertainty.from(a).greaterThan(b); + } + else { + return null; + } } - +exports.greaterThan = greaterThan; function greaterThanOrEquals(a, b, precision) { - if (areNumbers(a, b) || areStrings(a, b)) { - return a >= b; - } else if (areDateTimesOrQuantities(a, b)) { - return a.sameOrAfter(b, precision); - } else if (isUncertainty(a)) { - return a.greaterThanOrEquals(b); - } else if (isUncertainty(b)) { - return Uncertainty.from(a).greaterThanOrEquals(b); - } else { - return null; - } + if (areNumbers(a, b) || areStrings(a, b)) { + return a >= b; + } + else if (areDateTimesOrQuantities(a, b)) { + return a.sameOrAfter(b, precision); + } + else if (isUncertainty(a)) { + return a.greaterThanOrEquals(b); + } + else if (isUncertainty(b)) { + return datatypes_1.Uncertainty.from(a).greaterThanOrEquals(b); + } + else { + return null; + } } - +exports.greaterThanOrEquals = greaterThanOrEquals; function equivalent(a, b) { - if (a == null && b == null) { - return true; - } - - if (a == null || b == null) { - return false; - } - - if (isCode(a)) { - return codesAreEquivalent(a, b); - } // Quantity equivalence is the same as Quantity equality - - - if (a.isQuantity) { - return a.equals(b); - } // Use overloaded 'equivalent' function if it is available - - - if (typeof a.equivalent === 'function') { - return a.equivalent(b); - } - - var _getClassOfObjects = getClassOfObjects(a, b), - _getClassOfObjects2 = _slicedToArray(_getClassOfObjects, 2), - aClass = _getClassOfObjects2[0], - bClass = _getClassOfObjects2[1]; - - switch (aClass) { - case '[object Array]': - return compareEveryItemInArrays(a, b, equivalent); - - case '[object Object]': - return compareObjects(a, b, equivalent); - - case '[object String]': - // Make sure b is also a string - if (bClass === '[object String]') { - // String equivalence is case- and locale insensitive - a = a.replace(/\s/g, ' '); - b = b.replace(/\s/g, ' '); - return a.localeCompare(b, 'en', { - sensitivity: 'base' - }) === 0; - } - - break; - } - - return equals(a, b); + if (a == null && b == null) { + return true; + } + if (a == null || b == null) { + return false; + } + if (isCode(a)) { + return codesAreEquivalent(a, b); + } + // Quantity equivalence is the same as Quantity equality + if (a.isQuantity) { + return a.equals(b); + } + // Use overloaded 'equivalent' function if it is available + if (typeof a.equivalent === 'function') { + return a.equivalent(b); + } + var _a = getClassOfObjects(a, b), aClass = _a[0], bClass = _a[1]; + switch (aClass) { + case '[object Array]': + return compareEveryItemInArrays(a, b, equivalent); + case '[object Object]': + return compareObjects(a, b, equivalent); + case '[object String]': + // Make sure b is also a string + if (bClass === '[object String]') { + // String equivalence is case- and locale insensitive + a = a.replace(/\s/g, ' '); + b = b.replace(/\s/g, ' '); + return a.localeCompare(b, 'en', { sensitivity: 'base' }) === 0; + } + break; + } + return equals(a, b); } - +exports.equivalent = equivalent; function isCode(object) { - return object.hasMatch && typeof object.hasMatch === 'function'; + return object.hasMatch && typeof object.hasMatch === 'function'; } - function codesAreEquivalent(code1, code2) { - return code1.hasMatch(code2); + return code1.hasMatch(code2); } - function getClassOfObjects(object1, object2) { - return [object1, object2].map(function (obj) { - return {}.toString.call(obj); - }); + return [object1, object2].map(function (obj) { return ({}.toString.call(obj)); }); } - function compareEveryItemInArrays(array1, array2, comparisonFunction) { - return array1.length === array2.length && array1.every(function (item, i) { - return comparisonFunction(item, array2[i]); - }); + return (array1.length === array2.length && + array1.every(function (item, i) { return comparisonFunction(item, array2[i]); })); } - function compareObjects(a, b, comparisonFunction) { - if (!classesEqual(a, b)) { - return false; - } - - return deepCompareKeysAndValues(a, b, comparisonFunction); + if (!classesEqual(a, b)) { + return false; + } + return deepCompareKeysAndValues(a, b, comparisonFunction); } - function classesEqual(object1, object2) { - return object2 instanceof object1.constructor && object1 instanceof object2.constructor; + return object2 instanceof object1.constructor && object1 instanceof object2.constructor; } - function deepCompareKeysAndValues(a, b, comparisonFunction) { - var finalComparisonResult; - var aKeys = getKeysFromObject(a).sort(); - var bKeys = getKeysFromObject(b).sort(); // Array.every() will only return true or false, so set a flag for if we should return null - - var shouldReturnNull = false; // Check if both arrays of keys are the same length and key names match - - if (aKeys.length === bKeys.length && aKeys.every(function (value, index) { - return value === bKeys[index]; - })) { - finalComparisonResult = aKeys.every(function (key) { - // if both are null we should return true to satisfy ignoring empty values in tuples - if (a[key] == null && b[key] == null) { - return true; - } - - var comparisonResult = comparisonFunction(a[key], b[key]); - - if (comparisonResult === null) { - shouldReturnNull = true; - } - - return comparisonResult; - }); - } else { - finalComparisonResult = false; - } - - if (shouldReturnNull) { - return null; - } - - return finalComparisonResult; + var finalComparisonResult; + var aKeys = getKeysFromObject(a).sort(); + var bKeys = getKeysFromObject(b).sort(); + // Array.every() will only return true or false, so set a flag for if we should return null + var shouldReturnNull = false; + // Check if both arrays of keys are the same length and key names match + if (aKeys.length === bKeys.length && aKeys.every(function (value, index) { return value === bKeys[index]; })) { + finalComparisonResult = aKeys.every(function (key) { + // if both are null we should return true to satisfy ignoring empty values in tuples + if (a[key] == null && b[key] == null) { + return true; + } + var comparisonResult = comparisonFunction(a[key], b[key]); + if (comparisonResult === null) { + shouldReturnNull = true; + } + return comparisonResult; + }); + } + else { + finalComparisonResult = false; + } + if (shouldReturnNull) { + return null; + } + return finalComparisonResult; } - function getKeysFromObject(object) { - return Object.keys(object).filter(function (k) { - return !isFunction(object[k]); - }); + return Object.keys(object).filter(function (k) { return !isFunction(object[k]); }); } - function isFunction(input) { - return input instanceof Function || {}.toString.call(input) === '[object Function]'; + return input instanceof Function || {}.toString.call(input) === '[object Function]'; } - function equals(a, b) { - // Handle null cases first: spec says if either is null, return null - if (a == null || b == null) { - return null; - } // If one is a Quantity, use the Quantity equals function - - - if (a && a.isQuantity) { - return a.equals(b); - } // If one is a Ratio, use the ratio equals function - - - if (a && a.isRatio) { - return a.equals(b); - } // If one is an Uncertainty, convert the other to an Uncertainty - - - if (a instanceof Uncertainty) { - b = Uncertainty.from(b); - } else if (b instanceof Uncertainty) { - a = Uncertainty.from(a); - } // Use overloaded 'equals' function if it is available - - - if (typeof a.equals === 'function') { - return a.equals(b); - } // Return true of the objects are primitives and are strictly equal - - - if (_typeof(a) === _typeof(b) && typeof a === 'string' || typeof a === 'number' || typeof a === 'boolean') { - return a === b; - } // Return false if they are instances of different classes - - - var _getClassOfObjects3 = getClassOfObjects(a, b), - _getClassOfObjects4 = _slicedToArray(_getClassOfObjects3, 2), - aClass = _getClassOfObjects4[0], - bClass = _getClassOfObjects4[1]; - - if (aClass !== bClass) { - return false; - } - - switch (aClass) { - case '[object Date]': - // Compare the ms since epoch - return a.getTime() === b.getTime(); - - case '[object RegExp]': - // Compare the components of the regular expression - return ['source', 'global', 'ignoreCase', 'multiline'].every(function (p) { - return a[p] === b[p]; - }); - - case '[object Array]': - if (a.indexOf(null) >= 0 || a.indexOf(undefined) >= 0 || b.indexOf(null) >= 0 || b.indexOf(undefined) >= 0) { + // Handle null cases first: spec says if either is null, return null + if (a == null || b == null) { return null; - } - - return compareEveryItemInArrays(a, b, equals); - - case '[object Object]': - return compareObjects(a, b, equals); - - case '[object Function]': - return a.toString() === b.toString(); - } // If we made it this far, we can't handle it - - - return false; + } + // If one is a Quantity, use the Quantity equals function + if (a && a.isQuantity) { + return a.equals(b); + } + // If one is a Ratio, use the ratio equals function + if (a && a.isRatio) { + return a.equals(b); + } + // If one is an Uncertainty, convert the other to an Uncertainty + if (a instanceof datatypes_1.Uncertainty) { + b = datatypes_1.Uncertainty.from(b); + } + else if (b instanceof datatypes_1.Uncertainty) { + a = datatypes_1.Uncertainty.from(a); + } + // Use overloaded 'equals' function if it is available + if (typeof a.equals === 'function') { + return a.equals(b); + } + // Return true of the objects are primitives and are strictly equal + if ((typeof a === typeof b && typeof a === 'string') || + typeof a === 'number' || + typeof a === 'boolean') { + return a === b; + } + // Return false if they are instances of different classes + var _a = getClassOfObjects(a, b), aClass = _a[0], bClass = _a[1]; + if (aClass !== bClass) { + return false; + } + switch (aClass) { + case '[object Date]': + // Compare the ms since epoch + return a.getTime() === b.getTime(); + case '[object RegExp]': + // Compare the components of the regular expression + return ['source', 'global', 'ignoreCase', 'multiline'].every(function (p) { return a[p] === b[p]; }); + case '[object Array]': + if (a.indexOf(null) >= 0 || + a.indexOf(undefined) >= 0 || + b.indexOf(null) >= 0 || + b.indexOf(undefined) >= 0) { + return null; + } + return compareEveryItemInArrays(a, b, equals); + case '[object Object]': + return compareObjects(a, b, equals); + case '[object Function]': + return a.toString() === b.toString(); + } + // If we made it this far, we can't handle it + return false; } +exports.equals = equals; -module.exports = { - lessThan: lessThan, - lessThanOrEquals: lessThanOrEquals, - greaterThan: greaterThan, - greaterThanOrEquals: greaterThanOrEquals, - equivalent: equivalent, - equals: equals -}; -},{"../datatypes/uncertainty":13}],48:[function(require,module,exports){ +},{"../datatypes/datatypes":6}],53:[function(require,module,exports){ "use strict"; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -var _require = require('../datatypes/exception'), - Exception = _require.Exception; - -var _require2 = require('../datatypes/datetime'), - MIN_DATETIME_VALUE = _require2.MIN_DATETIME_VALUE, - MAX_DATETIME_VALUE = _require2.MAX_DATETIME_VALUE, - MIN_DATE_VALUE = _require2.MIN_DATE_VALUE, - MAX_DATE_VALUE = _require2.MAX_DATE_VALUE, - MIN_TIME_VALUE = _require2.MIN_TIME_VALUE, - MAX_TIME_VALUE = _require2.MAX_TIME_VALUE; - -var _require3 = require('../datatypes/uncertainty'), - Uncertainty = _require3.Uncertainty; - -var MAX_INT_VALUE = Math.pow(2, 31) - 1; -var MIN_INT_VALUE = Math.pow(-2, 31); -var MAX_FLOAT_VALUE = 99999999999999999999.99999999; -var MIN_FLOAT_VALUE = -99999999999999999999.99999999; -var MIN_FLOAT_PRECISION_VALUE = Math.pow(10, -8); - +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decimalOrNull = exports.decimalAdjust = exports.minValueForType = exports.minValueForInstance = exports.maxValueForType = exports.maxValueForInstance = exports.predecessor = exports.successor = exports.OverFlowException = exports.limitDecimalPrecision = exports.isValidDecimal = exports.isValidInteger = exports.overflowsOrUnderflows = exports.MAX_TIME_VALUE = exports.MIN_TIME_VALUE = exports.MAX_DATE_VALUE = exports.MIN_DATE_VALUE = exports.MAX_DATETIME_VALUE = exports.MIN_DATETIME_VALUE = exports.MIN_FLOAT_PRECISION_VALUE = exports.MIN_FLOAT_VALUE = exports.MAX_FLOAT_VALUE = exports.MIN_INT_VALUE = exports.MAX_INT_VALUE = void 0; +/* eslint-disable @typescript-eslint/no-loss-of-precision */ +var exception_1 = require("../datatypes/exception"); +var datetime_1 = require("../datatypes/datetime"); +var uncertainty_1 = require("../datatypes/uncertainty"); +exports.MAX_INT_VALUE = Math.pow(2, 31) - 1; +exports.MIN_INT_VALUE = Math.pow(-2, 31); +exports.MAX_FLOAT_VALUE = 99999999999999999999.99999999; +exports.MIN_FLOAT_VALUE = -99999999999999999999.99999999; +exports.MIN_FLOAT_PRECISION_VALUE = Math.pow(10, -8); +exports.MIN_DATETIME_VALUE = datetime_1.MIN_DATETIME_VALUE; +exports.MAX_DATETIME_VALUE = datetime_1.MAX_DATETIME_VALUE; +exports.MIN_DATE_VALUE = datetime_1.MIN_DATE_VALUE; +exports.MAX_DATE_VALUE = datetime_1.MAX_DATE_VALUE; +exports.MIN_TIME_VALUE = datetime_1.MIN_TIME_VALUE; +exports.MAX_TIME_VALUE = datetime_1.MAX_TIME_VALUE; function overflowsOrUnderflows(value) { - if (value == null) { - return false; - } - - if (value.isQuantity) { - if (!isValidDecimal(value.value)) { - return true; - } - } else if (value.isTime && value.isTime()) { - if (value.after(MAX_TIME_VALUE)) { - return true; + if (value == null) { + return false; } - - if (value.before(MIN_TIME_VALUE)) { - return true; + if (value.isQuantity) { + if (!isValidDecimal(value.value)) { + return true; + } } - } else if (value.isDateTime) { - if (value.after(MAX_DATETIME_VALUE)) { - return true; + else if (value.isTime && value.isTime()) { + if (value.after(exports.MAX_TIME_VALUE)) { + return true; + } + if (value.before(exports.MIN_TIME_VALUE)) { + return true; + } } - - if (value.before(MIN_DATETIME_VALUE)) { - return true; + else if (value.isDateTime) { + if (value.after(exports.MAX_DATETIME_VALUE)) { + return true; + } + if (value.before(exports.MIN_DATETIME_VALUE)) { + return true; + } } - } else if (value.isDate) { - if (value.after(MAX_DATE_VALUE)) { - return true; + else if (value.isDate) { + if (value.after(exports.MAX_DATE_VALUE)) { + return true; + } + if (value.before(exports.MIN_DATE_VALUE)) { + return true; + } } - - if (value.before(MIN_DATE_VALUE)) { - return true; + else if (Number.isInteger(value)) { + if (!isValidInteger(value)) { + return true; + } } - } else if (Number.isInteger(value)) { - if (!isValidInteger(value)) { - return true; + else if (value.isUncertainty) { + return overflowsOrUnderflows(value.low) || overflowsOrUnderflows(value.high); } - } else if (value.isUncertainty) { - return overflowsOrUnderflows(value.low) || overflowsOrUnderflows(value.high); - } else { - if (!isValidDecimal(value)) { - return true; + else { + if (!isValidDecimal(value)) { + return true; + } } - } - - return false; + return false; } - +exports.overflowsOrUnderflows = overflowsOrUnderflows; function isValidInteger(integer) { - if (isNaN(integer)) { - return false; - } - - if (integer > MAX_INT_VALUE) { - return false; - } - - if (integer < MIN_INT_VALUE) { - return false; - } - - return true; + if (isNaN(integer)) { + return false; + } + if (integer > exports.MAX_INT_VALUE) { + return false; + } + if (integer < exports.MIN_INT_VALUE) { + return false; + } + return true; } - +exports.isValidInteger = isValidInteger; function isValidDecimal(decimal) { - if (isNaN(decimal)) { - return false; - } - - if (decimal > MAX_FLOAT_VALUE) { - return false; - } - - if (decimal < MIN_FLOAT_VALUE) { - return false; - } - - return true; + if (isNaN(decimal)) { + return false; + } + if (decimal > exports.MAX_FLOAT_VALUE) { + return false; + } + if (decimal < exports.MIN_FLOAT_VALUE) { + return false; + } + return true; } - +exports.isValidDecimal = isValidDecimal; function limitDecimalPrecision(decimal) { - var decimalString = decimal.toString(); // For decimals so large that they are represented in scientific notation, javascript has already limited - // the decimal to its own constraints, so we can't determine the original precision. Leave as-is unless - // this becomes problematic, in which case we would need our own parseFloat. - - if (decimalString.indexOf('e') !== -1) { - return decimal; - } - - var splitDecimalString = decimalString.split('.'); - var decimalPoints = splitDecimalString[1]; - - if (decimalPoints != null && decimalPoints.length > 8) { - decimalString = splitDecimalString[0] + '.' + splitDecimalString[1].substring(0, 8); - } - - return parseFloat(decimalString); + var decimalString = decimal.toString(); + // For decimals so large that they are represented in scientific notation, javascript has already limited + // the decimal to its own constraints, so we can't determine the original precision. Leave as-is unless + // this becomes problematic, in which case we would need our own parseFloat. + if (decimalString.indexOf('e') !== -1) { + return decimal; + } + var splitDecimalString = decimalString.split('.'); + var decimalPoints = splitDecimalString[1]; + if (decimalPoints != null && decimalPoints.length > 8) { + decimalString = splitDecimalString[0] + '.' + splitDecimalString[1].substring(0, 8); + } + return parseFloat(decimalString); } - -var OverFlowException = /*#__PURE__*/function (_Exception) { - _inherits(OverFlowException, _Exception); - - var _super = _createSuper(OverFlowException); - - function OverFlowException() { - _classCallCheck(this, OverFlowException); - - return _super.apply(this, arguments); - } - - return OverFlowException; -}(Exception); - +exports.limitDecimalPrecision = limitDecimalPrecision; +var OverFlowException = /** @class */ (function (_super) { + __extends(OverFlowException, _super); + function OverFlowException() { + return _super !== null && _super.apply(this, arguments) || this; + } + return OverFlowException; +}(exception_1.Exception)); +exports.OverFlowException = OverFlowException; function successor(val) { - if (typeof val === 'number') { - if (parseInt(val) === val) { - if (val >= MAX_INT_VALUE) { - throw new OverFlowException(); - } else { - return val + 1; - } - } else { - if (val >= MAX_FLOAT_VALUE) { - throw new OverFlowException(); - } else { - return val + MIN_FLOAT_PRECISION_VALUE; - } + if (typeof val === 'number') { + if (Number.isInteger(val)) { + if (val >= exports.MAX_INT_VALUE) { + throw new OverFlowException(); + } + else { + return val + 1; + } + } + else { + if (val >= exports.MAX_FLOAT_VALUE) { + throw new OverFlowException(); + } + else { + return val + exports.MIN_FLOAT_PRECISION_VALUE; + } + } } - } else if (val && val.isTime && val.isTime()) { - if (val.sameAs(MAX_TIME_VALUE)) { - throw new OverFlowException(); - } else { - return val.successor(); + else if (val && val.isTime && val.isTime()) { + if (val.sameAs(exports.MAX_TIME_VALUE)) { + throw new OverFlowException(); + } + else { + return val.successor(); + } } - } else if (val && val.isDateTime) { - if (val.sameAs(MAX_DATETIME_VALUE)) { - throw new OverFlowException(); - } else { - return val.successor(); + else if (val && val.isDateTime) { + if (val.sameAs(exports.MAX_DATETIME_VALUE)) { + throw new OverFlowException(); + } + else { + return val.successor(); + } } - } else if (val && val.isDate) { - if (val.sameAs(MAX_DATE_VALUE)) { - throw new OverFlowException(); - } else { - return val.successor(); + else if (val && val.isDate) { + if (val.sameAs(exports.MAX_DATE_VALUE)) { + throw new OverFlowException(); + } + else { + return val.successor(); + } + } + else if (val && val.isUncertainty) { + // For uncertainties, if the high is the max val, don't increment it + var high = (function () { + try { + return successor(val.high); + } + catch (e) { + return val.high; + } + })(); + return new uncertainty_1.Uncertainty(successor(val.low), high); + } + else if (val && val.isQuantity) { + var succ = val.clone(); + succ.value = successor(val.value); + return succ; + } + else if (val == null) { + return null; } - } else if (val && val.isUncertainty) { - // For uncertainties, if the high is the max val, don't increment it - var high = function () { - try { - return successor(val.high); - } catch (e) { - return val.high; - } - }(); - - return new Uncertainty(successor(val.low), high); - } else if (val && val.isQuantity) { - var succ = val.clone(); - succ.value = successor(val.value); - return succ; - } else if (val == null) { - return null; - } } - +exports.successor = successor; function predecessor(val) { - if (typeof val === 'number') { - if (parseInt(val) === val) { - if (val <= MIN_INT_VALUE) { - throw new OverFlowException(); - } else { - return val - 1; - } - } else { - if (val <= MIN_FLOAT_VALUE) { - throw new OverFlowException(); - } else { - return val - MIN_FLOAT_PRECISION_VALUE; - } + if (typeof val === 'number') { + if (Number.isInteger(val)) { + if (val <= exports.MIN_INT_VALUE) { + throw new OverFlowException(); + } + else { + return val - 1; + } + } + else { + if (val <= exports.MIN_FLOAT_VALUE) { + throw new OverFlowException(); + } + else { + return val - exports.MIN_FLOAT_PRECISION_VALUE; + } + } } - } else if (val && val.isTime && val.isTime()) { - if (val.sameAs(MIN_TIME_VALUE)) { - throw new OverFlowException(); - } else { - return val.predecessor(); + else if (val && val.isTime && val.isTime()) { + if (val.sameAs(exports.MIN_TIME_VALUE)) { + throw new OverFlowException(); + } + else { + return val.predecessor(); + } } - } else if (val && val.isDateTime) { - if (val.sameAs(MIN_DATETIME_VALUE)) { - throw new OverFlowException(); - } else { - return val.predecessor(); + else if (val && val.isDateTime) { + if (val.sameAs(exports.MIN_DATETIME_VALUE)) { + throw new OverFlowException(); + } + else { + return val.predecessor(); + } } - } else if (val && val.isDate) { - if (val.sameAs(MIN_DATE_VALUE)) { - throw new OverFlowException(); - } else { - return val.predecessor(); + else if (val && val.isDate) { + if (val.sameAs(exports.MIN_DATE_VALUE)) { + throw new OverFlowException(); + } + else { + return val.predecessor(); + } + } + else if (val && val.isUncertainty) { + // For uncertainties, if the low is the min val, don't decrement it + var low = (function () { + try { + return predecessor(val.low); + } + catch (e) { + return val.low; + } + })(); + return new uncertainty_1.Uncertainty(low, predecessor(val.high)); + } + else if (val && val.isQuantity) { + var pred = val.clone(); + pred.value = predecessor(val.value); + return pred; + } + else if (val == null) { + return null; } - } else if (val && val.isUncertainty) { - // For uncertainties, if the low is the min val, don't decrement it - var low = function () { - try { - return predecessor(val.low); - } catch (e) { - return val.low; - } - }(); - - return new Uncertainty(low, predecessor(val.high)); - } else if (val && val.isQuantity) { - var pred = val.clone(); - pred.value = predecessor(val.value); - return pred; - } else if (val == null) { - return null; - } } - +exports.predecessor = predecessor; function maxValueForInstance(val) { - if (typeof val === 'number') { - if (parseInt(val) === val) { - return MAX_INT_VALUE; - } else { - return MAX_FLOAT_VALUE; - } - } else if (val && val.isTime && val.isTime()) { - return MAX_TIME_VALUE.copy(); - } else if (val && val.isDateTime) { - return MAX_DATETIME_VALUE.copy(); - } else if (val && val.isDate) { - return MAX_DATE_VALUE.copy(); - } else if (val && val.isQuantity) { - var val2 = val.clone(); - val2.value = maxValueForInstance(val2.value); - return val2; - } else { - return null; - } + if (typeof val === 'number') { + if (Number.isInteger(val)) { + return exports.MAX_INT_VALUE; + } + else { + return exports.MAX_FLOAT_VALUE; + } + } + else if (val && val.isTime && val.isTime()) { + return exports.MAX_TIME_VALUE === null || exports.MAX_TIME_VALUE === void 0 ? void 0 : exports.MAX_TIME_VALUE.copy(); + } + else if (val && val.isDateTime) { + return exports.MAX_DATETIME_VALUE === null || exports.MAX_DATETIME_VALUE === void 0 ? void 0 : exports.MAX_DATETIME_VALUE.copy(); + } + else if (val && val.isDate) { + return exports.MAX_DATE_VALUE === null || exports.MAX_DATE_VALUE === void 0 ? void 0 : exports.MAX_DATE_VALUE.copy(); + } + else if (val && val.isQuantity) { + var val2 = val.clone(); + val2.value = maxValueForInstance(val2.value); + return val2; + } + else { + return null; + } } - +exports.maxValueForInstance = maxValueForInstance; function maxValueForType(type, quantityInstance) { - switch (type) { - case '{urn:hl7-org:elm-types:r1}Integer': - return MAX_INT_VALUE; - - case '{urn:hl7-org:elm-types:r1}Decimal': - return MAX_FLOAT_VALUE; - - case '{urn:hl7-org:elm-types:r1}DateTime': - return MAX_DATETIME_VALUE.copy(); - - case '{urn:hl7-org:elm-types:r1}Date': - return MAX_DATE_VALUE.copy(); - - case '{urn:hl7-org:elm-types:r1}Time': - return MAX_TIME_VALUE.copy(); - - case '{urn:hl7-org:elm-types:r1}Quantity': - { - if (quantityInstance == null) { - // can't infer a quantity unit type from nothing] - return null; + switch (type) { + case '{urn:hl7-org:elm-types:r1}Integer': + return exports.MAX_INT_VALUE; + case '{urn:hl7-org:elm-types:r1}Decimal': + return exports.MAX_FLOAT_VALUE; + case '{urn:hl7-org:elm-types:r1}DateTime': + return exports.MAX_DATETIME_VALUE === null || exports.MAX_DATETIME_VALUE === void 0 ? void 0 : exports.MAX_DATETIME_VALUE.copy(); + case '{urn:hl7-org:elm-types:r1}Date': + return exports.MAX_DATE_VALUE === null || exports.MAX_DATE_VALUE === void 0 ? void 0 : exports.MAX_DATE_VALUE.copy(); + case '{urn:hl7-org:elm-types:r1}Time': + return exports.MAX_TIME_VALUE === null || exports.MAX_TIME_VALUE === void 0 ? void 0 : exports.MAX_TIME_VALUE.copy(); + case '{urn:hl7-org:elm-types:r1}Quantity': { + if (quantityInstance == null) { + // can't infer a quantity unit type from nothing] + return null; + } + var maxQty = quantityInstance.clone(); + maxQty.value = maxValueForInstance(maxQty.value); + return maxQty; } - - var maxQty = quantityInstance.clone(); - maxQty.value = maxValueForInstance(maxQty.value); - return maxQty; - } - } - - return null; + } + return null; } - +exports.maxValueForType = maxValueForType; function minValueForInstance(val) { - if (typeof val === 'number') { - if (parseInt(val) === val) { - return MIN_INT_VALUE; - } else { - return MIN_FLOAT_VALUE; - } - } else if (val && val.isTime && val.isTime()) { - return MIN_TIME_VALUE.copy(); - } else if (val && val.isDateTime) { - return MIN_DATETIME_VALUE.copy(); - } else if (val && val.isDate) { - return MIN_DATE_VALUE.copy(); - } else if (val && val.isQuantity) { - var val2 = val.clone(); - val2.value = minValueForInstance(val2.value); - return val2; - } else { - return null; - } + if (typeof val === 'number') { + if (Number.isInteger(val)) { + return exports.MIN_INT_VALUE; + } + else { + return exports.MIN_FLOAT_VALUE; + } + } + else if (val && val.isTime && val.isTime()) { + return exports.MIN_TIME_VALUE === null || exports.MIN_TIME_VALUE === void 0 ? void 0 : exports.MIN_TIME_VALUE.copy(); + } + else if (val && val.isDateTime) { + return exports.MIN_DATETIME_VALUE === null || exports.MIN_DATETIME_VALUE === void 0 ? void 0 : exports.MIN_DATETIME_VALUE.copy(); + } + else if (val && val.isDate) { + return exports.MIN_DATE_VALUE === null || exports.MIN_DATE_VALUE === void 0 ? void 0 : exports.MIN_DATE_VALUE.copy(); + } + else if (val && val.isQuantity) { + var val2 = val.clone(); + val2.value = minValueForInstance(val2.value); + return val2; + } + else { + return null; + } } - +exports.minValueForInstance = minValueForInstance; function minValueForType(type, quantityInstance) { - switch (type) { - case '{urn:hl7-org:elm-types:r1}Integer': - return MIN_INT_VALUE; - - case '{urn:hl7-org:elm-types:r1}Decimal': - return MIN_FLOAT_VALUE; - - case '{urn:hl7-org:elm-types:r1}DateTime': - return MIN_DATETIME_VALUE.copy(); - - case '{urn:hl7-org:elm-types:r1}Date': - return MIN_DATE_VALUE.copy(); - - case '{urn:hl7-org:elm-types:r1}Time': - return MIN_TIME_VALUE.copy(); - - case '{urn:hl7-org:elm-types:r1}Quantity': - { - if (quantityInstance == null) { - // can't infer a quantity unit type from nothing] - return null; + switch (type) { + case '{urn:hl7-org:elm-types:r1}Integer': + return exports.MIN_INT_VALUE; + case '{urn:hl7-org:elm-types:r1}Decimal': + return exports.MIN_FLOAT_VALUE; + case '{urn:hl7-org:elm-types:r1}DateTime': + return exports.MIN_DATETIME_VALUE === null || exports.MIN_DATETIME_VALUE === void 0 ? void 0 : exports.MIN_DATETIME_VALUE.copy(); + case '{urn:hl7-org:elm-types:r1}Date': + return exports.MIN_DATE_VALUE === null || exports.MIN_DATE_VALUE === void 0 ? void 0 : exports.MIN_DATE_VALUE.copy(); + case '{urn:hl7-org:elm-types:r1}Time': + return exports.MIN_TIME_VALUE === null || exports.MIN_TIME_VALUE === void 0 ? void 0 : exports.MIN_TIME_VALUE.copy(); + case '{urn:hl7-org:elm-types:r1}Quantity': { + if (quantityInstance == null) { + // can't infer a quantity unit type from nothing] + return null; + } + var minQty = quantityInstance.clone(); + minQty.value = minValueForInstance(minQty.value); + return minQty; } - - var minQty = quantityInstance.clone(); - minQty.value = minValueForInstance(minQty.value); - return minQty; - } - } - - return null; + } + return null; } - +exports.minValueForType = minValueForType; function decimalAdjust(type, value, exp) { - //If the exp is undefined or zero... - if (typeof exp === 'undefined' || +exp === 0) { - return Math[type](value); - } - - value = +value; - exp = +exp; //If the value is not a number or the exp is not an integer... - - if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) { - return NaN; - } //Shift - - - value = value.toString().split('e'); - var v = value[1] ? +value[1] - exp : -exp; - value = Math[type](+(value[0] + 'e' + v)); //Shift back - - value = value.toString().split('e'); - v = value[1] ? +value[1] + exp : exp; - return +(value[0] + 'e' + v); + //If the exp is undefined or zero... + if (typeof exp === 'undefined' || +exp === 0) { + return Math[type](value); + } + value = +value; + exp = +exp; + //If the value is not a number or the exp is not an integer... + if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) { + return NaN; + } + //Shift + value = value.toString().split('e'); + var v = value[1] ? +value[1] - exp : -exp; + value = Math[type](+(value[0] + 'e' + v)); + //Shift back + value = value.toString().split('e'); + v = value[1] ? +value[1] + exp : exp; + return +(value[0] + 'e' + v); } - +exports.decimalAdjust = decimalAdjust; function decimalOrNull(value) { - return isValidDecimal(value) ? value : null; + return isValidDecimal(value) ? value : null; } +exports.decimalOrNull = decimalOrNull; -module.exports = { - MAX_INT_VALUE: MAX_INT_VALUE, - MIN_INT_VALUE: MIN_INT_VALUE, - MAX_FLOAT_VALUE: MAX_FLOAT_VALUE, - MIN_FLOAT_VALUE: MIN_FLOAT_VALUE, - MIN_FLOAT_PRECISION_VALUE: MIN_FLOAT_PRECISION_VALUE, - MIN_DATETIME_VALUE: MIN_DATETIME_VALUE, - MAX_DATETIME_VALUE: MAX_DATETIME_VALUE, - MIN_DATE_VALUE: MIN_DATE_VALUE, - MAX_DATE_VALUE: MAX_DATE_VALUE, - MIN_TIME_VALUE: MIN_TIME_VALUE, - MAX_TIME_VALUE: MAX_TIME_VALUE, - overflowsOrUnderflows: overflowsOrUnderflows, - isValidInteger: isValidInteger, - isValidDecimal: isValidDecimal, - limitDecimalPrecision: limitDecimalPrecision, - OverFlowException: OverFlowException, - successor: successor, - predecessor: predecessor, - maxValueForInstance: maxValueForInstance, - minValueForInstance: minValueForInstance, - maxValueForType: maxValueForType, - minValueForType: minValueForType, - decimalAdjust: decimalAdjust, - decimalOrNull: decimalOrNull -}; -},{"../datatypes/datetime":7,"../datatypes/exception":8,"../datatypes/uncertainty":13}],49:[function(require,module,exports){ +},{"../datatypes/datetime":7,"../datatypes/exception":8,"../datatypes/uncertainty":13}],54:[function(require,module,exports){ "use strict"; - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - -var ucum = require('@lhncbc/ucum-lhc'); - -var _require = require('./math'), - decimalAdjust = _require.decimalAdjust; - -var utils = ucum.UcumLhcUtils.getInstance(); // Cache Map for unit validity results so we dont have to go to ucum-lhc for every check. - +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getQuotientOfUnits = exports.getProductOfUnits = exports.compareUnits = exports.convertToCQLDateUnit = exports.normalizeUnitsWhenPossible = exports.convertUnit = exports.checkUnit = void 0; +var ucum = __importStar(require("@lhncbc/ucum-lhc")); +var math_1 = require("./math"); +var utils = ucum.UcumLhcUtils.getInstance(); +// The CQL specification says that dates are based on the Gregorian calendar, so CQL-based year and month +// identifiers will be matched to the UCUM gregorian units. See http://unitsofmeasure.org/ucum.html#para-31 +var CQL_TO_UCUM_DATE_UNITS = { + years: 'a_g', + year: 'a_g', + months: 'mo_g', + month: 'mo_g', + weeks: 'wk', + week: 'wk', + days: 'd', + day: 'd', + hours: 'h', + hour: 'h', + minutes: 'min', + minute: 'min', + seconds: 's', + second: 's', + milliseconds: 'ms', + millisecond: 'ms' +}; +var UCUM_TO_CQL_DATE_UNITS = { + a: 'year', + a_j: 'year', + a_g: 'year', + mo: 'month', + mo_j: 'month', + mo_g: 'month', + wk: 'week', + d: 'day', + h: 'hour', + min: 'minute', + s: 'second', + ms: 'millisecond' +}; +// Cache Map for unit validity results so we dont have to go to ucum-lhc for every check. var unitValidityCache = new Map(); - -function checkUnit(unit) { - var allowEmptyUnits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - var allowCQLDateUnits = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - - if (allowEmptyUnits) { - unit = fixEmptyUnit(unit); - } - - if (allowCQLDateUnits) { - unit = fixCQLDateUnit(unit); - } - - if (!unitValidityCache.has(unit)) { - var result = utils.validateUnitString(unit, true); - - if (result.status === 'valid') { - unitValidityCache.set(unit, { - valid: true - }); - } else { - var msg = "Invalid UCUM unit: '".concat(unit, "'."); - - if (result.ucumCode != null) { - msg += " Did you mean '".concat(result.ucumCode, "'?"); - } - - unitValidityCache.set(unit, { - valid: false, - message: msg - }); +function checkUnit(unit, allowEmptyUnits, allowCQLDateUnits) { + if (allowEmptyUnits === void 0) { allowEmptyUnits = true; } + if (allowCQLDateUnits === void 0) { allowCQLDateUnits = true; } + if (allowEmptyUnits) { + unit = fixEmptyUnit(unit); + } + if (allowCQLDateUnits) { + unit = fixCQLDateUnit(unit); + } + if (!unitValidityCache.has(unit)) { + var result = utils.validateUnitString(unit, true); + if (result.status === 'valid') { + unitValidityCache.set(unit, { valid: true }); + } + else { + var msg = "Invalid UCUM unit: '".concat(unit, "'."); + if (result.ucumCode != null) { + msg += " Did you mean '".concat(result.ucumCode, "'?"); + } + unitValidityCache.set(unit, { valid: false, message: msg }); + } } - } - - return unitValidityCache.get(unit); + return unitValidityCache.get(unit); } - -function convertUnit(fromVal, fromUnit, toUnit) { - var adjustPrecision = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; - - var _map = [fromUnit, toUnit].map(fixUnit); - - var _map2 = _slicedToArray(_map, 2); - - fromUnit = _map2[0]; - toUnit = _map2[1]; - var result = utils.convertUnitTo(fixUnit(fromUnit), fromVal, fixUnit(toUnit)); - - if (result.status !== 'succeeded') { - return; - } - - return adjustPrecision ? decimalAdjust('round', result.toVal, -8) : result.toVal; +exports.checkUnit = checkUnit; +function convertUnit(fromVal, fromUnit, toUnit, adjustPrecision) { + var _a; + if (adjustPrecision === void 0) { adjustPrecision = true; } + _a = [fromUnit, toUnit].map(fixUnit), fromUnit = _a[0], toUnit = _a[1]; + var result = utils.convertUnitTo(fixUnit(fromUnit), fromVal, fixUnit(toUnit)); + if (result.status !== 'succeeded') { + return; + } + return adjustPrecision ? (0, math_1.decimalAdjust)('round', result.toVal, -8) : result.toVal; } - +exports.convertUnit = convertUnit; function normalizeUnitsWhenPossible(val1, unit1, val2, unit2) { - // If both units are CQL date units, return CQL date units - var useCQLDateUnits = CQL_TO_UCUM_DATE_UNITS[unit1] != null && CQL_TO_UCUM_DATE_UNITS[unit2] != null; - - var resultConverter = function resultConverter(unit) { - return useCQLDateUnits ? convertToCQLDateUnit(unit) : unit; - }; - - var _map3 = [unit1, unit2].map(fixUnit); - - var _map4 = _slicedToArray(_map3, 2); - - unit1 = _map4[0]; - unit2 = _map4[1]; - - if (unit1 === unit2) { - return [val1, unit1, val2, unit2]; - } - - var baseUnit1 = getBaseUnitAndPower(unit1)[0]; - var baseUnit2 = getBaseUnitAndPower(unit2)[0]; - - var _convertToBaseUnit = convertToBaseUnit(val2, unit2, baseUnit1), - _convertToBaseUnit2 = _slicedToArray(_convertToBaseUnit, 2), - newVal2 = _convertToBaseUnit2[0], - newUnit2 = _convertToBaseUnit2[1]; - - if (newVal2 == null) { - // it was not convertible, so just return the quantities as-is - return [val1, resultConverter(unit1), val2, resultConverter(unit2)]; - } // If the new val2 > old val2, return since we prefer conversion to smaller units - - - if (newVal2 >= val2) { - return [val1, resultConverter(unit1), newVal2, resultConverter(newUnit2)]; - } // else it was a conversion to a larger unit, so go the other way around - - - var _convertToBaseUnit3 = convertToBaseUnit(val1, unit1, baseUnit2), - _convertToBaseUnit4 = _slicedToArray(_convertToBaseUnit3, 2), - newVal1 = _convertToBaseUnit4[0], - newUnit1 = _convertToBaseUnit4[1]; - - if (newVal1 == null) { - // this should not happen since we established they are convertible, but just in case... - return [val1, resultConverter(unit1), newVal2, resultConverter(newUnit2)]; - } - - return [newVal1, resultConverter(newUnit1), val2, resultConverter(unit2)]; + var _a; + // If both units are CQL date units, return CQL date units + var useCQLDateUnits = unit1 in CQL_TO_UCUM_DATE_UNITS && unit2 in CQL_TO_UCUM_DATE_UNITS; + var resultConverter = function (unit) { + return useCQLDateUnits ? convertToCQLDateUnit(unit) : unit; + }; + _a = [unit1, unit2].map(function (u) { return fixUnit(u); }), unit1 = _a[0], unit2 = _a[1]; + if (unit1 === unit2) { + return [val1, unit1, val2, unit2]; + } + var baseUnit1 = getBaseUnitAndPower(unit1)[0]; + var baseUnit2 = getBaseUnitAndPower(unit2)[0]; + var _b = convertToBaseUnit(val2, unit2, baseUnit1), newVal2 = _b[0], newUnit2 = _b[1]; + if (newVal2 == null) { + // it was not convertible, so just return the quantities as-is + return [val1, resultConverter(unit1), val2, resultConverter(unit2)]; + } + // If the new val2 > old val2, return since we prefer conversion to smaller units + if (newVal2 >= val2) { + return [val1, resultConverter(unit1), newVal2, resultConverter(newUnit2)]; + } + // else it was a conversion to a larger unit, so go the other way around + var _c = convertToBaseUnit(val1, unit1, baseUnit2), newVal1 = _c[0], newUnit1 = _c[1]; + if (newVal1 == null) { + // this should not happen since we established they are convertible, but just in case... + return [val1, resultConverter(unit1), newVal2, resultConverter(newUnit2)]; + } + return [newVal1, resultConverter(newUnit1), val2, resultConverter(unit2)]; } - +exports.normalizeUnitsWhenPossible = normalizeUnitsWhenPossible; function convertToCQLDateUnit(unit) { - if (CQL_TO_UCUM_DATE_UNITS[unit]) { - // it's already a CQL unit, so return it as-is, removing trailing 's' if necessary (e.g., years -> year) - return unit.replace(/s$/, ''); - } - - return UCUM_TO_CQL_DATE_UNITS[unit]; + var dateUnit; + if (unit in CQL_TO_UCUM_DATE_UNITS) { + // it's already a CQL unit, so return it as-is, removing trailing 's' if necessary (e.g., years -> year) + dateUnit = unit.replace(/s$/, ''); + } + else if (unit in UCUM_TO_CQL_DATE_UNITS) { + dateUnit = UCUM_TO_CQL_DATE_UNITS[unit]; + } + return dateUnit; } - +exports.convertToCQLDateUnit = convertToCQLDateUnit; function compareUnits(unit1, unit2) { - try { - var c = convertUnit(1, unit1, unit2); - - if (c > 1) { - // unit1 is bigger (less precise) - return 1; - } else if (c < 1) { - // unit1 is smaller - return -1; - } //units are the same - - - return 0; - } catch (e) { - return null; - } + try { + var c = convertUnit(1, unit1, unit2); + if (c && c > 1) { + // unit1 is bigger (less precise) + return 1; + } + else if (c && c < 1) { + // unit1 is smaller + return -1; + } + //units are the same + return 0; + } + catch (e) { + return null; + } } - +exports.compareUnits = compareUnits; function getProductOfUnits(unit1, unit2) { - var _map5 = [unit1, unit2].map(fixEmptyUnit); - - var _map6 = _slicedToArray(_map5, 2); - - unit1 = _map6[0]; - unit2 = _map6[1]; - - if (!checkUnit(unit1).valid || !checkUnit(unit2).valid) { - return null; - } // If either unit contains a divisor,combine the numerators and denominators, then divide - - - if (unit1.indexOf('/') >= 0 || unit2.indexOf('/') >= 0) { - // NOTE: We're not trying to get perfection on unit simplification, but doing what is reasonable - var match1 = unit1.match(/([^/]*)(\/(.*))?/); - var match2 = unit2.match(/([^/]*)(\/(.*))?/); // In the previous regexes, numerator is match[1], denominator is match[3] - - var newNum = getProductOfUnits(match1[1], match2[1]); - var newDen = getProductOfUnits(match1[3], match2[3]); - return getQuotientOfUnits(newNum, newDen); - } // Get all the individual units being combined, accounting for multipliers (e.g., 'm.L'), - // and then group like base units to combine powers (and remove '1's since they are no-ops) - // e.g., 'm.L' * 'm' ==> { m: 2, L: 1}; 'm.L' * '1' ==> { m: 1, L: 1 }; '1' : '1' ==> { } - - - var factorPowerMap = new Map(); - var factors = [].concat(_toConsumableArray(unit1.split('.')), _toConsumableArray(unit2.split('.'))); - factors.forEach(function (factor) { - var _getBaseUnitAndPower = getBaseUnitAndPower(factor), - _getBaseUnitAndPower2 = _slicedToArray(_getBaseUnitAndPower, 2), - baseUnit = _getBaseUnitAndPower2[0], - power = _getBaseUnitAndPower2[1]; - - if (baseUnit === '1' || power === 0) { - // skip factors that are 1 since 1 * N is N. - return; + var _a; + _a = [unit1, unit2].map(fixEmptyUnit), unit1 = _a[0], unit2 = _a[1]; + if (!checkUnit(unit1).valid || !checkUnit(unit2).valid) { + return null; } - - var accumulatedPower = (factorPowerMap.get(baseUnit) || 0) + power; - factorPowerMap.set(baseUnit, accumulatedPower); - }); // Loop through the factor map, rebuilding each factor w/ combined power and join them all - // back via the multiplier '.', treating a final '' (no non-1 units) as '1' - // e.g., { m: 2, L: 1 } ==> 'm2.L' - - return fixUnit(Array.from(factorPowerMap.entries()).map(function (_ref) { - var _ref2 = _slicedToArray(_ref, 2), - base = _ref2[0], - power = _ref2[1]; - - return "".concat(base).concat(power > 1 ? power : ''); - }).join('.')); -} - -function getQuotientOfUnits(unit1, unit2) { - var _map7 = [unit1, unit2].map(fixEmptyUnit); - - var _map8 = _slicedToArray(_map7, 2); - - unit1 = _map8[0]; - unit2 = _map8[1]; - - if (!checkUnit(unit1).valid || !checkUnit(unit2).valid) { - return null; - } // Try to simplify division when neither unit contains a divisor itself - - - if (unit1.indexOf('/') === -1 && unit2.indexOf('/') === -1) { - // Get all the individual units in numerator and denominator accounting for multipliers - // (e.g., 'm.L'), and then group like base units to combine powers, inversing denominator - // powers since they are being divided. - // e.g., 'm3.L' / 'm' ==> { m: 2, L: -1}; 'm.L' / '1' ==> { m: 1, L: 1 }; '1' / '1' ==> { 1: 0 } + // If either unit contains a divisor,combine the numerators and denominators, then divide + if (unit1.indexOf('/') >= 0 || unit2.indexOf('/') >= 0) { + // NOTE: We're not trying to get perfection on unit simplification, but doing what is reasonable + var match1 = unit1.match(/([^/]*)(\/(.*))?/); + var match2 = unit2.match(/([^/]*)(\/(.*))?/); + // In the previous regexes, numerator is match[1], denominator is match[3] + var newNum = getProductOfUnits(match1[1], match2[1]); + var newDen = getProductOfUnits(match1[3], match2[3]); + return getQuotientOfUnits(newNum, newDen); + } + // Get all the individual units being combined, accounting for multipliers (e.g., 'm.L'), + // and then group like base units to combine powers (and remove '1's since they are no-ops) + // e.g., 'm.L' * 'm' ==> { m: 2, L: 1}; 'm.L' * '1' ==> { m: 1, L: 1 }; '1' : '1' ==> { } var factorPowerMap = new Map(); - unit1.split('.').forEach(function (factor) { - var _getBaseUnitAndPower3 = getBaseUnitAndPower(factor), - _getBaseUnitAndPower4 = _slicedToArray(_getBaseUnitAndPower3, 2), - baseUnit = _getBaseUnitAndPower4[0], - power = _getBaseUnitAndPower4[1]; - - var accumulatedPower = (factorPowerMap.get(baseUnit) || 0) + power; - factorPowerMap.set(baseUnit, accumulatedPower); + var factors = __spreadArray(__spreadArray([], unit1.split('.'), true), unit2.split('.'), true); + factors.forEach(function (factor) { + var _a = getBaseUnitAndPower(factor), baseUnit = _a[0], power = _a[1]; + if (baseUnit === '1' || power === 0) { + // skip factors that are 1 since 1 * N is N. + return; + } + var accumulatedPower = (factorPowerMap.get(baseUnit) || 0) + power; + factorPowerMap.set(baseUnit, accumulatedPower); }); - unit2.split('.').forEach(function (factor) { - var _getBaseUnitAndPower5 = getBaseUnitAndPower(factor), - _getBaseUnitAndPower6 = _slicedToArray(_getBaseUnitAndPower5, 2), - baseUnit = _getBaseUnitAndPower6[0], - power = _getBaseUnitAndPower6[1]; - - var accumulatedPower = (factorPowerMap.get(baseUnit) || 0) - power; - factorPowerMap.set(baseUnit, accumulatedPower); - }); // Construct the numerator from factors with positive power, and denominator from factors - // with negative power, filtering out base `1` and power 0 (which is also 1). - // e.g. numerator: { m: 2, L: -2 } ==> 'm2'; { 1: 1, L: -1 } => '' - // e.g. denominator: { m: 2, L: -2 } ==> 'L2'; { 1: 1, L: -1 } => 'L' - - var numerator = Array.from(factorPowerMap.entries()).filter(function (_ref3) { - var _ref4 = _slicedToArray(_ref3, 2), - base = _ref4[0], - power = _ref4[1]; - - return base !== '1' && power > 0; - }).map(function (_ref5) { - var _ref6 = _slicedToArray(_ref5, 2), - base = _ref6[0], - power = _ref6[1]; - - return "".concat(base).concat(power > 1 ? power : ''); - }).join('.'); - var denominator = Array.from(factorPowerMap.entries()).filter(function (_ref7) { - var _ref8 = _slicedToArray(_ref7, 2), - base = _ref8[0], - power = _ref8[1]; - - return base !== '1' && power < 0; - }).map(function (_ref9) { - var _ref10 = _slicedToArray(_ref9, 2), - base = _ref10[0], - power = _ref10[1]; - - return "".concat(base).concat(power < -1 ? power * -1 : ''); - }).join('.'); // wrap the denominator in parentheses if necessary - - denominator = /[.]/.test(denominator) ? "(".concat(denominator, ")") : denominator; - return fixUnit("".concat(numerator).concat(denominator !== '' ? '/' + denominator : '')); - } // One of the units had a divisor, so don't try to be too smart; just construct it from the parts - - - if (unit1 === unit2) { - // e.g. 'm/g' / 'm/g' ==> '1' - return '1'; - } else if (unit2 === '1') { - // e.g., 'm/g' / '1' ==> 'm/g/' - return unit1; - } else { - // denominator is unit2, wrapped in parentheses if necessary - var _denominator = /[./]/.test(unit2) ? "(".concat(unit2, ")") : unit2; - - if (unit1 === '1') { - // e.g., '1' / 'm' ==> '/m'; '1' / 'm.g' ==> '/(m.g)' - return "/".concat(_denominator); - } // e.g., 'L' / 'm' ==> 'L/m'; 'L' / 'm.g' ==> 'L/(m.g)' - - - return "".concat(unit1, "/").concat(_denominator); - } -} // UNEXPORTED FUNCTIONS - - + // Loop through the factor map, rebuilding each factor w/ combined power and join them all + // back via the multiplier '.', treating a final '' (no non-1 units) as '1' + // e.g., { m: 2, L: 1 } ==> 'm2.L' + return fixUnit(Array.from(factorPowerMap.entries()) + .map(function (_a) { + var base = _a[0], power = _a[1]; + return "".concat(base).concat(power > 1 ? power : ''); + }) + .join('.')); +} +exports.getProductOfUnits = getProductOfUnits; +function getQuotientOfUnits(unit1, unit2) { + var _a; + _a = [unit1, unit2].map(fixEmptyUnit), unit1 = _a[0], unit2 = _a[1]; + if (!checkUnit(unit1).valid || !checkUnit(unit2).valid) { + return null; + } + // Try to simplify division when neither unit contains a divisor itself + if (unit1.indexOf('/') === -1 && unit2.indexOf('/') === -1) { + // Get all the individual units in numerator and denominator accounting for multipliers + // (e.g., 'm.L'), and then group like base units to combine powers, inversing denominator + // powers since they are being divided. + // e.g., 'm3.L' / 'm' ==> { m: 2, L: -1}; 'm.L' / '1' ==> { m: 1, L: 1 }; '1' / '1' ==> { 1: 0 } + var factorPowerMap_1 = new Map(); + unit1.split('.').forEach(function (factor) { + var _a = getBaseUnitAndPower(factor), baseUnit = _a[0], power = _a[1]; + var accumulatedPower = (factorPowerMap_1.get(baseUnit) || 0) + power; + factorPowerMap_1.set(baseUnit, accumulatedPower); + }); + unit2.split('.').forEach(function (factor) { + var _a = getBaseUnitAndPower(factor), baseUnit = _a[0], power = _a[1]; + var accumulatedPower = (factorPowerMap_1.get(baseUnit) || 0) - power; + factorPowerMap_1.set(baseUnit, accumulatedPower); + }); + // Construct the numerator from factors with positive power, and denominator from factors + // with negative power, filtering out base `1` and power 0 (which is also 1). + // e.g. numerator: { m: 2, L: -2 } ==> 'm2'; { 1: 1, L: -1 } => '' + // e.g. denominator: { m: 2, L: -2 } ==> 'L2'; { 1: 1, L: -1 } => 'L' + var numerator = Array.from(factorPowerMap_1.entries()) + .filter(function (_a) { + var base = _a[0], power = _a[1]; + return base !== '1' && power > 0; + }) + .map(function (_a) { + var base = _a[0], power = _a[1]; + return "".concat(base).concat(power > 1 ? power : ''); + }) + .join('.'); + var denominator = Array.from(factorPowerMap_1.entries()) + .filter(function (_a) { + var base = _a[0], power = _a[1]; + return base !== '1' && power < 0; + }) + .map(function (_a) { + var base = _a[0], power = _a[1]; + return "".concat(base).concat(power < -1 ? power * -1 : ''); + }) + .join('.'); + // wrap the denominator in parentheses if necessary + denominator = /[.]/.test(denominator) ? "(".concat(denominator, ")") : denominator; + return fixUnit("".concat(numerator).concat(denominator !== '' ? '/' + denominator : '')); + } + // One of the units had a divisor, so don't try to be too smart; just construct it from the parts + if (unit1 === unit2) { + // e.g. 'm/g' / 'm/g' ==> '1' + return '1'; + } + else if (unit2 === '1') { + // e.g., 'm/g' / '1' ==> 'm/g/' + return unit1; + } + else { + // denominator is unit2, wrapped in parentheses if necessary + var denominator = /[./]/.test(unit2) ? "(".concat(unit2, ")") : unit2; + if (unit1 === '1') { + // e.g., '1' / 'm' ==> '/m'; '1' / 'm.g' ==> '/(m.g)' + return "/".concat(denominator); + } + // e.g., 'L' / 'm' ==> 'L/m'; 'L' / 'm.g' ==> 'L/(m.g)' + return "".concat(unit1, "/").concat(denominator); + } +} +exports.getQuotientOfUnits = getQuotientOfUnits; +// UNEXPORTED FUNCTIONS function convertToBaseUnit(fromVal, fromUnit, toBaseUnit) { - var fromPower = getBaseUnitAndPower(fromUnit)[1]; - var toUnit = fromPower === 1 ? toBaseUnit : "".concat(toBaseUnit).concat(fromPower); - var newVal = convertUnit(fromVal, fromUnit, toUnit); - return newVal != null ? [newVal, toUnit] : []; + var fromPower = getBaseUnitAndPower(fromUnit)[1]; + var toUnit = fromPower === 1 ? toBaseUnit : "".concat(toBaseUnit).concat(fromPower); + var newVal = convertUnit(fromVal, fromUnit, toUnit); + return newVal != null ? [newVal, toUnit] : []; } - function getBaseUnitAndPower(unit) { - // don't try to extract power from complex units (containing multipliers or divisors) - if (/[./]/.test(unit)) { - return [unit, 1]; - } - - unit = fixUnit(unit); - - var _unit$match$slice = unit.match(/^(.*[^-\d])?([-]?\d*)$/).slice(1), - _unit$match$slice2 = _slicedToArray(_unit$match$slice, 2), - term = _unit$match$slice2[0], - power = _unit$match$slice2[1]; - - if (term == null || term === '') { - term = power; - power = '1'; - } else if (power == null || power === '') { - power = '1'; - } - - return [term, parseInt(power)]; -} // The CQL specification says that dates are based on the Gregorian calendar, so CQL-based year and month -// identifiers will be matched to the UCUM gregorian units. See http://unitsofmeasure.org/ucum.html#para-31 - - -var CQL_TO_UCUM_DATE_UNITS = { - years: 'a_g', - year: 'a_g', - months: 'mo_g', - month: 'mo_g', - weeks: 'wk', - week: 'wk', - days: 'd', - day: 'd', - hours: 'h', - hour: 'h', - minutes: 'min', - minute: 'min', - seconds: 's', - second: 's', - milliseconds: 'ms', - millisecond: 'ms' -}; -var UCUM_TO_CQL_DATE_UNITS = { - a: 'year', - a_j: 'year', - a_g: 'year', - mo: 'month', - mo_j: 'month', - mo_g: 'month', - wk: 'week', - d: 'day', - h: 'hour', - min: 'minute', - s: 'second', - ms: 'millisecond' -}; - + // don't try to extract power from complex units (containing multipliers or divisors) + if (/[./]/.test(unit)) { + return [unit, 1]; + } + unit = fixUnit(unit); + var _a = unit.match(/^(.*[^-\d])?([-]?\d*)$/).slice(1), term = _a[0], power = _a[1]; + if (term == null || term === '') { + term = power; + power = '1'; + } + else if (power == null || power === '') { + power = '1'; + } + return [term, parseInt(power)]; +} function fixEmptyUnit(unit) { - if (unit == null || unit.trim && unit.trim() === '') { - return '1'; - } - - return unit; + if (unit == null || (unit.trim && unit.trim() === '')) { + return '1'; + } + return unit; } - function fixCQLDateUnit(unit) { - return CQL_TO_UCUM_DATE_UNITS[unit] || unit; + return CQL_TO_UCUM_DATE_UNITS[unit] || unit; } - function fixUnit(unit) { - return fixCQLDateUnit(fixEmptyUnit(unit)); + return fixCQLDateUnit(fixEmptyUnit(unit)); } -module.exports = { - checkUnit: checkUnit, - convertUnit: convertUnit, - normalizeUnitsWhenPossible: normalizeUnitsWhenPossible, - convertToCQLDateUnit: convertToCQLDateUnit, - compareUnits: compareUnits, - getProductOfUnits: getProductOfUnits, - getQuotientOfUnits: getQuotientOfUnits -}; -},{"./math":48,"@lhncbc/ucum-lhc":61}],50:[function(require,module,exports){ +},{"./math":53,"@lhncbc/ucum-lhc":66}],55:[function(require,module,exports){ "use strict"; - -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } - -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getTimezoneSeparatorFromString = exports.normalizeMillisecondsField = exports.normalizeMillisecondsFieldInString = exports.jsDate = exports.anyTrue = exports.allTrue = exports.typeIsArray = exports.isNull = exports.numerical_sort = exports.removeNulls = void 0; function removeNulls(things) { - return things.filter(function (x) { - return x != null; - }); + return things.filter(function (x) { return x != null; }); } - +exports.removeNulls = removeNulls; function numerical_sort(things, direction) { - return things.sort(function (a, b) { - if (direction == null || direction === 'asc' || direction === 'ascending') { - return a - b; - } else { - return b - a; - } - }); + return things.sort(function (a, b) { + if (direction == null || direction === 'asc' || direction === 'ascending') { + return a - b; + } + else { + return b - a; + } + }); } - +exports.numerical_sort = numerical_sort; function isNull(value) { - return value === null; + return value === null; } - -var typeIsArray = Array.isArray || function (value) { - return {}.toString.call(value) === '[object Array]'; -}; - +exports.isNull = isNull; +exports.typeIsArray = Array.isArray || (function (value) { return ({}.toString.call(value) === '[object Array]'); }); function allTrue(things) { - if (typeIsArray(things)) { - return things.every(function (x) { - return x; - }); - } else { - return things; - } + if ((0, exports.typeIsArray)(things)) { + return things.every(function (x) { return x; }); + } + else { + return things; + } } - +exports.allTrue = allTrue; function anyTrue(things) { - if (typeIsArray(things)) { - return things.some(function (x) { - return x; - }); - } else { - return things; - } -} //The export below is to make it easier if js Date is overwritten with CQL Date - - -var jsDate = Date; - + if ((0, exports.typeIsArray)(things)) { + return things.some(function (x) { return x; }); + } + else { + return things; + } +} +exports.anyTrue = anyTrue; +//The export below is to make it easier if js Date is overwritten with CQL Date +exports.jsDate = Date; function normalizeMillisecondsFieldInString(string, msString) { - // TODO: verify we are only removing numeral digits - var timezoneField; - msString = normalizeMillisecondsField(msString); - - var _string$split = string.split('.'), - _string$split2 = _slicedToArray(_string$split, 2), - beforeMs = _string$split2[0], - msAndAfter = _string$split2[1]; - - var timezoneSeparator = getTimezoneSeparatorFromString(msAndAfter); - - if (timezoneSeparator) { - timezoneField = msAndAfter != null ? msAndAfter.split(timezoneSeparator)[1] : undefined; - } - - if (timezoneField == null) { - timezoneField = ''; - } - - return string = beforeMs + '.' + msString + timezoneSeparator + timezoneField; + // TODO: verify we are only removing numeral digits + var timezoneField; + msString = normalizeMillisecondsField(msString); + var _a = string.split('.'), beforeMs = _a[0], msAndAfter = _a[1]; + var timezoneSeparator = getTimezoneSeparatorFromString(msAndAfter); + if (timezoneSeparator) { + timezoneField = msAndAfter != null ? msAndAfter.split(timezoneSeparator)[1] : undefined; + } + if (timezoneField == null) { + timezoneField = ''; + } + return (string = beforeMs + '.' + msString + timezoneSeparator + timezoneField); } - +exports.normalizeMillisecondsFieldInString = normalizeMillisecondsFieldInString; function normalizeMillisecondsField(msString) { - // fix up milliseconds by padding zeros and/or truncating (5 --> 500, 50 --> 500, 54321 --> 543, etc.) - return msString = (msString + '00').substring(0, 3); + // fix up milliseconds by padding zeros and/or truncating (5 --> 500, 50 --> 500, 54321 --> 543, etc.) + return (msString = (msString + '00').substring(0, 3)); } - +exports.normalizeMillisecondsField = normalizeMillisecondsField; function getTimezoneSeparatorFromString(string) { - if (string != null) { - var matches = string.match(/-/); - - if (matches && matches.length === 1) { - return '-'; - } - - matches = string.match(/\+/); - - if (matches && matches.length === 1) { - return '+'; + if (string != null) { + var matches = string.match(/-/); + if (matches && matches.length === 1) { + return '-'; + } + matches = string.match(/\+/); + if (matches && matches.length === 1) { + return '+'; + } } - } - - return ''; + return ''; } +exports.getTimezoneSeparatorFromString = getTimezoneSeparatorFromString; -module.exports = { - removeNulls: removeNulls, - numerical_sort: numerical_sort, - isNull: isNull, - typeIsArray: typeIsArray, - allTrue: allTrue, - anyTrue: anyTrue, - jsDate: jsDate, - normalizeMillisecondsFieldInString: normalizeMillisecondsFieldInString, - normalizeMillisecondsField: normalizeMillisecondsField, - getTimezoneSeparatorFromString: getTimezoneSeparatorFromString -}; -},{}],51:[function(require,module,exports){ +},{}],56:[function(require,module,exports){ module.exports={"license":"The following data (prefixes and units) was generated by the UCUM LHC code from the UCUM data and selected LOINC combinations of UCUM units. The license for the UCUM LHC code (demo and library code as well as the combined units) is located at https://github.com/lhncbc/ucum-lhc/blob/LICENSE.md.","prefixes":{"config":["code_","ciCode_","name_","printSymbol_","value_","exp_"],"data":[["E","EX","exa","E",1000000000000000000,"18"],["G","GA","giga","G",1000000000,"9"],["Gi","GIB","gibi","Gi",1073741824,null],["Ki","KIB","kibi","Ki",1024,null],["M","MA","mega","M",1000000,"6"],["Mi","MIB","mebi","Mi",1048576,null],["P","PT","peta","P",1000000000000000,"15"],["T","TR","tera","T",1000000000000,"12"],["Ti","TIB","tebi","Ti",1099511627776,null],["Y","YA","yotta","Y",1e+24,"24"],["Z","ZA","zetta","Z",1e+21,"21"],["a","A","atto","a",1e-18,"-18"],["c","C","centi","c",0.01,"-2"],["d","D","deci","d",0.1,"-1"],["da","DA","deka","da",10,"1"],["f","F","femto","f",1e-15,"-15"],["h","H","hecto","h",100,"2"],["k","K","kilo","k",1000,"3"],["m","M","milli","m",0.001,"-3"],["n","N","nano","n",1e-9,"-9"],["p","P","pico","p",1e-12,"-12"],["u","U","micro","μ",0.000001,"-6"],["y","YO","yocto","y",1.0000000000000001e-24,"-24"],["z","ZO","zepto","z",1e-21,"-21"]]},"units":{"config":["isBase_","name_","csCode_","ciCode_","property_","magnitude_",["dim_","dimVec_"],"printSymbol_","class_","isMetric_","variable_","cnv_","cnvPfx_","isSpecial_","isArbitrary_","moleExp_","synonyms_","source_","loincProperty_","category_","guidance_","csUnitString_","ciUnitString_","baseFactorStr_","baseFactor_","defError_"],"data":[[true,"meter","m","M","length",1,[1,0,0,0,0,0,0],"m",null,false,"L",null,1,false,false,0,"meters; metres; distance","UCUM","Len","Clinical","unit of length = 1.09361 yards",null,null,null,null,false],[true,"second - time","s","S","time",1,[0,1,0,0,0,0,0],"s",null,false,"T",null,1,false,false,0,"seconds","UCUM","Time","Clinical","",null,null,null,null,false],[true,"gram","g","G","mass",1,[0,0,1,0,0,0,0],"g",null,false,"M",null,1,false,false,0,"grams; gm","UCUM","Mass","Clinical","",null,null,null,null,false],[true,"radian","rad","RAD","plane angle",1,[0,0,0,1,0,0,0],"rad",null,false,"A",null,1,false,false,0,"radians","UCUM","Angle","Clinical","unit of angular measure where 1 radian = 1/2π turn = 57.296 degrees. ",null,null,null,null,false],[true,"degree Kelvin","K","K","temperature",1,[0,0,0,0,1,0,0],"K",null,false,"C",null,1,false,false,0,"Kelvin; degrees","UCUM","Temp","Clinical","absolute, thermodynamic temperature scale ",null,null,null,null,false],[true,"coulomb","C","C","electric charge",1,[0,0,0,0,0,1,0],"C",null,false,"Q",null,1,false,false,0,"coulombs","UCUM","","Clinical","defined as amount of 1 electron charge = 6.2415093×10^18 e, and equivalent to 1 Ampere-second",null,null,null,null,false],[true,"candela","cd","CD","luminous intensity",1,[0,0,0,0,0,0,1],"cd",null,false,"F",null,1,false,false,0,"candelas","UCUM","","Clinical","SI base unit of luminous intensity",null,null,null,null,false],[false,"the number ten for arbitrary powers","10*","10*","number",10,[0,0,0,0,0,0,0],"10","dimless",false,null,null,1,false,false,0,"10^; 10 to the arbitrary powers","UCUM","Num","Clinical","10* by itself is the same as 10, but users can add digits after the *. For example, 10*3 = 1000.","1","1","10",10,false],[false,"the number ten for arbitrary powers","10^","10^","number",10,[0,0,0,0,0,0,0],"10","dimless",false,null,null,1,false,false,0,"10*; 10 to the arbitrary power","UCUM","Num","Clinical","10* by itself is the same as 10, but users can add digits after the *. For example, 10*3 = 1000.","1","1","10",10,false],[false,"the number pi","[pi]","[PI]","number",3.141592653589793,[0,0,0,0,0,0,0],"π","dimless",false,null,null,1,false,false,0,"π","UCUM","","Constant","a mathematical constant; the ratio of a circle's circumference to its diameter ≈ 3.14159","1","1","3.1415926535897932384626433832795028841971693993751058209749445923",3.141592653589793,false],[false,"","%","%","fraction",0.01,[0,0,0,0,0,0,0],"%","dimless",false,null,null,1,false,false,0,"percents","UCUM","FR; NFR; MFR; CFR; SFR Rto; etc. ","Clinical","","10*-2","10*-2","1",1,false],[false,"parts per thousand","[ppth]","[PPTH]","fraction",0.001,[0,0,0,0,0,0,0],"ppth","dimless",false,null,null,1,false,false,0,"ppth; 10^-3","UCUM","MCnc; MCnt","Clinical","[ppth] is often used in solution concentrations as 1 g/L or 1 g/kg.\n\nCan be ambigous and would be better if the metric units was used directly. ","10*-3","10*-3","1",1,false],[false,"parts per million","[ppm]","[PPM]","fraction",0.000001,[0,0,0,0,0,0,0],"ppm","dimless",false,null,null,1,false,false,0,"ppm; 10^-6","UCUM","MCnt; MCnc; SFr","Clinical","[ppm] is often used in solution concentrations as 1 mg/L or 1 mg/kg. Also used to express mole fractions as 1 mmol/mol.\n\n[ppm] is also used in nuclear magnetic resonance (NMR) to represent chemical shift - the difference of a measured frequency in parts per million from the reference frequency.\n\nCan be ambigous and would be better if the metric units was used directly. ","10*-6","10*-6","1",1,false],[false,"parts per billion","[ppb]","[PPB]","fraction",1e-9,[0,0,0,0,0,0,0],"ppb","dimless",false,null,null,1,false,false,0,"ppb; 10^-9","UCUM","MCnt; MCnc; SFr","Clinical","[ppb] is often used in solution concentrations as 1 ug/L or 1 ug/kg. Also used to express mole fractions as 1 umol/mol.\n\nCan be ambigous and would be better if the metric units was used directly. ","10*-9","10*-9","1",1,false],[false,"parts per trillion","[pptr]","[PPTR]","fraction",1e-12,[0,0,0,0,0,0,0],"pptr","dimless",false,null,null,1,false,false,0,"pptr; 10^-12","UCUM","MCnt; MCnc; SFr","Clinical","[pptr] is often used in solution concentrations as 1 ng/L or 1 ng/kg. Also used to express mole fractions as 1 nmol/mol.\n\nCan be ambigous and would be better if the metric units was used directly. ","10*-12","10*-12","1",1,false],[false,"mole","mol","MOL","amount of substance",6.0221367e+23,[0,0,0,0,0,0,0],"mol","si",true,null,null,1,false,false,1,"moles","UCUM","Sub","Clinical","Measure the number of molecules ","10*23","10*23","6.0221367",6.0221367,false],[false,"steradian - solid angle","sr","SR","solid angle",1,[0,0,0,2,0,0,0],"sr","si",true,null,null,1,false,false,0,"square radian; rad2; rad^2","UCUM","Angle","Clinical","unit of solid angle in three-dimensional geometry analagous to radian; used in photometry which measures the perceived brightness of object by human eye (e.g. radiant intensity = watt/steradian)","rad2","RAD2","1",1,false],[false,"hertz","Hz","HZ","frequency",1,[0,-1,0,0,0,0,0],"Hz","si",true,null,null,1,false,false,0,"Herz; frequency; frequencies","UCUM","Freq; Num","Clinical","equal to one cycle per second","s-1","S-1","1",1,false],[false,"newton","N","N","force",1000,[1,-2,1,0,0,0,0],"N","si",true,null,null,1,false,false,0,"Newtons","UCUM","Force","Clinical","unit of force with base units kg.m/s2","kg.m/s2","KG.M/S2","1",1,false],[false,"pascal","Pa","PAL","pressure",1000,[-1,-2,1,0,0,0,0],"Pa","si",true,null,null,1,false,false,0,"pascals","UCUM","Pres","Clinical","standard unit of pressure equal to 1 newton per square meter (N/m2)","N/m2","N/M2","1",1,false],[false,"joule","J","J","energy",1000,[2,-2,1,0,0,0,0],"J","si",true,null,null,1,false,false,0,"joules","UCUM","Enrg","Clinical","unit of energy defined as the work required to move an object 1 m with a force of 1 N (N.m) or an electric charge of 1 C through 1 V (C.V), or to produce 1 W for 1 s (W.s) ","N.m","N.M","1",1,false],[false,"watt","W","W","power",1000,[2,-3,1,0,0,0,0],"W","si",true,null,null,1,false,false,0,"watts","UCUM","EngRat","Clinical","unit of power equal to 1 Joule per second (J/s) = kg⋅m2⋅s−3","J/s","J/S","1",1,false],[false,"Ampere","A","A","electric current",1,[0,-1,0,0,0,1,0],"A","si",true,null,null,1,false,false,0,"Amperes","UCUM","ElpotRat","Clinical","unit of electric current equal to flow rate of electrons equal to 16.2415×10^18 elementary charges moving past a boundary in one second or 1 Coulomb/second","C/s","C/S","1",1,false],[false,"volt","V","V","electric potential",1000,[2,-2,1,0,0,-1,0],"V","si",true,null,null,1,false,false,0,"volts","UCUM","Elpot","Clinical","unit of electric potential (voltage) = 1 Joule per Coulomb (J/C)","J/C","J/C","1",1,false],[false,"farad","F","F","electric capacitance",0.001,[-2,2,-1,0,0,2,0],"F","si",true,null,null,1,false,false,0,"farads; electric capacitance","UCUM","","Clinical","CGS unit of electric capacitance with base units C/V (Coulomb per Volt)","C/V","C/V","1",1,false],[false,"ohm","Ohm","OHM","electric resistance",1000,[2,-1,1,0,0,-2,0],"Ω","si",true,null,null,1,false,false,0,"Ω; resistance; ohms","UCUM","","Clinical","unit of electrical resistance with units of Volt per Ampere","V/A","V/A","1",1,false],[false,"siemens","S","SIE","electric conductance",0.001,[-2,1,-1,0,0,2,0],"S","si",true,null,null,1,false,false,0,"Reciprocal ohm; mho; Ω−1; conductance","UCUM","","Clinical","unit of electric conductance (the inverse of electrical resistance) equal to ohm^-1","Ohm-1","OHM-1","1",1,false],[false,"weber","Wb","WB","magnetic flux",1000,[2,-1,1,0,0,-1,0],"Wb","si",true,null,null,1,false,false,0,"magnetic flux; webers","UCUM","","Clinical","unit of magnetic flux equal to Volt second","V.s","V.S","1",1,false],[false,"degree Celsius","Cel","CEL","temperature",1,[0,0,0,0,1,0,0],"°C","si",true,null,"Cel",1,true,false,0,"°C; degrees","UCUM","Temp","Clinical","","K",null,null,1,false],[false,"tesla","T","T","magnetic flux density",1000,[0,-1,1,0,0,-1,0],"T","si",true,null,null,1,false,false,0,"Teslas; magnetic field","UCUM","","Clinical","SI unit of magnetic field strength for magnetic field B equal to 1 Weber/square meter = 1 kg/(s2*A)","Wb/m2","WB/M2","1",1,false],[false,"henry","H","H","inductance",1000,[2,0,1,0,0,-2,0],"H","si",true,null,null,1,false,false,0,"henries; inductance","UCUM","","Clinical","unit of electrical inductance; usually expressed in millihenrys (mH) or microhenrys (uH).","Wb/A","WB/A","1",1,false],[false,"lumen","lm","LM","luminous flux",1,[0,0,0,2,0,0,1],"lm","si",true,null,null,1,false,false,0,"luminous flux; lumens","UCUM","","Clinical","unit of luminous flux defined as 1 lm = 1 cd⋅sr (candela times sphere)","cd.sr","CD.SR","1",1,false],[false,"lux","lx","LX","illuminance",1,[-2,0,0,2,0,0,1],"lx","si",true,null,null,1,false,false,0,"illuminance; luxes","UCUM","","Clinical","unit of illuminance equal to one lumen per square meter. ","lm/m2","LM/M2","1",1,false],[false,"becquerel","Bq","BQ","radioactivity",1,[0,-1,0,0,0,0,0],"Bq","si",true,null,null,1,false,false,0,"activity; radiation; becquerels","UCUM","","Clinical","measure of the atomic radiation rate with units s^-1","s-1","S-1","1",1,false],[false,"gray","Gy","GY","energy dose",1,[2,-2,0,0,0,0,0],"Gy","si",true,null,null,1,false,false,0,"absorbed doses; ionizing radiation doses; kerma; grays","UCUM","EngCnt","Clinical","unit of ionizing radiation dose with base units of 1 joule of radiation energy per kilogram of matter","J/kg","J/KG","1",1,false],[false,"sievert","Sv","SV","dose equivalent",1,[2,-2,0,0,0,0,0],"Sv","si",true,null,null,1,false,false,0,"sieverts; radiation dose quantities; equivalent doses; effective dose; operational dose; committed dose","UCUM","","Clinical","SI unit for radiation dose equivalent equal to 1 Joule/kilogram.","J/kg","J/KG","1",1,false],[false,"degree - plane angle","deg","DEG","plane angle",0.017453292519943295,[0,0,0,1,0,0,0],"°","iso1000",false,null,null,1,false,false,0,"°; degree of arc; arc degree; arcdegree; angle","UCUM","Angle","Clinical","one degree is equivalent to π/180 radians.","[pi].rad/360","[PI].RAD/360","2",2,false],[false,"gon","gon","GON","plane angle",0.015707963267948967,[0,0,0,1,0,0,0],"□g","iso1000",false,null,null,1,false,false,0,"gon (grade); gons","UCUM","Angle","Nonclinical","unit of plane angle measurement equal to 1/400 circle","deg","DEG","0.9",0.9,false],[false,"arc minute","'","'","plane angle",0.0002908882086657216,[0,0,0,1,0,0,0],"'","iso1000",false,null,null,1,false,false,0,"arcminutes; arcmin; arc minutes; arc mins","UCUM","Angle","Clinical","equal to 1/60 degree; used in optometry and opthamology (e.g. visual acuity tests)","deg/60","DEG/60","1",1,false],[false,"arc second","''","''","plane angle",0.00000484813681109536,[0,0,0,1,0,0,0],"''","iso1000",false,null,null,1,false,false,0,"arcseconds; arcsecs","UCUM","Angle","Clinical","equal to 1/60 arcminute = 1/3600 degree; used in optometry and opthamology (e.g. visual acuity tests)","'/60","'/60","1",1,false],[false,"Liters","l","L","volume",0.001,[3,0,0,0,0,0,0],"l","iso1000",true,null,null,1,false,false,0,"cubic decimeters; decimeters cubed; decimetres; dm3; dm^3; litres; liters, LT ","UCUM","Vol","Clinical","Because lower case \"l\" can be read as the number \"1\", though this is a valid UCUM units. UCUM strongly reccomends using \"L\"","dm3","DM3","1",1,false],[false,"Liters","L","L","volume",0.001,[3,0,0,0,0,0,0],"L","iso1000",true,null,null,1,false,false,0,"cubic decimeters; decimeters cubed; decimetres; dm3; dm^3; litres; liters, LT ","UCUM","Vol","Clinical","Because lower case \"l\" can be read as the number \"1\", though this is a valid UCUM units. UCUM strongly reccomends using \"L\"","l",null,"1",1,false],[false,"are","ar","AR","area",100,[2,0,0,0,0,0,0],"a","iso1000",true,null,null,1,false,false,0,"100 m2; 100 m^2; 100 square meter; meters squared; metres","UCUM","Area","Clinical","metric base unit for area defined as 100 m^2","m2","M2","100",100,false],[false,"minute","min","MIN","time",60,[0,1,0,0,0,0,0],"min","iso1000",false,null,null,1,false,false,0,"minutes","UCUM","Time","Clinical","","s","S","60",60,false],[false,"hour","h","HR","time",3600,[0,1,0,0,0,0,0],"h","iso1000",false,null,null,1,false,false,0,"hours; hrs; age","UCUM","Time","Clinical","","min","MIN","60",60,false],[false,"day","d","D","time",86400,[0,1,0,0,0,0,0],"d","iso1000",false,null,null,1,false,false,0,"days; age; dy; 24 hours; 24 hrs","UCUM","Time","Clinical","","h","HR","24",24,false],[false,"tropical year","a_t","ANN_T","time",31556925.216,[0,1,0,0,0,0,0],"at","iso1000",false,null,null,1,false,false,0,"solar years; a tropical; years","UCUM","Time","Clinical","has an average of 365.242181 days but is constantly changing.","d","D","365.24219",365.24219,false],[false,"mean Julian year","a_j","ANN_J","time",31557600,[0,1,0,0,0,0,0],"aj","iso1000",false,null,null,1,false,false,0,"mean Julian yr; a julian; years","UCUM","Time","Clinical","has an average of 365.25 days, and in everyday use, has been replaced by the Gregorian year. However, this unit is used in astronomy to calculate light year. ","d","D","365.25",365.25,false],[false,"mean Gregorian year","a_g","ANN_G","time",31556952,[0,1,0,0,0,0,0],"ag","iso1000",false,null,null,1,false,false,0,"mean Gregorian yr; a gregorian; years","UCUM","Time","Clinical","has an average of 365.2425 days and is the most internationally used civil calendar.","d","D","365.2425",365.2425,false],[false,"year","a","ANN","time",31557600,[0,1,0,0,0,0,0],"a","iso1000",false,null,null,1,false,false,0,"years; a; yr, yrs; annum","UCUM","Time","Clinical","","a_j","ANN_J","1",1,false],[false,"week","wk","WK","time",604800,[0,1,0,0,0,0,0],"wk","iso1000",false,null,null,1,false,false,0,"weeks; wks","UCUM","Time","Clinical","","d","D","7",7,false],[false,"synodal month","mo_s","MO_S","time",2551442.976,[0,1,0,0,0,0,0],"mos","iso1000",false,null,null,1,false,false,0,"Moon; synodic month; lunar month; mo-s; mo s; months; moons","UCUM","Time","Nonclinical","has an average of 29.53 days per month, unit used in astronomy","d","D","29.53059",29.53059,false],[false,"mean Julian month","mo_j","MO_J","time",2629800,[0,1,0,0,0,0,0],"moj","iso1000",false,null,null,1,false,false,0,"mo-julian; mo Julian; months","UCUM","Time","Clinical","has an average of 30.435 days per month","a_j/12","ANN_J/12","1",1,false],[false,"mean Gregorian month","mo_g","MO_G","time",2629746,[0,1,0,0,0,0,0],"mog","iso1000",false,null,null,1,false,false,0,"months; month-gregorian; mo-gregorian","UCUM","Time","Clinical","has an average 30.436875 days per month and is from the most internationally used civil calendar.","a_g/12","ANN_G/12","1",1,false],[false,"month","mo","MO","time",2629800,[0,1,0,0,0,0,0],"mo","iso1000",false,null,null,1,false,false,0,"months; duration","UCUM","Time","Clinical","based on Julian calendar which has an average of 30.435 days per month (this unit is used in astronomy but not in everyday life - see mo_g)","mo_j","MO_J","1",1,false],[false,"metric ton","t","TNE","mass",1000000,[0,0,1,0,0,0,0],"t","iso1000",true,null,null,1,false,false,0,"tonnes; megagrams; tons","UCUM","Mass","Nonclinical","equal to 1000 kg used in the US (recognized by NIST as metric ton), and internationally (recognized as tonne)","kg","KG","1e3",1000,false],[false,"bar","bar","BAR","pressure",100000000,[-1,-2,1,0,0,0,0],"bar","iso1000",true,null,null,1,false,false,0,"bars","UCUM","Pres","Nonclinical","unit of pressure equal to 10^5 Pascals, primarily used by meteorologists and in weather forecasting","Pa","PAL","1e5",100000,false],[false,"unified atomic mass unit","u","AMU","mass",1.6605402e-24,[0,0,1,0,0,0,0],"u","iso1000",true,null,null,1,false,false,0,"unified atomic mass units; amu; Dalton; Da","UCUM","Mass","Clinical","the mass of 1/12 of an unbound Carbon-12 atom nuclide equal to 1.6606x10^-27 kg ","g","G","1.6605402e-24",1.6605402e-24,false],[false,"astronomic unit","AU","ASU","length",149597870691,[1,0,0,0,0,0,0],"AU","iso1000",false,null,null,1,false,false,0,"AU; units","UCUM","Len","Clinical","unit of length used in astronomy for measuring distance in Solar system","Mm","MAM","149597.870691",149597.870691,false],[false,"parsec","pc","PRS","length",30856780000000000,[1,0,0,0,0,0,0],"pc","iso1000",true,null,null,1,false,false,0,"parsecs","UCUM","Len","Clinical","unit of length equal to 3.26 light years, nad used to measure large distances to objects outside our Solar System","m","M","3.085678e16",30856780000000000,false],[false,"velocity of light in a vacuum","[c]","[C]","velocity",299792458,[1,-1,0,0,0,0,0],"c","const",true,null,null,1,false,false,0,"speed of light","UCUM","Vel","Constant","equal to 299792458 m/s (approximately 3 x 10^8 m/s)","m/s","M/S","299792458",299792458,false],[false,"Planck constant","[h]","[H]","action",6.6260755e-31,[2,-1,1,0,0,0,0],"h","const",true,null,null,1,false,false,0,"Planck's constant","UCUM","","Constant","constant = 6.62607004 × 10-34 m2.kg/s; defined as quantum of action","J.s","J.S","6.6260755e-34",6.6260755e-34,false],[false,"Boltzmann constant","[k]","[K]","(unclassified)",1.380658e-20,[2,-2,1,0,-1,0,0],"k","const",true,null,null,1,false,false,0,"k; kB","UCUM","","Constant","physical constant relating energy at the individual particle level with temperature = 1.38064852 ×10^−23 J/K","J/K","J/K","1.380658e-23",1.380658e-23,false],[false,"permittivity of vacuum - electric","[eps_0]","[EPS_0]","electric permittivity",8.854187817000001e-15,[-3,2,-1,0,0,2,0],"ε0","const",true,null,null,1,false,false,0,"ε0; Electric Constant; vacuum permittivity; permittivity of free space ","UCUM","","Constant","approximately equal to 8.854 × 10^−12 F/m (farads per meter)","F/m","F/M","8.854187817e-12",8.854187817e-12,false],[false,"permeability of vacuum - magnetic","[mu_0]","[MU_0]","magnetic permeability",0.0012566370614359172,[1,0,1,0,0,-2,0],"μ0","const",true,null,null,1,false,false,0,"μ0; vacuum permeability; permeability of free space; magnetic constant","UCUM","","Constant","equal to 4π×10^−7 N/A2 (Newtons per square ampere) ≈ 1.2566×10^−6 H/m (Henry per meter)","N/A2","4.[PI].10*-7.N/A2","1",0.0000012566370614359173,false],[false,"elementary charge","[e]","[E]","electric charge",1.60217733e-19,[0,0,0,0,0,1,0],"e","const",true,null,null,1,false,false,0,"e; q; electric charges","UCUM","","Constant","the magnitude of the electric charge carried by a single electron or proton ≈ 1.60217×10^-19 Coulombs","C","C","1.60217733e-19",1.60217733e-19,false],[false,"electronvolt","eV","EV","energy",1.60217733e-16,[2,-2,1,0,0,0,0],"eV","iso1000",true,null,null,1,false,false,0,"Electron Volts; electronvolts","UCUM","Eng","Clinical","unit of kinetic energy = 1 V * 1.602×10^−19 C = 1.6×10−19 Joules","[e].V","[E].V","1",1,false],[false,"electron mass","[m_e]","[M_E]","mass",9.1093897e-28,[0,0,1,0,0,0,0],"me","const",true,null,null,1,false,false,0,"electron rest mass; me","UCUM","Mass","Constant","approximately equal to 9.10938356 × 10-31 kg; defined as the mass of a stationary electron","g","g","9.1093897e-28",9.1093897e-28,false],[false,"proton mass","[m_p]","[M_P]","mass",1.6726231e-24,[0,0,1,0,0,0,0],"mp","const",true,null,null,1,false,false,0,"mp; masses","UCUM","Mass","Constant","approximately equal to 1.672622×10−27 kg","g","g","1.6726231e-24",1.6726231e-24,false],[false,"Newtonian constant of gravitation","[G]","[GC]","(unclassified)",6.67259e-14,[3,-2,-1,0,0,0,0],"G","const",true,null,null,1,false,false,0,"G; gravitational constant; Newton's constant","UCUM","","Constant","gravitational constant = 6.674×10−11 N⋅m2/kg2","m3.kg-1.s-2","M3.KG-1.S-2","6.67259e-11",6.67259e-11,false],[false,"standard acceleration of free fall","[g]","[G]","acceleration",9.80665,[1,-2,0,0,0,0,0],"gn","const",true,null,null,1,false,false,0,"standard gravity; g; ɡ0; ɡn","UCUM","Accel","Constant","defined by standard = 9.80665 m/s2","m/s2","M/S2","980665e-5",9.80665,false],[false,"Torr","Torr","Torr","pressure",133322,[-1,-2,1,0,0,0,0],"Torr","const",false,null,null,1,false,false,0,"torrs","UCUM","Pres","Clinical","1 torr = 1 mmHg; unit used to measure blood pressure","Pa","PAL","133.322",133.322,false],[false,"standard atmosphere","atm","ATM","pressure",101325000,[-1,-2,1,0,0,0,0],"atm","const",false,null,null,1,false,false,0,"reference pressure; atmos; std atmosphere","UCUM","Pres","Clinical","defined as being precisely equal to 101,325 Pa","Pa","PAL","101325",101325,false],[false,"light-year","[ly]","[LY]","length",9460730472580800,[1,0,0,0,0,0,0],"l.y.","const",true,null,null,1,false,false,0,"light years; ly","UCUM","Len","Constant","unit of astronomal distance = 5.88×10^12 mi","[c].a_j","[C].ANN_J","1",1,false],[false,"gram-force","gf","GF","force",9.80665,[1,-2,1,0,0,0,0],"gf","const",true,null,null,1,false,false,0,"Newtons; gram forces","UCUM","Force","Clinical","May be specific to unit related to cardiac output","g.[g]","G.[G]","1",1,false],[false,"Kayser","Ky","KY","lineic number",100,[-1,0,0,0,0,0,0],"K","cgs",true,null,null,1,false,false,0,"wavenumbers; kaysers","UCUM","InvLen","Clinical","unit of wavelength equal to cm^-1","cm-1","CM-1","1",1,false],[false,"Gal","Gal","GL","acceleration",0.01,[1,-2,0,0,0,0,0],"Gal","cgs",true,null,null,1,false,false,0,"galileos; Gals","UCUM","Accel","Clinical","unit of acceleration used in gravimetry; equivalent to cm/s2 ","cm/s2","CM/S2","1",1,false],[false,"dyne","dyn","DYN","force",0.01,[1,-2,1,0,0,0,0],"dyn","cgs",true,null,null,1,false,false,0,"dynes","UCUM","Force","Clinical","unit of force equal to 10^-5 Newtons","g.cm/s2","G.CM/S2","1",1,false],[false,"erg","erg","ERG","energy",0.0001,[2,-2,1,0,0,0,0],"erg","cgs",true,null,null,1,false,false,0,"10^-7 Joules, 10-7 Joules; 100 nJ; 100 nanoJoules; 1 dyne cm; 1 g.cm2/s2","UCUM","Eng","Clinical","unit of energy = 1 dyne centimeter = 10^-7 Joules","dyn.cm","DYN.CM","1",1,false],[false,"Poise","P","P","dynamic viscosity",100,[-1,-1,1,0,0,0,0],"P","cgs",true,null,null,1,false,false,0,"dynamic viscosity; poises","UCUM","Visc","Clinical","unit of dynamic viscosity where 1 Poise = 1/10 Pascal second","dyn.s/cm2","DYN.S/CM2","1",1,false],[false,"Biot","Bi","BI","electric current",10,[0,-1,0,0,0,1,0],"Bi","cgs",true,null,null,1,false,false,0,"Bi; abamperes; abA","UCUM","ElpotRat","Clinical","equal to 10 amperes","A","A","10",10,false],[false,"Stokes","St","ST","kinematic viscosity",0.0001,[2,-1,0,0,0,0,0],"St","cgs",true,null,null,1,false,false,0,"kinematic viscosity","UCUM","Visc","Clinical","unit of kimematic viscosity with units cm2/s","cm2/s","CM2/S","1",1,false],[false,"Maxwell","Mx","MX","flux of magnetic induction",0.00001,[2,-1,1,0,0,-1,0],"Mx","cgs",true,null,null,1,false,false,0,"magnetix flux; Maxwells","UCUM","","Clinical","unit of magnetic flux","Wb","WB","1e-8",1e-8,false],[false,"Gauss","G","GS","magnetic flux density",0.1,[0,-1,1,0,0,-1,0],"Gs","cgs",true,null,null,1,false,false,0,"magnetic fields; magnetic flux density; induction; B","UCUM","magnetic","Clinical","CGS unit of magnetic flux density, known as magnetic field B; defined as one maxwell unit per square centimeter (see Oersted for CGS unit for H field)","T","T","1e-4",0.0001,false],[false,"Oersted","Oe","OE","magnetic field intensity",79.57747154594767,[-1,-1,0,0,0,1,0],"Oe","cgs",true,null,null,1,false,false,0,"H magnetic B field; Oersteds","UCUM","","Clinical","CGS unit of the auxiliary magnetic field H defined as 1 dyne per unit pole = 1000/4π amperes per meter (see Gauss for CGS unit for B field)","A/m","/[PI].A/M","250",79.57747154594767,false],[false,"Gilbert","Gb","GB","magnetic tension",0.7957747154594768,[0,-1,0,0,0,1,0],"Gb","cgs",true,null,null,1,false,false,0,"Gi; magnetomotive force; Gilberts","UCUM","","Clinical","unit of magnetomotive force (magnetic potential)","Oe.cm","OE.CM","1",1,false],[false,"stilb","sb","SB","lum. intensity density",10000,[-2,0,0,0,0,0,1],"sb","cgs",true,null,null,1,false,false,0,"stilbs","UCUM","","Obsolete","unit of luminance; equal to and replaced by unit candela per square centimeter (cd/cm2)","cd/cm2","CD/CM2","1",1,false],[false,"Lambert","Lmb","LMB","brightness",3183.098861837907,[-2,0,0,0,0,0,1],"L","cgs",true,null,null,1,false,false,0,"luminance; lamberts","UCUM","","Clinical","unit of luminance defined as 1 lambert = 1/ π candela per square meter","cd/cm2/[pi]","CD/CM2/[PI]","1",1,false],[false,"phot","ph","PHT","illuminance",0.0001,[-2,0,0,2,0,0,1],"ph","cgs",true,null,null,1,false,false,0,"phots","UCUM","","Clinical","CGS photometric unit of illuminance, or luminous flux through an area equal to 10000 lumens per square meter = 10000 lux","lx","LX","1e-4",0.0001,false],[false,"Curie","Ci","CI","radioactivity",37000000000,[0,-1,0,0,0,0,0],"Ci","cgs",true,null,null,1,false,false,0,"curies","UCUM","","Obsolete","unit for measuring atomic disintegration rate; replaced by the Bequerel (Bq) unit","Bq","BQ","37e9",37000000000,false],[false,"Roentgen","R","ROE","ion dose",2.58e-7,[0,0,-1,0,0,1,0],"R","cgs",true,null,null,1,false,false,0,"röntgen; Roentgens","UCUM","","Clinical","unit of exposure of X-rays and gamma rays in air; unit used primarily in the US but strongly discouraged by NIST","C/kg","C/KG","2.58e-4",0.000258,false],[false,"radiation absorbed dose","RAD","[RAD]","energy dose",0.01,[2,-2,0,0,0,0,0],"RAD","cgs",true,null,null,1,false,false,0,"doses","UCUM","","Clinical","unit of radiation absorbed dose used primarily in the US with base units 100 ergs per gram of material. Also see the SI unit Gray (Gy).","erg/g","ERG/G","100",100,false],[false,"radiation equivalent man","REM","[REM]","dose equivalent",0.01,[2,-2,0,0,0,0,0],"REM","cgs",true,null,null,1,false,false,0,"Roentgen Equivalent in Man; rems; dose equivalents","UCUM","","Clinical","unit of equivalent dose which measures the effect of radiation on humans equal to 0.01 sievert. Used primarily in the US. Also see SI unit Sievert (Sv)","RAD","[RAD]","1",1,false],[false,"inch","[in_i]","[IN_I]","length",0.025400000000000002,[1,0,0,0,0,0,0],"in","intcust",false,null,null,1,false,false,0,"inches; in; international inch; body height","UCUM","Len","Clinical","standard unit for inch in the US and internationally","cm","CM","254e-2",2.54,false],[false,"foot","[ft_i]","[FT_I]","length",0.3048,[1,0,0,0,0,0,0],"ft","intcust",false,null,null,1,false,false,0,"ft; fts; foot; international foot; feet; international feet; height","UCUM","Len","Clinical","unit used in the US and internationally","[in_i]","[IN_I]","12",12,false],[false,"yard","[yd_i]","[YD_I]","length",0.9144000000000001,[1,0,0,0,0,0,0],"yd","intcust",false,null,null,1,false,false,0,"international yards; yds; distance","UCUM","Len","Clinical","standard unit used in the US and internationally","[ft_i]","[FT_I]","3",3,false],[false,"mile","[mi_i]","[MI_I]","length",1609.344,[1,0,0,0,0,0,0],"mi","intcust",false,null,null,1,false,false,0,"international miles; mi I; statute mile","UCUM","Len","Clinical","standard unit used in the US and internationally","[ft_i]","[FT_I]","5280",5280,false],[false,"fathom","[fth_i]","[FTH_I]","depth of water",1.8288000000000002,[1,0,0,0,0,0,0],"fth","intcust",false,null,null,1,false,false,0,"international fathoms","UCUM","Len","Nonclinical","unit used in the US and internationally to measure depth of water; same length as the US fathom","[ft_i]","[FT_I]","6",6,false],[false,"nautical mile","[nmi_i]","[NMI_I]","length",1852,[1,0,0,0,0,0,0],"n.mi","intcust",false,null,null,1,false,false,0,"nautical mile; nautical miles; international nautical mile; international nautical miles; nm; n.m.; nmi","UCUM","Len","Nonclinical","standard unit used in the US and internationally","m","M","1852",1852,false],[false,"knot","[kn_i]","[KN_I]","velocity",0.5144444444444445,[1,-1,0,0,0,0,0],"knot","intcust",false,null,null,1,false,false,0,"kn; kt; international knots","UCUM","Vel","Nonclinical","defined as equal to one nautical mile (1.852 km) per hour","[nmi_i]/h","[NMI_I]/H","1",1,false],[false,"square inch","[sin_i]","[SIN_I]","area",0.0006451600000000001,[2,0,0,0,0,0,0],null,"intcust",false,null,null,1,false,false,0,"in2; in^2; inches squared; sq inch; inches squared; international","UCUM","Area","Clinical","standard unit used in the US and internationally","[in_i]2","[IN_I]2","1",1,false],[false,"square foot","[sft_i]","[SFT_I]","area",0.09290304,[2,0,0,0,0,0,0],null,"intcust",false,null,null,1,false,false,0,"ft2; ft^2; ft squared; sq ft; feet; international","UCUM","Area","Clinical","standard unit used in the US and internationally","[ft_i]2","[FT_I]2","1",1,false],[false,"square yard","[syd_i]","[SYD_I]","area",0.8361273600000002,[2,0,0,0,0,0,0],null,"intcust",false,null,null,1,false,false,0,"yd2; yd^2; sq. yds; yards squared; international","UCUM","Area","Clinical","standard unit used in the US and internationally","[yd_i]2","[YD_I]2","1",1,false],[false,"cubic inch","[cin_i]","[CIN_I]","volume",0.000016387064000000003,[3,0,0,0,0,0,0],null,"intcust",false,null,null,1,false,false,0,"in3; in^3; in*3; inches^3; inches*3; cu. in; cu in; cubic inches; inches cubed; cin","UCUM","Vol","Clinical","standard unit used in the US and internationally","[in_i]3","[IN_I]3","1",1,false],[false,"cubic foot","[cft_i]","[CFT_I]","volume",0.028316846592000004,[3,0,0,0,0,0,0],null,"intcust",false,null,null,1,false,false,0,"ft3; ft^3; ft*3; cu. ft; cubic feet; cubed; [ft_i]3; international","UCUM","Vol","Clinical","","[ft_i]3","[FT_I]3","1",1,false],[false,"cubic yard","[cyd_i]","[CYD_I]","volume",0.7645548579840002,[3,0,0,0,0,0,0],"cu.yd","intcust",false,null,null,1,false,false,0,"cubic yards; cubic yds; cu yards; CYs; yards^3; yd^3; yds^3; yd3; yds3","UCUM","Vol","Nonclinical","standard unit used in the US and internationally","[yd_i]3","[YD_I]3","1",1,false],[false,"board foot","[bf_i]","[BF_I]","volume",0.002359737216,[3,0,0,0,0,0,0],null,"intcust",false,null,null,1,false,false,0,"BDFT; FBM; BF; board feet; international","UCUM","Vol","Nonclinical","unit of volume used to measure lumber","[in_i]3","[IN_I]3","144",144,false],[false,"cord","[cr_i]","[CR_I]","volume",3.6245563637760005,[3,0,0,0,0,0,0],null,"intcust",false,null,null,1,false,false,0,"crd I; international cords","UCUM","Vol","Nonclinical","unit of measure of dry volume used to measure firewood equal 128 ft3","[ft_i]3","[FT_I]3","128",128,false],[false,"mil","[mil_i]","[MIL_I]","length",0.000025400000000000004,[1,0,0,0,0,0,0],"mil","intcust",false,null,null,1,false,false,0,"thou, thousandth; mils; international","UCUM","Len","Clinical","equal to 0.001 international inch","[in_i]","[IN_I]","1e-3",0.001,false],[false,"circular mil","[cml_i]","[CML_I]","area",5.067074790974979e-10,[2,0,0,0,0,0,0],"circ.mil","intcust",false,null,null,1,false,false,0,"circular mils; cml I; international","UCUM","Area","Clinical","","[pi]/4.[mil_i]2","[PI]/4.[MIL_I]2","1",1,false],[false,"hand","[hd_i]","[HD_I]","height of horses",0.10160000000000001,[1,0,0,0,0,0,0],"hd","intcust",false,null,null,1,false,false,0,"hands; international","UCUM","Len","Nonclinical","used to measure horse height","[in_i]","[IN_I]","4",4,false],[false,"foot - US","[ft_us]","[FT_US]","length",0.3048006096012192,[1,0,0,0,0,0,0],"ftus","us-lengths",false,null,null,1,false,false,0,"US foot; foot US; us ft; ft us; height; visual distance; feet","UCUM","Len","Obsolete","Better to use [ft_i] which refers to the length used worldwide, including in the US; [ft_us] may be confused with land survey units. ","m/3937","M/3937","1200",1200,false],[false,"yard - US","[yd_us]","[YD_US]","length",0.9144018288036575,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"US yards; us yds; distance","UCUM","Len; Nrat","Obsolete","Better to use [yd_i] which refers to the length used worldwide, including in the US; [yd_us] refers to unit used in land surveys in the US","[ft_us]","[FT_US]","3",3,false],[false,"inch - US","[in_us]","[IN_US]","length",0.0254000508001016,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"US inches; in us; us in; inch US","UCUM","Len","Obsolete","Better to use [in_i] which refers to the length used worldwide, including in the US","[ft_us]/12","[FT_US]/12","1",1,false],[false,"rod - US","[rd_us]","[RD_US]","length",5.029210058420117,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"US rod; US rods; rd US; US rd","UCUM","Len","Obsolete","","[ft_us]","[FT_US]","16.5",16.5,false],[false,"Gunter's chain - US","[ch_us]","[CH_US]","length",20.116840233680467,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"surveyor's chain; Surveyor's chain USA; Gunter’s measurement; surveyor’s measurement; Gunter's Chain USA","UCUM","Len","Obsolete","historical unit used for land survey used only in the US","[rd_us]","[RD_US]","4",4,false],[false,"link for Gunter's chain - US","[lk_us]","[LK_US]","length",0.20116840233680466,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"Links for Gunter's Chain USA","UCUM","Len","Obsolete","","[ch_us]/100","[CH_US]/100","1",1,false],[false,"Ramden's chain - US","[rch_us]","[RCH_US]","length",30.480060960121918,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"Ramsden's chain; engineer's chains","UCUM","Len","Obsolete","distance measuring device used for land survey","[ft_us]","[FT_US]","100",100,false],[false,"link for Ramden's chain - US","[rlk_us]","[RLK_US]","length",0.3048006096012192,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"links for Ramsden's chain","UCUM","Len","Obsolete","","[rch_us]/100","[RCH_US]/100","1",1,false],[false,"fathom - US","[fth_us]","[FTH_US]","length",1.828803657607315,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"US fathoms; fathom USA; fth us","UCUM","Len","Obsolete","same length as the international fathom - better to use international fathom ([fth_i])","[ft_us]","[FT_US]","6",6,false],[false,"furlong - US","[fur_us]","[FUR_US]","length",201.16840233680466,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"US furlongs; fur us","UCUM","Len","Nonclinical","distance unit in horse racing","[rd_us]","[RD_US]","40",40,false],[false,"mile - US","[mi_us]","[MI_US]","length",1609.3472186944373,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"U.S. Survey Miles; US statute miles; survey mi; US mi; distance","UCUM","Len","Nonclinical","Better to use [mi_i] which refers to the length used worldwide, including in the US","[fur_us]","[FUR_US]","8",8,false],[false,"acre - US","[acr_us]","[ACR_US]","area",4046.872609874252,[2,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"Acre USA Survey; Acre USA; survey acres","UCUM","Area","Nonclinical","an older unit based on pre 1959 US statute lengths that is still sometimes used in the US only for land survey purposes. ","[rd_us]2","[RD_US]2","160",160,false],[false,"square rod - US","[srd_us]","[SRD_US]","area",25.292953811714074,[2,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"rod2; rod^2; sq. rod; rods squared","UCUM","Area","Nonclinical","Used only in the US to measure land area, based on US statute land survey length units","[rd_us]2","[RD_US]2","1",1,false],[false,"square mile - US","[smi_us]","[SMI_US]","area",2589998.470319521,[2,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"mi2; mi^2; sq mi; miles squared","UCUM","Area","Nonclinical","historical unit used only in the US for land survey purposes (based on the US survey mile), not the internationally recognized [mi_i]","[mi_us]2","[MI_US]2","1",1,false],[false,"section","[sct]","[SCT]","area",2589998.470319521,[2,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"sct; sections","UCUM","Area","Nonclinical","tract of land approximately equal to 1 mile square containing 640 acres","[mi_us]2","[MI_US]2","1",1,false],[false,"township","[twp]","[TWP]","area",93239944.93150276,[2,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"twp; townships","UCUM","Area","Nonclinical","land measurement equal to 6 mile square","[sct]","[SCT]","36",36,false],[false,"mil - US","[mil_us]","[MIL_US]","length",0.0000254000508001016,[1,0,0,0,0,0,0],null,"us-lengths",false,null,null,1,false,false,0,"thou, thousandth; mils","UCUM","Len","Obsolete","better to use [mil_i] which is based on the internationally recognized inch","[in_us]","[IN_US]","1e-3",0.001,false],[false,"inch - British","[in_br]","[IN_BR]","length",0.025399980000000003,[1,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"imperial inches; imp in; br in; british inches","UCUM","Len","Obsolete","","cm","CM","2.539998",2.539998,false],[false,"foot - British","[ft_br]","[FT_BR]","length",0.30479976000000003,[1,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"British Foot; Imperial Foot; feet; imp fts; br fts","UCUM","Len","Obsolete","","[in_br]","[IN_BR]","12",12,false],[false,"rod - British","[rd_br]","[RD_BR]","length",5.02919604,[1,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"British rods; br rd","UCUM","Len","Obsolete","","[ft_br]","[FT_BR]","16.5",16.5,false],[false,"Gunter's chain - British","[ch_br]","[CH_BR]","length",20.11678416,[1,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"Gunter's Chain British; Gunters Chain British; Surveyor's Chain British","UCUM","Len","Obsolete","historical unit used for land survey used only in Great Britain","[rd_br]","[RD_BR]","4",4,false],[false,"link for Gunter's chain - British","[lk_br]","[LK_BR]","length",0.2011678416,[1,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"Links for Gunter's Chain British","UCUM","Len","Obsolete","","[ch_br]/100","[CH_BR]/100","1",1,false],[false,"fathom - British","[fth_br]","[FTH_BR]","length",1.82879856,[1,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"British fathoms; imperial fathoms; br fth; imp fth","UCUM","Len","Obsolete","","[ft_br]","[FT_BR]","6",6,false],[false,"pace - British","[pc_br]","[PC_BR]","length",0.7619994000000001,[1,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"British paces; br pc","UCUM","Len","Nonclinical","traditional unit of length equal to 152.4 centimeters, or 1.52 meter. ","[ft_br]","[FT_BR]","2.5",2.5,false],[false,"yard - British","[yd_br]","[YD_BR]","length",0.91439928,[1,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"British yards; Br yds; distance","UCUM","Len","Obsolete","","[ft_br]","[FT_BR]","3",3,false],[false,"mile - British","[mi_br]","[MI_BR]","length",1609.3427328000002,[1,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"imperial miles; British miles; English statute miles; imp mi, br mi","UCUM","Len","Obsolete","","[ft_br]","[FT_BR]","5280",5280,false],[false,"nautical mile - British","[nmi_br]","[NMI_BR]","length",1853.1825408000002,[1,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"British nautical miles; Imperial nautical miles; Admiralty miles; n.m. br; imp nm","UCUM","Len","Obsolete","","[ft_br]","[FT_BR]","6080",6080,false],[false,"knot - British","[kn_br]","[KN_BR]","velocity",0.5147729280000001,[1,-1,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"British knots; kn br; kt","UCUM","Vel","Obsolete","based on obsolete British nautical mile ","[nmi_br]/h","[NMI_BR]/H","1",1,false],[false,"acre","[acr_br]","[ACR_BR]","area",4046.850049400269,[2,0,0,0,0,0,0],null,"brit-length",false,null,null,1,false,false,0,"Imperial acres; British; a; ac; ar; acr","UCUM","Area","Nonclinical","the standard unit for acre used in the US and internationally","[yd_br]2","[YD_BR]2","4840",4840,false],[false,"gallon - US","[gal_us]","[GAL_US]","fluid volume",0.0037854117840000006,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"US gallons; US liquid gallon; gal us; Queen Anne's wine gallon","UCUM","Vol","Nonclinical","only gallon unit used in the US; [gal_us] is only used in some other countries in South American and Africa to measure gasoline volume","[in_i]3","[IN_I]3","231",231,false],[false,"barrel - US","[bbl_us]","[BBL_US]","fluid volume",0.158987294928,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"bbl","UCUM","Vol","Nonclinical","[bbl_us] is the standard unit for oil barrel, which is a unit only used in the US to measure the volume oil. ","[gal_us]","[GAL_US]","42",42,false],[false,"quart - US","[qt_us]","[QT_US]","fluid volume",0.0009463529460000001,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"US quarts; us qts","UCUM","Vol","Clinical","Used only in the US","[gal_us]/4","[GAL_US]/4","1",1,false],[false,"pint - US","[pt_us]","[PT_US]","fluid volume",0.00047317647300000007,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"US pints; pint US; liquid pint; pt us; us pt","UCUM","Vol","Clinical","Used only in the US","[qt_us]/2","[QT_US]/2","1",1,false],[false,"gill - US","[gil_us]","[GIL_US]","fluid volume",0.00011829411825000002,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"US gills; gil us","UCUM","Vol","Nonclinical","only used in the context of alcohol volume in the US","[pt_us]/4","[PT_US]/4","1",1,false],[false,"fluid ounce - US","[foz_us]","[FOZ_US]","fluid volume",0.000029573529562500005,[3,0,0,0,0,0,0],"oz fl","us-volumes",false,null,null,1,false,false,0,"US fluid ounces; fl ozs; FO; fl. oz.; foz us","UCUM","Vol","Clinical","unit used only in the US","[gil_us]/4","[GIL_US]/4","1",1,false],[false,"fluid dram - US","[fdr_us]","[FDR_US]","fluid volume",0.0000036966911953125006,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"US fluid drams; fdr us","UCUM","Vol","Nonclinical","equal to 1/8 US fluid ounce = 3.69 mL; used informally to mean small amount of liquor, especially Scotch whiskey","[foz_us]/8","[FOZ_US]/8","1",1,false],[false,"minim - US","[min_us]","[MIN_US]","fluid volume",6.1611519921875e-8,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"min US; US min; ♏ US","UCUM","Vol","Obsolete","","[fdr_us]/60","[FDR_US]/60","1",1,false],[false,"cord - US","[crd_us]","[CRD_US]","fluid volume",3.6245563637760005,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"US cord; US cords; crd us; us crd","UCUM","Vol","Nonclinical","unit of measure of dry volume used to measure firewood equal 128 ft3 (the same as international cord [cr_i])","[ft_i]3","[FT_I]3","128",128,false],[false,"bushel - US","[bu_us]","[BU_US]","dry volume",0.03523907016688001,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"US bushels; US bsh; US bu","UCUM","Vol","Obsolete","Historical unit of dry volume that is rarely used today","[in_i]3","[IN_I]3","2150.42",2150.42,false],[false,"gallon - historical","[gal_wi]","[GAL_WI]","dry volume",0.004404883770860001,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"Corn Gallon British; Dry Gallon US; Gallons Historical; Grain Gallon British; Winchester Corn Gallon; historical winchester gallons; wi gal","UCUM","Vol","Obsolete","historical unit of dry volume no longer used","[bu_us]/8","[BU_US]/8","1",1,false],[false,"peck - US","[pk_us]","[PK_US]","dry volume",0.008809767541720002,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"US pecks; US pk","UCUM","Vol","Nonclinical","unit of dry volume rarely used today (can be used to measure volume of apples)","[bu_us]/4","[BU_US]/4","1",1,false],[false,"dry quart - US","[dqt_us]","[DQT_US]","dry volume",0.0011012209427150002,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"dry quarts; dry quart US; US dry quart; dry qt; us dry qt; dqt; dqt us","UCUM","Vol","Nonclinical","historical unit of dry volume only in the US, but is rarely used today","[pk_us]/8","[PK_US]/8","1",1,false],[false,"dry pint - US","[dpt_us]","[DPT_US]","dry volume",0.0005506104713575001,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"dry pints; dry pint US; US dry pint; dry pt; dpt; dpt us","UCUM","Vol","Nonclinical","historical unit of dry volume only in the US, but is rarely used today","[dqt_us]/2","[DQT_US]/2","1",1,false],[false,"tablespoon - US","[tbs_us]","[TBS_US]","volume",0.000014786764781250002,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"Tbs; tbsp; tbs us; US tablespoons","UCUM","Vol","Clinical","unit defined as 0.5 US fluid ounces or 3 teaspoons - used only in the US. See [tbs_m] for the unit used internationally and in the US for nutrional labelling. ","[foz_us]/2","[FOZ_US]/2","1",1,false],[false,"teaspoon - US","[tsp_us]","[TSP_US]","volume",0.0000049289215937500005,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"tsp; t; US teaspoons","UCUM","Vol","Nonclinical","unit defined as 1/6 US fluid ounces - used only in the US. See [tsp_m] for the unit used internationally and in the US for nutrional labelling. ","[tbs_us]/3","[TBS_US]/3","1",1,false],[false,"cup - US customary","[cup_us]","[CUP_US]","volume",0.00023658823650000004,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"cup us; us cups","UCUM","Vol","Nonclinical","Unit defined as 1/2 US pint or 16 US tablespoons ≈ 236.59 mL, which is not the standard unit defined by the FDA of 240 mL - see [cup_m] (metric cup)","[tbs_us]","[TBS_US]","16",16,false],[false,"fluid ounce - metric","[foz_m]","[FOZ_M]","fluid volume",0.000029999999999999997,[3,0,0,0,0,0,0],"oz fl","us-volumes",false,null,null,1,false,false,0,"metric fluid ounces; fozs m; fl ozs m","UCUM","Vol","Clinical","unit used only in the US for nutritional labelling, as set by the FDA","mL","ML","30",30,false],[false,"cup - US legal","[cup_m]","[CUP_M]","volume",0.00023999999999999998,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"cup m; metric cups","UCUM","Vol","Clinical","standard unit equal to 240 mL used in the US for nutritional labelling, as defined by the FDA. Note that this is different from the US customary cup (236.59 mL) and the metric cup used in Commonwealth nations (250 mL).","mL","ML","240",240,false],[false,"teaspoon - metric","[tsp_m]","[TSP_M]","volume",0.0000049999999999999996,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"tsp; t; metric teaspoons","UCUM","Vol","Clinical","standard unit used in the US and internationally","mL","mL","5",5,false],[false,"tablespoon - metric","[tbs_m]","[TBS_M]","volume",0.000014999999999999999,[3,0,0,0,0,0,0],null,"us-volumes",false,null,null,1,false,false,0,"metric tablespoons; Tbs; tbsp; T; tbs m","UCUM","Vol","Clinical","standard unit used in the US and internationally","mL","mL","15",15,false],[false,"gallon- British","[gal_br]","[GAL_BR]","volume",0.004546090000000001,[3,0,0,0,0,0,0],null,"brit-volumes",false,null,null,1,false,false,0,"imperial gallons, UK gallons; British gallons; br gal; imp gal","UCUM","Vol","Nonclinical","Used only in Great Britain and other Commonwealth countries","l","L","4.54609",4.54609,false],[false,"peck - British","[pk_br]","[PK_BR]","volume",0.009092180000000002,[3,0,0,0,0,0,0],null,"brit-volumes",false,null,null,1,false,false,0,"imperial pecks; British pecks; br pk; imp pk","UCUM","Vol","Nonclinical","unit of dry volume rarely used today (can be used to measure volume of apples)","[gal_br]","[GAL_BR]","2",2,false],[false,"bushel - British","[bu_br]","[BU_BR]","volume",0.03636872000000001,[3,0,0,0,0,0,0],null,"brit-volumes",false,null,null,1,false,false,0,"British bushels; imperial; br bsh; br bu; imp","UCUM","Vol","Obsolete","Historical unit of dry volume that is rarely used today","[pk_br]","[PK_BR]","4",4,false],[false,"quart - British","[qt_br]","[QT_BR]","volume",0.0011365225000000002,[3,0,0,0,0,0,0],null,"brit-volumes",false,null,null,1,false,false,0,"British quarts; imperial quarts; br qts","UCUM","Vol","Clinical","Used only in Great Britain and other Commonwealth countries","[gal_br]/4","[GAL_BR]/4","1",1,false],[false,"pint - British","[pt_br]","[PT_BR]","volume",0.0005682612500000001,[3,0,0,0,0,0,0],null,"brit-volumes",false,null,null,1,false,false,0,"British pints; imperial pints; pt br; br pt; imp pt; pt imp","UCUM","Vol","Clinical","Used only in Great Britain and other Commonwealth countries","[qt_br]/2","[QT_BR]/2","1",1,false],[false,"gill - British","[gil_br]","[GIL_BR]","volume",0.00014206531250000003,[3,0,0,0,0,0,0],null,"brit-volumes",false,null,null,1,false,false,0,"imperial gills; British gills; imp gill, br gill","UCUM","Vol","Nonclinical","only used in the context of alcohol volume in Great Britain","[pt_br]/4","[PT_BR]/4","1",1,false],[false,"fluid ounce - British","[foz_br]","[FOZ_BR]","volume",0.000028413062500000005,[3,0,0,0,0,0,0],null,"brit-volumes",false,null,null,1,false,false,0,"British fluid ounces; Imperial fluid ounces; br fozs; imp fozs; br fl ozs","UCUM","Vol","Clinical","Used only in Great Britain and other Commonwealth countries","[gil_br]/5","[GIL_BR]/5","1",1,false],[false,"fluid dram - British","[fdr_br]","[FDR_BR]","volume",0.0000035516328125000006,[3,0,0,0,0,0,0],null,"brit-volumes",false,null,null,1,false,false,0,"British fluid drams; fdr br","UCUM","Vol","Nonclinical","equal to 1/8 Imperial fluid ounce = 3.55 mL; used informally to mean small amount of liquor, especially Scotch whiskey","[foz_br]/8","[FOZ_BR]/8","1",1,false],[false,"minim - British","[min_br]","[MIN_BR]","volume",5.919388020833334e-8,[3,0,0,0,0,0,0],null,"brit-volumes",false,null,null,1,false,false,0,"min br; br min; ♏ br","UCUM","Vol","Obsolete","","[fdr_br]/60","[FDR_BR]/60","1",1,false],[false,"grain","[gr]","[GR]","mass",0.06479891,[0,0,1,0,0,0,0],null,"avoirdupois",false,null,null,1,false,false,0,"gr; grains","UCUM","Mass","Nonclinical","an apothecary measure of mass rarely used today","mg","MG","64.79891",64.79891,false],[false,"pound","[lb_av]","[LB_AV]","mass",453.59237,[0,0,1,0,0,0,0],"lb","avoirdupois",false,null,null,1,false,false,0,"avoirdupois pounds, international pounds; av lbs; pounds","UCUM","Mass","Clinical","standard unit used in the US and internationally","[gr]","[GR]","7000",7000,false],[false,"pound force - US","[lbf_av]","[LBF_AV]","force",4448.2216152605,[1,-2,1,0,0,0,0],"lbf","const",false,null,null,1,false,false,0,"lbfs; US lbf; US pound forces","UCUM","Force","Clinical","only rarely needed in health care - see [lb_av] which is the more common unit to express weight","[lb_av].[g]","[LB_AV].[G]","1",1,false],[false,"ounce","[oz_av]","[OZ_AV]","mass",28.349523125,[0,0,1,0,0,0,0],"oz","avoirdupois",false,null,null,1,false,false,0,"ounces; international ounces; avoirdupois ounces; av ozs","UCUM","Mass","Clinical","standard unit used in the US and internationally","[lb_av]/16","[LB_AV]/16","1",1,false],[false,"Dram mass unit","[dr_av]","[DR_AV]","mass",1.7718451953125,[0,0,1,0,0,0,0],null,"avoirdupois",false,null,null,1,false,false,0,"Dram; drams avoirdupois; avoidupois dram; international dram","UCUM","Mass","Clinical","unit from the avoirdupois system, which is used in the US and internationally","[oz_av]/16","[OZ_AV]/16","1",1,false],[false,"short hundredweight","[scwt_av]","[SCWT_AV]","mass",45359.237,[0,0,1,0,0,0,0],null,"avoirdupois",false,null,null,1,false,false,0,"hundredweights; s cwt; scwt; avoirdupois","UCUM","Mass","Nonclinical","Used only in the US to equal 100 pounds","[lb_av]","[LB_AV]","100",100,false],[false,"long hundredweight","[lcwt_av]","[LCWT_AV]","mass",50802.345440000005,[0,0,1,0,0,0,0],null,"avoirdupois",false,null,null,1,false,false,0,"imperial hundredweights; imp cwt; lcwt; avoirdupois","UCUM","Mass","Obsolete","","[lb_av]","[LB_AV]","112",112,false],[false,"short ton - US","[ston_av]","[STON_AV]","mass",907184.74,[0,0,1,0,0,0,0],null,"avoirdupois",false,null,null,1,false,false,0,"ton; US tons; avoirdupois tons","UCUM","Mass","Clinical","Used only in the US","[scwt_av]","[SCWT_AV]","20",20,false],[false,"long ton - British","[lton_av]","[LTON_AV]","mass",1016046.9088000001,[0,0,1,0,0,0,0],null,"avoirdupois",false,null,null,1,false,false,0,"imperial tons; weight tons; British long tons; long ton avoirdupois","UCUM","Mass","Nonclinical","Used only in Great Britain and other Commonwealth countries","[lcwt_av]","[LCWT_AV]","20",20,false],[false,"stone - British","[stone_av]","[STONE_AV]","mass",6350.293180000001,[0,0,1,0,0,0,0],null,"avoirdupois",false,null,null,1,false,false,0,"British stones; avoirdupois","UCUM","Mass","Nonclinical","Used primarily in the UK and Ireland to measure body weight","[lb_av]","[LB_AV]","14",14,false],[false,"pennyweight - troy","[pwt_tr]","[PWT_TR]","mass",1.5551738400000001,[0,0,1,0,0,0,0],null,"troy",false,null,null,1,false,false,0,"dwt; denarius weights","UCUM","Mass","Obsolete","historical unit used to measure mass and cost of precious metals","[gr]","[GR]","24",24,false],[false,"ounce - troy","[oz_tr]","[OZ_TR]","mass",31.103476800000003,[0,0,1,0,0,0,0],null,"troy",false,null,null,1,false,false,0,"troy ounces; tr ozs","UCUM","Mass","Nonclinical","unit of mass for precious metals and gemstones only","[pwt_tr]","[PWT_TR]","20",20,false],[false,"pound - troy","[lb_tr]","[LB_TR]","mass",373.2417216,[0,0,1,0,0,0,0],null,"troy",false,null,null,1,false,false,0,"troy pounds; tr lbs","UCUM","Mass","Nonclinical","only used for weighing precious metals","[oz_tr]","[OZ_TR]","12",12,false],[false,"scruple","[sc_ap]","[SC_AP]","mass",1.2959782,[0,0,1,0,0,0,0],null,"apoth",false,null,null,1,false,false,0,"scruples; sc ap","UCUM","Mass","Obsolete","","[gr]","[GR]","20",20,false],[false,"dram - apothecary","[dr_ap]","[DR_AP]","mass",3.8879346,[0,0,1,0,0,0,0],null,"apoth",false,null,null,1,false,false,0,"ʒ; drachm; apothecaries drams; dr ap; dram ap","UCUM","Mass","Nonclinical","unit still used in the US occasionally to measure amount of drugs in pharmacies","[sc_ap]","[SC_AP]","3",3,false],[false,"ounce - apothecary","[oz_ap]","[OZ_AP]","mass",31.1034768,[0,0,1,0,0,0,0],null,"apoth",false,null,null,1,false,false,0,"apothecary ounces; oz ap; ap ozs; ozs ap","UCUM","Mass","Obsolete","","[dr_ap]","[DR_AP]","8",8,false],[false,"pound - apothecary","[lb_ap]","[LB_AP]","mass",373.2417216,[0,0,1,0,0,0,0],null,"apoth",false,null,null,1,false,false,0,"apothecary pounds; apothecaries pounds; ap lb; lb ap; ap lbs; lbs ap","UCUM","Mass","Obsolete","","[oz_ap]","[OZ_AP]","12",12,false],[false,"ounce - metric","[oz_m]","[OZ_M]","mass",28,[0,0,1,0,0,0,0],null,"apoth",false,null,null,1,false,false,0,"metric ounces; m ozs","UCUM","Mass","Clinical","see [oz_av] (the avoirdupois ounce) for the standard ounce used internationally; [oz_m] is equal to 28 grams and is based on the apothecaries' system of mass units which is used in some US pharmacies. ","g","g","28",28,false],[false,"line","[lne]","[LNE]","length",0.002116666666666667,[1,0,0,0,0,0,0],null,"typeset",false,null,null,1,false,false,0,"British lines; br L; L; l","UCUM","Len","Obsolete","","[in_i]/12","[IN_I]/12","1",1,false],[false,"point (typography)","[pnt]","[PNT]","length",0.0003527777777777778,[1,0,0,0,0,0,0],null,"typeset",false,null,null,1,false,false,0,"DTP points; desktop publishing point; pt; pnt","UCUM","Len","Nonclinical","typography unit for typesetter's length","[lne]/6","[LNE]/6","1",1,false],[false,"pica (typography)","[pca]","[PCA]","length",0.004233333333333334,[1,0,0,0,0,0,0],null,"typeset",false,null,null,1,false,false,0,"picas","UCUM","Len","Nonclinical","typography unit for typesetter's length","[pnt]","[PNT]","12",12,false],[false,"Printer's point (typography)","[pnt_pr]","[PNT_PR]","length",0.00035145980000000004,[1,0,0,0,0,0,0],null,"typeset",false,null,null,1,false,false,0,"pnt pr","UCUM","Len","Nonclinical","typography unit for typesetter's length","[in_i]","[IN_I]","0.013837",0.013837,false],[false,"Printer's pica (typography)","[pca_pr]","[PCA_PR]","length",0.004217517600000001,[1,0,0,0,0,0,0],null,"typeset",false,null,null,1,false,false,0,"pca pr; Printer's picas","UCUM","Len","Nonclinical","typography unit for typesetter's length","[pnt_pr]","[PNT_PR]","12",12,false],[false,"pied","[pied]","[PIED]","length",0.3248,[1,0,0,0,0,0,0],null,"typeset",false,null,null,1,false,false,0,"pieds du roi; Paris foot; royal; French; feet","UCUM","Len","Obsolete","","cm","CM","32.48",32.48,false],[false,"pouce","[pouce]","[POUCE]","length",0.027066666666666666,[1,0,0,0,0,0,0],null,"typeset",false,null,null,1,false,false,0,"historical French inches; French royal inches","UCUM","Len","Obsolete","","[pied]/12","[PIED]/12","1",1,false],[false,"ligne","[ligne]","[LIGNE]","length",0.0022555555555555554,[1,0,0,0,0,0,0],null,"typeset",false,null,null,1,false,false,0,"Paris lines; lignes","UCUM","Len","Obsolete","","[pouce]/12","[POUCE]/12","1",1,false],[false,"didot","[didot]","[DIDOT]","length",0.0003759259259259259,[1,0,0,0,0,0,0],null,"typeset",false,null,null,1,false,false,0,"Didot point; dd; Didots Point; didots; points","UCUM","Len","Obsolete","typography unit for typesetter's length","[ligne]/6","[LIGNE]/6","1",1,false],[false,"cicero","[cicero]","[CICERO]","length",0.004511111111111111,[1,0,0,0,0,0,0],null,"typeset",false,null,null,1,false,false,0,"Didot's pica; ciceros; picas","UCUM","Len","Obsolete","typography unit for typesetter's length","[didot]","[DIDOT]","12",12,false],[false,"degrees Fahrenheit","[degF]","[DEGF]","temperature",0.5555555555555556,[0,0,0,0,1,0,0],"°F","heat",false,null,"degF",1,true,false,0,"°F; deg F","UCUM","Temp","Clinical","","K",null,null,0.5555555555555556,false],[false,"degrees Rankine","[degR]","[degR]","temperature",0.5555555555555556,[0,0,0,0,1,0,0],"°R","heat",false,null,null,1,false,false,0,"°R; °Ra; Rankine","UCUM","Temp","Obsolete","Replaced by Kelvin","K/9","K/9","5",5,false],[false,"degrees Réaumur","[degRe]","[degRe]","temperature",1.25,[0,0,0,0,1,0,0],"°Ré","heat",false,null,"degRe",1,true,false,0,"°Ré, °Re, °r; Réaumur; degree Reaumur; Reaumur","UCUM","Temp","Obsolete","replaced by Celsius","K",null,null,1.25,false],[false,"calorie at 15°C","cal_[15]","CAL_[15]","energy",4185.8,[2,-2,1,0,0,0,0],"cal15°C","heat",true,null,null,1,false,false,0,"calorie 15 C; cals 15 C; calories at 15 C","UCUM","Enrg","Nonclinical","equal to 4.1855 joules; calorie most often used in engineering","J","J","4.18580",4.1858,false],[false,"calorie at 20°C","cal_[20]","CAL_[20]","energy",4181.9,[2,-2,1,0,0,0,0],"cal20°C","heat",true,null,null,1,false,false,0,"calorie 20 C; cal 20 C; calories at 20 C","UCUM","Enrg","Clinical","equal to 4.18190 joules. ","J","J","4.18190",4.1819,false],[false,"mean calorie","cal_m","CAL_M","energy",4190.0199999999995,[2,-2,1,0,0,0,0],"calm","heat",true,null,null,1,false,false,0,"mean cals; mean calories","UCUM","Enrg","Clinical","equal to 4.19002 joules. ","J","J","4.19002",4.19002,false],[false,"international table calorie","cal_IT","CAL_IT","energy",4186.8,[2,-2,1,0,0,0,0],"calIT","heat",true,null,null,1,false,false,0,"calories IT; IT cals; international steam table calories","UCUM","Enrg","Nonclinical","used in engineering steam tables and defined as 1/860 international watt-hour; equal to 4.1868 joules","J","J","4.1868",4.1868,false],[false,"thermochemical calorie","cal_th","CAL_TH","energy",4184,[2,-2,1,0,0,0,0],"calth","heat",true,null,null,1,false,false,0,"thermochemical calories; th cals","UCUM","Enrg","Clinical","equal to 4.184 joules; used as the unit in medicine and biochemistry (equal to cal)","J","J","4.184",4.184,false],[false,"calorie","cal","CAL","energy",4184,[2,-2,1,0,0,0,0],"cal","heat",true,null,null,1,false,false,0,"gram calories; small calories","UCUM","Enrg","Clinical","equal to 4.184 joules (the same value as the thermochemical calorie, which is the most common calorie used in medicine and biochemistry)","cal_th","CAL_TH","1",1,false],[false,"nutrition label Calories","[Cal]","[CAL]","energy",4184000,[2,-2,1,0,0,0,0],"Cal","heat",false,null,null,1,false,false,0,"food calories; Cal; kcal","UCUM","Eng","Clinical","","kcal_th","KCAL_TH","1",1,false],[false,"British thermal unit at 39°F","[Btu_39]","[BTU_39]","energy",1059670,[2,-2,1,0,0,0,0],"Btu39°F","heat",false,null,null,1,false,false,0,"BTU 39F; BTU 39 F; B.T.U. 39 F; B.Th.U. 39 F; BThU 39 F; British thermal units","UCUM","Eng","Nonclinical","equal to 1.05967 kJ; used as a measure of power in the electric power, steam generation, heating, and air conditioning industries","kJ","kJ","1.05967",1.05967,false],[false,"British thermal unit at 59°F","[Btu_59]","[BTU_59]","energy",1054800,[2,-2,1,0,0,0,0],"Btu59°F","heat",false,null,null,1,false,false,0,"BTU 59 F; BTU 59F; B.T.U. 59 F; B.Th.U. 59 F; BThU 59F; British thermal units","UCUM","Eng","Nonclinical","equal to 1.05480 kJ; used as a measure of power in the electric power, steam generation, heating, and air conditioning industries","kJ","kJ","1.05480",1.0548,false],[false,"British thermal unit at 60°F","[Btu_60]","[BTU_60]","energy",1054680,[2,-2,1,0,0,0,0],"Btu60°F","heat",false,null,null,1,false,false,0,"BTU 60 F; BTU 60F; B.T.U. 60 F; B.Th.U. 60 F; BThU 60 F; British thermal units 60 F","UCUM","Eng","Nonclinical","equal to 1.05468 kJ; used as a measure of power in the electric power, steam generation, heating, and air conditioning industries","kJ","kJ","1.05468",1.05468,false],[false,"mean British thermal unit","[Btu_m]","[BTU_M]","energy",1055870,[2,-2,1,0,0,0,0],"Btum","heat",false,null,null,1,false,false,0,"BTU mean; B.T.U. mean; B.Th.U. mean; BThU mean; British thermal units mean; ","UCUM","Eng","Nonclinical","equal to 1.05587 kJ; used as a measure of power in the electric power, steam generation, heating, and air conditioning industries","kJ","kJ","1.05587",1.05587,false],[false,"international table British thermal unit","[Btu_IT]","[BTU_IT]","energy",1055055.85262,[2,-2,1,0,0,0,0],"BtuIT","heat",false,null,null,1,false,false,0,"BTU IT; B.T.U. IT; B.Th.U. IT; BThU IT; British thermal units IT","UCUM","Eng","Nonclinical","equal to 1.055 kJ; used as a measure of power in the electric power, steam generation, heating, and air conditioning industries","kJ","kJ","1.05505585262",1.05505585262,false],[false,"thermochemical British thermal unit","[Btu_th]","[BTU_TH]","energy",1054350,[2,-2,1,0,0,0,0],"Btuth","heat",false,null,null,1,false,false,0,"BTU Th; B.T.U. Th; B.Th.U. Th; BThU Th; thermochemical British thermal units","UCUM","Eng","Nonclinical","equal to 1.054350 kJ; used as a measure of power in the electric power, steam generation, heating, and air conditioning industries","kJ","kJ","1.054350",1.05435,false],[false,"British thermal unit","[Btu]","[BTU]","energy",1054350,[2,-2,1,0,0,0,0],"btu","heat",false,null,null,1,false,false,0,"BTU; B.T.U. ; B.Th.U.; BThU; British thermal units","UCUM","Eng","Nonclinical","equal to the thermochemical British thermal unit equal to 1.054350 kJ; used as a measure of power in the electric power, steam generation, heating, and air conditioning industries","[Btu_th]","[BTU_TH]","1",1,false],[false,"horsepower - mechanical","[HP]","[HP]","power",745699.8715822703,[2,-3,1,0,0,0,0],null,"heat",false,null,null,1,false,false,0,"imperial horsepowers","UCUM","EngRat","Nonclinical","refers to mechanical horsepower, which is unit used to measure engine power primarily in the US. ","[ft_i].[lbf_av]/s","[FT_I].[LBF_AV]/S","550",550,false],[false,"tex","tex","TEX","linear mass density (of textile thread)",0.001,[-1,0,1,0,0,0,0],"tex","heat",true,null,null,1,false,false,0,"linear mass density; texes","UCUM","","Clinical","unit of linear mass density for fibers equal to gram per 1000 meters","g/km","G/KM","1",1,false],[false,"Denier (linear mass density)","[den]","[DEN]","linear mass density (of textile thread)",0.0001111111111111111,[-1,0,1,0,0,0,0],"den","heat",false,null,null,1,false,false,0,"den; deniers","UCUM","","Nonclinical","equal to the mass in grams per 9000 meters of the fiber (1 denier = 1 strand of silk)","g/9/km","G/9/KM","1",1,false],[false,"meter of water column","m[H2O]","M[H2O]","pressure",9806650,[-1,-2,1,0,0,0,0],"m HO2","clinical",true,null,null,1,false,false,0,"mH2O; m H2O; meters of water column; metres; pressure","UCUM","Pres","Clinical","","kPa","KPAL","980665e-5",9.80665,false],[false,"meter of mercury column","m[Hg]","M[HG]","pressure",133322000,[-1,-2,1,0,0,0,0],"m Hg","clinical",true,null,null,1,false,false,0,"mHg; m Hg; meters of mercury column; metres; pressure","UCUM","Pres","Clinical","","kPa","KPAL","133.3220",133.322,false],[false,"inch of water column","[in_i'H2O]","[IN_I'H2O]","pressure",249088.91000000003,[-1,-2,1,0,0,0,0],"in HO2","clinical",false,null,null,1,false,false,0,"inches WC; inAq; in H2O; inch of water gauge; iwg; pressure","UCUM","Pres","Clinical","unit of pressure, especially in respiratory and ventilation care","m[H2O].[in_i]/m","M[H2O].[IN_I]/M","1",1,false],[false,"inch of mercury column","[in_i'Hg]","[IN_I'HG]","pressure",3386378.8000000003,[-1,-2,1,0,0,0,0],"in Hg","clinical",false,null,null,1,false,false,0,"inHg; in Hg; pressure; inches","UCUM","Pres","Clinical","unit of pressure used in US to measure barometric pressure and occasionally blood pressure (see mm[Hg] for unit used internationally)","m[Hg].[in_i]/m","M[HG].[IN_I]/M","1",1,false],[false,"peripheral vascular resistance unit","[PRU]","[PRU]","fluid resistance",133322000000,[-4,-1,1,0,0,0,0],"P.R.U.","clinical",false,null,null,1,false,false,0,"peripheral vascular resistance units; peripheral resistance unit; peripheral resistance units; PRU","UCUM","FldResist","Clinical","used to assess blood flow in the capillaries; equal to 1 mmH.min/mL = 133.3 Pa·min/mL","mm[Hg].s/ml","MM[HG].S/ML","1",1,false],[false,"Wood unit","[wood'U]","[WOOD'U]","fluid resistance",7999320000,[-4,-1,1,0,0,0,0],"Wood U.","clinical",false,null,null,1,false,false,0,"hybrid reference units; HRU; mmHg.min/L; vascular resistance","UCUM","Pres","Clinical","simplified unit of measurement for for measuring pulmonary vascular resistance that uses pressure; equal to mmHg.min/L","mm[Hg].min/L","MM[HG].MIN/L","1",1,false],[false,"diopter (lens)","[diop]","[DIOP]","refraction of a lens",1,[1,0,0,0,0,0,0],"dpt","clinical",false,null,"inv",1,false,false,0,"diopters; diop; dioptre; dpt; refractive power","UCUM","InvLen","Clinical","unit of optical power of lens represented by inverse meters (m^-1)","m","/M","1",1,false],[false,"prism diopter (magnifying power)","[p'diop]","[P'DIOP]","refraction of a prism",1,[0,0,0,1,0,0,0],"PD","clinical",false,null,"tanTimes100",1,true,false,0,"diopters; dioptres; p diops; pdiop; dpt; pdptr; Δ; cm/m; centimeter per meter; centimetre; metre","UCUM","Angle","Clinical","unit for prism correction in eyeglass prescriptions","rad",null,null,1,false],[false,"percent of slope","%[slope]","%[SLOPE]","slope",0.017453292519943295,[0,0,0,1,0,0,0],"%","clinical",false,null,"100tan",1,true,false,0,"% slope; %slope; percents slopes","UCUM","VelFr; ElpotRatFr; VelRtoFr; AccelFr","Clinical","","deg",null,null,1,false],[false,"mesh","[mesh_i]","[MESH_I]","lineic number",0.025400000000000002,[1,0,0,0,0,0,0],null,"clinical",false,null,"inv",1,false,false,0,"meshes","UCUM","NLen (lineic number)","Clinical","traditional unit of length defined as the number of strands or particles per inch","[in_i]","/[IN_I]","1",1,false],[false,"French (catheter gauge) ","[Ch]","[CH]","gauge of catheters",0.0003333333333333333,[1,0,0,0,0,0,0],"Ch","clinical",false,null,null,1,false,false,0,"Charrières, French scales; French gauges; Fr, Fg, Ga, FR, Ch","UCUM","Len; Circ; Diam","Clinical","","mm/3","MM/3","1",1,false],[false,"drop - metric (1/20 mL)","[drp]","[DRP]","volume",5e-8,[3,0,0,0,0,0,0],"drp","clinical",false,null,null,1,false,false,0,"drop dosing units; metric drops; gtt","UCUM","Vol","Clinical","standard unit used in the US and internationally for clinical medicine but note that although [drp] is defined as 1/20 milliliter, in practice, drop sizes will vary due to external factors","ml/20","ML/20","1",1,false],[false,"Hounsfield unit","[hnsf'U]","[HNSF'U]","x-ray attenuation",1,[0,0,0,0,0,0,0],"HF","clinical",false,null,null,1,false,false,0,"HU; units","UCUM","","Clinical","used to measure X-ray attenuation, especially in CT scans.","1","1","1",1,false],[false,"Metabolic Equivalent of Task ","[MET]","[MET]","metabolic cost of physical activity",5.833333333333334e-11,[3,-1,-1,0,0,0,0],"MET","clinical",false,null,null,1,false,false,0,"metabolic equivalents","UCUM","RelEngRat","Clinical","unit used to measure rate of energy expenditure per power in treadmill and other functional tests","mL/min/kg","ML/MIN/KG","3.5",3.5,false],[false,"homeopathic potency of decimal series (retired)","[hp'_X]","[HP'_X]","homeopathic potency (retired)",1,[0,0,0,0,0,0,0],"X","clinical",false,null,"hpX",1,true,false,0,null,"UCUM",null,null,null,"1",null,null,1,false],[false,"homeopathic potency of centesimal series (retired)","[hp'_C]","[HP'_C]","homeopathic potency (retired)",1,[0,0,0,0,0,0,0],"C","clinical",false,null,"hpC",1,true,false,0,null,"UCUM",null,null,null,"1",null,null,1,false],[false,"homeopathic potency of millesimal series (retired)","[hp'_M]","[HP'_M]","homeopathic potency (retired)",1,[0,0,0,0,0,0,0],"M","clinical",false,null,"hpM",1,true,false,0,null,"UCUM",null,null,null,"1",null,null,1,false],[false,"homeopathic potency of quintamillesimal series (retired)","[hp'_Q]","[HP'_Q]","homeopathic potency (retired)",1,[0,0,0,0,0,0,0],"Q","clinical",false,null,"hpQ",1,true,false,0,null,"UCUM",null,null,null,"1",null,null,1,false],[false,"homeopathic potency of decimal hahnemannian series","[hp_X]","[HP_X]","homeopathic potency (Hahnemann)",1,[0,0,0,0,0,0,0],"X","clinical",false,null,null,1,false,true,0,null,"UCUM",null,null,null,"1","1","1",1,false],[false,"homeopathic potency of centesimal hahnemannian series","[hp_C]","[HP_C]","homeopathic potency (Hahnemann)",1,[0,0,0,0,0,0,0],"C","clinical",false,null,null,1,false,true,0,null,"UCUM",null,null,null,"1","1","1",1,false],[false,"homeopathic potency of millesimal hahnemannian series","[hp_M]","[HP_M]","homeopathic potency (Hahnemann)",1,[0,0,0,0,0,0,0],"M","clinical",false,null,null,1,false,true,0,null,"UCUM",null,null,null,"1","1","1",1,false],[false,"homeopathic potency of quintamillesimal hahnemannian series","[hp_Q]","[HP_Q]","homeopathic potency (Hahnemann)",1,[0,0,0,0,0,0,0],"Q","clinical",false,null,null,1,false,true,0,null,"UCUM",null,null,null,"1","1","1",1,false],[false,"homeopathic potency of decimal korsakovian series","[kp_X]","[KP_X]","homeopathic potency (Korsakov)",1,[0,0,0,0,0,0,0],"X","clinical",false,null,null,1,false,true,0,null,"UCUM",null,null,null,"1","1","1",1,false],[false,"homeopathic potency of centesimal korsakovian series","[kp_C]","[KP_C]","homeopathic potency (Korsakov)",1,[0,0,0,0,0,0,0],"C","clinical",false,null,null,1,false,true,0,null,"UCUM",null,null,null,"1","1","1",1,false],[false,"homeopathic potency of millesimal korsakovian series","[kp_M]","[KP_M]","homeopathic potency (Korsakov)",1,[0,0,0,0,0,0,0],"M","clinical",false,null,null,1,false,true,0,null,"UCUM",null,null,null,"1","1","1",1,false],[false,"homeopathic potency of quintamillesimal korsakovian series","[kp_Q]","[KP_Q]","homeopathic potency (Korsakov)",1,[0,0,0,0,0,0,0],"Q","clinical",false,null,null,1,false,true,0,null,"UCUM",null,null,null,"1","1","1",1,false],[false,"equivalent","eq","EQ","amount of substance",6.0221367e+23,[0,0,0,0,0,0,0],"eq","chemical",true,null,null,1,false,false,1,"equivalents","UCUM","Sub","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"osmole","osm","OSM","amount of substance (dissolved particles)",6.0221367e+23,[0,0,0,0,0,0,0],"osm","chemical",true,null,null,1,false,false,1,"osmoles; osmols","UCUM","Osmol","Clinical","the number of moles of solute that contribute to the osmotic pressure of a solution","mol","MOL","1",1,false],[false,"pH","[pH]","[PH]","acidity",6.0221366999999994e+26,[-3,0,0,0,0,0,0],"pH","chemical",false,null,"pH",1,true,false,0,"pH scale","UCUM","LogCnc","Clinical","Log concentration of H+","mol/l",null,null,1,false],[false,"gram percent","g%","G%","mass concentration",10000,[-3,0,1,0,0,0,0],"g%","chemical",true,null,null,1,false,false,0,"gram %; gram%; grams per deciliter; g/dL; gm per dL; gram percents","UCUM","MCnc","Clinical","equivalent to unit gram per deciliter (g/dL), a unit often used in medical tests to represent solution concentrations","g/dl","G/DL","1",1,false],[false,"Svedberg unit","[S]","[S]","sedimentation coefficient",1e-13,[0,1,0,0,0,0,0],"S","chemical",false,null,null,1,false,false,0,"Sv; 10^-13 seconds; 100 fs; 100 femtoseconds","UCUM","Time","Clinical","unit of time used in measuring particle's sedimentation rate, usually after centrifugation. ","s","10*-13.S","1",1e-13,false],[false,"high power field (microscope)","[HPF]","[HPF]","view area in microscope",1,[0,0,0,0,0,0,0],"HPF","chemical",false,null,null,1,false,false,0,"HPF","UCUM","Area","Clinical","area visible under the maximum magnification power of the objective in microscopy (usually 400x)\n","1","1","1",1,false],[false,"low power field (microscope)","[LPF]","[LPF]","view area in microscope",1,[0,0,0,0,0,0,0],"LPF","chemical",false,null,null,1,false,false,0,"LPF; fields","UCUM","Area","Clinical","area visible under the low magnification of the objective in microscopy (usually 100 x)\n","1","1","100",100,false],[false,"katal","kat","KAT","catalytic activity",6.0221367e+23,[0,-1,0,0,0,0,0],"kat","chemical",true,null,null,1,false,false,1,"mol/secs; moles per second; mol*sec-1; mol*s-1; mol.s-1; katals; catalytic activity; enzymatic; enzyme units; activities","UCUM","CAct","Clinical","kat is a unit of catalytic activity with base units = mol/s. Rarely used because its units are too large to practically express catalytic activity. See enzyme unit [U] which is the standard unit for catalytic activity.","mol/s","MOL/S","1",1,false],[false,"enzyme unit","U","U","catalytic activity",10036894500000000,[0,-1,0,0,0,0,0],"U","chemical",true,null,null,1,false,false,1,"micromoles per minute; umol/min; umol per minute; umol min-1; enzymatic activity; enzyme activity","UCUM","CAct","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"international unit - arbitrary","[iU]","[IU]","arbitrary",1,[0,0,0,0,0,0,0],"IU","chemical",true,null,null,1,false,true,0,"international units; IE; F2","UCUM","Arb","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","1","1","1",1,false],[false,"international unit - arbitrary","[IU]","[IU]","arbitrary",1,[0,0,0,0,0,0,0],"i.U.","chemical",true,null,null,1,false,true,0,"international units; IE; F2","UCUM","Arb","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"arbitary unit","[arb'U]","[ARB'U]","arbitrary",1,[0,0,0,0,0,0,0],"arb. U","chemical",false,null,null,1,false,true,0,"arbitary units; arb units; arbU","UCUM","Arb","Clinical","relative unit of measurement to show the ratio of test measurement to reference measurement","1","1","1",1,false],[false,"United States Pharmacopeia unit","[USP'U]","[USP'U]","arbitrary",1,[0,0,0,0,0,0,0],"U.S.P.","chemical",false,null,null,1,false,true,0,"USP U; USP'U","UCUM","Arb","Clinical","a dose unit to express potency of drugs and vitamins defined by the United States Pharmacopoeia; usually 1 USP = 1 IU","1","1","1",1,false],[false,"GPL unit","[GPL'U]","[GPL'U]","biologic activity of anticardiolipin IgG",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"GPL Units; GPL U; IgG anticardiolipin units; IgG Phospholipid","UCUM","ACnc; AMass","Clinical","Units for an antiphospholipid test","1","1","1",1,false],[false,"MPL unit","[MPL'U]","[MPL'U]","biologic activity of anticardiolipin IgM",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"MPL units; MPL U; MPL'U; IgM anticardiolipin units; IgM Phospholipid Units ","UCUM","ACnc","Clinical","units for antiphospholipid test","1","1","1",1,false],[false,"APL unit","[APL'U]","[APL'U]","biologic activity of anticardiolipin IgA",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"APL units; APL U; IgA anticardiolipin; IgA Phospholipid; biologic activity of","UCUM","AMass; ACnc","Clinical","Units for an anti phospholipid syndrome test","1","1","1",1,false],[false,"Bethesda unit","[beth'U]","[BETH'U]","biologic activity of factor VIII inhibitor",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"BU","UCUM","ACnc","Clinical","measures of blood coagulation inhibitior for many blood factors","1","1","1",1,false],[false,"anti factor Xa unit","[anti'Xa'U]","[ANTI'XA'U]","biologic activity of factor Xa inhibitor (heparin)",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"units","UCUM","ACnc","Clinical","[anti'Xa'U] unit is equivalent to and can be converted to IU/mL. ","1","1","1",1,false],[false,"Todd unit","[todd'U]","[TODD'U]","biologic activity antistreptolysin O",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"units","UCUM","InvThres; RtoThres","Clinical","the unit for the results of the testing for antistreptolysin O (ASO)","1","1","1",1,false],[false,"Dye unit","[dye'U]","[DYE'U]","biologic activity of amylase",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"units","UCUM","CCnc","Obsolete","equivalent to the Somogyi unit, which is an enzyme unit for amylase but better to use U, the standard enzyme unit for measuring catalytic activity","1","1","1",1,false],[false,"Somogyi unit","[smgy'U]","[SMGY'U]","biologic activity of amylase",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"Somogyi units; smgy U","UCUM","CAct","Clinical","measures the enzymatic activity of amylase in blood serum - better to use base units mg/mL ","1","1","1",1,false],[false,"Bodansky unit","[bdsk'U]","[BDSK'U]","biologic activity of phosphatase",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"","UCUM","ACnc","Obsolete","Enzyme unit specific to alkaline phosphatase - better to use standard enzyme unit of U","1","1","1",1,false],[false,"King-Armstrong unit","[ka'U]","[KA'U]","biologic activity of phosphatase",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"King-Armstrong Units; King units","UCUM","AMass","Obsolete","enzyme units for acid phosphatase - better to use enzyme unit [U]","1","1","1",1,false],[false,"Kunkel unit","[knk'U]","[KNK'U]","arbitrary biologic activity",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,null,"UCUM",null,null,null,"1","1","1",1,false],[false,"Mac Lagan unit","[mclg'U]","[MCLG'U]","arbitrary biologic activity",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"galactose index; galactose tolerance test; thymol turbidity test unit; mclg U; units; indexes","UCUM","ACnc","Obsolete","unit for liver tests - previously used in thymol turbidity tests for liver disease diagnoses, and now is sometimes referred to in the oral galactose tolerance test","1","1","1",1,false],[false,"tuberculin unit","[tb'U]","[TB'U]","biologic activity of tuberculin",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"TU; units","UCUM","Arb","Clinical","amount of tuberculin antigen -usually in reference to a TB skin test ","1","1","1",1,false],[false,"50% cell culture infectious dose","[CCID_50]","[CCID_50]","biologic activity (infectivity) of an infectious agent preparation",1,[0,0,0,0,0,0,0],"CCID50","chemical",false,null,null,1,false,true,0,"CCID50; 50% cell culture infective doses","UCUM","NumThres","Clinical","","1","1","1",1,false],[false,"50% tissue culture infectious dose","[TCID_50]","[TCID_50]","biologic activity (infectivity) of an infectious agent preparation",1,[0,0,0,0,0,0,0],"TCID50","chemical",false,null,null,1,false,true,0,"TCID50; 50% tissue culture infective dose","UCUM","NumThres","Clinical","","1","1","1",1,false],[false,"50% embryo infectious dose","[EID_50]","[EID_50]","biologic activity (infectivity) of an infectious agent preparation",1,[0,0,0,0,0,0,0],"EID50","chemical",false,null,null,1,false,true,0,"EID50; 50% embryo infective doses; EID50 Egg Infective Dosage","UCUM","thresNum","Clinical","","1","1","1",1,false],[false,"plaque forming units","[PFU]","[PFU]","amount of an infectious agent",1,[0,0,0,0,0,0,0],"PFU","chemical",false,null,null,1,false,true,0,"PFU","UCUM","ACnc","Clinical","tests usually report unit as number of PFU per unit volume","1","1","1",1,false],[false,"focus forming units (cells)","[FFU]","[FFU]","amount of an infectious agent",1,[0,0,0,0,0,0,0],"FFU","chemical",false,null,null,1,false,true,0,"FFU","UCUM","EntNum","Clinical","","1","1","1",1,false],[false,"colony forming units","[CFU]","[CFU]","amount of a proliferating organism",1,[0,0,0,0,0,0,0],"CFU","chemical",false,null,null,1,false,true,0,"CFU","UCUM","Num","Clinical","","1","1","1",1,false],[false,"index of reactivity (allergen)","[IR]","[IR]","amount of an allergen callibrated through in-vivo testing using the Stallergenes® method.",1,[0,0,0,0,0,0,0],"IR","chemical",false,null,null,1,false,true,0,"IR; indexes","UCUM","Acnc","Clinical","amount of an allergen callibrated through in-vivo testing using the Stallergenes method. Usually reported in tests as IR/mL","1","1","1",1,false],[false,"bioequivalent allergen unit","[BAU]","[BAU]","amount of an allergen callibrated through in-vivo testing based on the ID50EAL method of (intradermal dilution for 50mm sum of erythema diameters",1,[0,0,0,0,0,0,0],"BAU","chemical",false,null,null,1,false,true,0,"BAU; Bioequivalent Allergy Units; bioequivalent allergen units","UCUM","Arb","Clinical","","1","1","1",1,false],[false,"allergy unit","[AU]","[AU]","procedure defined amount of an allergen using some reference standard",1,[0,0,0,0,0,0,0],"AU","chemical",false,null,null,1,false,true,0,"allergy units; allergen units; AU","UCUM","Arb","Clinical","Most standard test allergy units are reported as [IU] or as %. ","1","1","1",1,false],[false,"allergen unit for Ambrosia artemisiifolia","[Amb'a'1'U]","[AMB'A'1'U]","procedure defined amount of the major allergen of ragweed.",1,[0,0,0,0,0,0,0],"Amb a 1 U","chemical",false,null,null,1,false,true,0,"Amb a 1 unit; Antigen E; AgE U; allergen units","UCUM","Arb","Clinical","Amb a 1 is the major allergen in short ragweed, and can be converted Bioequivalent allergen units (BAU) where 350 Amb a 1 U/mL = 100,000 BAU/mL","1","1","1",1,false],[false,"protein nitrogen unit (allergen testing)","[PNU]","[PNU]","procedure defined amount of a protein substance",1,[0,0,0,0,0,0,0],"PNU","chemical",false,null,null,1,false,true,0,"protein nitrogen units; PNU","UCUM","Mass","Clinical","defined as 0.01 ug of phosphotungstic acid-precipitable protein nitrogen. Being replaced by bioequivalent allergy units (BAU).","1","1","1",1,false],[false,"Limit of flocculation","[Lf]","[LF]","procedure defined amount of an antigen substance",1,[0,0,0,0,0,0,0],"Lf","chemical",false,null,null,1,false,true,0,"Lf doses","UCUM","Arb","Clinical","the antigen content forming 1:1 ratio against 1 unit of antitoxin","1","1","1",1,false],[false,"D-antigen unit (polio)","[D'ag'U]","[D'AG'U]","procedure defined amount of a poliomyelitis d-antigen substance",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"DAgU; units","UCUM","Acnc","Clinical","unit of potency of poliovirus vaccine used for poliomyelitis prevention reported as D antigen units/mL. The unit is poliovirus type-specific.","1","1","1",1,false],[false,"fibrinogen equivalent units","[FEU]","[FEU]","amount of fibrinogen broken down into the measured d-dimers",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"FEU","UCUM","MCnc","Clinical","Note both the FEU and DDU units are used to report D-dimer measurements. 1 DDU = 1/2 FFU","1","1","1",1,false],[false,"ELISA unit","[ELU]","[ELU]","arbitrary ELISA unit",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"Enzyme-Linked Immunosorbent Assay Units; ELU; EL. U","UCUM","ACnc","Clinical","","1","1","1",1,false],[false,"Ehrlich units (urobilinogen)","[EU]","[EU]","Ehrlich unit",1,[0,0,0,0,0,0,0],null,"chemical",false,null,null,1,false,true,0,"EU/dL; mg{urobilinogen}/dL","UCUM","ACnc","Clinical","","1","1","1",1,false],[false,"neper","Np","NEP","level",1,[0,0,0,0,0,0,0],"Np","levels",true,null,"ln",1,true,false,0,"nepers","UCUM","LogRto","Clinical","logarithmic unit for ratios of measurements of physical field and power quantities, such as gain and loss of electronic signals","1",null,null,1,false],[false,"bel","B","B","level",1,[0,0,0,0,0,0,0],"B","levels",true,null,"lg",1,true,false,0,"bels","UCUM","LogRto","Clinical","Logarithm of the ratio of power- or field-type quantities; usually expressed in decibels ","1",null,null,1,false],[false,"bel sound pressure","B[SPL]","B[SPL]","pressure level",0.02,[-1,-2,1,0,0,0,0],"B(SPL)","levels",true,null,"lgTimes2",1,true,false,0,"bel SPL; B SPL; sound pressure bels","UCUM","LogRto","Clinical","used to measure sound level in acoustics","Pa",null,null,0.00002,false],[false,"bel volt","B[V]","B[V]","electric potential level",1000,[2,-2,1,0,0,-1,0],"B(V)","levels",true,null,"lgTimes2",1,true,false,0,"bel V; B V; volts bels","UCUM","LogRtoElp","Clinical","used to express power gain in electrical circuits","V",null,null,1,false],[false,"bel millivolt","B[mV]","B[MV]","electric potential level",1,[2,-2,1,0,0,-1,0],"B(mV)","levels",true,null,"lgTimes2",1,true,false,0,"bel mV; B mV; millivolt bels; 10^-3V bels; 10*-3V ","UCUM","LogRtoElp","Clinical","used to express power gain in electrical circuits","mV",null,null,1,false],[false,"bel microvolt","B[uV]","B[UV]","electric potential level",0.001,[2,-2,1,0,0,-1,0],"B(μV)","levels",true,null,"lgTimes2",1,true,false,0,"bel uV; B uV; microvolts bels; 10^-6V bel; 10*-6V bel","UCUM","LogRto","Clinical","used to express power gain in electrical circuits","uV",null,null,1,false],[false,"bel 10 nanovolt","B[10.nV]","B[10.NV]","electric potential level",0.000010000000000000003,[2,-2,1,0,0,-1,0],"B(10 nV)","levels",true,null,"lgTimes2",1,true,false,0,"bel 10 nV; B 10 nV; 10 nanovolts bels","UCUM","LogRtoElp","Clinical","used to express power gain in electrical circuits","nV",null,null,10,false],[false,"bel watt","B[W]","B[W]","power level",1000,[2,-3,1,0,0,0,0],"B(W)","levels",true,null,"lg",1,true,false,0,"bel W; b W; b Watt; Watts bels","UCUM","LogRto","Clinical","used to express power","W",null,null,1,false],[false,"bel kilowatt","B[kW]","B[KW]","power level",1000000,[2,-3,1,0,0,0,0],"B(kW)","levels",true,null,"lg",1,true,false,0,"bel kW; B kW; kilowatt bel; kW bel; kW B","UCUM","LogRto","Clinical","used to express power","kW",null,null,1,false],[false,"stere","st","STR","volume",1,[3,0,0,0,0,0,0],"st","misc",true,null,null,1,false,false,0,"stère; m3; cubic meter; m^3; meters cubed; metre","UCUM","Vol","Nonclinical","equal to one cubic meter, usually used for measuring firewoord","m3","M3","1",1,false],[false,"Ångström","Ao","AO","length",1.0000000000000002e-10,[1,0,0,0,0,0,0],"Å","misc",false,null,null,1,false,false,0,"Å; Angstroms; Ao; Ångströms","UCUM","Len","Clinical","equal to 10^-10 meters; used to express wave lengths and atom scaled differences ","nm","NM","0.1",0.1,false],[false,"barn","b","BRN","action area",9.999999999999999e-29,[2,0,0,0,0,0,0],"b","misc",false,null,null,1,false,false,0,"barns","UCUM","Area","Clinical","used in high-energy physics to express cross-sectional areas","fm2","FM2","100",100,false],[false,"technical atmosphere","att","ATT","pressure",98066499.99999999,[-1,-2,1,0,0,0,0],"at","misc",false,null,null,1,false,false,0,"at; tech atm; tech atmosphere; kgf/cm2; atms; atmospheres","UCUM","Pres","Obsolete","non-SI unit of pressure equal to one kilogram-force per square centimeter","kgf/cm2","KGF/CM2","1",1,false],[false,"mho","mho","MHO","electric conductance",0.001,[-2,1,-1,0,0,2,0],"mho","misc",true,null,null,1,false,false,0,"siemens; ohm reciprocals; Ω^−1; Ω-1 ","UCUM","","Obsolete","unit of electric conductance (the inverse of electrical resistance) equal to ohm^-1","S","S","1",1,false],[false,"pound per square inch","[psi]","[PSI]","pressure",6894757.293168359,[-1,-2,1,0,0,0,0],"psi","misc",false,null,null,1,false,false,0,"psi; lb/in2; lb per in2","UCUM","Pres","Clinical","","[lbf_av]/[in_i]2","[LBF_AV]/[IN_I]2","1",1,false],[false,"circle - plane angle","circ","CIRC","plane angle",6.283185307179586,[0,0,0,1,0,0,0],"circ","misc",false,null,null,1,false,false,0,"angles; circles","UCUM","Angle","Clinical","","[pi].rad","[PI].RAD","2",2,false],[false,"spere - solid angle","sph","SPH","solid angle",12.566370614359172,[0,0,0,2,0,0,0],"sph","misc",false,null,null,1,false,false,0,"speres","UCUM","Angle","Clinical","equal to the solid angle of an entire sphere = 4πsr (sr = steradian) ","[pi].sr","[PI].SR","4",4,false],[false,"metric carat","[car_m]","[CAR_M]","mass",0.2,[0,0,1,0,0,0,0],"ctm","misc",false,null,null,1,false,false,0,"carats; ct; car m","UCUM","Mass","Nonclinical","unit of mass for gemstones","g","G","2e-1",0.2,false],[false,"carat of gold alloys","[car_Au]","[CAR_AU]","mass fraction",0.041666666666666664,[0,0,0,0,0,0,0],"ctAu","misc",false,null,null,1,false,false,0,"karats; k; kt; car au; carats","UCUM","MFr","Nonclinical","unit of purity for gold alloys","/24","/24","1",1,false],[false,"Smoot","[smoot]","[SMOOT]","length",1.7018000000000002,[1,0,0,0,0,0,0],null,"misc",false,null,null,1,false,false,0,"","UCUM","Len","Nonclinical","prank unit of length from MIT","[in_i]","[IN_I]","67",67,false],[false,"meter per square seconds per square root of hertz","[m/s2/Hz^(1/2)]","[M/S2/HZ^(1/2)]","amplitude spectral density",1,[2,-3,0,0,0,0,0],null,"misc",false,null,"sqrt",1,true,false,0,"m/s2/(Hz^.5); m/s2/(Hz^(1/2)); m per s2 per Hz^1/2","UCUM","","Constant","measures amplitude spectral density, and is equal to the square root of power spectral density\n ","m2/s4/Hz",null,null,1,false],[false,"bit - logarithmic","bit_s","BIT_S","amount of information",1,[0,0,0,0,0,0,0],"bits","infotech",false,null,"ld",1,true,false,0,"bit-s; bit s; bit logarithmic","UCUM","LogA","Nonclinical","defined as the log base 2 of the number of distinct signals; cannot practically be used to express more than 1000 bits\n\nIn information theory, the definition of the amount of self-information and information entropy is often expressed with the binary logarithm (log base 2)","1",null,null,1,false],[false,"bit","bit","BIT","amount of information",1,[0,0,0,0,0,0,0],"bit","infotech",true,null,null,1,false,false,0,"bits","UCUM","","Nonclinical","dimensionless information unit of 1 used in computing and digital communications","1","1","1",1,false],[false,"byte","By","BY","amount of information",8,[0,0,0,0,0,0,0],"B","infotech",true,null,null,1,false,false,0,"bytes","UCUM","","Nonclinical","equal to 8 bits","bit","bit","8",8,false],[false,"baud","Bd","BD","signal transmission rate",1,[0,1,0,0,0,0,0],"Bd","infotech",true,null,"inv",1,false,false,0,"Bd; bauds","UCUM","Freq","Nonclinical","unit to express rate in symbols per second or pulses per second. ","s","/s","1",1,false],[false,"per twelve hour","/(12.h)","/HR","",0.000023148148148148147,[0,-1,0,0,0,0,0],"/h",null,false,null,null,1,false,false,0,"per 12 hours; 12hrs; 12 hrs; /12hrs","LOINC","Rat","Clinical","",null,null,null,null,false],[false,"per arbitrary unit","/[arb'U]","/[ARB'U]","",1,[0,0,0,0,0,0,0],"/arb/ U",null,false,null,null,1,false,true,0,"/arbU","LOINC","InvA ","Clinical","",null,null,null,null,false],[false,"per high power field","/[HPF]","/[HPF]","",1,[0,0,0,0,0,0,0],"/HPF",null,false,null,null,1,false,false,0,"/HPF; per HPF","LOINC","Naric","Clinical","",null,null,null,null,false],[false,"per international unit","/[IU]","/[IU]","",1,[0,0,0,0,0,0,0],"/i/U.",null,false,null,null,1,false,true,0,"international units; /IU; per IU","LOINC","InvA","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)",null,null,null,null,false],[false,"per low power field","/[LPF]","/[LPF]","",1,[0,0,0,0,0,0,0],"/LPF",null,false,null,null,1,false,false,0,"/LPF; per LPF","LOINC","Naric","Clinical","",null,null,null,null,false],[false,"per 10 billion ","/10*10","/10*10","",1e-10,[0,0,0,0,0,0,0],"/1010<.sup>",null,false,null,null,1,false,false,0,"/10^10; per 10*10","LOINC","NFr","Clinical","used for counting entities, e.g. blood cells; usually these kinds of terms have numerators such as moles or milligrams, and counting that amount per the number in the denominator",null,null,null,null,false],[false,"per trillion ","/10*12","/10*12","",1e-12,[0,0,0,0,0,0,0],"/1012<.sup>",null,false,null,null,1,false,false,0,"/10^12; per 10*12","LOINC","NFr","Clinical","used for counting entities, e.g. blood cells; usually these kinds of terms have numerators such as moles or milligrams, and counting that amount per the number in the denominator",null,null,null,null,false],[false,"per thousand","/10*3","/10*3","",0.001,[0,0,0,0,0,0,0],"/103<.sup>",null,false,null,null,1,false,false,0,"/10^3; per 10*3","LOINC","NFr","Clinical","used for counting entities, e.g. blood cells; usually these kinds of terms have numerators such as moles or milligrams, and counting that amount per the number in the denominator",null,null,null,null,false],[false,"per million","/10*6","/10*6","",0.000001,[0,0,0,0,0,0,0],"/106<.sup>",null,false,null,null,1,false,false,0,"/10^6; per 10*6;","LOINC","NFr","Clinical","used for counting entities, e.g. blood cells; usually these kinds of terms have numerators such as moles or milligrams, and counting that amount per the number in the denominator",null,null,null,null,false],[false,"per billion","/10*9","/10*9","",1e-9,[0,0,0,0,0,0,0],"/109<.sup>",null,false,null,null,1,false,false,0,"/10^9; per 10*9","LOINC","NFr","Clinical","used for counting entities, e.g. blood cells; usually these kinds of terms have numerators such as moles or milligrams, and counting that amount per the number in the denominator",null,null,null,null,false],[false,"per 100","/100","","",0.01,[0,0,0,0,0,0,0],null,null,false,null,null,1,false,false,0,"per hundred; 10^2; 10*2","LOINC","NFr","Clinical","used for counting entities, e.g. blood cells; usually these kinds of terms have numerators such as moles or milligrams, and counting that amount per the number in the denominator",null,null,null,null,false],[false,"per 100 cells","/100{cells}","","",0.01,[0,0,0,0,0,0,0],null,null,false,null,null,1,false,false,0,"/100 cells; /100cells; per hundred","LOINC","EntMass; EntNum; NFr","Clinical","",null,null,null,null,false],[false,"per 100 neutrophils","/100{neutrophils}","","",0.01,[0,0,0,0,0,0,0],null,null,false,null,null,1,false,false,0,"/100 neutrophils; /100neutrophils; per hundred","LOINC","EntMass; EntNum; NFr","Clinical","",null,null,null,null,false],[false,"per 100 spermatozoa","/100{spermatozoa}","","",0.01,[0,0,0,0,0,0,0],null,null,false,null,null,1,false,false,0,"/100 spermatozoa; /100spermatozoa; per hundred","LOINC","NFr","Clinical","",null,null,null,null,false],[false,"per 100 white blood cells","/100{WBCs}","","",0.01,[0,0,0,0,0,0,0],null,null,false,null,null,1,false,false,0,"/100 WBCs; /100WBCs; per hundred","LOINC","Ratio; NFr","Clinical","",null,null,null,null,false],[false,"per year","/a","/ANN","",3.168808781402895e-8,[0,-1,0,0,0,0,0],"/a",null,false,null,null,1,false,false,0,"/Years; /yrs; yearly","LOINC","NRat","Clinical","",null,null,null,null,false],[false,"per centimeter of water","/cm[H2O]","/CM[H2O]","",0.000010197162129779282,[1,2,-1,0,0,0,0],"/cm HO2<.r>",null,false,null,null,1,false,false,0,"/cmH2O; /cm H2O; centimeters; centimetres","LOINC","InvPress","Clinical","",null,null,null,null,false],[false,"per day","/d","/D","",0.000011574074074074073,[0,-1,0,0,0,0,0],"/d",null,false,null,null,1,false,false,0,"/dy; per day","LOINC","NRat","Clinical","",null,null,null,null,false],[false,"per deciliter","/dL","/DL","",10000,[-3,0,0,0,0,0,0],"/dL",null,false,null,null,1,false,false,0,"per dL; /deciliter; decilitre","LOINC","NCnc","Clinical","",null,null,null,null,false],[false,"per gram","/g","/G","",1,[0,0,-1,0,0,0,0],"/g",null,false,null,null,1,false,false,0,"/gm; /gram; per g","LOINC","NCnt","Clinical","",null,null,null,null,false],[false,"per hour","/h","/HR","",0.0002777777777777778,[0,-1,0,0,0,0,0],"/h",null,false,null,null,1,false,false,0,"/hr; /hour; per hr","LOINC","NRat","Clinical","",null,null,null,null,false],[false,"per kilogram","/kg","/KG","",0.001,[0,0,-1,0,0,0,0],"/kg",null,false,null,null,1,false,false,0,"per kg; per kilogram","LOINC","NCnt","Clinical","",null,null,null,null,false],[false,"per liter","/L","/L","",1000,[-3,0,0,0,0,0,0],"/L",null,false,null,null,1,false,false,0,"/liter; litre","LOINC","NCnc","Clinical","",null,null,null,null,false],[false,"per square meter","/m2","/M2","",1,[-2,0,0,0,0,0,0],"/m2<.sup>",null,false,null,null,1,false,false,0,"/m^2; /m*2; /sq. m; per square meter; meter squared; metre","LOINC","Naric","Clinical","",null,null,null,null,false],[false,"per cubic meter","/m3","/M3","",1,[-3,0,0,0,0,0,0],"/m3<.sup>",null,false,null,null,1,false,false,0,"/m^3; /m*3; /cu. m; per cubic meter; meter cubed; per m3; metre","LOINC","NCncn","Clinical","",null,null,null,null,false],[false,"per milligram","/mg","/MG","",1000,[0,0,-1,0,0,0,0],"/mg",null,false,null,null,1,false,false,0,"/milligram; per mg","LOINC","NCnt","Clinical","",null,null,null,null,false],[false,"per minute","/min","/MIN","",0.016666666666666666,[0,-1,0,0,0,0,0],"/min",null,false,null,null,1,false,false,0,"/minute; per mins; breaths beats per minute","LOINC","NRat","Clinical","",null,null,null,null,false],[false,"per milliliter","/mL","/ML","",1000000,[-3,0,0,0,0,0,0],"/mL",null,false,null,null,1,false,false,0,"/milliliter; per mL; millilitre","LOINC","NCncn","Clinical","",null,null,null,null,false],[false,"per millimeter","/mm","/MM","",1000,[-1,0,0,0,0,0,0],"/mm",null,false,null,null,1,false,false,0,"/millimeter; per mm; millimetre","LOINC","InvLen","Clinical","",null,null,null,null,false],[false,"per month","/mo","/MO","",3.802570537683474e-7,[0,-1,0,0,0,0,0],"/mo",null,false,null,null,1,false,false,0,"/month; per mo; monthly; month","LOINC","NRat","Clinical","",null,null,null,null,false],[false,"per second","/s","/S","",1,[0,-1,0,0,0,0,0],"/s",null,false,null,null,1,false,false,0,"/second; /sec; per sec; frequency; Hertz; Herz; Hz; becquerels; Bq; s-1; s^-1","LOINC","NRat","Clinical","",null,null,null,null,false],[false,"per enzyme unit","/U","/U","",9.963241120049633e-17,[0,1,0,0,0,0,0],"/U",null,false,null,null,1,false,false,-1,"/enzyme units; per U","LOINC","InvC; NCat","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)",null,null,null,null,false],[false,"per microliter","/uL","/UL","",999999999.9999999,[-3,0,0,0,0,0,0],"/μL",null,false,null,null,1,false,false,0,"/microliter; microlitre; /mcl; per uL","LOINC","ACnc","Clinical","",null,null,null,null,false],[false,"per week","/wk","/WK","",0.0000016534391534391535,[0,-1,0,0,0,0,0],"/wk",null,false,null,null,1,false,false,0,"/week; per wk; weekly, weeks","LOINC","NRat","Clinical","",null,null,null,null,false],[false,"APL unit per milliliter","[APL'U]/mL","[APL'U]/ML","biologic activity of anticardiolipin IgA",1000000,[-3,0,0,0,0,0,0],"/mL","chemical",false,null,null,1,false,true,0,"APL/mL; APL'U/mL; APL U/mL; APL/milliliter; IgA anticardiolipin units per milliliter; IgA Phospholipid Units; millilitre; biologic activity of","LOINC","ACnc","Clinical","Units for an anti phospholipid syndrome test","1","1","1",1,false],[false,"arbitrary unit per milliliter","[arb'U]/mL","[ARB'U]/ML","arbitrary",1000000,[-3,0,0,0,0,0,0],"(arb. U)/mL","chemical",false,null,null,1,false,true,0,"arb'U/mL; arbU/mL; arb U/mL; arbitrary units per milliliter; millilitre","LOINC","ACnc","Clinical","relative unit of measurement to show the ratio of test measurement to reference measurement","1","1","1",1,false],[false,"colony forming units per liter","[CFU]/L","[CFU]/L","amount of a proliferating organism",1000,[-3,0,0,0,0,0,0],"CFU/L","chemical",false,null,null,1,false,true,0,"CFU per Liter; CFU/L","LOINC","NCnc","Clinical","","1","1","1",1,false],[false,"colony forming units per milliliter","[CFU]/mL","[CFU]/ML","amount of a proliferating organism",1000000,[-3,0,0,0,0,0,0],"CFU/mL","chemical",false,null,null,1,false,true,0,"CFU per mL; CFU/mL","LOINC","NCnc","Clinical","","1","1","1",1,false],[false,"foot per foot - US","[ft_us]/[ft_us]","[FT_US]/[FT_US]","length",1,[0,0,0,0,0,0,0],"(ftus)/(ftus)","us-lengths",false,null,null,1,false,false,0,"ft/ft; ft per ft; feet per feet; visual acuity","","LenRto","Clinical","distance ratio to measure 20:20 vision","m/3937","M/3937","1200",1200,false],[false,"GPL unit per milliliter","[GPL'U]/mL","[GPL'U]/ML","biologic activity of anticardiolipin IgG",1000000,[-3,0,0,0,0,0,0],"/mL","chemical",false,null,null,1,false,true,0,"GPL U/mL; GPL'U/mL; GPL/mL; GPL U per mL; IgG Phospholipid Units per milliliters; IgG anticardiolipin units; millilitres ","LOINC","ACnc; AMass","Clinical","Units for an antiphospholipid test","1","1","1",1,false],[false,"international unit per 2 hour","[IU]/(2.h)","[IU]/HR","arbitrary",0.0001388888888888889,[0,-1,0,0,0,0,0],"(i.U.)/h","chemical",true,null,null,1,false,true,0,"IU/2hrs; IU/2 hours; IU per 2 hrs; international units per 2 hours","LOINC","ARat","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"international unit per 24 hour","[IU]/(24.h)","[IU]/HR","arbitrary",0.000011574074074074073,[0,-1,0,0,0,0,0],"(i.U.)/h","chemical",true,null,null,1,false,true,0,"IU/24hr; IU/24 hours; IU per 24 hrs; international units per 24 hours","LOINC","ARat","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"international unit per day","[IU]/d","[IU]/D","arbitrary",0.000011574074074074073,[0,-1,0,0,0,0,0],"(i.U.)/d","chemical",true,null,null,1,false,true,0,"IU/dy; IU/days; IU per dys; international units per day","LOINC","ARat","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"international unit per deciliter","[IU]/dL","[IU]/DL","arbitrary",10000,[-3,0,0,0,0,0,0],"(i.U.)/dL","chemical",true,null,null,1,false,true,0,"IU/dL; IU per dL; international units per deciliters; decilitres","LOINC","ACnc","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"international unit per gram","[IU]/g","[IU]/G","arbitrary",1,[0,0,-1,0,0,0,0],"(i.U.)/g","chemical",true,null,null,1,false,true,0,"IU/gm; IU/gram; IU per gm; IU per g; international units per gram","LOINC","ACnt","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"international unit per hour","[IU]/h","[IU]/HR","arbitrary",0.0002777777777777778,[0,-1,0,0,0,0,0],"(i.U.)/h","chemical",true,null,null,1,false,true,0,"IU/hrs; IU per hours; international units per hour","LOINC","ARat","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"international unit per kilogram","[IU]/kg","[IU]/KG","arbitrary",0.001,[0,0,-1,0,0,0,0],"(i.U.)/kg","chemical",true,null,null,1,false,true,0,"IU/kg; IU/kilogram; IU per kg; units","LOINC","ACnt","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"international unit per kilogram per day","[IU]/kg/d","[IU]/KG/D","arbitrary",1.1574074074074074e-8,[0,-1,-1,0,0,0,0],"(i.U.)/kg/d","chemical",true,null,null,1,false,true,0,"IU/kg/dy; IU/kg/day; IU/kilogram/day; IU per kg per day; units","LOINC","ACntRat","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"international unit per liter","[IU]/L","[IU]/L","arbitrary",1000,[-3,0,0,0,0,0,0],"(i.U.)/L","chemical",true,null,null,1,false,true,0,"IU/L; IU/liter; IU per liter; units; litre","LOINC","ACnc","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"international unit per minute","[IU]/min","[IU]/MIN","arbitrary",0.016666666666666666,[0,-1,0,0,0,0,0],"(i.U.)/min","chemical",true,null,null,1,false,true,0,"IU/min; IU/minute; IU per minute; international units","LOINC","ARat","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"international unit per milliliter","[IU]/mL","[IU]/ML","arbitrary",1000000,[-3,0,0,0,0,0,0],"(i.U.)/mL","chemical",true,null,null,1,false,true,0,"IU/mL; IU per mL; international units per milliliter; millilitre","LOINC","ACnc","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"MPL unit per milliliter","[MPL'U]/mL","[MPL'U]/ML","biologic activity of anticardiolipin IgM",1000000,[-3,0,0,0,0,0,0],"/mL","chemical",false,null,null,1,false,true,0,"MPL/mL; MPL U/mL; MPL'U/mL; IgM anticardiolipin units; IgM Phospholipid Units; millilitre ","LOINC","ACnc","Clinical","units for antiphospholipid test\n","1","1","1",1,false],[false,"number per high power field","{#}/[HPF]","/[HPF]","",1,[0,0,0,0,0,0,0],"/HPF",null,false,null,null,1,false,false,0,"#/HPF; # per HPF; number/HPF; numbers per high power field","LOINC","Naric","Clinical","",null,null,null,null,false],[false,"number per low power field","{#}/[LPF]","/[LPF]","",1,[0,0,0,0,0,0,0],"/LPF",null,false,null,null,1,false,false,0,"#/LPF; # per LPF; number/LPF; numbers per low power field","LOINC","Naric","Clinical","",null,null,null,null,false],[false,"IgA antiphosphatidylserine unit ","{APS'U}","","",1,[0,0,0,0,0,0,0],null,null,false,null,null,1,false,false,0,"APS Unit; Phosphatidylserine Antibody IgA Units","LOINC","ACnc","Clinical","unit for antiphospholipid test",null,null,null,null,false],[false,"EIA index","{EIA_index}","","",1,[0,0,0,0,0,0,0],null,null,false,null,null,1,false,false,0,"enzyme immunoassay index","LOINC","ACnc","Clinical","",null,null,null,null,false],[false,"kaolin clotting time","{KCT'U}","","",1,[0,0,0,0,0,0,0],null,null,false,null,null,1,false,false,0,"KCT","LOINC","Time","Clinical","sensitive test to detect lupus anticoagulants; measured in seconds",null,null,null,null,false],[false,"IgM antiphosphatidylserine unit","{MPS'U}","","",1,[0,0,0,0,0,0,0],null,null,false,null,null,1,false,false,0,"Phosphatidylserine Antibody IgM Measurement ","LOINC","ACnc","Clinical","",null,null,null,null,false],[false,"trillion per liter","10*12/L","(10*12)/L","number",1000000000000000,[-3,0,0,0,0,0,0],"(1012)/L","dimless",false,null,null,1,false,false,0,"10^12/L; 10*12 per Liter; trillion per liter; litre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"10^3 (used for cell count)","10*3","10*3","number",1000,[0,0,0,0,0,0,0],"103","dimless",false,null,null,1,false,false,0,"10^3; thousand","LOINC","Num","Clinical","usually used for counting entities (e.g. blood cells) per volume","1","1","10",10,false],[false,"thousand per liter","10*3/L","(10*3)/L","number",1000000,[-3,0,0,0,0,0,0],"(103)/L","dimless",false,null,null,1,false,false,0,"10^3/L; 10*3 per liter; litre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"thousand per milliliter","10*3/mL","(10*3)/ML","number",1000000000,[-3,0,0,0,0,0,0],"(103)/mL","dimless",false,null,null,1,false,false,0,"10^3/mL; 10*3 per mL; thousand per milliliter; millilitre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"thousand per microliter","10*3/uL","(10*3)/UL","number",999999999999.9999,[-3,0,0,0,0,0,0],"(103)/μL","dimless",false,null,null,1,false,false,0,"10^3/uL; 10*3 per uL; thousand per microliter; microlitre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"10 thousand per microliter","10*4/uL","(10*4)/UL","number",10000000000000,[-3,0,0,0,0,0,0],"(104)/μL","dimless",false,null,null,1,false,false,0,"10^4/uL; 10*4 per uL; microlitre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"10^5 ","10*5","10*5","number",100000,[0,0,0,0,0,0,0],"105","dimless",false,null,null,1,false,false,0,"one hundred thousand","LOINC","Num","Clinical","","1","1","10",10,false],[false,"10^6","10*6","10*6","number",1000000,[0,0,0,0,0,0,0],"106","dimless",false,null,null,1,false,false,0,"","LOINC","Num","Clinical","","1","1","10",10,false],[false,"million colony forming unit per liter","10*6.[CFU]/L","(10*6).[CFU]/L","number",1000000000,[-3,0,0,0,0,0,0],"(106).CFU/L","dimless",false,null,null,1,false,true,0,"10*6 CFU/L; 10^6 CFU/L; 10^6CFU; 10^6 CFU per liter; million colony forming units; litre","LOINC","ACnc","Clinical","","1","1","10",10,false],[false,"million international unit","10*6.[IU]","(10*6).[IU]","number",1000000,[0,0,0,0,0,0,0],"(106).(i.U.)","dimless",false,null,null,1,false,true,0,"10*6 IU; 10^6 IU; international units","LOINC","arb","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","1","1","10",10,false],[false,"million per 24 hour","10*6/(24.h)","(10*6)/HR","number",11.574074074074074,[0,-1,0,0,0,0,0],"(106)/h","dimless",false,null,null,1,false,false,0,"10*6/24hrs; 10^6/24 hrs; 10*6 per 24 hrs; 10^6 per 24 hours","LOINC","NRat","Clinical","","1","1","10",10,false],[false,"million per kilogram","10*6/kg","(10*6)/KG","number",1000,[0,0,-1,0,0,0,0],"(106)/kg","dimless",false,null,null,1,false,false,0,"10^6/kg; 10*6 per kg; 10*6 per kilogram; millions","LOINC","NCnt","Clinical","","1","1","10",10,false],[false,"million per liter","10*6/L","(10*6)/L","number",1000000000,[-3,0,0,0,0,0,0],"(106)/L","dimless",false,null,null,1,false,false,0,"10^6/L; 10*6 per Liter; 10^6 per Liter; litre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"million per milliliter","10*6/mL","(10*6)/ML","number",1000000000000,[-3,0,0,0,0,0,0],"(106)/mL","dimless",false,null,null,1,false,false,0,"10^6/mL; 10*6 per mL; 10*6 per milliliter; millilitre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"million per microliter","10*6/uL","(10*6)/UL","number",1000000000000000,[-3,0,0,0,0,0,0],"(106)/μL","dimless",false,null,null,1,false,false,0,"10^6/uL; 10^6 per uL; 10^6/mcl; 10^6 per mcl; 10^6 per microliter; microlitre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"10^8","10*8","10*8","number",100000000,[0,0,0,0,0,0,0],"108","dimless",false,null,null,1,false,false,0,"100 million; one hundred million; 10^8","LOINC","Num","Clinical","","1","1","10",10,false],[false,"billion per liter","10*9/L","(10*9)/L","number",1000000000000,[-3,0,0,0,0,0,0],"(109)/L","dimless",false,null,null,1,false,false,0,"10^9/L; 10*9 per Liter; litre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"billion per milliliter","10*9/mL","(10*9)/ML","number",1000000000000000,[-3,0,0,0,0,0,0],"(109)/mL","dimless",false,null,null,1,false,false,0,"10^9/mL; 10*9 per mL; 10^9 per mL; 10*9 per milliliter; millilitre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"billion per microliter","10*9/uL","(10*9)/UL","number",1000000000000000000,[-3,0,0,0,0,0,0],"(109)/μL","dimless",false,null,null,1,false,false,0,"10^9/uL; 10^9 per uL; 10^9/mcl; 10^9 per mcl; 10*9 per uL; 10*9 per mcl; 10*9/mcl; 10^9 per microliter; microlitre","LOINC","NCncn","Clinical","","1","1","10",10,false],[false,"10 liter per minute per square meter","10.L/(min.m2)","L/(MIN.M2)","",0.00016666666666666666,[1,-1,0,0,0,0,0],"L/(min.(m2))",null,false,null,null,1,false,false,0,"10 liters per minutes per square meter; 10 L per min per m2; m^2; 10 L/(min*m2); 10L/(min*m^2); litres; sq. meter; metre; meters squared","LOINC","ArVRat","Clinical","",null,null,null,null,false],[false,"10 liter per minute","10.L/min","L/MIN","",0.00016666666666666666,[3,-1,0,0,0,0,0],"L/min",null,false,null,null,1,false,false,0,"10 liters per minute; 10 L per min; 10L; 10 L/min; litre","LOINC","VRat","Clinical","",null,null,null,null,false],[false,"10 micronewton second per centimeter to the fifth power per square meter","10.uN.s/(cm5.m2)","(UN.S)/(CM5.M2)","",100000000,[-6,-1,1,0,0,0,0],"(μN.s)/(cm5).(m2)",null,false,null,null,1,false,false,0,"dyne seconds per centimeter5 and square meter; dyn.s/(cm5.m2); dyn.s/cm5/m2; cm^5; m^2","LOINC","","Clinical","unit to measure systemic vascular resistance per body surface area",null,null,null,null,false],[false,"24 hour","24.h","HR","",86400,[0,1,0,0,0,0,0],"h",null,false,null,null,1,false,false,0,"24hrs; 24 hrs; 24 hours; days; dy","LOINC","Time","Clinical","",null,null,null,null,false],[false,"ampere per meter","A/m","A/M","electric current",1,[-1,-1,0,0,0,1,0],"A/m","si",true,null,null,1,false,false,0,"A/m; amp/meter; magnetic field strength; H; B; amperes per meter; metre","LOINC","","Clinical","unit of magnetic field strength","C/s","C/S","1",1,false],[true,"centigram","cg","CG","mass",0.01,[0,0,1,0,0,0,0],"cg",null,false,"M",null,1,false,false,0,"centigrams; cg; cgm","LOINC","Mass","Clinical","",null,null,null,null,false],[false,"centiliter","cL","CL","volume",0.00001,[3,0,0,0,0,0,0],"cL","iso1000",true,null,null,1,false,false,0,"centiliters; centilitres","LOINC","Vol","Clinical","","l",null,"1",1,false],[true,"centimeter","cm","CM","length",0.01,[1,0,0,0,0,0,0],"cm",null,false,"L",null,1,false,false,0,"centimeters; centimetres","LOINC","Len","Clinical","",null,null,null,null,false],[false,"centimeter of water","cm[H2O]","CM[H2O]","pressure",98066.5,[-1,-2,1,0,0,0,0],"cm HO2","clinical",true,null,null,1,false,false,0,"cm H2O; cmH2O; centimetres; pressure","LOINC","Pres","Clinical","unit of pressure mostly applies to blood pressure","kPa","KPAL","980665e-5",9.80665,false],[false,"centimeter of water per liter per second","cm[H2O]/L/s","(CM[H2O]/L)/S","pressure",98066500,[-4,-3,1,0,0,0,0],"(cm HO2)/L/s","clinical",true,null,null,1,false,false,0,"cm[H2O]/(L/s); cm[H2O].s/L; cm H2O/L/sec; cmH2O/L/sec; cmH2O/Liter; cmH2O per L per secs; centimeters of water per liters per second; centimetres; litres; cm[H2O]/(L/s)","LOINC","PresRat","Clinical","unit used to measure mean pulmonary resistance","kPa","KPAL","980665e-5",9.80665,false],[false,"centimeter of water per second per meter","cm[H2O]/s/m","(CM[H2O]/S)/M","pressure",98066.5,[-2,-3,1,0,0,0,0],"(cm HO2)/s/m","clinical",true,null,null,1,false,false,0,"cm[H2O]/(s.m); cm H2O/s/m; cmH2O; cmH2O/sec/m; cmH2O per secs per meters; centimeters of water per seconds per meter; centimetres; metre","LOINC","PresRat","Clinical","unit used to measure pulmonary pressure time product","kPa","KPAL","980665e-5",9.80665,false],[false,"centimeter of mercury","cm[Hg]","CM[HG]","pressure",1333220,[-1,-2,1,0,0,0,0],"cm Hg","clinical",true,null,null,1,false,false,0,"centimeters of mercury; centimetres; cmHg; cm Hg","LOINC","Pres","Clinical","unit of pressure where 1 cmHg = 10 torr","kPa","KPAL","133.3220",133.322,false],[true,"square centimeter","cm2","CM2","length",0.0001,[2,0,0,0,0,0,0],"cm2",null,false,"L",null,1,false,false,0,"cm^2; sq cm; centimeters squared; square centimeters; centimetre; area","LOINC","Area","Clinical","",null,null,null,null,false],[true,"square centimeter per second","cm2/s","CM2/S","length",0.0001,[2,-1,0,0,0,0,0],"(cm2)/s",null,false,"L",null,1,false,false,0,"cm^2/sec; square centimeters per second; sq cm per sec; cm2; centimeters squared; centimetres","LOINC","AreaRat","Clinical","",null,null,null,null,false],[false,"centipoise","cP","CP","dynamic viscosity",1,[-1,-1,1,0,0,0,0],"cP","cgs",true,null,null,1,false,false,0,"cps; centiposes","LOINC","Visc","Clinical","unit of dynamic viscosity in the CGS system with base units: 10^−3 Pa.s = 1 mPa·.s (1 millipascal second)","dyn.s/cm2","DYN.S/CM2","1",1,false],[false,"centistoke","cSt","CST","kinematic viscosity",0.0000010000000000000002,[2,-1,0,0,0,0,0],"cSt","cgs",true,null,null,1,false,false,0,"centistokes","LOINC","Visc","Clinical","unit for kinematic viscosity with base units of mm^2/s (square millimeter per second)","cm2/s","CM2/S","1",1,false],[false,"dekaliter per minute","daL/min","DAL/MIN","volume",0.00016666666666666666,[3,-1,0,0,0,0,0],"daL/min","iso1000",true,null,null,1,false,false,0,"dekalitres; dekaliters per minute; per min","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"dekaliter per minute per square meter","daL/min/m2","(DAL/MIN)/M2","volume",0.00016666666666666666,[1,-1,0,0,0,0,0],"(daL/min)/(m2)","iso1000",true,null,null,1,false,false,0,"daL/min/m^2; daL/minute/m2; sq. meter; dekaliters per minutes per square meter; meter squared; dekalitres; metre","LOINC","ArVRat","Clinical","The area usually is the body surface area used to normalize cardiovascular measures for patient's size","l",null,"1",1,false],[false,"decibel","dB","DB","level",1,[0,0,0,0,0,0,0],"dB","levels",true,null,"lg",0.1,true,false,0,"decibels","LOINC","LogRto","Clinical","unit most commonly used in acoustics as unit of sound pressure level. (also see B[SPL] or bel sound pressure level). ","1",null,null,1,false],[false,"degree per second","deg/s","DEG/S","plane angle",0.017453292519943295,[0,-1,0,1,0,0,0],"°/s","iso1000",false,null,null,1,false,false,0,"deg/sec; deg per sec; °/sec; twist rate; angular speed; rotational speed","LOINC","ARat","Clinical","unit of angular (rotational) speed used to express turning rate","[pi].rad/360","[PI].RAD/360","2",2,false],[true,"decigram","dg","DG","mass",0.1,[0,0,1,0,0,0,0],"dg",null,false,"M",null,1,false,false,0,"decigrams; dgm; 0.1 grams; 1/10 gm","LOINC","Mass","Clinical","equal to 1/10 gram",null,null,null,null,false],[false,"deciliter","dL","DL","volume",0.0001,[3,0,0,0,0,0,0],"dL","iso1000",true,null,null,1,false,false,0,"deciliters; decilitres; 0.1 liters; 1/10 L","LOINC","Vol","Clinical","equal to 1/10 liter","l",null,"1",1,false],[true,"decimeter","dm","DM","length",0.1,[1,0,0,0,0,0,0],"dm",null,false,"L",null,1,false,false,0,"decimeters; decimetres; 0.1 meters; 1/10 m; 10 cm; centimeters","LOINC","Len","Clinical","equal to 1/10 meter or 10 centimeters",null,null,null,null,false],[true,"square decimeter per square second","dm2/s2","DM2/S2","length",0.010000000000000002,[2,-2,0,0,0,0,0],"(dm2)/(s2)",null,false,"L",null,1,false,false,0,"dm2 per s2; dm^2/s^2; decimeters squared per second squared; sq dm; sq sec","LOINC","EngMass (massic energy)","Clinical","units for energy per unit mass or Joules per kilogram (J/kg = kg.m2/s2/kg = m2/s2) ",null,null,null,null,false],[false,"dyne second per centimeter per square meter","dyn.s/(cm.m2)","(DYN.S)/(CM.M2)","force",1,[-2,-1,1,0,0,0,0],"(dyn.s)/(cm.(m2))","cgs",true,null,null,1,false,false,0,"(dyn*s)/(cm*m2); (dyn*s)/(cm*m^2); dyn s per cm per m2; m^2; dyne seconds per centimeters per square meter; centimetres; sq. meter; squared","LOINC","","Clinical","","g.cm/s2","G.CM/S2","1",1,false],[false,"dyne second per centimeter","dyn.s/cm","(DYN.S)/CM","force",1,[0,-1,1,0,0,0,0],"(dyn.s)/cm","cgs",true,null,null,1,false,false,0,"(dyn*s)/cm; dyn sec per cm; seconds; centimetre; dyne seconds","LOINC","","Clinical","","g.cm/s2","G.CM/S2","1",1,false],[false,"equivalent per liter","eq/L","EQ/L","amount of substance",6.0221366999999994e+26,[-3,0,0,0,0,0,0],"eq/L","chemical",true,null,null,1,false,false,1,"eq/liter; eq/litre; eqs; equivalents per liter; litre","LOINC","SCnc","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"equivalent per milliliter","eq/mL","EQ/ML","amount of substance",6.0221367e+29,[-3,0,0,0,0,0,0],"eq/mL","chemical",true,null,null,1,false,false,1,"equivalent/milliliter; equivalents per milliliter; eq per mL; millilitre","LOINC","SCnc","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"equivalent per millimole","eq/mmol","EQ/MMOL","amount of substance",1000,[0,0,0,0,0,0,0],"eq/mmol","chemical",true,null,null,1,false,false,0,"equivalent/millimole; equivalents per millimole; eq per mmol","LOINC","SRto","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"equivalent per micromole","eq/umol","EQ/UMOL","amount of substance",1000000,[0,0,0,0,0,0,0],"eq/μmol","chemical",true,null,null,1,false,false,0,"equivalent/micromole; equivalents per micromole; eq per umol","LOINC","SRto","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[true,"femtogram","fg","FG","mass",1e-15,[0,0,1,0,0,0,0],"fg",null,false,"M",null,1,false,false,0,"fg; fgm; femtograms; weight","LOINC","Mass","Clinical","equal to 10^-15 grams",null,null,null,null,false],[false,"femtoliter","fL","FL","volume",1e-18,[3,0,0,0,0,0,0],"fL","iso1000",true,null,null,1,false,false,0,"femtolitres; femtoliters","LOINC","Vol; EntVol","Clinical","equal to 10^-15 liters","l",null,"1",1,false],[true,"femtometer","fm","FM","length",1e-15,[1,0,0,0,0,0,0],"fm",null,false,"L",null,1,false,false,0,"femtometres; femtometers","LOINC","Len","Clinical","equal to 10^-15 meters",null,null,null,null,false],[false,"femtomole","fmol","FMOL","amount of substance",602213670,[0,0,0,0,0,0,0],"fmol","si",true,null,null,1,false,false,1,"femtomoles","LOINC","EntSub","Clinical","equal to 10^-15 moles","10*23","10*23","6.0221367",6.0221367,false],[false,"femtomole per gram","fmol/g","FMOL/G","amount of substance",602213670,[0,0,-1,0,0,0,0],"fmol/g","si",true,null,null,1,false,false,1,"femtomoles; fmol/gm; fmol per gm","LOINC","SCnt","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"femtomole per liter","fmol/L","FMOL/L","amount of substance",602213670000,[-3,0,0,0,0,0,0],"fmol/L","si",true,null,null,1,false,false,1,"femtomoles; fmol per liter; litre","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"femtomole per milligram","fmol/mg","FMOL/MG","amount of substance",602213670000,[0,0,-1,0,0,0,0],"fmol/mg","si",true,null,null,1,false,false,1,"fmol per mg; femtomoles","LOINC","SCnt","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"femtomole per milliliter","fmol/mL","FMOL/ML","amount of substance",602213670000000,[-3,0,0,0,0,0,0],"fmol/mL","si",true,null,null,1,false,false,1,"femtomoles; millilitre; fmol per mL; fmol per milliliter","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[true,"gram meter","g.m","G.M","mass",1,[1,0,1,0,0,0,0],"g.m",null,false,"M",null,1,false,false,0,"g*m; gxm; meters; metres","LOINC","Enrg","Clinical","Unit for measuring stroke work (heart work)",null,null,null,null,false],[true,"gram per 100 gram","g/(100.g)","G/G","mass",0.01,[0,0,0,0,0,0,0],"g/g",null,false,"M",null,1,false,false,0,"g/100 gm; 100gm; grams per 100 grams; gm per 100 gm","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"gram per 12 hour","g/(12.h)","G/HR","mass",0.000023148148148148147,[0,-1,1,0,0,0,0],"g/h",null,false,"M",null,1,false,false,0,"gm/12hrs; 12 hrs; gm per 12 hrs; 12hrs; grams per 12 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per 24 hour","g/(24.h)","G/HR","mass",0.000011574074074074073,[0,-1,1,0,0,0,0],"g/h",null,false,"M",null,1,false,false,0,"gm/24hrs; gm/24 hrs; gm per 24 hrs; 24hrs; grams per 24 hours; gm/dy; gm per dy; grams per day","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per 3 days","g/(3.d)","G/D","mass",0.000003858024691358025,[0,-1,1,0,0,0,0],"g/d",null,false,"M",null,1,false,false,0,"gm/3dy; gm/3 dy; gm per 3 days; grams","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per 4 hour","g/(4.h)","G/HR","mass",0.00006944444444444444,[0,-1,1,0,0,0,0],"g/h",null,false,"M",null,1,false,false,0,"gm/4hrs; gm/4 hrs; gm per 4 hrs; 4hrs; grams per 4 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per 48 hour","g/(48.h)","G/HR","mass",0.000005787037037037037,[0,-1,1,0,0,0,0],"g/h",null,false,"M",null,1,false,false,0,"gm/48hrs; gm/48 hrs; gm per 48 hrs; 48hrs; grams per 48 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per 5 hour","g/(5.h)","G/HR","mass",0.00005555555555555556,[0,-1,1,0,0,0,0],"g/h",null,false,"M",null,1,false,false,0,"gm/5hrs; gm/5 hrs; gm per 5 hrs; 5hrs; grams per 5 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per 6 hour","g/(6.h)","G/HR","mass",0.000046296296296296294,[0,-1,1,0,0,0,0],"g/h",null,false,"M",null,1,false,false,0,"gm/6hrs; gm/6 hrs; gm per 6 hrs; 6hrs; grams per 6 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per 72 hour","g/(72.h)","G/HR","mass",0.000003858024691358025,[0,-1,1,0,0,0,0],"g/h",null,false,"M",null,1,false,false,0,"gm/72hrs; gm/72 hrs; gm per 72 hrs; 72hrs; grams per 72 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per cubic centimeter","g/cm3","G/CM3","mass",999999.9999999999,[-3,0,1,0,0,0,0],"g/(cm3)",null,false,"M",null,1,false,false,0,"g/cm^3; gm per cm3; g per cm^3; grams per centimeter cubed; cu. cm; centimetre; g/mL; gram per milliliter; millilitre","LOINC","MCnc","Clinical","g/cm3 = g/mL",null,null,null,null,false],[true,"gram per day","g/d","G/D","mass",0.000011574074074074073,[0,-1,1,0,0,0,0],"g/d",null,false,"M",null,1,false,false,0,"gm/dy; gm per dy; grams per day; gm/24hrs; gm/24 hrs; gm per 24 hrs; 24hrs; grams per 24 hours; serving","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per deciliter","g/dL","G/DL","mass",10000,[-3,0,1,0,0,0,0],"g/dL",null,false,"M",null,1,false,false,0,"gm/dL; gm per dL; grams per deciliter; decilitre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"gram per gram","g/g","G/G","mass",1,[0,0,0,0,0,0,0],"g/g",null,false,"M",null,1,false,false,0,"gm; grams","LOINC","MRto ","Clinical","",null,null,null,null,false],[true,"gram per hour","g/h","G/HR","mass",0.0002777777777777778,[0,-1,1,0,0,0,0],"g/h",null,false,"M",null,1,false,false,0,"gm/hr; gm per hr; grams; intake; output","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per hour per square meter","g/h/m2","(G/HR)/M2","mass",0.0002777777777777778,[-2,-1,1,0,0,0,0],"(g/h)/(m2)",null,false,"M",null,1,false,false,0,"gm/hr/m2; gm/h/m2; /m^2; sq. m; g per hr per m2; grams per hours per square meter; meter squared; metre","LOINC","ArMRat","Clinical","",null,null,null,null,false],[true,"gram per kilogram","g/kg ","G/KG","mass",0.001,[0,0,0,0,0,0,0],"g/kg",null,false,"M",null,1,false,false,0,"g per kg; gram per kilograms","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"gram per kilogram per 8 hour ","g/kg/(8.h)","(G/KG)/HR","mass",3.472222222222222e-8,[0,-1,0,0,0,0,0],"(g/kg)/h",null,false,"M",null,1,false,false,0,"g/(8.kg.h); gm/kg/8hrs; 8 hrs; g per kg per 8 hrs; 8hrs; grams per kilograms per 8 hours; shift","LOINC","MCntRat; RelMRat","Clinical","unit often used to describe mass in grams of protein consumed in a 8 hours, divided by the subject's body weight in kilograms. Also used to measure mass dose rate per body mass",null,null,null,null,false],[true,"gram per kilogram per day","g/kg/d","(G/KG)/D","mass",1.1574074074074074e-8,[0,-1,0,0,0,0,0],"(g/kg)/d",null,false,"M",null,1,false,false,0,"g/(kg.d); gm/kg/dy; gm per kg per dy; grams per kilograms per day","LOINC","RelMRat","Clinical","unit often used to describe mass in grams of protein consumed in a day, divided by the subject's body weight in kilograms. Also used to measure mass dose rate per body mass",null,null,null,null,false],[true,"gram per kilogram per hour","g/kg/h","(G/KG)/HR","mass",2.7777777777777776e-7,[0,-1,0,0,0,0,0],"(g/kg)/h",null,false,"M",null,1,false,false,0,"g/(kg.h); g/kg/hr; g per kg per hrs; grams per kilograms per hour","LOINC","MCntRat; RelMRat","Clinical","unit used to measure mass dose rate per body mass",null,null,null,null,false],[true,"gram per kilogram per minute","g/kg/min","(G/KG)/MIN","mass",0.000016666666666666667,[0,-1,0,0,0,0,0],"(g/kg)/min",null,false,"M",null,1,false,false,0,"g/(kg.min); g/kg/min; g per kg per min; grams per kilograms per minute","LOINC","MCntRat; RelMRat","Clinical","unit used to measure mass dose rate per body mass",null,null,null,null,false],[true,"gram per liter","g/L","G/L","mass",1000,[-3,0,1,0,0,0,0],"g/L",null,false,"M",null,1,false,false,0,"gm per liter; g/liter; grams per liter; litre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"gram per square meter","g/m2","G/M2","mass",1,[-2,0,1,0,0,0,0],"g/(m2)",null,false,"M",null,1,false,false,0,"g/m^2; gram/square meter; g/sq m; g per m2; g per m^2; grams per square meter; meters squared; metre","LOINC","ArMass","Clinical","Tests measure myocardial mass (heart ventricle system) per body surface area; unit used to measure mass dose per body surface area",null,null,null,null,false],[true,"gram per milligram","g/mg","G/MG","mass",1000,[0,0,0,0,0,0,0],"g/mg",null,false,"M",null,1,false,false,0,"g per mg; grams per milligram","LOINC","MCnt; MRto","Clinical","",null,null,null,null,false],[true,"gram per minute","g/min","G/MIN","mass",0.016666666666666666,[0,-1,1,0,0,0,0],"g/min",null,false,"M",null,1,false,false,0,"g per min; grams per minute; gram/minute","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"gram per milliliter","g/mL","G/ML","mass",1000000,[-3,0,1,0,0,0,0],"g/mL",null,false,"M",null,1,false,false,0,"g per mL; grams per milliliter; millilitre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"gram per millimole","g/mmol","G/MMOL","mass",1.6605401866749388e-21,[0,0,1,0,0,0,0],"g/mmol",null,false,"M",null,1,false,false,-1,"grams per millimole; g per mmol","LOINC","Ratio","Clinical","",null,null,null,null,false],[false,"joule per liter","J/L","J/L","energy",1000000,[-1,-2,1,0,0,0,0],"J/L","si",true,null,null,1,false,false,0,"joules per liter; litre; J per L","LOINC","EngCnc","Clinical","","N.m","N.M","1",1,false],[true,"degree Kelvin per Watt","K/W","K/W","temperature",0.001,[-2,3,-1,0,1,0,0],"K/W",null,false,"C",null,1,false,false,0,"degree Kelvin/Watt; K per W; thermal ohm; thermal resistance; degrees","LOINC","TempEngRat","Clinical","unit for absolute thermal resistance equal to the reciprocal of thermal conductance. Unit used for tests to measure work of breathing",null,null,null,null,false],[false,"kilo international unit per liter","k[IU]/L","K[IU]/L","arbitrary",1000000,[-3,0,0,0,0,0,0],"(ki.U.)/L","chemical",true,null,null,1,false,true,0,"kIU/L; kIU per L; kIU per liter; kilo international units; litre; allergens; allergy units","LOINC","ACnc","Clinical","IgE has an WHO reference standard so IgE allergen testing can be reported as k[IU]/L","[iU]","[IU]","1",1,false],[false,"kilo international unit per milliliter","k[IU]/mL","K[IU]/ML","arbitrary",1000000000,[-3,0,0,0,0,0,0],"(ki.U.)/mL","chemical",true,null,null,1,false,true,0,"kIU/mL; kIU per mL; kIU per milliliter; kilo international units; millilitre; allergens; allergy units","LOINC","ACnc","Clinical","IgE has an WHO reference standard so IgE allergen testing can be reported as k[IU]/mL","[iU]","[IU]","1",1,false],[false,"katal per kilogram","kat/kg","KAT/KG","catalytic activity",602213670000000000000,[0,-1,-1,0,0,0,0],"kat/kg","chemical",true,null,null,1,false,false,1,"kat per kg; katals per kilogram; mol/s/kg; moles per seconds per kilogram","LOINC","CCnt","Clinical","kat is a unit of catalytic activity with base units = mol/s. Rarely used because its units are too large to practically express catalytic activity. See enzyme unit [U] which is the standard unit for catalytic activity.","mol/s","MOL/S","1",1,false],[false,"katal per liter","kat/L","KAT/L","catalytic activity",6.0221366999999994e+26,[-3,-1,0,0,0,0,0],"kat/L","chemical",true,null,null,1,false,false,1,"kat per L; katals per liter; litre; mol/s/L; moles per seconds per liter","LOINC","CCnc","Clinical","kat is a unit of catalytic activity with base units = mol/s. Rarely used because its units are too large to practically express catalytic activity. See enzyme unit [U] which is the standard unit for catalytic activity.","mol/s","MOL/S","1",1,false],[false,"kilocalorie","kcal","KCAL","energy",4184000,[2,-2,1,0,0,0,0],"kcal","heat",true,null,null,1,false,false,0,"kilogram calories; large calories; food calories; kcals","LOINC","EngRat","Clinical","It is equal to 1000 calories (equal to 4.184 kJ). But in practical usage, kcal refers to food calories which excludes caloric content in fiber and other constitutes that is not digestible by humans. Also see nutrition label Calories ([Cal])","cal_th","CAL_TH","1",1,false],[false,"kilocalorie per 24 hour","kcal/(24.h)","KCAL/HR","energy",48.425925925925924,[2,-3,1,0,0,0,0],"kcal/h","heat",true,null,null,1,false,false,0,"kcal/24hrs; kcal/24 hrs; kcal per 24hrs; kilocalories per 24 hours; kilojoules; kJ/24hr; kJ/(24.h); kJ/dy; kilojoules per days; intake; calories burned; metabolic rate; food calories","","EngRat","Clinical","","cal_th","CAL_TH","1",1,false],[false,"kilocalorie per ounce","kcal/[oz_av]","KCAL/[OZ_AV]","energy",147586.25679704445,[2,-2,0,0,0,0,0],"kcal/oz","heat",true,null,null,1,false,false,0,"kcal/oz; kcal per ozs; large calories per ounces; food calories; servings; international","LOINC","EngCnt","Clinical","used in nutrition to represent calorie of food","cal_th","CAL_TH","1",1,false],[false,"kilocalorie per day","kcal/d","KCAL/D","energy",48.425925925925924,[2,-3,1,0,0,0,0],"kcal/d","heat",true,null,null,1,false,false,0,"kcal/dy; kcal per day; kilocalories per days; kilojoules; kJ/dy; kilojoules per days; intake; calories burned; metabolic rate; food calories","LOINC","EngRat","Clinical","unit in nutrition for food intake (measured in calories) in a day","cal_th","CAL_TH","1",1,false],[false,"kilocalorie per hour","kcal/h","KCAL/HR","energy",1162.2222222222222,[2,-3,1,0,0,0,0],"kcal/h","heat",true,null,null,1,false,false,0,"kcal/hrs; kcals per hr; intake; kilocalories per hours; kilojoules","LOINC","EngRat","Clinical","used in nutrition to represent caloric requirement or consumption","cal_th","CAL_TH","1",1,false],[false,"kilocalorie per kilogram per 24 hour","kcal/kg/(24.h)","(KCAL/KG)/HR","energy",0.04842592592592593,[2,-3,0,0,0,0,0],"(kcal/kg)/h","heat",true,null,null,1,false,false,0,"kcal/kg/24hrs; 24 hrs; kcal per kg per 24hrs; kilocalories per kilograms per 24 hours; kilojoules","LOINC","EngCntRat","Clinical","used in nutrition to represent caloric requirement per day based on subject's body weight in kilograms","cal_th","CAL_TH","1",1,false],[true,"kilogram","kg","KG","mass",1000,[0,0,1,0,0,0,0],"kg",null,false,"M",null,1,false,false,0,"kilograms; kgs","LOINC","Mass","Clinical","",null,null,null,null,false],[true,"kilogram meter per second","kg.m/s","(KG.M)/S","mass",1000,[1,-1,1,0,0,0,0],"(kg.m)/s",null,false,"M",null,1,false,false,0,"kg*m/s; kg.m per sec; kg*m per sec; p; momentum","LOINC","","Clinical","unit for momentum = mass times velocity",null,null,null,null,false],[true,"kilogram per second per square meter","kg/(s.m2)","KG/(S.M2)","mass",1000,[-2,-1,1,0,0,0,0],"kg/(s.(m2))",null,false,"M",null,1,false,false,0,"kg/(s*m2); kg/(s*m^2); kg per s per m2; per sec; per m^2; kilograms per seconds per square meter; meter squared; metre","LOINC","ArMRat","Clinical","",null,null,null,null,false],[true,"kilogram per hour","kg/h","KG/HR","mass",0.2777777777777778,[0,-1,1,0,0,0,0],"kg/h",null,false,"M",null,1,false,false,0,"kg/hr; kg per hr; kilograms per hour","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"kilogram per liter","kg/L","KG/L","mass",1000000,[-3,0,1,0,0,0,0],"kg/L",null,false,"M",null,1,false,false,0,"kg per liter; litre; kilograms","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"kilogram per square meter","kg/m2","KG/M2","mass",1000,[-2,0,1,0,0,0,0],"kg/(m2)",null,false,"M",null,1,false,false,0,"kg/m^2; kg/sq. m; kg per m2; per m^2; per sq. m; kilograms; meter squared; metre; BMI","LOINC","Ratio","Clinical","units for body mass index (BMI)",null,null,null,null,false],[true,"kilogram per cubic meter","kg/m3","KG/M3","mass",1000,[-3,0,1,0,0,0,0],"kg/(m3)",null,false,"M",null,1,false,false,0,"kg/m^3; kg/cu. m; kg per m3; per m^3; per cu. m; kilograms; meters cubed; metre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"kilogram per minute","kg/min","KG/MIN","mass",16.666666666666668,[0,-1,1,0,0,0,0],"kg/min",null,false,"M",null,1,false,false,0,"kilogram/minute; kg per min; kilograms per minute","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"kilogram per mole","kg/mol","KG/MOL","mass",1.6605401866749388e-21,[0,0,1,0,0,0,0],"kg/mol",null,false,"M",null,1,false,false,-1,"kilogram/mole; kg per mol; kilograms per mole","LOINC","SCnt","Clinical","",null,null,null,null,false],[true,"kilogram per second","kg/s","KG/S","mass",1000,[0,-1,1,0,0,0,0],"kg/s",null,false,"M",null,1,false,false,0,"kg/sec; kilogram/second; kg per sec; kilograms; second","LOINC","MRat","Clinical","",null,null,null,null,false],[false,"kiloliter","kL","KL","volume",1,[3,0,0,0,0,0,0],"kL","iso1000",true,null,null,1,false,false,0,"kiloliters; kilolitres; m3; m^3; meters cubed; metre","LOINC","Vol","Clinical","","l",null,"1",1,false],[true,"kilometer","km","KM","length",1000,[1,0,0,0,0,0,0],"km",null,false,"L",null,1,false,false,0,"kilometers; kilometres; distance","LOINC","Len","Clinical","",null,null,null,null,false],[false,"kilopascal","kPa","KPAL","pressure",1000000,[-1,-2,1,0,0,0,0],"kPa","si",true,null,null,1,false,false,0,"kilopascals; pressure","LOINC","Pres; PPresDiff","Clinical","","N/m2","N/M2","1",1,false],[true,"kilosecond","ks","KS","time",1000,[0,1,0,0,0,0,0],"ks",null,false,"T",null,1,false,false,0,"kiloseconds; ksec","LOINC","Time","Clinical","",null,null,null,null,false],[false,"kilo enzyme unit","kU","KU","catalytic activity",10036894500000000000,[0,-1,0,0,0,0,0],"kU","chemical",true,null,null,1,false,false,1,"units; mmol/min; millimoles per minute","LOINC","CAct","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 kU = 1 mmol/min","umol/min","UMOL/MIN","1",1,false],[false,"kilo enzyme unit per gram","kU/g","KU/G","catalytic activity",10036894500000000000,[0,-1,-1,0,0,0,0],"kU/g","chemical",true,null,null,1,false,false,1,"units per grams; kU per gm","LOINC","CCnt","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 kU = 1 mmol/min","umol/min","UMOL/MIN","1",1,false],[false,"kilo enzyme unit per liter","kU/L","KU/L","catalytic activity",1.00368945e+22,[-3,-1,0,0,0,0,0],"kU/L","chemical",true,null,null,1,false,false,1,"units per liter; litre; enzymatic activity; enzyme activity per volume; activities","LOINC","ACnc; CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 kU = 1 mmol/min","umol/min","UMOL/MIN","1",1,false],[false,"kilo enzyme unit per milliliter","kU/mL","KU/ML","catalytic activity",1.00368945e+25,[-3,-1,0,0,0,0,0],"kU/mL","chemical",true,null,null,1,false,false,1,"kU per mL; units per milliliter; millilitre; enzymatic activity per volume; enzyme activities","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 kU = 1 mmol/min","umol/min","UMOL/MIN","1",1,false],[false,"Liters per 24 hour","L/(24.h)","L/HR","volume",1.1574074074074074e-8,[3,-1,0,0,0,0,0],"L/h","iso1000",true,null,null,1,false,false,0,"L/24hrs; L/24 hrs; L per 24hrs; liters per 24 hours; day; dy; litres; volume flow rate","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"Liters per 8 hour","L/(8.h)","L/HR","volume",3.472222222222222e-8,[3,-1,0,0,0,0,0],"L/h","iso1000",true,null,null,1,false,false,0,"L/8hrs; L/8 hrs; L per 8hrs; liters per 8 hours; litres; volume flow rate; shift","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"Liters per minute per square meter","L/(min.m2) ","L/(MIN.M2)","volume",0.000016666666666666667,[1,-1,0,0,0,0,0],"L/(min.(m2))","iso1000",true,null,null,1,false,false,0,"L/(min.m2); L/min/m^2; L/min/sq. meter; L per min per m2; m^2; liters per minutes per square meter; meter squared; litres; metre ","LOINC","ArVRat","Clinical","unit for tests that measure cardiac output per body surface area (cardiac index)","l",null,"1",1,false],[false,"Liters per day","L/d","L/D","volume",1.1574074074074074e-8,[3,-1,0,0,0,0,0],"L/d","iso1000",true,null,null,1,false,false,0,"L/dy; L per day; 24hrs; 24 hrs; 24 hours; liters; litres","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"Liters per hour","L/h","L/HR","volume",2.7777777777777776e-7,[3,-1,0,0,0,0,0],"L/h","iso1000",true,null,null,1,false,false,0,"L/hr; L per hr; litres","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"Liters per kilogram","L/kg","L/KG","volume",0.000001,[3,0,-1,0,0,0,0],"L/kg","iso1000",true,null,null,1,false,false,0,"L per kg; litre","LOINC","VCnt","Clinical","","l",null,"1",1,false],[false,"Liters per liter","L/L","L/L","volume",1,[0,0,0,0,0,0,0],"L/L","iso1000",true,null,null,1,false,false,0,"L per L; liter/liter; litre","LOINC","VFr","Clinical","","l",null,"1",1,false],[false,"Liters per minute","L/min","L/MIN","volume",0.000016666666666666667,[3,-1,0,0,0,0,0],"L/min","iso1000",true,null,null,1,false,false,0,"liters per minute; litre","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"Liters per minute per square meter","L/min/m2","(L/MIN)/M2","volume",0.000016666666666666667,[1,-1,0,0,0,0,0],"(L/min)/(m2)","iso1000",true,null,null,1,false,false,0,"L/(min.m2); L/min/m^2; L/min/sq. meter; L per min per m2; m^2; liters per minutes per square meter; meter squared; litres; metre ","","ArVRat","Clinical","unit for tests that measure cardiac output per body surface area (cardiac index)","l",null,"1",1,false],[false,"Liters per second","L/s","L/S","volume",0.001,[3,-1,0,0,0,0,0],"L/s","iso1000",true,null,null,1,false,false,0,"L per sec; litres","LOINC","VRat","Clinical","unit used often to measure gas flow and peak expiratory flow","l",null,"1",1,false],[false,"Liters per second per square second","L/s/s2","(L/S)/S2","volume",0.001,[3,-3,0,0,0,0,0],"(L/s)/(s2)","iso1000",true,null,null,1,false,false,0,"L/s/s^2; L/sec/sec2; L/sec/sec^2; L/sec/sq. sec; L per s per s2; L per sec per sec2; s^2; sec^2; liters per seconds per square second; second squared; litres ","LOINC","ArVRat","Clinical","unit for tests that measure cardiac output/body surface area","l",null,"1",1,false],[false,"lumen square meter","lm.m2","LM.M2","luminous flux",1,[2,0,0,2,0,0,1],"lm.(m2)","si",true,null,null,1,false,false,0,"lm*m2; lm*m^2; lumen meters squared; lumen sq. meters; metres","LOINC","","Clinical","","cd.sr","CD.SR","1",1,false],[true,"meter per second","m/s","M/S","length",1,[1,-1,0,0,0,0,0],"m/s",null,false,"L",null,1,false,false,0,"meter/second; m per sec; meters per second; metres; velocity; speed","LOINC","Vel","Clinical","unit of velocity",null,null,null,null,false],[true,"meter per square second","m/s2","M/S2","length",1,[1,-2,0,0,0,0,0],"m/(s2)",null,false,"L",null,1,false,false,0,"m/s^2; m/sq. sec; m per s2; per s^2; meters per square second; second squared; sq second; metres; acceleration","LOINC","Accel","Clinical","unit of acceleration",null,null,null,null,false],[false,"milli international unit per liter","m[IU]/L","M[IU]/L","arbitrary",1,[-3,0,0,0,0,0,0],"(mi.U.)/L","chemical",true,null,null,1,false,true,0,"mIU/L; m IU/L; mIU per liter; units; litre","LOINC","ACnc","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"milli international unit per milliliter","m[IU]/mL","M[IU]/ML","arbitrary",1000.0000000000001,[-3,0,0,0,0,0,0],"(mi.U.)/mL","chemical",true,null,null,1,false,true,0,"mIU/mL; m IU/mL; mIU per mL; milli international units per milliliter; millilitre","LOINC","ACnc","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[true,"square meter","m2","M2","length",1,[2,0,0,0,0,0,0],"m2",null,false,"L",null,1,false,false,0,"m^2; sq m; square meters; meters squared; metres","LOINC","Area","Clinical","unit often used to represent body surface area",null,null,null,null,false],[true,"square meter per second","m2/s","M2/S","length",1,[2,-1,0,0,0,0,0],"(m2)/s",null,false,"L",null,1,false,false,0,"m^2/sec; m2 per sec; m^2 per sec; sq m/sec; meters squared/seconds; sq m per sec; meters squared; metres","LOINC","ArRat","Clinical","",null,null,null,null,false],[true,"cubic meter per second","m3/s","M3/S","length",1,[3,-1,0,0,0,0,0],"(m3)/s",null,false,"L",null,1,false,false,0,"m^3/sec; m3 per sec; m^3 per sec; cu m/sec; cubic meters per seconds; meters cubed; metres","LOINC","VRat","Clinical","",null,null,null,null,false],[false,"milliampere","mA","MA","electric current",0.001,[0,-1,0,0,0,1,0],"mA","si",true,null,null,1,false,false,0,"mamp; milliamperes","LOINC","ElpotRat","Clinical","unit of electric current","C/s","C/S","1",1,false],[false,"millibar","mbar","MBAR","pressure",100000,[-1,-2,1,0,0,0,0],"mbar","iso1000",true,null,null,1,false,false,0,"millibars","LOINC","Pres","Clinical","unit of pressure","Pa","PAL","1e5",100000,false],[false,"millibar second per liter","mbar.s/L","(MBAR.S)/L","pressure",100000000,[-4,-1,1,0,0,0,0],"(mbar.s)/L","iso1000",true,null,null,1,false,false,0,"mbar*s/L; mbar.s per L; mbar*s per L; millibar seconds per liter; millibar second per litre","LOINC","","Clinical","unit to measure expiratory resistance","Pa","PAL","1e5",100000,false],[false,"millibar per liter per second","mbar/L/s","(MBAR/L)/S","pressure",100000000,[-4,-3,1,0,0,0,0],"(mbar/L)/s","iso1000",true,null,null,1,false,false,0,"mbar/(L.s); mbar/L/sec; mbar/liter/second; mbar per L per sec; mbar per liter per second; millibars per liters per seconds; litres","LOINC","PresCncRat","Clinical","unit to measure expiratory resistance","Pa","PAL","1e5",100000,false],[false,"milliequivalent","meq","MEQ","amount of substance",602213670000000000000,[0,0,0,0,0,0,0],"meq","chemical",true,null,null,1,false,false,1,"milliequivalents; meqs","LOINC","Sub","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"milliequivalent per 2 hour","meq/(2.h)","MEQ/HR","amount of substance",83640787500000000,[0,-1,0,0,0,0,0],"meq/h","chemical",true,null,null,1,false,false,1,"meq/2hrs; meq/2 hrs; meq per 2 hrs; milliequivalents per 2 hours","LOINC","SRat","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"milliequivalent per 24 hour","meq/(24.h)","MEQ/HR","amount of substance",6970065625000000,[0,-1,0,0,0,0,0],"meq/h","chemical",true,null,null,1,false,false,1,"meq/24hrs; meq/24 hrs; meq per 24 hrs; milliequivalents per 24 hours","LOINC","SRat","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"milliequivalent per 8 hour","meq/(8.h)","MEQ/HR","amount of substance",20910196875000000,[0,-1,0,0,0,0,0],"meq/h","chemical",true,null,null,1,false,false,1,"meq/8hrs; meq/8 hrs; meq per 8 hrs; milliequivalents per 8 hours; shift","LOINC","SRat","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"milliequivalent per day","meq/d","MEQ/D","amount of substance",6970065625000000,[0,-1,0,0,0,0,0],"meq/d","chemical",true,null,null,1,false,false,1,"meq/dy; meq per day; milliquivalents per days; meq/24hrs; meq/24 hrs; meq per 24 hrs; milliequivalents per 24 hours","LOINC","SRat","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"milliequivalent per deciliter","meq/dL","MEQ/DL","amount of substance",6.022136699999999e+24,[-3,0,0,0,0,0,0],"meq/dL","chemical",true,null,null,1,false,false,1,"meq per dL; milliequivalents per deciliter; decilitre","LOINC","SCnc","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"milliequivalent per gram","meq/g","MEQ/G","amount of substance",602213670000000000000,[0,0,-1,0,0,0,0],"meq/g","chemical",true,null,null,1,false,false,1,"mgq/gm; meq per gm; milliequivalents per gram","LOINC","MCnt","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"milliequivalent per hour","meq/h","MEQ/HR","amount of substance",167281575000000000,[0,-1,0,0,0,0,0],"meq/h","chemical",true,null,null,1,false,false,1,"meq/hrs; meq per hrs; milliequivalents per hour","LOINC","SRat","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"milliequivalent per kilogram","meq/kg","MEQ/KG","amount of substance",602213670000000000,[0,0,-1,0,0,0,0],"meq/kg","chemical",true,null,null,1,false,false,1,"meq per kg; milliequivalents per kilogram","LOINC","SCnt","Clinical","equivalence equals moles per valence; used to measure dose per patient body mass","mol","MOL","1",1,false],[false,"milliequivalent per kilogram per hour","meq/kg/h","(MEQ/KG)/HR","amount of substance",167281575000000,[0,-1,-1,0,0,0,0],"(meq/kg)/h","chemical",true,null,null,1,false,false,1,"meq/(kg.h); meq/kg/hr; meq per kg per hr; milliequivalents per kilograms per hour","LOINC","SCntRat","Clinical","equivalence equals moles per valence; unit used to measure dose rate per patient body mass","mol","MOL","1",1,false],[false,"milliequivalent per liter","meq/L","MEQ/L","amount of substance",6.0221367e+23,[-3,0,0,0,0,0,0],"meq/L","chemical",true,null,null,1,false,false,1,"milliequivalents per liter; litre; meq per l; acidity","LOINC","SCnc","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"milliequivalent per square meter","meq/m2","MEQ/M2","amount of substance",602213670000000000000,[-2,0,0,0,0,0,0],"meq/(m2)","chemical",true,null,null,1,false,false,1,"meq/m^2; meq/sq. m; milliequivalents per square meter; meter squared; metre","LOINC","ArSub","Clinical","equivalence equals moles per valence; note that the use of m2 in clinical units ofter refers to body surface area","mol","MOL","1",1,false],[false,"milliequivalent per minute","meq/min","MEQ/MIN","amount of substance",10036894500000000000,[0,-1,0,0,0,0,0],"meq/min","chemical",true,null,null,1,false,false,1,"meq per min; milliequivalents per minute","LOINC","SRat","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[false,"milliequivalent per milliliter","meq/mL","MEQ/ML","amount of substance",6.0221367e+26,[-3,0,0,0,0,0,0],"meq/mL","chemical",true,null,null,1,false,false,1,"meq per mL; milliequivalents per milliliter; millilitre","LOINC","SCnc","Clinical","equivalence equals moles per valence","mol","MOL","1",1,false],[true,"milligram","mg","MG","mass",0.001,[0,0,1,0,0,0,0],"mg",null,false,"M",null,1,false,false,0,"milligrams","LOINC","Mass","Clinical","",null,null,null,null,false],[true,"milligram per 10 hour","mg/(10.h)","MG/HR","mass",2.7777777777777777e-8,[0,-1,1,0,0,0,0],"mg/h",null,false,"M",null,1,false,false,0,"mg/10hrs; mg/10 hrs; mg per 10 hrs; milligrams per 10 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"milligram per 12 hour","mg/(12.h)","MG/HR","mass",2.3148148148148148e-8,[0,-1,1,0,0,0,0],"mg/h",null,false,"M",null,1,false,false,0,"mg/12hrs; mg/12 hrs; per 12 hrs; 12hrs; milligrams per 12 hours","LOINC","MRat","Clinical","units used for tests in urine",null,null,null,null,false],[true,"milligram per 2 hour","mg/(2.h)","MG/HR","mass",1.3888888888888888e-7,[0,-1,1,0,0,0,0],"mg/h",null,false,"M",null,1,false,false,0,"mg/2hrs; mg/2 hrs; mg per 2 hrs; 2hrs; milligrams per 2 hours","LOINC","MRat","Clinical","units used for tests in urine",null,null,null,null,false],[true,"milligram per 24 hour","mg/(24.h)","MG/HR","mass",1.1574074074074074e-8,[0,-1,1,0,0,0,0],"mg/h",null,false,"M",null,1,false,false,0,"mg/24hrs; mg/24 hrs; milligrams per 24 hours; mg/kg/dy; mg per kg per day; milligrams per kilograms per days","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"milligram per 6 hour","mg/(6.h)","MG/HR","mass",4.6296296296296295e-8,[0,-1,1,0,0,0,0],"mg/h",null,false,"M",null,1,false,false,0,"mg/6hrs; mg/6 hrs; mg per 6 hrs; 6hrs; milligrams per 6 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"milligram per 72 hour","mg/(72.h)","MG/HR","mass",3.858024691358025e-9,[0,-1,1,0,0,0,0],"mg/h",null,false,"M",null,1,false,false,0,"mg/72hrs; mg/72 hrs; 72 hrs; 72hrs; milligrams per 72 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"milligram per 8 hour","mg/(8.h)","MG/HR","mass",3.472222222222222e-8,[0,-1,1,0,0,0,0],"mg/h",null,false,"M",null,1,false,false,0,"mg/8hrs; mg/8 hrs; milligrams per 8 hours; shift","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"milligram per day","mg/d","MG/D","mass",1.1574074074074074e-8,[0,-1,1,0,0,0,0],"mg/d",null,false,"M",null,1,false,false,0,"mg/24hrs; mg/24 hrs; milligrams per 24 hours; mg/dy; mg per day; milligrams","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"milligram per deciliter","mg/dL","MG/DL","mass",10,[-3,0,1,0,0,0,0],"mg/dL",null,false,"M",null,1,false,false,0,"mg per dL; milligrams per deciliter; decilitre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"milligram per gram","mg/g","MG/G","mass",0.001,[0,0,0,0,0,0,0],"mg/g",null,false,"M",null,1,false,false,0,"mg per gm; milligrams per gram","LOINC","MCnt; MRto","Clinical","",null,null,null,null,false],[true,"milligram per hour","mg/h","MG/HR","mass",2.7777777777777776e-7,[0,-1,1,0,0,0,0],"mg/h",null,false,"M",null,1,false,false,0,"mg/hr; mg per hr; milligrams","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"milligram per kilogram","mg/kg","MG/KG","mass",0.000001,[0,0,0,0,0,0,0],"mg/kg",null,false,"M",null,1,false,false,0,"mg per kg; milligrams per kilograms","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"milligram per kilogram per 8 hour","mg/kg/(8.h)","(MG/KG)/HR","mass",3.472222222222222e-11,[0,-1,0,0,0,0,0],"(mg/kg)/h",null,false,"M",null,1,false,false,0,"mg/(8.h.kg); mg/kg/8hrs; mg/kg/8 hrs; mg per kg per 8hrs; 8 hrs; milligrams per kilograms per 8 hours; shift","LOINC","RelMRat; MCntRat","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"milligram per kilogram per day","mg/kg/d","(MG/KG)/D","mass",1.1574074074074074e-11,[0,-1,0,0,0,0,0],"(mg/kg)/d",null,false,"M",null,1,false,false,0,"mg/(kg.d); mg/(kg.24.h)mg/kg/dy; mg per kg per day; milligrams per kilograms per days; mg/kg/(24.h); mg/kg/24hrs; 24 hrs; 24 hours","LOINC","RelMRat ","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"milligram per kilogram per hour","mg/kg/h","(MG/KG)/HR","mass",2.7777777777777777e-10,[0,-1,0,0,0,0,0],"(mg/kg)/h",null,false,"M",null,1,false,false,0,"mg/(kg.h); mg/kg/hr; mg per kg per hr; milligrams per kilograms per hour","LOINC","RelMRat; MCntRat","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"milligram per kilogram per minute","mg/kg/min","(MG/KG)/MIN","mass",1.6666666666666667e-8,[0,-1,0,0,0,0,0],"(mg/kg)/min",null,false,"M",null,1,false,false,0,"mg/(kg.min); mg per kg per min; milligrams per kilograms per minute","LOINC","RelMRat; MCntRat","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"milligram per liter","mg/L","MG/L","mass",1,[-3,0,1,0,0,0,0],"mg/L",null,false,"M",null,1,false,false,0,"mg per l; milligrams per liter; litre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"milligram per square meter","mg/m2","MG/M2","mass",0.001,[-2,0,1,0,0,0,0],"mg/(m2)",null,false,"M",null,1,false,false,0,"mg/m^2; mg/sq. m; mg per m2; mg per m^2; mg per sq. milligrams; meter squared; metre","LOINC","ArMass","Clinical","",null,null,null,null,false],[true,"milligram per cubic meter","mg/m3","MG/M3","mass",0.001,[-3,0,1,0,0,0,0],"mg/(m3)",null,false,"M",null,1,false,false,0,"mg/m^3; mg/cu. m; mg per m3; milligrams per cubic meter; meter cubed; metre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"milligram per milligram","mg/mg","MG/MG","mass",1,[0,0,0,0,0,0,0],"mg/mg",null,false,"M",null,1,false,false,0,"mg per mg; milligrams; milligram/milligram","LOINC","MRto","Clinical","",null,null,null,null,false],[true,"milligram per minute","mg/min","MG/MIN","mass",0.000016666666666666667,[0,-1,1,0,0,0,0],"mg/min",null,false,"M",null,1,false,false,0,"mg per min; milligrams per minutes; milligram/minute","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"milligram per milliliter","mg/mL","MG/ML","mass",1000.0000000000001,[-3,0,1,0,0,0,0],"mg/mL",null,false,"M",null,1,false,false,0,"mg per mL; milligrams per milliliters; millilitre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"milligram per millimole","mg/mmol","MG/MMOL","mass",1.660540186674939e-24,[0,0,1,0,0,0,0],"mg/mmol",null,false,"M",null,1,false,false,-1,"mg per mmol; milligrams per millimole; ","LOINC","Ratio","Clinical","",null,null,null,null,false],[true,"milligram per week","mg/wk","MG/WK","mass",1.6534391534391535e-9,[0,-1,1,0,0,0,0],"mg/wk",null,false,"M",null,1,false,false,0,"mg/week; mg per wk; milligrams per weeks; milligram/week","LOINC","Mrat","Clinical","",null,null,null,null,false],[false,"milliliter","mL","ML","volume",0.000001,[3,0,0,0,0,0,0],"mL","iso1000",true,null,null,1,false,false,0,"milliliters; millilitres","LOINC","Vol","Clinical","","l",null,"1",1,false],[false,"milliliter per 10 hour","mL/(10.h)","ML/HR","volume",2.7777777777777777e-11,[3,-1,0,0,0,0,0],"mL/h","iso1000",true,null,null,1,false,false,0,"ml/10hrs; ml/10 hrs; mL per 10hrs; 10 hrs; milliliters per 10 hours; millilitres","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per 12 hour","mL/(12.h)","ML/HR","volume",2.3148148148148147e-11,[3,-1,0,0,0,0,0],"mL/h","iso1000",true,null,null,1,false,false,0,"ml/12hrs; ml/12 hrs; mL per 12hrs; 12 hrs; milliliters per 12 hours; millilitres","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per 2 hour","mL/(2.h)","ML/HR","volume",1.3888888888888888e-10,[3,-1,0,0,0,0,0],"mL/h","iso1000",true,null,null,1,false,false,0,"ml/2hrs; ml/2 hrs; mL per 2hrs; 2 hrs; milliliters per 2 hours; millilitres ","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per 24 hour","mL/(24.h)","ML/HR","volume",1.1574074074074074e-11,[3,-1,0,0,0,0,0],"mL/h","iso1000",true,null,null,1,false,false,0,"ml/24hrs; ml/24 hrs; mL per 24hrs; 24 hrs; milliliters per 24 hours; millilitres; ml/dy; /day; ml per dy; days; fluid outputs; fluid inputs; flow rate","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per 4 hour","mL/(4.h)","ML/HR","volume",6.944444444444444e-11,[3,-1,0,0,0,0,0],"mL/h","iso1000",true,null,null,1,false,false,0,"ml/4hrs; ml/4 hrs; mL per 4hrs; 4 hrs; milliliters per 4 hours; millilitres","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per 5 hour","mL/(5.h)","ML/HR","volume",5.5555555555555553e-11,[3,-1,0,0,0,0,0],"mL/h","iso1000",true,null,null,1,false,false,0,"ml/5hrs; ml/5 hrs; mL per 5hrs; 5 hrs; milliliters per 5 hours; millilitres","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per 6 hour","mL/(6.h)","ML/HR","volume",4.6296296296296294e-11,[3,-1,0,0,0,0,0],"mL/h","iso1000",true,null,null,1,false,false,0,"ml/6hrs; ml/6 hrs; mL per 6hrs; 6 hrs; milliliters per 6 hours; millilitres","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per 72 hour","mL/(72.h)","ML/HR","volume",3.8580246913580245e-12,[3,-1,0,0,0,0,0],"mL/h","iso1000",true,null,null,1,false,false,0,"ml/72hrs; ml/72 hrs; mL per 72hrs; 72 hrs; milliliters per 72 hours; millilitres","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per 8 hour","mL/(8.h)","ML/HR","volume",3.472222222222222e-11,[3,-1,0,0,0,0,0],"mL/h","iso1000",true,null,null,1,false,false,0,"ml/8hrs; ml/8 hrs; mL per 8hrs; 8 hrs; milliliters per 8 hours; millilitres; shift","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per 8 hour per kilogram","mL/(8.h)/kg","(ML/HR)/KG","volume",3.472222222222222e-14,[3,-1,-1,0,0,0,0],"(mL/h)/kg","iso1000",true,null,null,1,false,false,0,"mL/kg/(8.h); ml/8h/kg; ml/8 h/kg; ml/8hr/kg; ml/8 hr/kgr; mL per 8h per kg; 8 h; 8hr; 8 hr; milliliters per 8 hours per kilogram; millilitres; shift","LOINC","VRatCnt","Clinical","unit used to measure renal excretion volume rate per body mass","l",null,"1",1,false],[false,"milliliter per square inch (international)","mL/[sin_i]","ML/[SIN_I]","volume",0.0015500031000061998,[1,0,0,0,0,0,0],"mL","iso1000",true,null,null,1,false,false,0,"mL/sin; mL/in2; mL/in^2; mL per sin; in2; in^2; sq. in; milliliters per square inch; inch squared","LOINC","ArVol","Clinical","","l",null,"1",1,false],[false,"milliliter per centimeter of water","mL/cm[H2O]","ML/CM[H2O]","volume",1.0197162129779282e-11,[4,2,-1,0,0,0,0],"mL/(cm HO2)","iso1000",true,null,null,1,false,false,0,"milliliters per centimeter of water; millilitre per centimetre of water; millilitres per centimetre of water; mL/cmH2O; mL/cm H2O; mL per cmH2O; mL per cm H2O","LOINC","Compli","Clinical","unit used to measure dynamic lung compliance","l",null,"1",1,false],[false,"milliliter per day","mL/d","ML/D","volume",1.1574074074074074e-11,[3,-1,0,0,0,0,0],"mL/d","iso1000",true,null,null,1,false,false,0,"ml/day; ml per day; milliliters per day; 24 hours; 24hrs; millilitre;","LOINC","VRat","Clinical","usually used to measure fluid output or input; flow rate","l",null,"1",1,false],[false,"milliliter per deciliter","mL/dL","ML/DL","volume",0.009999999999999998,[0,0,0,0,0,0,0],"mL/dL","iso1000",true,null,null,1,false,false,0,"mL per dL; millilitres; decilitre; milliliters","LOINC","VFr; VFrDiff","Clinical","","l",null,"1",1,false],[false,"milliliter per hour","mL/h","ML/HR","volume",2.7777777777777777e-10,[3,-1,0,0,0,0,0],"mL/h","iso1000",true,null,null,1,false,false,0,"mL/hr; mL per hr; milliliters per hour; millilitres; fluid intake; fluid output","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per kilogram","mL/kg","ML/KG","volume",9.999999999999999e-10,[3,0,-1,0,0,0,0],"mL/kg","iso1000",true,null,null,1,false,false,0,"mL per kg; milliliters per kilogram; millilitres","LOINC","VCnt","Clinical","","l",null,"1",1,false],[false,"milliliter per kilogram per 8 hour","mL/kg/(8.h)","(ML/KG)/HR","volume",3.472222222222222e-14,[3,-1,-1,0,0,0,0],"(mL/kg)/h","iso1000",true,null,null,1,false,false,0,"mL/(8.h.kg); mL/kg/8hrs; mL/kg/8 hrs; mL per kg per 8hrs; 8 hrs; milliliters per kilograms per 8 hours; millilitres; shift","LOINC","VCntRat; RelEngRat","Clinical","unit used to measure renal excretion volume rate per body mass","l",null,"1",1,false],[false,"milliliter per kilogram per day","mL/kg/d","(ML/KG)/D","volume",1.1574074074074072e-14,[3,-1,-1,0,0,0,0],"(mL/kg)/d","iso1000",true,null,null,1,false,false,0,"mL/(kg.d); mL/kg/dy; mL per kg per day; milliliters per kilograms per day; mg/kg/24hrs; 24 hrs; per 24 hours millilitres","LOINC","VCntRat; RelEngRat","Clinical","unit used to measure renal excretion volume rate per body mass","l",null,"1",1,false],[false,"milliliter per kilogram per hour","mL/kg/h","(ML/KG)/HR","volume",2.7777777777777774e-13,[3,-1,-1,0,0,0,0],"(mL/kg)/h","iso1000",true,null,null,1,false,false,0,"mL/(kg.h); mL/kg/hr; mL per kg per hr; milliliters per kilograms per hour; millilitres","LOINC","VCntRat; RelEngRat","Clinical","unit used to measure renal excretion volume rate per body mass","l",null,"1",1,false],[false,"milliliter per kilogram per minute","mL/kg/min","(ML/KG)/MIN","volume",1.6666666666666664e-11,[3,-1,-1,0,0,0,0],"(mL/kg)/min","iso1000",true,null,null,1,false,false,0,"mL/(kg.min); mL/kg/dy; mL per kg per day; milliliters per kilograms per day; millilitres","LOINC","RelEngRat","Clinical","used for tests that measure activity metabolic rate compared to standard resting metabolic rate ","l",null,"1",1,false],[false,"milliliter per square meter","mL/m2","ML/M2","volume",0.000001,[1,0,0,0,0,0,0],"mL/(m2)","iso1000",true,null,null,1,false,false,0,"mL/m^2; mL/sq. meter; mL per m2; m^2; sq. meter; milliliters per square meter; millilitres; meter squared","LOINC","ArVol","Clinical","used for tests that relate to heart work - e.g. ventricular stroke volume; atrial volume per body surface area","l",null,"1",1,false],[false,"milliliter per millibar","mL/mbar","ML/MBAR","volume",1e-11,[4,2,-1,0,0,0,0],"mL/mbar","iso1000",true,null,null,1,false,false,0,"mL per mbar; milliliters per millibar; millilitres","LOINC","","Clinical","unit used to measure dynamic lung compliance","l",null,"1",1,false],[false,"milliliter per minute","mL/min","ML/MIN","volume",1.6666666666666667e-8,[3,-1,0,0,0,0,0],"mL/min","iso1000",true,null,null,1,false,false,0,"mL per min; milliliters; millilitres","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"milliliter per minute per square meter","mL/min/m2","(ML/MIN)/M2","volume",1.6666666666666667e-8,[1,-1,0,0,0,0,0],"(mL/min)/(m2)","iso1000",true,null,null,1,false,false,0,"ml/min/m^2; ml/min/sq. meter; mL per min per m2; m^2; sq. meter; milliliters per minutes per square meter; millilitres; metre; meter squared","LOINC","ArVRat","Clinical","unit used to measure volume per body surface area; oxygen consumption index","l",null,"1",1,false],[false,"milliliter per millimeter","mL/mm","ML/MM","volume",0.001,[2,0,0,0,0,0,0],"mL/mm","iso1000",true,null,null,1,false,false,0,"mL per mm; milliliters per millimeter; millilitres; millimetre","LOINC","Lineic Volume","Clinical","","l",null,"1",1,false],[false,"milliliter per second","mL/s","ML/S","volume",0.000001,[3,-1,0,0,0,0,0],"mL/s","iso1000",true,null,null,1,false,false,0,"ml/sec; mL per sec; milliliters per second; millilitres","LOINC","Vel; VelRat; VRat","Clinical","","l",null,"1",1,false],[true,"millimeter","mm","MM","length",0.001,[1,0,0,0,0,0,0],"mm",null,false,"L",null,1,false,false,0,"millimeters; millimetres; height; length; diameter; thickness; axis; curvature; size","LOINC","Len","Clinical","",null,null,null,null,false],[true,"millimeter per hour","mm/h","MM/HR","length",2.7777777777777776e-7,[1,-1,0,0,0,0,0],"mm/h",null,false,"L",null,1,false,false,0,"mm/hr; mm per hr; millimeters per hour; millimetres","LOINC","Vel","Clinical","unit to measure sedimentation rate",null,null,null,null,false],[true,"millimeter per minute","mm/min","MM/MIN","length",0.000016666666666666667,[1,-1,0,0,0,0,0],"mm/min",null,false,"L",null,1,false,false,0,"mm per min; millimeters per minute; millimetres","LOINC","Vel","Clinical","",null,null,null,null,false],[false,"millimeter of water","mm[H2O]","MM[H2O]","pressure",9806.65,[-1,-2,1,0,0,0,0],"mm HO2","clinical",true,null,null,1,false,false,0,"mmH2O; mm H2O; millimeters of water; millimetres","LOINC","Pres","Clinical","","kPa","KPAL","980665e-5",9.80665,false],[false,"millimeter of mercury","mm[Hg]","MM[HG]","pressure",133322,[-1,-2,1,0,0,0,0],"mm Hg","clinical",true,null,null,1,false,false,0,"mmHg; mm Hg; millimeters of mercury; millimetres","LOINC","Pres; PPres; Ratio","Clinical","1 mm[Hg] = 1 torr; unit to measure blood pressure","kPa","KPAL","133.3220",133.322,false],[true,"square millimeter","mm2","MM2","length",0.000001,[2,0,0,0,0,0,0],"mm2",null,false,"L",null,1,false,false,0,"mm^2; sq. mm.; sq. millimeters; millimeters squared; millimetres","LOINC","Area","Clinical","",null,null,null,null,false],[false,"millimole","mmol","MMOL","amount of substance",602213670000000000000,[0,0,0,0,0,0,0],"mmol","si",true,null,null,1,false,false,1,"millimoles","LOINC","Sub","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per 12 hour","mmol/(12.h)","MMOL/HR","amount of substance",13940131250000000,[0,-1,0,0,0,0,0],"mmol/h","si",true,null,null,1,false,false,1,"mmol/12hrs; mmol/12 hrs; mmol per 12 hrs; 12hrs; millimoles per 12 hours","LOINC","SRat","Clinical","unit for tests related to urine","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per 2 hour","mmol/(2.h)","MMOL/HR","amount of substance",83640787500000000,[0,-1,0,0,0,0,0],"mmol/h","si",true,null,null,1,false,false,1,"mmol/2hrs; mmol/2 hrs; mmol per 2 hrs; 2hrs; millimoles per 2 hours","LOINC","SRat","Clinical","unit for tests related to urine","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per 24 hour","mmol/(24.h)","MMOL/HR","amount of substance",6970065625000000,[0,-1,0,0,0,0,0],"mmol/h","si",true,null,null,1,false,false,1,"mmol/24hrs; mmol/24 hrs; mmol per 24 hrs; 24hrs; millimoles per 24 hours","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per 5 hour","mmol/(5.h)","MMOL/HR","amount of substance",33456315000000000,[0,-1,0,0,0,0,0],"mmol/h","si",true,null,null,1,false,false,1,"mmol/5hrs; mmol/5 hrs; mmol per 5 hrs; 5hrs; millimoles per 5 hours","LOINC","SRat","Clinical","unit for tests related to doses","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per 6 hour","mmol/(6.h)","MMOL/HR","amount of substance",27880262500000000,[0,-1,0,0,0,0,0],"mmol/h","si",true,null,null,1,false,false,1,"mmol/6hrs; mmol/6 hrs; mmol per 6 hrs; 6hrs; millimoles per 6 hours","LOINC","SRat","Clinical","unit for tests related to urine","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per 8 hour","mmol/(8.h)","MMOL/HR","amount of substance",20910196875000000,[0,-1,0,0,0,0,0],"mmol/h","si",true,null,null,1,false,false,1,"mmol/8hrs; mmol/8 hrs; mmol per 8 hrs; 8hrs; millimoles per 8 hours; shift","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per day","mmol/d","MMOL/D","amount of substance",6970065625000000,[0,-1,0,0,0,0,0],"mmol/d","si",true,null,null,1,false,false,1,"mmol/24hrs; mmol/24 hrs; mmol per 24 hrs; 24hrs; millimoles per 24 hours","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per deciliter","mmol/dL","MMOL/DL","amount of substance",6.022136699999999e+24,[-3,0,0,0,0,0,0],"mmol/dL","si",true,null,null,1,false,false,1,"mmol per dL; millimoles; decilitre","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per gram","mmol/g","MMOL/G","amount of substance",602213670000000000000,[0,0,-1,0,0,0,0],"mmol/g","si",true,null,null,1,false,false,1,"mmol per gram; millimoles","LOINC","SCnt","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per hour","mmol/h","MMOL/HR","amount of substance",167281575000000000,[0,-1,0,0,0,0,0],"mmol/h","si",true,null,null,1,false,false,1,"mmol/hr; mmol per hr; millimoles per hour","LOINC","SRat","Clinical","unit for tests related to urine","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per kilogram","mmol/kg","MMOL/KG","amount of substance",602213670000000000,[0,0,-1,0,0,0,0],"mmol/kg","si",true,null,null,1,false,false,1,"mmol per kg; millimoles per kilogram","LOINC","SCnt","Clinical","unit for tests related to stool","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per kilogram per 8 hour","mmol/kg/(8.h)","(MMOL/KG)/HR","amount of substance",20910196875000,[0,-1,-1,0,0,0,0],"(mmol/kg)/h","si",true,null,null,1,false,false,1,"mmol/(8.h.kg); mmol/kg/8hrs; mmol/kg/8 hrs; mmol per kg per 8hrs; 8 hrs; millimoles per kilograms per 8 hours; shift","LOINC","CCnt","Clinical","unit used to measure molar dose rate per patient body mass","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per kilogram per day","mmol/kg/d","(MMOL/KG)/D","amount of substance",6970065625000,[0,-1,-1,0,0,0,0],"(mmol/kg)/d","si",true,null,null,1,false,false,1,"mmol/kg/dy; mmol/kg/day; mmol per kg per dy; millimoles per kilograms per day","LOINC","RelSRat","Clinical","unit used to measure molar dose rate per patient body mass","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per kilogram per hour","mmol/kg/h","(MMOL/KG)/HR","amount of substance",167281575000000,[0,-1,-1,0,0,0,0],"(mmol/kg)/h","si",true,null,null,1,false,false,1,"mmol/kg/hr; mmol per kg per hr; millimoles per kilograms per hour","LOINC","CCnt","Clinical","unit used to measure molar dose rate per patient body mass","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per kilogram per minute","mmol/kg/min","(MMOL/KG)/MIN","amount of substance",10036894500000000,[0,-1,-1,0,0,0,0],"(mmol/kg)/min","si",true,null,null,1,false,false,1,"mmol/(kg.min); mmol/kg/min; mmol per kg per min; millimoles per kilograms per minute","LOINC","CCnt","Clinical","unit used to measure molar dose rate per patient body mass; note that the unit for the enzyme unit U = umol/min. mmol/kg/min = kU/kg; ","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per liter","mmol/L","MMOL/L","amount of substance",6.0221367e+23,[-3,0,0,0,0,0,0],"mmol/L","si",true,null,null,1,false,false,1,"mmol per L; millimoles per liter; litre","LOINC","SCnc","Clinical","unit for tests related to doses","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per square meter","mmol/m2","MMOL/M2","amount of substance",602213670000000000000,[-2,0,0,0,0,0,0],"mmol/(m2)","si",true,null,null,1,false,false,1,"mmol/m^2; mmol/sq. meter; mmol per m2; m^2; sq. meter; millimoles; meter squared; metre","LOINC","ArSub","Clinical","unit used to measure molar dose per patient body surface area","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per minute","mmol/min","MMOL/MIN","amount of substance",10036894500000000000,[0,-1,0,0,0,0,0],"mmol/min","si",true,null,null,1,false,false,1,"mmol per min; millimoles per minute","LOINC","Srat; CAct","Clinical","unit for the enzyme unit U = umol/min. mmol/min = kU","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per millimole","mmol/mmol","MMOL/MMOL","amount of substance",1,[0,0,0,0,0,0,0],"mmol/mmol","si",true,null,null,1,false,false,0,"mmol per mmol; millimoles per millimole","LOINC","SRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per mole","mmol/mol","MMOL/MOL","amount of substance",0.001,[0,0,0,0,0,0,0],"mmol/mol","si",true,null,null,1,false,false,0,"mmol per mol; millimoles per mole","LOINC","SRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"millimole per second per liter","mmol/s/L","(MMOL/S)/L","amount of substance",6.0221367e+23,[-3,-1,0,0,0,0,0],"(mmol/s)/L","si",true,null,null,1,false,false,1,"mmol/sec/L; mmol per s per L; per sec; millimoles per seconds per liter; litre","LOINC","CCnc ","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"mole per kilogram","mol/kg","MOL/KG","amount of substance",602213670000000000000,[0,0,-1,0,0,0,0],"mol/kg","si",true,null,null,1,false,false,1,"mol per kg; moles; mols","LOINC","SCnt","Clinical","unit for tests related to stool","10*23","10*23","6.0221367",6.0221367,false],[false,"mole per kilogram per second","mol/kg/s","(MOL/KG)/S","amount of substance",602213670000000000000,[0,-1,-1,0,0,0,0],"(mol/kg)/s","si",true,null,null,1,false,false,1,"mol/kg/sec; mol per kg per sec; moles per kilograms per second; mols","LOINC","CCnt","Clinical","unit of catalytic activity (mol/s) per mass (kg)","10*23","10*23","6.0221367",6.0221367,false],[false,"mole per liter","mol/L","MOL/L","amount of substance",6.0221366999999994e+26,[-3,0,0,0,0,0,0],"mol/L","si",true,null,null,1,false,false,1,"mol per L; moles per liter; litre; moles; mols","LOINC","SCnc","Clinical","unit often used in tests measuring oxygen content","10*23","10*23","6.0221367",6.0221367,false],[false,"mole per cubic meter","mol/m3","MOL/M3","amount of substance",6.0221367e+23,[-3,0,0,0,0,0,0],"mol/(m3)","si",true,null,null,1,false,false,1,"mol/m^3; mol/cu. m; mol per m3; m^3; cu. meter; mols; moles; meters cubed; metre; mole per kiloliter; kilolitre; mol/kL","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"mole per milliliter","mol/mL","MOL/ML","amount of substance",6.0221367e+29,[-3,0,0,0,0,0,0],"mol/mL","si",true,null,null,1,false,false,1,"mol per mL; moles; millilitre; mols","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"mole per mole","mol/mol","MOL/MOL","amount of substance",1,[0,0,0,0,0,0,0],"mol/mol","si",true,null,null,1,false,false,0,"mol per mol; moles per mol; mols","LOINC","SRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"mole per second","mol/s","MOL/S","amount of substance",6.0221367e+23,[0,-1,0,0,0,0,0],"mol/s","si",true,null,null,1,false,false,1,"mol per sec; moles per second; mols","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"milliosmole","mosm","MOSM","amount of substance (dissolved particles)",602213670000000000000,[0,0,0,0,0,0,0],"mosm","chemical",true,null,null,1,false,false,1,"milliosmoles","LOINC","Osmol","Clinical","equal to 1/1000 of an osmole","mol","MOL","1",1,false],[false,"milliosmole per kilogram","mosm/kg","MOSM/KG","amount of substance (dissolved particles)",602213670000000000,[0,0,-1,0,0,0,0],"mosm/kg","chemical",true,null,null,1,false,false,1,"mosm per kg; milliosmoles per kilogram","LOINC","Osmol","Clinical","","mol","MOL","1",1,false],[false,"milliosmole per liter","mosm/L","MOSM/L","amount of substance (dissolved particles)",6.0221367e+23,[-3,0,0,0,0,0,0],"mosm/L","chemical",true,null,null,1,false,false,1,"mosm per liter; litre; milliosmoles","LOINC","Osmol","Clinical","","mol","MOL","1",1,false],[false,"millipascal","mPa","MPAL","pressure",1,[-1,-2,1,0,0,0,0],"mPa","si",true,null,null,1,false,false,0,"millipascals","LOINC","Pres","Clinical","unit of pressure","N/m2","N/M2","1",1,false],[false,"millipascal second","mPa.s","MPAL.S","pressure",1,[-1,-1,1,0,0,0,0],"mPa.s","si",true,null,null,1,false,false,0,"mPa*s; millipoise; mP; dynamic viscosity","LOINC","Visc","Clinical","base units for millipoise, a measurement of dynamic viscosity","N/m2","N/M2","1",1,false],[true,"megasecond","Ms","MAS","time",1000000,[0,1,0,0,0,0,0],"Ms",null,false,"T",null,1,false,false,0,"megaseconds","LOINC","Time","Clinical","",null,null,null,null,false],[true,"millisecond","ms","MS","time",0.001,[0,1,0,0,0,0,0],"ms",null,false,"T",null,1,false,false,0,"milliseconds; duration","LOINC","Time","Clinical","",null,null,null,null,false],[false,"milli enzyme unit per gram","mU/g","MU/G","catalytic activity",10036894500000,[0,-1,-1,0,0,0,0],"mU/g","chemical",true,null,null,1,false,false,1,"mU per gm; milli enzyme units per gram; enzyme activity; enzymatic activity per mass","LOINC","CCnt","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 mU = 1 nmol/min","umol/min","UMOL/MIN","1",1,false],[false,"milli enzyme unit per liter","mU/L","MU/L","catalytic activity",10036894500000000,[-3,-1,0,0,0,0,0],"mU/L","chemical",true,null,null,1,false,false,1,"mU per liter; litre; milli enzyme units enzymatic activity per volume; enzyme activity","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 mU = 1 nmol/min","umol/min","UMOL/MIN","1",1,false],[false,"milli enzyme unit per milligram","mU/mg","MU/MG","catalytic activity",10036894500000000,[0,-1,-1,0,0,0,0],"mU/mg","chemical",true,null,null,1,false,false,1,"mU per mg; milli enzyme units per milligram","LOINC","CCnt","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 mU = 1 nmol/min","umol/min","UMOL/MIN","1",1,false],[false,"milli enzyme unit per milliliter","mU/mL","MU/ML","catalytic activity",10036894500000000000,[-3,-1,0,0,0,0,0],"mU/mL","chemical",true,null,null,1,false,false,1,"mU per mL; milli enzyme units per milliliter; millilitre; enzymatic activity per volume; enzyme activity","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 mU = 1 nmol/min","umol/min","UMOL/MIN","1",1,false],[false,"milli enzyme unit per milliliter per minute","mU/mL/min","(MU/ML)/MIN","catalytic activity",167281575000000000,[-3,-2,0,0,0,0,0],"(mU/mL)/min","chemical",true,null,null,1,false,false,1,"mU per mL per min; mU per milliliters per minute; millilitres; milli enzyme units; enzymatic activity; enzyme activity","LOINC","CCncRat","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 mU = 1 nmol/min","umol/min","UMOL/MIN","1",1,false],[false,"millivolt","mV","MV","electric potential",1,[2,-2,1,0,0,-1,0],"mV","si",true,null,null,1,false,false,0,"millivolts","LOINC","Elpot","Clinical","unit of electric potential (voltage)","J/C","J/C","1",1,false],[false,"Newton centimeter","N.cm","N.CM","force",10,[2,-2,1,0,0,0,0],"N.cm","si",true,null,null,1,false,false,0,"N*cm; Ncm; N cm; Newton*centimeters; Newton* centimetres; torque; work","LOINC","","Clinical","as a measurement of work, N.cm = 1/100 Joules;\nnote that N.m is the standard unit of measurement for torque (although dimensionally equivalent to Joule), and N.cm can also be thought of as a torqe unit","kg.m/s2","KG.M/S2","1",1,false],[false,"Newton second","N.s","N.S","force",1000,[1,-1,1,0,0,0,0],"N.s","si",true,null,null,1,false,false,0,"Newton*seconds; N*s; N s; Ns; impulse; imp","LOINC","","Clinical","standard unit of impulse","kg.m/s2","KG.M/S2","1",1,false],[true,"nanogram","ng","NG","mass",1e-9,[0,0,1,0,0,0,0],"ng",null,false,"M",null,1,false,false,0,"nanograms","LOINC","Mass","Clinical","",null,null,null,null,false],[true,"nanogram per 24 hour","ng/(24.h)","NG/HR","mass",1.1574074074074075e-14,[0,-1,1,0,0,0,0],"ng/h",null,false,"M",null,1,false,false,0,"ng/24hrs; ng/24 hrs; nanograms per 24 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"nanogram per 8 hour","ng/(8.h)","NG/HR","mass",3.4722222222222224e-14,[0,-1,1,0,0,0,0],"ng/h",null,false,"M",null,1,false,false,0,"ng/8hrs; ng/8 hrs; nanograms per 8 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"nanogram per million","ng/10*6","NG/(10*6)","mass",1e-15,[0,0,1,0,0,0,0],"ng/(106)",null,false,"M",null,1,false,false,0,"ng/10^6; ng per 10*6; 10^6; nanograms","LOINC","MNum","Clinical","",null,null,null,null,false],[true,"nanogram per day","ng/d","NG/D","mass",1.1574074074074075e-14,[0,-1,1,0,0,0,0],"ng/d",null,false,"M",null,1,false,false,0,"ng/dy; ng per day; nanograms ","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"nanogram per deciliter","ng/dL","NG/DL","mass",0.00001,[-3,0,1,0,0,0,0],"ng/dL",null,false,"M",null,1,false,false,0,"ng per dL; nanograms per deciliter; decilitre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"nanogram per gram","ng/g","NG/G","mass",1e-9,[0,0,0,0,0,0,0],"ng/g",null,false,"M",null,1,false,false,0,"ng/gm; ng per gm; nanograms per gram","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"nanogram per hour","ng/h","NG/HR","mass",2.777777777777778e-13,[0,-1,1,0,0,0,0],"ng/h",null,false,"M",null,1,false,false,0,"ng/hr; ng per hr; nanograms per hour","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"nanogram per kilogram","ng/kg","NG/KG","mass",1e-12,[0,0,0,0,0,0,0],"ng/kg",null,false,"M",null,1,false,false,0,"ng per kg; nanograms per kilogram","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"nanogram per kilogram per 8 hour","ng/kg/(8.h)","(NG/KG)/HR","mass",3.472222222222222e-17,[0,-1,0,0,0,0,0],"(ng/kg)/h",null,false,"M",null,1,false,false,0,"ng/(8.h.kg); ng/kg/8hrs; ng/kg/8 hrs; ng per kg per 8hrs; 8 hrs; nanograms per kilograms per 8 hours; shift","LOINC","MRtoRat ","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"nanogram per kilogram per hour","ng/kg/h","(NG/KG)/HR","mass",2.7777777777777775e-16,[0,-1,0,0,0,0,0],"(ng/kg)/h",null,false,"M",null,1,false,false,0,"ng/(kg.h); ng/kg/hr; ng per kg per hr; nanograms per kilograms per hour","LOINC","MRtoRat ","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"nanogram per kilogram per minute","ng/kg/min","(NG/KG)/MIN","mass",1.6666666666666667e-14,[0,-1,0,0,0,0,0],"(ng/kg)/min",null,false,"M",null,1,false,false,0,"ng/(kg.min); ng per kg per min; nanograms per kilograms per minute","LOINC","MRtoRat ","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"nanogram per liter","ng/L","NG/L","mass",0.000001,[-3,0,1,0,0,0,0],"ng/L",null,false,"M",null,1,false,false,0,"ng per L; nanograms per liter; litre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"nanogram per square meter","ng/m2","NG/M2","mass",1e-9,[-2,0,1,0,0,0,0],"ng/(m2)",null,false,"M",null,1,false,false,0,"ng/m^2; ng/sq. m; ng per m2; m^2; sq. meter; nanograms; meter squared; metre","LOINC","ArMass","Clinical","unit used to measure mass dose per patient body surface area",null,null,null,null,false],[true,"nanogram per milligram","ng/mg","NG/MG","mass",0.000001,[0,0,0,0,0,0,0],"ng/mg",null,false,"M",null,1,false,false,0,"ng per mg; nanograms","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"nanogram per milligram per hour","ng/mg/h","(NG/MG)/HR","mass",2.7777777777777777e-10,[0,-1,0,0,0,0,0],"(ng/mg)/h",null,false,"M",null,1,false,false,0,"ng/mg/hr; ng per mg per hr; nanograms per milligrams per hour","LOINC","MRtoRat ","Clinical","",null,null,null,null,false],[true,"nanogram per minute","ng/min","NG/MIN","mass",1.6666666666666667e-11,[0,-1,1,0,0,0,0],"ng/min",null,false,"M",null,1,false,false,0,"ng per min; nanograms","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"nanogram per millliiter","ng/mL","NG/ML","mass",0.001,[-3,0,1,0,0,0,0],"ng/mL",null,false,"M",null,1,false,false,0,"ng per mL; nanograms; millilitre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"nanogram per milliliter per hour","ng/mL/h","(NG/ML)/HR","mass",2.7777777777777776e-7,[-3,-1,1,0,0,0,0],"(ng/mL)/h",null,false,"M",null,1,false,false,0,"ng/mL/hr; ng per mL per mL; nanograms per milliliter per hour; nanogram per millilitre per hour; nanograms per millilitre per hour; enzymatic activity per volume; enzyme activity per milliliters","LOINC","CCnc","Clinical","tests that measure enzymatic activity",null,null,null,null,false],[true,"nanogram per second","ng/s","NG/S","mass",1e-9,[0,-1,1,0,0,0,0],"ng/s",null,false,"M",null,1,false,false,0,"ng/sec; ng per sec; nanograms per second","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"nanogram per enzyme unit","ng/U","NG/U","mass",9.963241120049634e-26,[0,1,1,0,0,0,0],"ng/U",null,false,"M",null,1,false,false,-1,"ng per U; nanograms per enzyme unit","LOINC","CMass","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)",null,null,null,null,false],[false,"nanokatal","nkat","NKAT","catalytic activity",602213670000000,[0,-1,0,0,0,0,0],"nkat","chemical",true,null,null,1,false,false,1,"nanokatals","LOINC","CAct","Clinical","kat is a unit of catalytic activity with base units = mol/s. Rarely used because its units are too large to practically express catalytic activity. See enzyme unit [U] which is the standard unit for catalytic activity.","mol/s","MOL/S","1",1,false],[false,"nanoliter","nL","NL","volume",1.0000000000000002e-12,[3,0,0,0,0,0,0],"nL","iso1000",true,null,null,1,false,false,0,"nanoliters; nanolitres","LOINC","Vol","Clinical","","l",null,"1",1,false],[true,"nanometer","nm","NM","length",1e-9,[1,0,0,0,0,0,0],"nm",null,false,"L",null,1,false,false,0,"nanometers; nanometres","LOINC","Len","Clinical","",null,null,null,null,false],[true,"nanometer per second per liter","nm/s/L","(NM/S)/L","length",0.000001,[-2,-1,0,0,0,0,0],"(nm/s)/L",null,false,"L",null,1,false,false,0,"nm/sec/liter; nm/sec/litre; nm per s per l; nm per sec per l; nanometers per second per liter; nanometre per second per litre; nanometres per second per litre","LOINC","VelCnc","Clinical","",null,null,null,null,false],[false,"nanomole","nmol","NMOL","amount of substance",602213670000000,[0,0,0,0,0,0,0],"nmol","si",true,null,null,1,false,false,1,"nanomoles","LOINC","Sub","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per 24 hour","nmol/(24.h)","NMOL/HR","amount of substance",6970065625,[0,-1,0,0,0,0,0],"nmol/h","si",true,null,null,1,false,false,1,"nmol/24hr; nmol/24 hr; nanomoles per 24 hours; nmol/day; nanomoles per day; nmol per day; nanomole/day; nanomol/day","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per day","nmol/d","NMOL/D","amount of substance",6970065625,[0,-1,0,0,0,0,0],"nmol/d","si",true,null,null,1,false,false,1,"nmol/day; nanomoles per day; nmol per day; nanomole/day; nanomol/day; nmol/24hr; nmol/24 hr; nanomoles per 24 hours; ","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per deciliter","nmol/dL","NMOL/DL","amount of substance",6022136700000000000,[-3,0,0,0,0,0,0],"nmol/dL","si",true,null,null,1,false,false,1,"nmol per dL; nanomoles per deciliter; nanomole per decilitre; nanomoles per decilitre; nanomole/deciliter; nanomole/decilitre; nanomol/deciliter; nanomol/decilitre","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per gram","nmol/g","NMOL/G","amount of substance",602213670000000,[0,0,-1,0,0,0,0],"nmol/g","si",true,null,null,1,false,false,1,"nmol per gram; nanomoles per gram; nanomole/gram","LOINC","SCnt","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per hour per liter","nmol/h/L","(NMOL/HR)/L","amount of substance",167281575000000,[-3,-1,0,0,0,0,0],"(nmol/h)/L","si",true,null,null,1,false,false,1,"nmol/hrs/L; nmol per hrs per L; nanomoles per hours per liter; litre; enzymatic activity per volume; enzyme activities","LOINC","CCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per liter","nmol/L","NMOL/L","amount of substance",602213670000000000,[-3,0,0,0,0,0,0],"nmol/L","si",true,null,null,1,false,false,1,"nmol per L; nanomoles per liter; litre","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per milligram","nmol/mg","NMOL/MG","amount of substance",602213670000000000,[0,0,-1,0,0,0,0],"nmol/mg","si",true,null,null,1,false,false,1,"nmol per mg; nanomoles per milligram","LOINC","SCnt","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per milligram per hour","nmol/mg/h","(NMOL/MG)/HR","amount of substance",167281575000000,[0,-1,-1,0,0,0,0],"(nmol/mg)/h","si",true,null,null,1,false,false,1,"nmol/mg/hr; nmol per mg per hr; nanomoles per milligrams per hour","LOINC","SCntRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per milligram of protein","nmol/mg{prot}","NMOL/MG","amount of substance",602213670000000000,[0,0,-1,0,0,0,0],"nmol/mg","si",true,null,null,1,false,false,1,"nanomoles; nmol/mg prot; nmol per mg prot","LOINC","Ratio; CCnt","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per minute","nmol/min","NMOL/MIN","amount of substance",10036894500000,[0,-1,0,0,0,0,0],"nmol/min","si",true,null,null,1,false,false,1,"nmol per min; nanomoles per minute; milli enzyme units; enzyme activity per volume; enzymatic activity","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min. nmol/min = mU (milli enzyme unit)","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per minute per milliliter","nmol/min/mL","(NMOL/MIN)/ML","amount of substance",10036894500000000000,[-3,-1,0,0,0,0,0],"(nmol/min)/mL","si",true,null,null,1,false,false,1,"nmol per min per mL; nanomoles per minutes per milliliter; millilitre; milli enzyme units per volume; enzyme activity; enzymatic activity","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min. nmol/mL/min = mU/mL","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per milliliter","nmol/mL","NMOL/ML","amount of substance",602213670000000000000,[-3,0,0,0,0,0,0],"nmol/mL","si",true,null,null,1,false,false,1,"nmol per mL; nanomoles per milliliter; millilitre","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per milliliter per hour","nmol/mL/h","(NMOL/ML)/HR","amount of substance",167281575000000000,[-3,-1,0,0,0,0,0],"(nmol/mL)/h","si",true,null,null,1,false,false,1,"nmol/mL/hr; nmol per mL per hr; nanomoles per milliliters per hour; millilitres; milli enzyme units per volume; enzyme activity; enzymatic activity","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min.","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per milliliter per minute","nmol/mL/min","(NMOL/ML)/MIN","amount of substance",10036894500000000000,[-3,-1,0,0,0,0,0],"(nmol/mL)/min","si",true,null,null,1,false,false,1,"nmol per mL per min; nanomoles per milliliters per min; millilitres; milli enzyme units per volume; enzyme activity; enzymatic activity","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min. nmol/mL/min = mU/mL","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per millimole","nmol/mmol","NMOL/MMOL","amount of substance",0.000001,[0,0,0,0,0,0,0],"nmol/mmol","si",true,null,null,1,false,false,0,"nmol per mmol; nanomoles per millimole","LOINC","SRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per millimole of creatinine","nmol/mmol{creat}","NMOL/MMOL","amount of substance",0.000001,[0,0,0,0,0,0,0],"nmol/mmol","si",true,null,null,1,false,false,0,"nanomoles","LOINC","SRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per mole","nmol/mol","NMOL/MOL","amount of substance",1e-9,[0,0,0,0,0,0,0],"nmol/mol","si",true,null,null,1,false,false,0,"nmol per mole; nanomoles","LOINC","SRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per nanomole","nmol/nmol","NMOL/NMOL","amount of substance",1,[0,0,0,0,0,0,0],"nmol/nmol","si",true,null,null,1,false,false,0,"nmol per nmol; nanomoles","LOINC","SRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per second","nmol/s","NMOL/S","amount of substance",602213670000000,[0,-1,0,0,0,0,0],"nmol/s","si",true,null,null,1,false,false,1,"nmol/sec; nmol per sec; nanomoles per sercond; milli enzyme units; enzyme activity; enzymatic activity","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min.","10*23","10*23","6.0221367",6.0221367,false],[false,"nanomole per second per liter","nmol/s/L","(NMOL/S)/L","amount of substance",602213670000000000,[-3,-1,0,0,0,0,0],"(nmol/s)/L","si",true,null,null,1,false,false,1,"nmol/sec/L; nmol per s per L; nmol per sec per L; nanomoles per seconds per liter; litre; milli enzyme units per volume; enzyme activity; enzymatic activity","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min.","10*23","10*23","6.0221367",6.0221367,false],[true,"nanosecond","ns","NS","time",1e-9,[0,1,0,0,0,0,0],"ns",null,false,"T",null,1,false,false,0,"nanoseconds","LOINC","Time","Clinical","",null,null,null,null,false],[false,"nanoenzyme unit per milliliter","nU/mL","NU/ML","catalytic activity",10036894500000,[-3,-1,0,0,0,0,0],"nU/mL","chemical",true,null,null,1,false,false,1,"nU per mL; nanoenzyme units per milliliter; millilitre; enzymatic activity per volume; enzyme activity","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 fU = pmol/min","umol/min","UMOL/MIN","1",1,false],[false,"Ohm meter","Ohm.m","OHM.M","electric resistance",1000,[3,-1,1,0,0,-2,0],"Ω.m","si",true,null,null,1,false,false,0,"electric resistivity; meters; metres","LOINC","","Clinical","unit of electric resistivity","V/A","V/A","1",1,false],[false,"osmole per kilogram","osm/kg","OSM/KG","amount of substance (dissolved particles)",602213670000000000000,[0,0,-1,0,0,0,0],"osm/kg","chemical",true,null,null,1,false,false,1,"osm per kg; osmoles per kilogram; osmols","LOINC","Osmol","Clinical","","mol","MOL","1",1,false],[false,"osmole per liter","osm/L","OSM/L","amount of substance (dissolved particles)",6.0221366999999994e+26,[-3,0,0,0,0,0,0],"osm/L","chemical",true,null,null,1,false,false,1,"osm per L; osmoles per liter; litre; osmols","LOINC","Osmol","Clinical","","mol","MOL","1",1,false],[false,"picoampere","pA","PA","electric current",1e-12,[0,-1,0,0,0,1,0],"pA","si",true,null,null,1,false,false,0,"picoamperes","LOINC","","Clinical","equal to 10^-12 amperes","C/s","C/S","1",1,false],[true,"picogram","pg","PG","mass",1e-12,[0,0,1,0,0,0,0],"pg",null,false,"M",null,1,false,false,0,"picograms","LOINC","Mass; EntMass","Clinical","",null,null,null,null,false],[true,"picogram per deciliter","pg/dL","PG/DL","mass",9.999999999999999e-9,[-3,0,1,0,0,0,0],"pg/dL",null,false,"M",null,1,false,false,0,"pg per dL; picograms; decilitre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"picogram per liter","pg/L","PG/L","mass",1e-9,[-3,0,1,0,0,0,0],"pg/L",null,false,"M",null,1,false,false,0,"pg per L; picograms; litre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"picogram per milligram","pg/mg","PG/MG","mass",1e-9,[0,0,0,0,0,0,0],"pg/mg",null,false,"M",null,1,false,false,0,"pg per mg; picograms","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"picogram per milliliter","pg/mL","PG/ML","mass",0.000001,[-3,0,1,0,0,0,0],"pg/mL",null,false,"M",null,1,false,false,0,"pg per mL; picograms per milliliter; millilitre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"picogram per millimeter","pg/mm","PG/MM","mass",1e-9,[-1,0,1,0,0,0,0],"pg/mm",null,false,"M",null,1,false,false,0,"pg per mm; picogram/millimeter; picogram/millimetre; picograms per millimeter; millimetre","LOINC","Lineic Mass","Clinical","",null,null,null,null,false],[false,"picokatal","pkat","PKAT","catalytic activity",602213670000,[0,-1,0,0,0,0,0],"pkat","chemical",true,null,null,1,false,false,1,"pkats; picokatals","LOINC","CAct","Clinical","kat is a unit of catalytic activity with base units = mol/s. Rarely used because its units are too large to practically express catalytic activity. See enzyme unit [U] which is the standard unit for catalytic activity.","mol/s","MOL/S","1",1,false],[false,"picoliter","pL","PL","volume",1e-15,[3,0,0,0,0,0,0],"pL","iso1000",true,null,null,1,false,false,0,"picoliters; picolitres","LOINC","Vol","Clinical","","l",null,"1",1,false],[true,"picometer","pm","PM","length",1e-12,[1,0,0,0,0,0,0],"pm",null,false,"L",null,1,false,false,0,"picometers; picometres","LOINC","Len","Clinical","",null,null,null,null,false],[false,"picomole","pmol","PMOL","amount of substance",602213670000,[0,0,0,0,0,0,0],"pmol","si",true,null,null,1,false,false,1,"picomoles; pmols","LOINC","Sub","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"picomole per 24 hour","pmol/(24.h)","PMOL/HR","amount of substance",6970065.625,[0,-1,0,0,0,0,0],"pmol/h","si",true,null,null,1,false,false,1,"pmol/24hrs; pmol/24 hrs; pmol per 24 hrs; 24hrs; days; dy; picomoles per 24 hours","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"picomole per day","pmol/d","PMOL/D","amount of substance",6970065.625,[0,-1,0,0,0,0,0],"pmol/d","si",true,null,null,1,false,false,1,"pmol/dy; pmol per day; 24 hours; 24hrs; 24 hrs; picomoles","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"picomole per deciliter","pmol/dL","PMOL/DL","amount of substance",6022136700000000,[-3,0,0,0,0,0,0],"pmol/dL","si",true,null,null,1,false,false,1,"pmol per dL; picomoles per deciliter; decilitre","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"picomole per gram","pmol/g","PMOL/G","amount of substance",602213670000,[0,0,-1,0,0,0,0],"pmol/g","si",true,null,null,1,false,false,1,"pmol per gm; picomoles per gram; picomole/gram","LOINC","SCnt","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"picomole per hour per milliliter ","pmol/h/mL","(PMOL/HR)/ML","amount of substance",167281575000000,[-3,-1,0,0,0,0,0],"(pmol/h)/mL","si",true,null,null,1,false,false,1,"pmol/hrs/mL; pmol per hrs per mL; picomoles per hour per milliliter; millilitre; micro enzyme units per volume; enzymatic activity; enzyme activity","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min. ","10*23","10*23","6.0221367",6.0221367,false],[false,"picomole per liter","pmol/L","PMOL/L","amount of substance",602213670000000,[-3,0,0,0,0,0,0],"pmol/L","si",true,null,null,1,false,false,1,"picomole/liter; pmol per L; picomoles; litre","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"picomole per minute","pmol/min","PMOL/MIN","amount of substance",10036894500,[0,-1,0,0,0,0,0],"pmol/min","si",true,null,null,1,false,false,1,"picomole/minute; pmol per min; picomoles per minute; micro enzyme units; enzymatic activity; enzyme activity","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min. pmol/min = uU (micro enzyme unit)","10*23","10*23","6.0221367",6.0221367,false],[false,"picomole per milliliter","pmol/mL","PMOL/ML","amount of substance",602213670000000000,[-3,0,0,0,0,0,0],"pmol/mL","si",true,null,null,1,false,false,1,"picomole/milliliter; picomole/millilitre; pmol per mL; picomoles; millilitre; picomols; pmols","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"picomole per micromole","pmol/umol","PMOL/UMOL","amount of substance",0.000001,[0,0,0,0,0,0,0],"pmol/μmol","si",true,null,null,1,false,false,0,"pmol/mcgmol; picomole/micromole; pmol per umol; pmol per mcgmol; picomoles ","LOINC","SRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[true,"picosecond","ps","PS","time",1e-12,[0,1,0,0,0,0,0],"ps",null,false,"T",null,1,false,false,0,"picoseconds; psec","LOINC","Time","Clinical","",null,null,null,null,false],[false,"picotesla","pT","PT","magnetic flux density",1e-9,[0,-1,1,0,0,-1,0],"pT","si",true,null,null,1,false,false,0,"picoteslas","LOINC","","Clinical","SI unit of magnetic field strength for magnetic field B","Wb/m2","WB/M2","1",1,false],[false,"enzyme unit per 12 hour","U/(12.h)","U/HR","catalytic activity",232335520833.33334,[0,-2,0,0,0,0,0],"U/h","chemical",true,null,null,1,false,false,1,"U/12hrs; U/ 12hrs; U per 12 hrs; 12hrs; enzyme units per 12 hours; enzyme activity; enzymatic activity per time; umol per min per 12 hours; micromoles per minute per 12 hours; umol/min/12hr","LOINC","CRat","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per 2 hour","U/(2.h)","U/HR","catalytic activity",1394013125000,[0,-2,0,0,0,0,0],"U/h","chemical",true,null,null,1,false,false,1,"U/2hrs; U/ 2hrs; U per 2 hrs; 2hrs; enzyme units per 2 hours; enzyme activity; enzymatic activity per time; umol per minute per 2 hours; micromoles per minute; umol/min/2hr; umol per min per 2hr","LOINC","CRat","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per 24 hour","U/(24.h)","U/HR","catalytic activity",116167760416.66667,[0,-2,0,0,0,0,0],"U/h","chemical",true,null,null,1,false,false,1,"U/24hrs; U/ 24hrs; U per 24 hrs; 24hrs; enzyme units per 24 hours; enzyme activity; enzymatic activity per time; micromoles per minute per 24 hours; umol/min/24hr; umol per min per 24hr","LOINC","CRat","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per 10","U/10","U","catalytic activity",1003689450000000,[0,-1,0,0,0,0,0],"U","chemical",true,null,null,1,false,false,1,"enzyme unit/10; U per 10; enzyme units per 10; enzymatic activity; enzyme activity; micromoles per minute; umol/min/10","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per 10 billion","U/10*10","U/(10*10)","catalytic activity",1003689.45,[0,-1,0,0,0,0,0],"U/(1010)","chemical",true,null,null,1,false,false,1,"U per 10*10; enzyme units per 10*10; U per 10 billion; enzyme units; enzymatic activity; micromoles per minute per 10 billion; umol/min/10*10","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per trillion","U/10*12","U/(10*12)","catalytic activity",10036.8945,[0,-1,0,0,0,0,0],"U/(1012)","chemical",true,null,null,1,false,false,1,"enzyme unit/10*12; U per 10*12; enzyme units per 10*12; enzyme units per trillion; enzymatic activity; micromoles per minute per trillion; umol/min/10*12; umol per min per 10*12","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per million","U/10*6","U/(10*6)","catalytic activity",10036894500,[0,-1,0,0,0,0,0],"U/(106)","chemical",true,null,null,1,false,false,1,"enzyme unit/10*6; U per 10*6; enzyme units per 10*6; enzyme units; enzymatic activity per volume; micromoles per minute per million; umol/min/10*6; umol per min per 10*6","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per billion","U/10*9","U/(10*9)","catalytic activity",10036894.5,[0,-1,0,0,0,0,0],"U/(109)","chemical",true,null,null,1,false,false,1,"enzyme unit/10*9; U per 10*9; enzyme units per 10*9; enzymatic activity per volume; micromoles per minute per billion; umol/min/10*9; umol per min per 10*9","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per day","U/d","U/D","catalytic activity",116167760416.66667,[0,-2,0,0,0,0,0],"U/d","chemical",true,null,null,1,false,false,1,"U/dy; enzyme units per day; enzyme units; enzyme activity; enzymatic activity per time; micromoles per minute per day; umol/min/day; umol per min per day","LOINC","CRat","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per deciliter","U/dL","U/DL","catalytic activity",100368945000000000000,[-3,-1,0,0,0,0,0],"U/dL","chemical",true,null,null,1,false,false,1,"U per dL; enzyme units per deciliter; decilitre; micromoles per minute per deciliter; umol/min/dL; umol per min per dL","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per gram","U/g","U/G","catalytic activity",10036894500000000,[0,-1,-1,0,0,0,0],"U/g","chemical",true,null,null,1,false,false,1,"U/gm; U per gm; enzyme units per gram; micromoles per minute per gram; umol/min/g; umol per min per g","LOINC","CCnt","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per hour","U/h","U/HR","catalytic activity",2788026250000,[0,-2,0,0,0,0,0],"U/h","chemical",true,null,null,1,false,false,1,"U/hr; U per hr; enzyme units per hour; micromoles per minute per hour; umol/min/hr; umol per min per hr","LOINC","CRat","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per liter","U/L","U/L","catalytic activity",10036894500000000000,[-3,-1,0,0,0,0,0],"U/L","chemical",true,null,null,1,false,false,1,"enzyme unit/liter; enzyme unit/litre; U per L; enzyme units per liter; enzyme unit per litre; micromoles per minute per liter; umol/min/L; umol per min per L","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per minute","U/min","U/MIN","catalytic activity",167281575000000,[0,-2,0,0,0,0,0],"U/min","chemical",true,null,null,1,false,false,1,"enzyme unit/minute; U per min; enzyme units; umol/min/min; micromoles per minute per minute; micromoles per min per min; umol","LOINC","CRat","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per milliliter","U/mL","U/ML","catalytic activity",1.00368945e+22,[-3,-1,0,0,0,0,0],"U/mL","chemical",true,null,null,1,false,false,1,"U per mL; enzyme units per milliliter; millilitre; micromoles per minute per milliliter; umol/min/mL; umol per min per mL","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"enzyme unit per second","U/s","U/S","catalytic activity",10036894500000000,[0,-2,0,0,0,0,0],"U/s","chemical",true,null,null,1,false,false,1,"U/sec; U per second; enzyme units per second; micromoles per minute per second; umol/min/sec; umol per min per sec","LOINC","CRat","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min)","umol/min","UMOL/MIN","1",1,false],[false,"micro international unit","u[IU]","U[IU]","arbitrary",0.000001,[0,0,0,0,0,0,0],"μi.U.","chemical",true,null,null,1,false,true,0,"uIU; u IU; microinternational units","LOINC","Arb","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"micro international unit per liter","u[IU]/L","U[IU]/L","arbitrary",0.001,[-3,0,0,0,0,0,0],"(μi.U.)/L","chemical",true,null,null,1,false,true,0,"uIU/L; u IU/L; uIU per L; microinternational units per liter; litre; ","LOINC","ACnc","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"micro international unit per milliliter","u[IU]/mL","U[IU]/ML","arbitrary",1,[-3,0,0,0,0,0,0],"(μi.U.)/mL","chemical",true,null,null,1,false,true,0,"uIU/mL; u IU/mL; uIU per mL; microinternational units per milliliter; millilitre","LOINC","ACnc","Clinical","International units (IU) are analyte and reference specimen specific arbitrary units (held at WHO)","[iU]","[IU]","1",1,false],[false,"microequivalent","ueq","UEQ","amount of substance",602213670000000000,[0,0,0,0,0,0,0],"μeq","chemical",true,null,null,1,false,false,1,"microequivalents; 10^-6 equivalents; 10-6 equivalents","LOINC","Sub","Clinical","","mol","MOL","1",1,false],[false,"microequivalent per liter","ueq/L","UEQ/L","amount of substance",602213670000000000000,[-3,0,0,0,0,0,0],"μeq/L","chemical",true,null,null,1,false,false,1,"ueq per liter; litre; microequivalents","LOINC","MCnc","Clinical","","mol","MOL","1",1,false],[false,"microequivalent per milliliter","ueq/mL","UEQ/ML","amount of substance",6.0221367000000003e+23,[-3,0,0,0,0,0,0],"μeq/mL","chemical",true,null,null,1,false,false,1,"ueq per milliliter; millilitre; microequivalents","LOINC","MCnc","Clinical","","mol","MOL","1",1,false],[true,"microgram","ug","UG","mass",0.000001,[0,0,1,0,0,0,0],"μg",null,false,"M",null,1,false,false,0,"mcg; micrograms; 10^-6 grams; 10-6 grams","LOINC","Mass","Clinical","",null,null,null,null,false],[true,"microgram per 100 gram","ug/(100.g)","UG/G","mass",1e-8,[0,0,0,0,0,0,0],"μg/g",null,false,"M",null,1,false,false,0,"ug/100gm; ug/100 gm; mcg; ug per 100g; 100 gm; mcg per 100g; micrograms per 100 grams","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"microgram per 24 hour","ug/(24.h)","UG/HR","mass",1.1574074074074074e-11,[0,-1,1,0,0,0,0],"μg/h",null,false,"M",null,1,false,false,0,"ug/24hrs; ug/24 hrs; mcg/24hrs; ug per 24hrs; mcg per 24hrs; 24 hrs; micrograms per 24 hours","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"microgram per 8 hour","ug/(8.h)","UG/HR","mass",3.472222222222222e-11,[0,-1,1,0,0,0,0],"μg/h",null,false,"M",null,1,false,false,0,"ug/8hrs; ug/8 hrs; mcg/8hrs; ug per 8hrs; mcg per 8hrs; 8 hrs; micrograms per 8 hours; shift","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"microgram per square foot (international)","ug/[sft_i]","UG/[SFT_I]","mass",0.000010763910416709721,[-2,0,1,0,0,0,0],"μg",null,false,"M",null,1,false,false,0,"ug/sft; ug/ft2; ug/ft^2; ug/sq. ft; micrograms; sq. foot; foot squared","LOINC","ArMass","Clinical","",null,null,null,null,false],[true,"microgram per day","ug/d","UG/D","mass",1.1574074074074074e-11,[0,-1,1,0,0,0,0],"μg/d",null,false,"M",null,1,false,false,0,"ug/dy; mcg/dy; ug per day; mcg; micrograms per day","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"microgram per deciliter","ug/dL","UG/DL","mass",0.009999999999999998,[-3,0,1,0,0,0,0],"μg/dL",null,false,"M",null,1,false,false,0,"ug per dL; mcg/dl; mcg per dl; micrograms per deciliter; decilitre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"microgram per gram","ug/g","UG/G","mass",0.000001,[0,0,0,0,0,0,0],"μg/g",null,false,"M",null,1,false,false,0,"ug per gm; mcg/gm; mcg per g; micrograms per gram","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"microgram per hour","ug/h","UG/HR","mass",2.7777777777777777e-10,[0,-1,1,0,0,0,0],"μg/h",null,false,"M",null,1,false,false,0,"ug/hr; mcg/hr; mcg per hr; ug per hr; ug per hour; micrograms","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"microgram per kilogram","ug/kg","UG/KG","mass",9.999999999999999e-10,[0,0,0,0,0,0,0],"μg/kg",null,false,"M",null,1,false,false,0,"ug per kg; mcg/kg; mcg per kg; micrograms per kilogram","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"microgram per kilogram per 8 hour","ug/kg/(8.h)","(UG/KG)/HR","mass",3.472222222222222e-14,[0,-1,0,0,0,0,0],"(μg/kg)/h",null,false,"M",null,1,false,false,0,"ug/kg/8hrs; mcg/kg/8hrs; ug/kg/8 hrs; mcg/kg/8 hrs; ug per kg per 8hrs; 8 hrs; mcg per kg per 8hrs; micrograms per kilograms per 8 hours; shift","LOINC","","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"microgram per kilogram per day","ug/kg/d","(UG/KG)/D","mass",1.1574074074074072e-14,[0,-1,0,0,0,0,0],"(μg/kg)/d",null,false,"M",null,1,false,false,0,"ug/(kg.d); ug/kg/dy; mcg/kg/day; ug per kg per dy; 24 hours; 24hrs; mcg; kilograms; microgram per kilogram and day","LOINC","","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"microgram per kilogram per hour","ug/kg/h","(UG/KG)/HR","mass",2.7777777777777774e-13,[0,-1,0,0,0,0,0],"(μg/kg)/h",null,false,"M",null,1,false,false,0,"ug/(kg.h); ug/kg/hr; mcg/kg/hr; ug per kg per hr; mcg per kg per hr; kilograms","LOINC","","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"microgram per kilogram per minute","ug/kg/min","(UG/KG)/MIN","mass",1.6666666666666664e-11,[0,-1,0,0,0,0,0],"(μg/kg)/min",null,false,"M",null,1,false,false,0,"ug/kg/min; ug/kg/min; mcg/kg/min; ug per kg per min; mcg; micrograms per kilograms per minute ","LOINC","","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"microgram per liter","ug/L","UG/L","mass",0.001,[-3,0,1,0,0,0,0],"μg/L",null,false,"M",null,1,false,false,0,"mcg/L; ug per L; mcg; micrograms per liter; litre ","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"microgram per liter per 24 hour","ug/L/(24.h)","(UG/L)/HR","mass",1.1574074074074074e-8,[-3,-1,1,0,0,0,0],"(μg/L)/h",null,false,"M",null,1,false,false,0,"ug/L/24hrs; ug/L/24 hrs; mcg/L/24hrs; ug per L per 24hrs; 24 hrs; day; dy mcg; micrograms per liters per 24 hours; litres","LOINC","","Clinical","unit used to measure mass dose rate per patient body mass",null,null,null,null,false],[true,"microgram per square meter","ug/m2","UG/M2","mass",0.000001,[-2,0,1,0,0,0,0],"μg/(m2)",null,false,"M",null,1,false,false,0,"ug/m^2; ug/sq. m; mcg/m2; mcg/m^2; mcg/sq. m; ug per m2; m^2; sq. meter; mcg; micrograms per square meter; meter squared; metre","LOINC","ArMass","Clinical","unit used to measure mass dose per patient body surface area",null,null,null,null,false],[true,"microgram per cubic meter","ug/m3","UG/M3","mass",0.000001,[-3,0,1,0,0,0,0],"μg/(m3)",null,false,"M",null,1,false,false,0,"ug/m^3; ug/cu. m; mcg/m3; mcg/m^3; mcg/cu. m; ug per m3; ug per m^3; ug per cu. m; mcg; micrograms per cubic meter; meter cubed; metre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"microgram per milligram","ug/mg","UG/MG","mass",0.001,[0,0,0,0,0,0,0],"μg/mg",null,false,"M",null,1,false,false,0,"ug per mg; mcg/mg; mcg per mg; micromilligrams per milligram","LOINC","MCnt","Clinical","",null,null,null,null,false],[true,"microgram per minute","ug/min","UG/MIN","mass",1.6666666666666667e-8,[0,-1,1,0,0,0,0],"μg/min",null,false,"M",null,1,false,false,0,"ug per min; mcg/min; mcg per min; microminutes per minute","LOINC","MRat","Clinical","",null,null,null,null,false],[true,"microgram per milliliter","ug/mL","UG/ML","mass",1,[-3,0,1,0,0,0,0],"μg/mL",null,false,"M",null,1,false,false,0,"ug per mL; mcg/mL; mcg per mL; micrograms per milliliter; millilitre","LOINC","MCnc","Clinical","",null,null,null,null,false],[true,"microgram per millimole","ug/mmol","UG/MMOL","mass",1.660540186674939e-27,[0,0,1,0,0,0,0],"μg/mmol",null,false,"M",null,1,false,false,-1,"ug per mmol; mcg/mmol; mcg per mmol; micrograms per millimole","LOINC","Ratio","Clinical","",null,null,null,null,false],[true,"microgram per nanogram","ug/ng","UG/NG","mass",999.9999999999999,[0,0,0,0,0,0,0],"μg/ng",null,false,"M",null,1,false,false,0,"ug per ng; mcg/ng; mcg per ng; micrograms per nanogram","LOINC","MCnt","Clinical","",null,null,null,null,false],[false,"microkatal","ukat","UKAT","catalytic activity",602213670000000000,[0,-1,0,0,0,0,0],"μkat","chemical",true,null,null,1,false,false,1,"microkatals; ukats","LOINC","CAct","Clinical","kat is a unit of catalytic activity with base units = mol/s. Rarely used because its units are too large to practically express catalytic activity. See enzyme unit [U] which is the standard unit for catalytic activity.","mol/s","MOL/S","1",1,false],[false,"microliter","uL","UL","volume",1e-9,[3,0,0,0,0,0,0],"μL","iso1000",true,null,null,1,false,false,0,"microliters; microlitres; mcl","LOINC","Vol","Clinical","","l",null,"1",1,false],[false,"microliter per 2 hour","uL/(2.h)","UL/HR","volume",1.388888888888889e-13,[3,-1,0,0,0,0,0],"μL/h","iso1000",true,null,null,1,false,false,0,"uL/2hrs; uL/2 hrs; mcg/2hr; mcg per 2hr; uL per 2hr; uL per 2 hrs; microliters per 2 hours; microlitres ","LOINC","VRat","Clinical","","l",null,"1",1,false],[false,"microliter per hour","uL/h","UL/HR","volume",2.777777777777778e-13,[3,-1,0,0,0,0,0],"μL/h","iso1000",true,null,null,1,false,false,0,"uL/hr; mcg/hr; mcg per hr; uL per hr; microliters per hour; microlitres","LOINC","VRat","Clinical","","l",null,"1",1,false],[true,"micrometer","um","UM","length",0.000001,[1,0,0,0,0,0,0],"μm",null,false,"L",null,1,false,false,0,"micrometers; micrometres; μm; microns","LOINC","Len","Clinical","Unit of length that is usually used in tests related to the eye",null,null,null,null,false],[true,"microns per second","um/s","UM/S","length",0.000001,[1,-1,0,0,0,0,0],"μm/s",null,false,"L",null,1,false,false,0,"um/sec; micron/second; microns/second; um per sec; micrometers per second; micrometres","LOINC","Vel","Clinical","",null,null,null,null,false],[false,"micromole","umol","UMOL","amount of substance",602213670000000000,[0,0,0,0,0,0,0],"μmol","si",true,null,null,1,false,false,1,"micromoles; umols","LOINC","Sub","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per 2 hour","umol/(2.h)","UMOL/HR","amount of substance",83640787500000,[0,-1,0,0,0,0,0],"μmol/h","si",true,null,null,1,false,false,1,"umol/2hrs; umol/2 hrs; umol per 2 hrs; 2hrs; micromoles per 2 hours","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per 24 hour","umol/(24.h)","UMOL/HR","amount of substance",6970065625000,[0,-1,0,0,0,0,0],"μmol/h","si",true,null,null,1,false,false,1,"umol/24hrs; umol/24 hrs; umol per 24 hrs; per 24hrs; micromoles per 24 hours","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per 8 hour","umol/(8.h)","UMOL/HR","amount of substance",20910196875000,[0,-1,0,0,0,0,0],"μmol/h","si",true,null,null,1,false,false,1,"umol/8hr; umol/8 hr; umol per 8 hr; umol per 8hr; umols per 8hr; umol per 8 hours; micromoles per 8 hours; shift","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per day","umol/d","UMOL/D","amount of substance",6970065625000,[0,-1,0,0,0,0,0],"μmol/d","si",true,null,null,1,false,false,1,"umol/day; umol per day; umols per day; umol per days; micromoles per days; umol/24hr; umol/24 hr; umol per 24 hr; umol per 24hr; umols per 24hr; umol per 24 hours; micromoles per 24 hours","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per deciliter","umol/dL","UMOL/DL","amount of substance",6.0221367e+21,[-3,0,0,0,0,0,0],"μmol/dL","si",true,null,null,1,false,false,1,"micromole/deciliter; micromole/decilitre; umol per dL; micromoles per deciliters; micromole per decilitres","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per gram","umol/g","UMOL/G","amount of substance",602213670000000000,[0,0,-1,0,0,0,0],"μmol/g","si",true,null,null,1,false,false,1,"micromole/gram; umol per g; micromoles per gram","LOINC","SCnt; Ratio","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per hour","umol/h","UMOL/HR","amount of substance",167281575000000,[0,-1,0,0,0,0,0],"μmol/h","si",true,null,null,1,false,false,1,"umol/hr; umol per hr; umol per hour; micromoles per hours","LOINC","SRat","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per kilogram","umol/kg","UMOL/KG","amount of substance",602213670000000,[0,0,-1,0,0,0,0],"μmol/kg","si",true,null,null,1,false,false,1,"umol per kg; micromoles per kilogram","LOINC","SCnt","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per liter","umol/L","UMOL/L","amount of substance",602213670000000000000,[-3,0,0,0,0,0,0],"μmol/L","si",true,null,null,1,false,false,1,"micromole/liter; micromole/litre; umol per liter; micromoles per liter; litre","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per liter per hour","umol/L/h","(UMOL/L)/HR","amount of substance",167281575000000000,[-3,-1,0,0,0,0,0],"(μmol/L)/h","si",true,null,null,1,false,false,1,"umol/liter/hr; umol/litre/hr; umol per L per hr; umol per liter per hour; micromoles per liters per hour; litre","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min; umol/L/h is a derived unit of enzyme units","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per milligram","umol/mg","UMOL/MG","amount of substance",602213670000000000000,[0,0,-1,0,0,0,0],"μmol/mg","si",true,null,null,1,false,false,1,"micromole/milligram; umol per mg; micromoles per milligram","LOINC","SCnt","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per minute","umol/min","UMOL/MIN","amount of substance",10036894500000000,[0,-1,0,0,0,0,0],"μmol/min","si",true,null,null,1,false,false,1,"micromole/minute; umol per min; micromoles per minute; enzyme units","LOINC","CAct","Clinical","unit for the enzyme unit U = umol/min","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per minute per gram","umol/min/g","(UMOL/MIN)/G","amount of substance",10036894500000000,[0,-1,-1,0,0,0,0],"(μmol/min)/g","si",true,null,null,1,false,false,1,"umol/min/gm; umol per min per gm; micromoles per minutes per gram; U/g; enzyme units","LOINC","CCnt","Clinical","unit for the enzyme unit U = umol/min. umol/min/g = U/g","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per minute per liter","umol/min/L","(UMOL/MIN)/L","amount of substance",10036894500000000000,[-3,-1,0,0,0,0,0],"(μmol/min)/L","si",true,null,null,1,false,false,1,"umol/min/liter; umol/minute/liter; micromoles per minutes per liter; litre; enzyme units; U/L","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min. umol/min/L = U/L","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per milliliter","umol/mL","UMOL/ML","amount of substance",6.0221367000000003e+23,[-3,0,0,0,0,0,0],"μmol/mL","si",true,null,null,1,false,false,1,"umol per mL; micromoles per milliliter; millilitre","LOINC","SCnc","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per milliliter per minute","umol/mL/min","(UMOL/ML)/MIN","amount of substance",1.00368945e+22,[-3,-1,0,0,0,0,0],"(μmol/mL)/min","si",true,null,null,1,false,false,1,"umol per mL per min; micromoles per milliliters per minute; millilitres","LOINC","CCnc","Clinical","unit for the enzyme unit U = umol/min. umol/mL/min = U/mL","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per millimole","umol/mmol","UMOL/MMOL","amount of substance",0.001,[0,0,0,0,0,0,0],"μmol/mmol","si",true,null,null,1,false,false,0,"umol per mmol; micromoles per millimole","LOINC","SRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per mole","umol/mol","UMOL/MOL","amount of substance",0.000001,[0,0,0,0,0,0,0],"μmol/mol","si",true,null,null,1,false,false,0,"umol per mol; micromoles per mole","LOINC","SRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"micromole per micromole","umol/umol","UMOL/UMOL","amount of substance",1,[0,0,0,0,0,0,0],"μmol/μmol","si",true,null,null,1,false,false,0,"umol per umol; micromoles per micromole","LOINC","Srto; SFr; EntSRto","Clinical","","10*23","10*23","6.0221367",6.0221367,false],[false,"microOhm","uOhm","UOHM","electric resistance",0.001,[2,-1,1,0,0,-2,0],"μΩ","si",true,null,null,1,false,false,0,"microOhms; µΩ","LOINC","","Clinical","unit of electric resistance","V/A","V/A","1",1,false],[true,"microsecond","us","US","time",0.000001,[0,1,0,0,0,0,0],"μs",null,false,"T",null,1,false,false,0,"microseconds","LOINC","Time","Clinical","",null,null,null,null,false],[false,"micro enzyme unit per gram","uU/g","UU/G","catalytic activity",10036894500,[0,-1,-1,0,0,0,0],"μU/g","chemical",true,null,null,1,false,false,1,"uU per gm; micro enzyme units per gram; micro enzymatic activity per mass; enzyme activity","LOINC","CCnt","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 uU = 1pmol/min","umol/min","UMOL/MIN","1",1,false],[false,"micro enzyme unit per liter","uU/L","UU/L","catalytic activity",10036894500000,[-3,-1,0,0,0,0,0],"μU/L","chemical",true,null,null,1,false,false,1,"uU per L; micro enzyme units per liter; litre; enzymatic activity per volume; enzyme activity ","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 uU = 1pmol/min","umol/min","UMOL/MIN","1",1,false],[false,"micro enzyme unit per milliliter","uU/mL","UU/ML","catalytic activity",10036894500000000,[-3,-1,0,0,0,0,0],"μU/mL","chemical",true,null,null,1,false,false,1,"uU per mL; micro enzyme units per milliliter; millilitre; enzymatic activity per volume; enzyme activity","LOINC","CCnc","Clinical","1 U is the standard enzyme unit which equals 1 micromole substrate catalyzed per minute (1 umol/min); 1 uU = 1pmol/min","umol/min","UMOL/MIN","1",1,false],[false,"microvolt","uV","UV","electric potential",0.001,[2,-2,1,0,0,-1,0],"μV","si",true,null,null,1,false,false,0,"microvolts","LOINC","Elpot","Clinical","unit of electric potential (voltage)","J/C","J/C","1",1,false]]}} -},{}],52:[function(require,module,exports){ +},{}],57:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -15440,7 +10794,7 @@ var Ucum = { exports.Ucum = Ucum; -},{}],53:[function(require,module,exports){ +},{}],58:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -15796,7 +11150,7 @@ class Dimension { exports.Dimension = Dimension; -},{"./config.js":52,"is-integer":66}],54:[function(require,module,exports){ +},{"./config.js":57,"is-integer":71}],59:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -15936,7 +11290,7 @@ function unpackArray(obj) { } -},{}],55:[function(require,module,exports){ +},{}],60:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -16094,7 +11448,7 @@ class Prefix { exports.Prefix = Prefix; -},{"./config.js":52}],56:[function(require,module,exports){ +},{"./config.js":57}],61:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -16239,7 +11593,7 @@ const PrefixTables = { exports.PrefixTables = PrefixTables; -},{}],57:[function(require,module,exports){ +},{}],62:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -16472,7 +11826,7 @@ var _default = new UcumFunctions(); // one singleton instance exports.default = _default; -},{}],58:[function(require,module,exports){ +},{}],63:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -16579,7 +11933,7 @@ function getSynonyms(theSyn) { } // end getSynonyms -},{"./unitTables.js":64}],59:[function(require,module,exports){ +},{"./unitTables.js":69}],64:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -16649,7 +12003,7 @@ var ucumJsonDefs = new UcumJsonDefs(); exports.ucumJsonDefs = ucumJsonDefs; -},{"../data/ucumDefs.min.json":51,"./jsonArrayPack.js":54,"./prefix.js":55,"./prefixTables.js":56,"./unit.js":62,"./unitTables.js":64}],60:[function(require,module,exports){ +},{"../data/ucumDefs.min.json":56,"./jsonArrayPack.js":59,"./prefix.js":60,"./prefixTables.js":61,"./unit.js":67,"./unitTables.js":69}],65:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -17159,7 +12513,7 @@ UcumLhcUtils.getInstance = function () { }; -},{"./config.js":52,"./ucumInternalUtils.js":58,"./ucumJsonDefs.js":59,"./unitString.js":63,"./unitTables.js":64}],61:[function(require,module,exports){ +},{"./config.js":57,"./ucumInternalUtils.js":63,"./ucumJsonDefs.js":64,"./unitString.js":68,"./unitTables.js":69}],66:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -17186,7 +12540,7 @@ var UnitTables = require("./unitTables.js").UnitTables; exports.UnitTables = UnitTables; -},{"./config.js":52,"./ucumLhcUtils.js":60,"./unitTables.js":64}],62:[function(require,module,exports){ +},{"./config.js":57,"./ucumLhcUtils.js":65,"./unitTables.js":69}],67:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -18147,7 +13501,7 @@ class Unit { exports.Unit = Unit; -},{"./config.js":52,"./dimension.js":53,"./ucumFunctions.js":57,"./ucumInternalUtils.js":58,"./unitTables.js":64,"is-integer":66}],63:[function(require,module,exports){ +},{"./config.js":57,"./dimension.js":58,"./ucumFunctions.js":62,"./ucumInternalUtils.js":63,"./unitTables.js":69,"is-integer":71}],68:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -19659,7 +15013,7 @@ UnitString.getInstance(); */ -},{"./config.js":52,"./prefixTables.js":56,"./ucumInternalUtils.js":58,"./unit.js":62,"./unitTables.js":64}],64:[function(require,module,exports){ +},{"./config.js":57,"./prefixTables.js":61,"./ucumInternalUtils.js":63,"./unit.js":67,"./unitTables.js":69}],69:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -20371,14 +15725,14 @@ const UnitTables = { exports.UnitTables = UnitTables; -},{"./config.js":52}],65:[function(require,module,exports){ +},{"./config.js":57}],70:[function(require,module,exports){ 'use strict'; module.exports = Number.isFinite || function (value) { return !(typeof value !== 'number' || value !== value || value === Infinity || value === -Infinity); }; -},{}],66:[function(require,module,exports){ +},{}],71:[function(require,module,exports){ // https://github.com/paulmillr/es6-shim // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isinteger var isFinite = require("is-finite"); @@ -20388,7 +15742,7 @@ module.exports = Number.isInteger || function(val) { Math.floor(val) === val; }; -},{"is-finite":65}],67:[function(require,module,exports){ +},{"is-finite":70}],72:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/examples/node/exec-age.js b/examples/node/exec-age.js index da6f8a94e..dc4a21354 100644 --- a/examples/node/exec-age.js +++ b/examples/node/exec-age.js @@ -1,7 +1,7 @@ /* eslint-disable no-console, */ -const cql = require('../../src/cql'); +const cql = require('../../lib/cql'); const measure = require('./age.json'); const lib = new cql.Library(measure); diff --git a/examples/typescript/age.cql b/examples/typescript/age.cql new file mode 100644 index 000000000..c1b9b57ac --- /dev/null +++ b/examples/typescript/age.cql @@ -0,0 +1,12 @@ +library AgeAtMP version '1' + +// NOTE: This example uses a custom data model that is very simplistic and suitable only for +// demonstration and testing purposes. Real-world CQL should use a more appropriate model. +using Simple version '1.0.0' + +parameter MeasurementPeriod default Interval[DateTime(2013, 1, 1, 0, 0, 0, 0), DateTime(2014, 1, 1, 0, 0, 0, 0)) + +context Patient + +define InDemographic: + AgeInYearsAt(start of MeasurementPeriod) >= 2 and AgeInYearsAt(start of MeasurementPeriod) < 18 diff --git a/examples/typescript/age.json b/examples/typescript/age.json new file mode 100644 index 000000000..6d0bfac22 --- /dev/null +++ b/examples/typescript/age.json @@ -0,0 +1,183 @@ +{ + "library" : { + "annotation" : [ { + "translatorOptions" : "", + "type" : "CqlToElmInfo" + } ], + "identifier" : { + "id" : "AgeAtMP", + "version" : "1" + }, + "schemaIdentifier" : { + "id" : "urn:hl7-org:elm", + "version" : "r1" + }, + "usings" : { + "def" : [ { + "localIdentifier" : "System", + "uri" : "urn:hl7-org:elm-types:r1" + }, { + "localIdentifier" : "Simple", + "uri" : "https://github.com/cqframework/cql-execution/simple", + "version" : "1.0.0" + } ] + }, + "parameters" : { + "def" : [ { + "name" : "MeasurementPeriod", + "accessLevel" : "Public", + "default" : { + "lowClosed" : true, + "highClosed" : false, + "type" : "Interval", + "low" : { + "type" : "DateTime", + "year" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "2013", + "type" : "Literal" + }, + "month" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "1", + "type" : "Literal" + }, + "day" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "1", + "type" : "Literal" + }, + "hour" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + }, + "minute" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + }, + "second" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + }, + "millisecond" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + } + }, + "high" : { + "type" : "DateTime", + "year" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "2014", + "type" : "Literal" + }, + "month" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "1", + "type" : "Literal" + }, + "day" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "1", + "type" : "Literal" + }, + "hour" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + }, + "minute" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + }, + "second" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + }, + "millisecond" : { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "0", + "type" : "Literal" + } + } + } + } ] + }, + "statements" : { + "def" : [ { + "name" : "Patient", + "context" : "Patient", + "expression" : { + "type" : "SingletonFrom", + "operand" : { + "dataType" : "{https://github.com/cqframework/cql-execution/simple}Patient", + "type" : "Retrieve" + } + } + }, { + "name" : "InDemographic", + "context" : "Patient", + "accessLevel" : "Public", + "expression" : { + "type" : "And", + "operand" : [ { + "type" : "GreaterOrEqual", + "operand" : [ { + "precision" : "Year", + "type" : "CalculateAgeAt", + "operand" : [ { + "path" : "birthDate", + "type" : "Property", + "source" : { + "name" : "Patient", + "type" : "ExpressionRef" + } + }, { + "type" : "Start", + "operand" : { + "name" : "MeasurementPeriod", + "type" : "ParameterRef" + } + } ] + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "2", + "type" : "Literal" + } ] + }, { + "type" : "Less", + "operand" : [ { + "precision" : "Year", + "type" : "CalculateAgeAt", + "operand" : [ { + "path" : "birthDate", + "type" : "Property", + "source" : { + "name" : "Patient", + "type" : "ExpressionRef" + } + }, { + "type" : "Start", + "operand" : { + "name" : "MeasurementPeriod", + "type" : "ParameterRef" + } + } ] + }, { + "valueType" : "{urn:hl7-org:elm-types:r1}Integer", + "value" : "18", + "type" : "Literal" + } ] + } ] + } + } ] + } + } +} + diff --git a/examples/typescript/exec-age.ts b/examples/typescript/exec-age.ts new file mode 100644 index 000000000..ae9cd317b --- /dev/null +++ b/examples/typescript/exec-age.ts @@ -0,0 +1,26 @@ +/* eslint-disable no-console */ +/* eslint-disable @typescript-eslint/no-var-requires */ +import cql from '../../src/cql'; +import * as measure from './age.json'; // Ensure "resolveJsonModule" is set to true in tsconfig.json + +const lib = new cql.Library(measure); +const executor = new cql.Executor(lib); +const psource = new cql.PatientSource([ + { + id: '1', + recordType: 'Patient', + name: 'John Smith', + gender: 'M', + birthDate: '1980-02-17T06:15' + }, + { + id: '2', + recordType: 'Patient', + name: 'Sally Smith', + gender: 'F', + birthDate: '2007-08-02T11:47' + } +]); + +const result = executor.exec(psource); +console.log(JSON.stringify(result, undefined, 2)); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..c77f93dc4 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,4467 @@ +{ + "name": "cql-execution", + "version": "2.3.3", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", + "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.16.7" + } + }, + "@babel/compat-data": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.8.tgz", + "integrity": "sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q==", + "dev": true + }, + "@babel/core": { + "version": "7.16.12", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.12.tgz", + "integrity": "sha512-dK5PtG1uiN2ikk++5OzSYsitZKny4wOCD0nrO4TqnW4BVBTQ2NGS3NgilvT/TEyxTST7LNyWV/T4tXDoD3fOgg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.8", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helpers": "^7.16.7", + "@babel/parser": "^7.16.12", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.10", + "@babel/types": "^7.16.8", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + }, + "dependencies": { + "convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.8.tgz", + "integrity": "sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.8", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", + "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.17.5", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "@babel/helper-environment-visitor": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", + "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-function-name": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz", + "integrity": "sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz", + "integrity": "sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", + "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-module-imports": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", + "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-module-transforms": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", + "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-simple-access": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", + "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", + "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", + "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", + "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "dev": true + }, + "@babel/helpers": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz", + "integrity": "sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw==", + "dev": true, + "requires": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/highlight": { + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", + "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.16.12", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.12.tgz", + "integrity": "sha512-VfaV15po8RiZssrkPweyvbGVSe4x2y+aciFCgn0n0/SJMR22cwofRV1mtnJQYcSB1wUTaA/X1LnA3es66MCO5A==", + "dev": true + }, + "@babel/template": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", + "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/traverse": { + "version": "7.16.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.10.tgz", + "integrity": "sha512-yzuaYXoRJBGMlBhsMJoUW7G1UmSb/eXr/JHYM/MsOJgavJibLwASijW7oXBdw3NQ6T0bW7Ty5P/VarOs9cHmqw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.8", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.16.10", + "@babel/types": "^7.16.8", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "dependencies": { + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.8.tgz", + "integrity": "sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + } + }, + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, + "@eslint/eslintrc": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz", + "integrity": "sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.2.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.6.0.tgz", + "integrity": "sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true + }, + "@lhncbc/ucum-lhc": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@lhncbc/ucum-lhc/-/ucum-lhc-4.1.4.tgz", + "integrity": "sha512-ErlXJv6lrerZbthxc33SWTKrZv4KjMIaCN2lNxsNrGZW4PqyVFEKDie6lok//SvC6QeEoAC1mWN8xD87r72qPQ==", + "requires": { + "csv-parse": "^4.4.6", + "csv-stringify": "^1.0.4", + "escape-html": "^1.0.3", + "is-integer": "^1.0.6", + "jsonfile": "^2.2.3", + "stream": "0.0.2", + "stream-transform": "^0.1.1", + "string-to-stream": "^1.1.0", + "xmldoc": "^0.4.0" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, + "@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "dev": true + }, + "@types/luxon": { + "version": "1.27.1", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.27.1.tgz", + "integrity": "sha512-cPiXpOvPFDr2edMnOXlz3UBDApwUfR+cpizvxCy0n3vp9bz/qe8BWzHPIEFcy+ogUOyjKuCISgyq77ELZPmkkg==", + "dev": true + }, + "@types/mocha": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.0.tgz", + "integrity": "sha512-QCWHkbMv4Y5U9oW10Uxbr45qMMSzl4OzijsozynUAgx3kEHUdXB00udx2dWDQ7f2TU2a2uuiFaRZjCe3unPpeg==", + "dev": true + }, + "@types/node": { + "version": "17.0.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.10.tgz", + "integrity": "sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==", + "dev": true + }, + "@types/test-console": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/test-console/-/test-console-2.0.0.tgz", + "integrity": "sha512-gaNsdiJjASZcf8uGLplJlfxOavCk0RhiPTD+vuDaALmkEwrFQbi1PQZ3PmkL1roWn5cGJGDsFSliu1j8mKwq1Q==", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.0.tgz", + "integrity": "sha512-XXVKnMsq2fuu9K2KsIxPUGqb6xAImz8MEChClbXmE3VbveFtBUU5bzM6IPVWqzyADIgdkS2Ws/6Xo7W2TeZWjQ==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/type-utils": "5.10.0", + "@typescript-eslint/utils": "5.10.0", + "debug": "^4.3.2", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/parser": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.0.tgz", + "integrity": "sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "debug": "^4.3.2" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.10.0.tgz", + "integrity": "sha512-tgNgUgb4MhqK6DoKn3RBhyZ9aJga7EQrw+2/OiDk5hKf3pTVZWyqBi7ukP+Z0iEEDMF5FDa64LqODzlfE4O/Dg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0" + } + }, + "@typescript-eslint/type-utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz", + "integrity": "sha512-TzlyTmufJO5V886N+hTJBGIfnjQDQ32rJYxPaeiyWKdjsv2Ld5l8cbS7pxim4DeNs62fKzRSt8Q14Evs4JnZyQ==", + "dev": true, + "requires": { + "@typescript-eslint/utils": "5.10.0", + "debug": "^4.3.2", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/types": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.0.tgz", + "integrity": "sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz", + "integrity": "sha512-x+7e5IqfwLwsxTdliHRtlIYkgdtYXzE0CkFeV6ytAqq431ZyxCFzNMNR5sr3WOlIG/ihVZr9K/y71VHTF/DUQA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/visitor-keys": "5.10.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.0.tgz", + "integrity": "sha512-IGYwlt1CVcFoE2ueW4/ioEwybR60RAdGeiJX/iDAw0t5w0wK3S7QncDwpmsM70nKgGTuVchEWB8lwZwHqPAWRg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.10.0", + "@typescript-eslint/types": "5.10.0", + "@typescript-eslint/typescript-estree": "5.10.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz", + "integrity": "sha512-GMxj0K1uyrFLPKASLmZzCuSddmjZVbVj3Ouy5QVuIGKZopxvOr24JsS7gruz6C3GExE01mublZ3mIBOaon9zuQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.10.0", + "eslint-visitor-keys": "^3.0.0" + } + }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, + "acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true + }, + "acorn-node": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", + "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==", + "dev": true, + "requires": { + "acorn": "^7.0.0", + "acorn-walk": "^7.0.0", + "xtend": "^4.0.2" + } + }, + "acorn-walk": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", + "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", + "dev": true + }, + "aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "requires": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + } + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "append-transform": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", + "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", + "dev": true, + "requires": { + "default-require-extensions": "^3.0.0" + } + }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "asn1": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "dev": true, + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true + } + } + }, + "assert": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", + "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", + "dev": true, + "requires": { + "object-assign": "^4.1.1", + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "bn.js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", + "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browser-pack": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz", + "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "combine-source-map": "~0.8.0", + "defined": "^1.0.0", + "safe-buffer": "^5.1.1", + "through2": "^2.0.0", + "umd": "^3.0.0" + } + }, + "browser-resolve": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz", + "integrity": "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==", + "dev": true, + "requires": { + "resolve": "^1.17.0" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "browserify": { + "version": "16.5.2", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-16.5.2.tgz", + "integrity": "sha512-TkOR1cQGdmXU9zW4YukWzWVSJwrxmNdADFbqbE3HFgQWe5wqZmOawqZ7J/8MPCwk/W8yY7Y0h+7mOtcZxLP23g==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "assert": "^1.4.0", + "browser-pack": "^6.0.1", + "browser-resolve": "^2.0.0", + "browserify-zlib": "~0.2.0", + "buffer": "~5.2.1", + "cached-path-relative": "^1.0.0", + "concat-stream": "^1.6.0", + "console-browserify": "^1.1.0", + "constants-browserify": "~1.0.0", + "crypto-browserify": "^3.0.0", + "defined": "^1.0.0", + "deps-sort": "^2.0.0", + "domain-browser": "^1.2.0", + "duplexer2": "~0.1.2", + "events": "^2.0.0", + "glob": "^7.1.0", + "has": "^1.0.0", + "htmlescape": "^1.1.0", + "https-browserify": "^1.0.0", + "inherits": "~2.0.1", + "insert-module-globals": "^7.0.0", + "labeled-stream-splicer": "^2.0.0", + "mkdirp-classic": "^0.5.2", + "module-deps": "^6.2.3", + "os-browserify": "~0.3.0", + "parents": "^1.0.1", + "path-browserify": "~0.0.0", + "process": "~0.11.0", + "punycode": "^1.3.2", + "querystring-es3": "~0.2.0", + "read-only-stream": "^2.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.4", + "shasum": "^1.0.0", + "shell-quote": "^1.6.1", + "stream-browserify": "^2.0.0", + "stream-http": "^3.0.0", + "string_decoder": "^1.1.1", + "subarg": "^1.0.0", + "syntax-error": "^1.1.1", + "through2": "^2.0.0", + "timers-browserify": "^1.0.1", + "tty-browserify": "0.0.1", + "url": "~0.11.0", + "util": "~0.10.1", + "vm-browserify": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", + "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", + "dev": true, + "requires": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", + "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "dev": true, + "requires": { + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.3", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, + "browserslist": { + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", + "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", + "escalade": "^3.1.1", + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" + } + }, + "buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", + "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "cached-path-relative": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.1.0.tgz", + "integrity": "sha512-WF0LihfemtesFcJgO7xfOoOcnWzY/QHR4qeDqV44jPU3HTI54+LnfXK3SA27AVVGCdZFgjjFFaqUA9Jx7dMJZA==", + "dev": true + }, + "caching-transform": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", + "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", + "dev": true, + "requires": { + "hasha": "^5.0.0", + "make-dir": "^3.0.0", + "package-hash": "^4.0.0", + "write-file-atomic": "^3.0.0" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001304", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001304.tgz", + "integrity": "sha512-bdsfZd6K6ap87AGqSHJP/s1V+U6Z5lyrcbBu3ovbCCf8cSYpwTtGrCBObMpJqwxfTbLW6YTIdbb1jEeTelcpYQ==", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "combine-source-map": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", + "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", + "dev": true, + "requires": { + "convert-source-map": "~1.1.0", + "inline-source-map": "~0.6.0", + "lodash.memoize": "~3.0.3", + "source-map": "~0.5.3" + } + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "console-browserify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", + "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", + "dev": true + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "convert-source-map": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", + "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "coveralls": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.1.0.tgz", + "integrity": "sha512-sHxOu2ELzW8/NC1UP5XVLbZDzO4S3VxfFye3XYCznopHy02YjNkHcj5bKaVw2O7hVaBdBjEdQGpie4II1mWhuQ==", + "dev": true, + "requires": { + "js-yaml": "^3.13.1", + "lcov-parse": "^1.0.0", + "log-driver": "^1.2.7", + "minimist": "^1.2.5", + "request": "^2.88.2" + } + }, + "create-ecdh": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", + "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true + } + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "csv-parse": { + "version": "4.16.3", + "resolved": "https://registry.npmjs.org/csv-parse/-/csv-parse-4.16.3.tgz", + "integrity": "sha512-cO1I/zmz4w2dcKHVvpCr7JVRu8/FymG5OEpmvsZYlccYolPBLoVGKUHgNoc4ZGkFeFlWGEDmMyBM+TTqRdW/wg==" + }, + "csv-stringify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-1.1.2.tgz", + "integrity": "sha1-d6QVJlgbzjOA8SsA18W7rHDIK1g=", + "requires": { + "lodash.get": "~4.4.2" + } + }, + "dash-ast": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", + "integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "default-require-extensions": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", + "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", + "dev": true, + "requires": { + "strip-bom": "^4.0.0" + } + }, + "defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", + "dev": true + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "deps-sort": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.1.tgz", + "integrity": "sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "shasum-object": "^1.0.0", + "subarg": "^1.0.0", + "through2": "^2.0.0" + } + }, + "des.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "detective": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/detective/-/detective-5.2.0.tgz", + "integrity": "sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg==", + "dev": true, + "requires": { + "acorn-node": "^1.6.1", + "defined": "^1.0.0", + "minimist": "^1.1.1" + } + }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true + } + } + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "domain-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", + "dev": true + }, + "duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "electron-to-chromium": { + "version": "1.4.60", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.60.tgz", + "integrity": "sha512-h53hbEiKC6hijelDgxgkgAUC3PKyR7TmIfvjHnBjUGPMg/3sBuTyG6eDormw+lY24uUJvHkUPzB8dpK8b2u3Sw==", + "dev": true + }, + "elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dev": true, + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true + } + } + }, + "emitter-component": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/emitter-component/-/emitter-component-1.1.1.tgz", + "integrity": "sha1-Bl4tvtaVm/RwZ57avq95gdEAOrY=" + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.0.1.tgz", + "integrity": "sha512-LsgcwZgQ72vZ+SMp4K6pAnk2yFDWL7Ti4pJaRvsZ0Hsw2h8ZjUIW38a9AFn2cZXdBMlScMFYYgsSp4ttFI/0bA==", + "dev": true, + "requires": { + "@eslint/eslintrc": "^1.0.3", + "@humanwhocodes/config-array": "^0.6.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^6.0.0", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.0.0", + "espree": "^9.0.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.2.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "eslint-scope": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-6.0.0.tgz", + "integrity": "sha512-uRDL9MWmQCkaFus8RF5K9/L/2fn+80yoW3jkD53l4shjCh26fCtvJGasxjUqP5OT87SYTxCVA3BwTUzuELx9kA==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + } + } + }, + "eslint-config-prettier": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz", + "integrity": "sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw==", + "dev": true, + "requires": { + "get-stdin": "^6.0.0" + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz", + "integrity": "sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ==", + "dev": true + }, + "espree": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.0.tgz", + "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==", + "dev": true, + "requires": { + "acorn": "^8.7.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.1.0" + }, + "dependencies": { + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "events": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/events/-/events-2.1.0.tgz", + "integrity": "sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg==", + "dev": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "dev": true + }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "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==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "dev": true + }, + "foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fromentries": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", + "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, + "get-assigned-identifiers": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", + "integrity": "sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, + "get-stdin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "dev": true, + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dev": true, + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hasha": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", + "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", + "dev": true, + "requires": { + "is-stream": "^2.0.0", + "type-fest": "^0.8.0" + }, + "dependencies": { + "type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true + } + } + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "htmlescape": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", + "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=", + "dev": true + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true + }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "inline-source-map": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", + "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", + "dev": true, + "requires": { + "source-map": "~0.5.3" + } + }, + "insert-module-globals": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.1.tgz", + "integrity": "sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "acorn-node": "^1.5.2", + "combine-source-map": "^0.8.0", + "concat-stream": "^1.6.1", + "is-buffer": "^1.1.0", + "path-is-absolute": "^1.0.1", + "process": "~0.11.0", + "through2": "^2.0.0", + "undeclared-identifiers": "^1.1.2", + "xtend": "^4.0.0" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-core-module": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", + "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-finite": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", + "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==" + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-integer": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-integer/-/is-integer-1.0.7.tgz", + "integrity": "sha1-a96Bqs3feLZZtmKdYpytxRqIbVw=", + "requires": { + "is-finite": "^1.0.0" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true + }, + "istanbul-lib-hook": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", + "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", + "dev": true, + "requires": { + "append-transform": "^2.0.0" + } + }, + "istanbul-lib-instrument": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", + "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", + "dev": true, + "requires": { + "@babel/core": "^7.7.5", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "istanbul-lib-processinfo": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.2.tgz", + "integrity": "sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw==", + "dev": true, + "requires": { + "archy": "^1.0.0", + "cross-spawn": "^7.0.0", + "istanbul-lib-coverage": "^3.0.0-alpha.1", + "make-dir": "^3.0.0", + "p-map": "^3.0.0", + "rimraf": "^3.0.0", + "uuid": "^3.3.3" + } + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.3.tgz", + "integrity": "sha512-x9LtDVtfm/t1GFiLl3NffC7hz+I1ragvgX1P/Lg1NlIagifZDKUkuuaAxH/qpwj2IuEfD8G2Bs/UKp+sZ/pKkg==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-schema": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", + "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", + "dev": true, + "requires": { + "jsonify": "~0.0.0" + } + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", + "dev": true + }, + "jsprim": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", + "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + } + }, + "labeled-stream-splicer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz", + "integrity": "sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "stream-splicer": "^2.0.0" + } + }, + "lcov-parse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-1.0.0.tgz", + "integrity": "sha1-6w1GtUER68VhrLTECO+TY73I9+A=", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", + "dev": true + }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" + }, + "lodash.memoize": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", + "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "log-driver": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", + "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", + "dev": true + }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "luxon": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.26.0.tgz", + "integrity": "sha512-+V5QIQ5f6CDXQpWNICELwjwuHdqeJM1UenlZWx5ujcRMc9venvluCjFb4t5NYLhb6IhkbMVOxzVuOqkgMxee2A==" + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true + } + } + }, + "mime-db": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", + "dev": true + }, + "mime-types": { + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "dev": true, + "requires": { + "mime-db": "1.51.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true + }, + "mocha": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.0.tgz", + "integrity": "sha512-kNn7E8g2SzVcq0a77dkphPsDSN7P+iYkqE0ZsGCYWRsoiKjOt+NvXfaagik8vuDa6W5Zw3qxe8Jfpt5qKf+6/Q==", + "dev": true, + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.3", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.2.0", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.2.0", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "workerpool": "6.2.0", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "module-deps": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.3.tgz", + "integrity": "sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "browser-resolve": "^2.0.0", + "cached-path-relative": "^1.0.2", + "concat-stream": "~1.6.0", + "defined": "^1.0.0", + "detective": "^5.2.0", + "duplexer2": "^0.1.2", + "inherits": "^2.0.1", + "parents": "^1.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.4.0", + "stream-combiner2": "^1.1.1", + "subarg": "^1.0.0", + "through2": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "nanoid": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node-preload": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", + "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", + "dev": true, + "requires": { + "process-on-spawn": "^1.0.0" + } + }, + "node-releases": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "nyc": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", + "integrity": "sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==", + "dev": true, + "requires": { + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "caching-transform": "^4.0.0", + "convert-source-map": "^1.7.0", + "decamelize": "^1.2.0", + "find-cache-dir": "^3.2.0", + "find-up": "^4.1.0", + "foreground-child": "^2.0.0", + "get-package-type": "^0.1.0", + "glob": "^7.1.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-hook": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-processinfo": "^2.0.2", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "make-dir": "^3.0.0", + "node-preload": "^0.2.1", + "p-map": "^3.0.0", + "process-on-spawn": "^1.0.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "spawn-wrap": "^2.0.0", + "test-exclude": "^6.0.0", + "yargs": "^15.0.2" + }, + "dependencies": { + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true + }, + "yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + }, + "yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "package-hash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", + "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.15", + "hasha": "^5.0.0", + "lodash.flattendeep": "^4.4.0", + "release-zalgo": "^1.0.0" + } + }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parents": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", + "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", + "dev": true, + "requires": { + "path-platform": "~0.11.15" + } + }, + "parse-asn1": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", + "dev": true, + "requires": { + "asn1.js": "^5.2.0", + "browserify-aes": "^1.0.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "path-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", + "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-platform": { + "version": "0.11.15", + "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", + "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "dev": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + } + } + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "process-on-spawn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", + "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", + "dev": true, + "requires": { + "fromentries": "^1.2.0" + } + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "dev": true + }, + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", + "dev": true + } + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", + "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "dev": true + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "read-only-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", + "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "release-zalgo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", + "integrity": "sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA=", + "dev": true, + "requires": { + "es6-error": "^4.0.1" + } + }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "resolve": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, + "requires": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shasum": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz", + "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", + "dev": true, + "requires": { + "json-stable-stringify": "~0.0.0", + "sha.js": "~2.4.4" + } + }, + "shasum-object": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shasum-object/-/shasum-object-1.0.0.tgz", + "integrity": "sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg==", + "dev": true, + "requires": { + "fast-safe-stringify": "^2.0.7" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "shell-quote": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz", + "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==", + "dev": true + }, + "should": { + "version": "13.2.3", + "resolved": "https://registry.npmjs.org/should/-/should-13.2.3.tgz", + "integrity": "sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==", + "dev": true, + "requires": { + "should-equal": "^2.0.0", + "should-format": "^3.0.3", + "should-type": "^1.4.0", + "should-type-adaptors": "^1.0.1", + "should-util": "^1.0.0" + } + }, + "should-equal": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/should-equal/-/should-equal-2.0.0.tgz", + "integrity": "sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==", + "dev": true, + "requires": { + "should-type": "^1.4.0" + } + }, + "should-format": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=", + "dev": true, + "requires": { + "should-type": "^1.3.0", + "should-type-adaptors": "^1.0.1" + } + }, + "should-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=", + "dev": true + }, + "should-type-adaptors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz", + "integrity": "sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==", + "dev": true, + "requires": { + "should-type": "^1.3.0", + "should-util": "^1.0.0" + } + }, + "should-util": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/should-util/-/should-util-1.0.1.tgz", + "integrity": "sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==", + "dev": true + }, + "signal-exit": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", + "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==", + "dev": true + }, + "simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "spawn-wrap": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", + "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", + "dev": true, + "requires": { + "foreground-child": "^2.0.0", + "is-windows": "^1.0.2", + "make-dir": "^3.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "which": "^2.0.1" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz", + "integrity": "sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "stream": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stream/-/stream-0.0.2.tgz", + "integrity": "sha1-f1Nj8Ff2WSxVlfALyAon9c7B8O8=", + "requires": { + "emitter-component": "^1.1.1" + } + }, + "stream-browserify": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz", + "integrity": "sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg==", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-combiner2": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", + "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", + "dev": true, + "requires": { + "duplexer2": "~0.1.0", + "readable-stream": "^2.0.2" + } + }, + "stream-http": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.2.0.tgz", + "integrity": "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==", + "dev": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "stream-splicer": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.1.tgz", + "integrity": "sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-transform": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/stream-transform/-/stream-transform-0.1.2.tgz", + "integrity": "sha1-fY5rTgOsR4F3j4x5UXUBv7B2Kp8=" + }, + "string-to-stream": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string-to-stream/-/string-to-stream-1.1.1.tgz", + "integrity": "sha512-QySF2+3Rwq0SdO3s7BAp4x+c3qsClpPQ6abAmb0DGViiSBAkT5kL6JT2iyzEVP+T1SmzHrQD1TwlP9QAHCc+Sw==", + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.1.0" + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "subarg": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", + "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", + "dev": true, + "requires": { + "minimist": "^1.1.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "syntax-error": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", + "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", + "dev": true, + "requires": { + "acorn-node": "^1.2.0" + } + }, + "test-console": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/test-console/-/test-console-2.0.0.tgz", + "integrity": "sha512-ciILzfCQCny8zy1+HEw2yBLKus7LNMsAHymsp2fhvGTVh5pWE5v2EB7V+5ag3WM9aO2ULtgsXVQePWYE+fb7pA==", + "dev": true + }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "timers-browserify": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", + "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", + "dev": true, + "requires": { + "process": "~0.11.0" + } + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "dependencies": { + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + } + } + }, + "ts-node": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz", + "integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "yn": "3.1.1" + }, + "dependencies": { + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + } + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "tty-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", + "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true + }, + "umd": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", + "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", + "dev": true + }, + "undeclared-identifiers": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz", + "integrity": "sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw==", + "dev": true, + "requires": { + "acorn-node": "^1.3.0", + "dash-ast": "^1.0.0", + "get-assigned-identifiers": "^1.2.0", + "simple-concat": "^1.0.0", + "xtend": "^4.0.1" + } + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + } + } + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "vm-browserify": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", + "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "workerpool": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", + "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "xml-js": { + "version": "1.6.11", + "resolved": "https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz", + "integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==", + "dev": true, + "requires": { + "sax": "^1.2.4" + } + }, + "xmldoc": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/xmldoc/-/xmldoc-0.4.0.tgz", + "integrity": "sha1-0lciS+g5PqrL+DfvIn/Y7CWzaIg=", + "requires": { + "sax": "~1.1.1" + }, + "dependencies": { + "sax": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.1.6.tgz", + "integrity": "sha1-XWFr6KXmB9VOEUr65Vt+ry/MMkA=" + } + } + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/package.json b/package.json index 85360bfa1..50cd53fe8 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,10 @@ { "name": "Dylan Mahalingam", "email": "kmahalingam@mitre.org" + }, + { + "name": "Matthew Gramigna", + "email": "mgramigna@mitre.org" } ], "repository": { @@ -62,9 +66,12 @@ "url": "https://github.com/cqframework/cql-execution.git" }, "devDependencies": { - "@babel/cli": "^7.15.7", - "@babel/core": "^7.15.8", - "@babel/preset-env": "^7.15.8", + "@types/luxon": "1", + "@types/mocha": "^9.1.0", + "@types/node": "^17.0.10", + "@types/test-console": "^2.0.0", + "@typescript-eslint/eslint-plugin": "^5.10.0", + "@typescript-eslint/parser": "^5.10.0", "browserify": "^16.5.1", "coveralls": "^3.1.0", "eslint": "^8.0.1", @@ -74,6 +81,8 @@ "prettier": "^2.1.1", "should": "^13.2.3", "test-console": "^2.0.0", + "ts-node": "^10.4.0", + "typescript": "^4.5.4", "xml-js": "^1.6.11" }, "dependencies": { @@ -85,25 +94,26 @@ "ansi-regex": "^5.0.1" }, "main": "lib/cql", + "types": "lib/cql.d.ts", "directories": { "lib": "lib" }, "scripts": { - "prepublish": "npm run build --scripts-prepend-node-path && npm run build:browserify --scripts-prepend-node-path", - "build": "babel src --out-dir lib", - "build:browserify": "node ./bin/browserify.js", + "prepare": "npm run build && npm run build:browserify", + "build": "tsc", + "build:browserify": "npm run build && node ./bin/browserify.js", "build:test-data": "cd ./test/generator && ./gradlew generateTestData && cd ..", "build:spec-test-data": "node test/spec-tests/generate-cql.js && cd ./test/generator && ./gradlew generateSpecTestData && cd ..", - "build:all": "npm run build --scripts-prepend-node-path && npm run build:browserify --scripts-prepend-node-path && npm run build:test-data --scripts-prepend-node-path && npm run build:spec-test-data --scripts-prepend-node-path", + "build:all": "npm run build && npm run build:browserify && npm run build:test-data && npm run build:spec-test-data", "watch:test-data": "cd ./test/generator && ./gradlew watchTestData && cd ..", - "test": "mocha --reporter spec --recursive", - "test:nyc": "nyc --reporter=html npx mocha --reporter spec --recursive", - "test:watch": "mocha --reporter spec --recursive --watch", + "test": "TS_NODE_PROJECT=\"./tsconfig.test.json\" TS_NODE_FILES=true mocha --reporter spec --recursive", + "test:nyc": "TS_NODE_PROJECT=\"./tsconfig.test.json\" TS_NODE_FILES=true nyc --reporter=html npx mocha --reporter spec --recursive", + "test:watch": "TS_NODE_PROJECT=\"./tsconfig.test.json\" TS_NODE_FILES=true mocha --reporter spec --recursive --watch", "lint": "eslint .", "lint:fix": "eslint . --fix", - "prettier": "prettier --check \"**/*.js\"", - "prettier:fix": "prettier --write \"**/*.js\"", - "test:plus": "npm test --scripts-prepend-node-path && npm run build --scripts-prepend-node-path && npm run lint --scripts-prepend-node-path && npm run prettier --scripts-prepend-node-path" + "prettier": "prettier --check \"**/*.{js,ts}\"", + "prettier:fix": "prettier --write \"**/*.{js,ts}\"", + "test:plus": "npm test && npm run build && npm run lint && npm run prettier" }, "license": "Apache-2.0" } diff --git a/src/cql-code-service.js b/src/cql-code-service.ts similarity index 51% rename from src/cql-code-service.js rename to src/cql-code-service.ts index bc852efa0..92d87ad25 100644 --- a/src/cql-code-service.js +++ b/src/cql-code-service.ts @@ -1,32 +1,35 @@ -const { Code, ValueSet } = require('./datatypes/datatypes'); +import { Code, ValueSet } from './datatypes/datatypes'; +import { TerminologyProvider, ValueSetDictionary, ValueSetObject } from './types'; -class CodeService { - constructor(valueSetsJson = {}) { +export class CodeService implements TerminologyProvider { + valueSets: ValueSetObject; + + constructor(valueSetsJson: ValueSetDictionary = {}) { this.valueSets = {}; - for (let oid in valueSetsJson) { + for (const oid in valueSetsJson) { this.valueSets[oid] = {}; - for (let version in valueSetsJson[oid]) { + for (const version in valueSetsJson[oid]) { const codes = valueSetsJson[oid][version].map( - code => new Code(code.code, code.system, code.version) + (code: any) => new Code(code.code, code.system, code.version) ); this.valueSets[oid][version] = new ValueSet(oid, version, codes); } } } - findValueSetsByOid(oid) { + findValueSetsByOid(oid: string): ValueSet[] { return this.valueSets[oid] ? Object.values(this.valueSets[oid]) : []; } - findValueSet(oid, version) { + findValueSet(oid: string, version?: string): ValueSet | null { if (version != null) { - return this.valueSets[oid] != null ? this.valueSets[oid][version] : undefined; + return this.valueSets[oid] != null ? this.valueSets[oid][version] : null; } else { const results = this.findValueSetsByOid(oid); if (results.length === 0) { return null; } else { - return results.reduce((a, b) => { + return results.reduce((a: any, b: any) => { if (a.version > b.version) { return a; } else { @@ -37,5 +40,3 @@ class CodeService { } } } - -module.exports.CodeService = CodeService; diff --git a/src/cql-patient.js b/src/cql-patient.ts similarity index 75% rename from src/cql-patient.js rename to src/cql-patient.ts index a77ce37d7..36cb526c1 100644 --- a/src/cql-patient.js +++ b/src/cql-patient.ts @@ -1,18 +1,22 @@ -const DT = require('./datatypes/datatypes'); +import * as DT from './datatypes/datatypes'; +import { DataProvider, NamedTypeSpecifier, PatientObject, RecordObject } from './types'; -class Record { - constructor(json) { +export class Record implements RecordObject { + json: any; + id: string; + + constructor(json: any) { this.json = json; this.id = this.json.id; } - _is(typeSpecifier) { + _is(typeSpecifier: NamedTypeSpecifier) { return this._typeHierarchy().some( t => t.type === typeSpecifier.type && t.name == typeSpecifier.name ); } - _typeHierarchy() { + _typeHierarchy(): NamedTypeSpecifier[] { return [ { name: `{https://github.com/cqframework/cql-execution/simple}${this.json.recordType}`, @@ -26,7 +30,7 @@ class Record { ]; } - _recursiveGet(field) { + _recursiveGet(field: any): any { if (field != null && field.indexOf('.') >= 0) { const [root, rest] = field.split('.', 2); return new Record(this._recursiveGet(root))._recursiveGet(rest); @@ -34,7 +38,7 @@ class Record { return this.json[field]; } - get(field) { + get(field: any) { // the model should return the correct type for the field. For this simple model example, // we just cheat and use the shape of the value to determine it. Real implementations should // have a more sophisticated approach @@ -55,7 +59,7 @@ class Record { return this.id; } - getDate(field) { + getDate(field: any) { const val = this._recursiveGet(field); if (val != null) { return DT.DateTime.parse(val); @@ -64,7 +68,7 @@ class Record { } } - getInterval(field) { + getInterval(field: any) { const val = this._recursiveGet(field); if (val != null && typeof val === 'object') { const low = val.low != null ? DT.DateTime.parse(val.low) : null; @@ -73,7 +77,7 @@ class Record { } } - getDateOrInterval(field) { + getDateOrInterval(field: any) { const val = this._recursiveGet(field); if (val != null && typeof val === 'object') { return this.getInterval(field); @@ -82,7 +86,7 @@ class Record { } } - getCode(field) { + getCode(field: any) { const val = this._recursiveGet(field); if (val != null && typeof val === 'object') { return new DT.Code(val.code, val.system, val.version); @@ -90,14 +94,19 @@ class Record { } } -class Patient extends Record { - constructor(json) { +export class Patient extends Record implements PatientObject { + name?: string; + gender?: string; + birthDate?: DT.DateTime | null; + records: { [recordType: string]: Record[] }; + + constructor(json: any) { super(json); this.name = json.name; this.gender = json.gender; this.birthDate = json.birthDate != null ? DT.DateTime.parse(json.birthDate) : undefined; this.records = {}; - (json.records || []).forEach(r => { + (json.records || []).forEach((r: any) => { if (this.records[r.recordType] == null) { this.records[r.recordType] = []; } @@ -105,13 +114,18 @@ class Patient extends Record { }); } - findRecords(profile) { + findRecords(profile: string | null): Record[] { if (profile == null) { return []; } - const recordType = profile.match( + + const match = profile.match( /(\{https:\/\/github\.com\/cqframework\/cql-execution\/simple\})?(.*)/ - )[2]; + ); + + if (match == null) return []; + + const recordType = match[2]; if (recordType === 'Patient') { return [this]; } else { @@ -120,8 +134,11 @@ class Patient extends Record { } } -class PatientSource { - constructor(patients) { +export class PatientSource implements DataProvider { + patients: any[]; + current?: Patient; + + constructor(patients: any) { this.patients = patients; this.nextPatient(); } @@ -136,6 +153,3 @@ class PatientSource { return this.current; } } - -module.exports.Patient = Patient; -module.exports.PatientSource = PatientSource; diff --git a/src/cql.js b/src/cql.js deleted file mode 100644 index 20cd98f65..000000000 --- a/src/cql.js +++ /dev/null @@ -1,42 +0,0 @@ -const library = require('./elm/library'); -const expression = require('./elm/expression'); -const repository = require('./runtime/repository'); -const context = require('./runtime/context'); -const exec = require('./runtime/executor'); -const listeners = require('./runtime/messageListeners'); -const results = require('./runtime/results'); -const datatypes = require('./datatypes/datatypes'); -const patient = require('./cql-patient'); -const codeservice = require('./cql-code-service'); - -// Library-related classes -module.exports.Library = library.Library; -module.exports.Repository = repository.Repository; -module.exports.Expression = expression.Expression; - -// Execution-related classes -module.exports.Context = context.Context; -module.exports.Executor = exec.Executor; -module.exports.PatientContext = context.PatientContext; -module.exports.UnfilteredContext = context.UnfilteredContext; -module.exports.Results = results.Results; -module.exports.ConsoleMessageListener = listeners.ConsoleMessageListener; -module.exports.NullMessageListener = listeners.NullMessageListener; - -// PatientSource-related classes -module.exports.Patient = patient.Patient; -module.exports.PatientSource = patient.PatientSource; - -// TerminologyService-related classes -module.exports.CodeService = codeservice.CodeService; - -// DataType classes -module.exports.Code = datatypes.Code; -module.exports.CodeSystem = datatypes.CodeSystem; -module.exports.Concept = datatypes.Concept; -module.exports.Date = datatypes.Date; -module.exports.DateTime = datatypes.DateTime; -module.exports.Interval = datatypes.Interval; -module.exports.Quantity = datatypes.Quantity; -module.exports.Ratio = datatypes.Ratio; -module.exports.ValueSet = datatypes.ValueSet; diff --git a/src/cql.ts b/src/cql.ts new file mode 100644 index 000000000..d34fa7c41 --- /dev/null +++ b/src/cql.ts @@ -0,0 +1,82 @@ +// Library-related classes +import { Library } from './elm/library'; +import { Repository } from './runtime/repository'; +import { Expression } from './elm/expression'; + +// Execution-related classes +import { Context, PatientContext, UnfilteredContext } from './runtime/context'; +import { Executor } from './runtime/executor'; +import { Results } from './runtime/results'; +import { ConsoleMessageListener, NullMessageListener } from './runtime/messageListeners'; + +// PatientSource-related classes +import { Patient, PatientSource } from './cql-patient'; + +// TerminologyService-related classes +import { CodeService } from './cql-code-service'; + +// DataType classes +import { + Code, + CodeSystem, + Concept, + Date, + DateTime, + Interval, + Quantity, + Ratio, + ValueSet +} from './datatypes/datatypes'; + +// Custom Types +export * from './types'; + +export { + Library, + Repository, + Expression, + Context, + PatientContext, + UnfilteredContext, + Executor, + Results, + ConsoleMessageListener, + NullMessageListener, + Patient, + PatientSource, + CodeService, + Code, + CodeSystem, + Concept, + Date, + DateTime, + Interval, + Quantity, + Ratio, + ValueSet +}; + +export default { + Library, + Repository, + Expression, + Context, + PatientContext, + UnfilteredContext, + Executor, + Results, + ConsoleMessageListener, + NullMessageListener, + Patient, + PatientSource, + CodeService, + Code, + CodeSystem, + Concept, + Date, + DateTime, + Interval, + Quantity, + Ratio, + ValueSet +}; diff --git a/src/datatypes/clinical.js b/src/datatypes/clinical.ts similarity index 68% rename from src/datatypes/clinical.js rename to src/datatypes/clinical.ts index ec8c1e59a..3a14f43a5 100644 --- a/src/datatypes/clinical.js +++ b/src/datatypes/clinical.ts @@ -1,18 +1,18 @@ -const { typeIsArray } = require('../util/util'); +import { typeIsArray } from '../util/util'; -class Code { - constructor(code, system, version, display) { - this.code = code; - this.system = system; - this.version = version; - this.display = display; - } +export class Code { + constructor( + public code: string, + public system?: string, + public version?: string, + public display?: string + ) {} get isCode() { return true; } - hasMatch(code) { + hasMatch(code: any) { if (typeof code === 'string') { // the specific behavior for this is not in the specification. Matching codesystem behavior. return code === this.code; @@ -22,39 +22,36 @@ class Code { } } -class Concept { - constructor(codes, display) { - this.codes = codes || []; - this.display = display; +export class Concept { + constructor(public codes: any[], public display?: string) { + this.codes ||= []; } get isConcept() { return true; } - hasMatch(code) { + hasMatch(code: any) { return codesInList(toCodeList(code), this.codes); } } -class ValueSet { - constructor(oid, version, codes) { - this.oid = oid; - this.version = version; - this.codes = codes || []; +export class ValueSet { + constructor(public oid: string, public version?: string, public codes: any[] = []) { + this.codes ||= []; } get isValueSet() { return true; } - hasMatch(code) { + hasMatch(code: any) { const codesList = toCodeList(code); // InValueSet String Overload if (codesList.length === 1 && typeof codesList[0] === 'string') { let matchFound = false; let multipleCodeSystemsExist = false; - for (let codeItem of this.codes) { + for (const codeItem of this.codes) { // Confirm all code systems match if (codeItem.system !== this.codes[0].system) { multipleCodeSystemsExist = true; @@ -75,12 +72,12 @@ class ValueSet { } } -function toCodeList(c) { +function toCodeList(c: any): any { if (c == null) { return []; } else if (typeIsArray(c)) { - let list = []; - for (let c2 of c) { + let list: any = []; + for (const c2 of c) { list = list.concat(toCodeList(c2)); } return list; @@ -91,10 +88,10 @@ function toCodeList(c) { } } -function codesInList(cl1, cl2) { +function codesInList(cl1: any, cl2: any) { // test each code in c1 against each code in c2 looking for a match - return cl1.some(c1 => - cl2.some(c2 => { + return cl1.some((c1: any) => + cl2.some((c2: any) => { // only the left argument (cl1) can contain strings. cl2 will only contain codes. if (typeof c1 === 'string') { // for "string in codesystem" this should compare the string to @@ -107,15 +104,10 @@ function codesInList(cl1, cl2) { ); } -function codesMatch(code1, code2) { +function codesMatch(code1: Code, code2: Code) { return code1.code === code2.code && code1.system === code2.system; } -class CodeSystem { - constructor(id, version) { - this.id = id; - this.version = version; - } +export class CodeSystem { + constructor(public id: string, public version?: string) {} } - -module.exports = { Code, Concept, ValueSet, CodeSystem }; diff --git a/src/datatypes/datatypes.js b/src/datatypes/datatypes.js deleted file mode 100644 index f6fa29dd1..000000000 --- a/src/datatypes/datatypes.js +++ /dev/null @@ -1,14 +0,0 @@ -const logic = require('./logic'); -const clinical = require('./clinical'); -const uncertainty = require('./uncertainty'); -const datetime = require('./datetime'); -const interval = require('./interval'); -const quantity = require('./quantity'); -const ratio = require('./ratio'); - -const libs = [logic, clinical, uncertainty, datetime, interval, quantity, ratio]; -for (let lib of libs) { - for (let element of Object.keys(lib)) { - module.exports[element] = lib[element]; - } -} diff --git a/src/datatypes/datatypes.ts b/src/datatypes/datatypes.ts new file mode 100644 index 000000000..aa00c71cd --- /dev/null +++ b/src/datatypes/datatypes.ts @@ -0,0 +1,7 @@ +export * from './logic'; +export * from './clinical'; +export * from './uncertainty'; +export * from './datetime'; +export * from './interval'; +export * from './quantity'; +export * from './ratio'; diff --git a/src/datatypes/datetime.js b/src/datatypes/datetime.ts similarity index 53% rename from src/datatypes/datetime.js rename to src/datatypes/datetime.ts index 9ae185dc3..222290713 100644 --- a/src/datatypes/datetime.js +++ b/src/datatypes/datetime.ts @@ -1,10 +1,19 @@ -const { Uncertainty } = require('./uncertainty'); -const { +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { Uncertainty } from './uncertainty'; +import { jsDate, normalizeMillisecondsField, normalizeMillisecondsFieldInString -} = require('../util/util'); -const luxon = require('luxon'); +} from '../util/util'; +import { + Duration, + DurationUnit, + DateTime as LuxonDateTime, + DurationObjectUnits, + FixedOffsetZone +} from 'luxon'; + +type DateTimeUnit = keyof DurationObjectUnits; // It's easiest and most performant to organize formats by length of the supported strings. // This way we can test strings only against the formats that have a chance of working. @@ -18,7 +27,7 @@ const LENGTH_TO_DATE_FORMAT_MAP = (() => { })(); const LENGTH_TO_DATETIME_FORMATS_MAP = (() => { - const formats = { + const formats: any = { yyyy: '2012', 'yyyy-MM': '2012-01', 'yyyy-MM-dd': '2012-01-31', @@ -49,25 +58,509 @@ const LENGTH_TO_DATETIME_FORMATS_MAP = (() => { return ltdtfMap; })(); -function wholeLuxonDuration(duration, unit) { +function wholeLuxonDuration(duration: Duration, unit: DurationUnit) { const value = duration.get(unit); return value >= 0 ? Math.floor(value) : Math.ceil(value); } -function truncateLuxonDateTime(luxonDT, unit) { +function truncateLuxonDateTime(luxonDT: LuxonDateTime, unit: DateTimeUnit) { // Truncating by week (to the previous Sunday) requires different logic than the rest if (unit === DateTime.Unit.WEEK) { // Sunday is ISO weekday 7 if (luxonDT.weekday !== 7) { luxonDT = luxonDT.set({ weekday: 7 }).minus({ weeks: 1 }); } - unit = DateTime.Unit.DAY; + unit = DateTime.Unit.DAY as DateTimeUnit; } return luxonDT.startOf(unit); } -class DateTime { - static parse(string) { +/* + * Base class for Date and DateTime to extend from + * Implements shared functions by both classes + * TODO: we can probably iterate on this more to improve the accessing of "FIELDS" and the overall structure + * TODO: we can also investigate if it's reasonable for DateTime to extend Date directly instead + */ +abstract class AbstractDate { + constructor( + public year: number | null = null, + public month: number | null = null, + public day: number | null = null + ) {} + + // Implemented by subclasses + abstract getPrecision(): string | null; + abstract getDateTime(): DateTime; + abstract copy(): AbstractDate; + abstract toLuxonDateTime(): LuxonDateTime; + abstract isDate: boolean; + abstract isDateTime: boolean; + + // Shared functions + isPrecise() { + // @ts-ignore + return this.constructor.FIELDS.every(field => this[field] != null); + } + + isImprecise() { + return !this.isPrecise(); + } + + isMorePrecise(other: any) { + // @ts-ignore + if (typeof other === 'string' && this.constructor.FIELDS.includes(other)) { + // @ts-ignore + if (this[other] == null) { + return false; + } + } else { + // @ts-ignore + for (const field of this.constructor.FIELDS) { + // @ts-ignore + if (other[field] != null && this[field] == null) { + return false; + } + } + } + + return !this.isSamePrecision(other); + } + // This function can take another Date-ish object, or a precision string (e.g. 'month') + isLessPrecise(other: any) { + return !this.isSamePrecision(other) && !this.isMorePrecise(other); + } + + // This function can take another Date-ish object, or a precision string (e.g. 'month') + isSamePrecision(other: any) { + // @ts-ignore + if (typeof other === 'string' && this.constructor.FIELDS.includes(other)) { + return other === this.getPrecision(); + } + + // @ts-ignore + for (const field of this.constructor.FIELDS) { + // @ts-ignore + if (this[field] != null && other[field] == null) { + return false; + } + // @ts-ignore + if (this[field] == null && other[field] != null) { + return false; + } + } + return true; + } + + equals(other: any) { + return compareWithDefaultResult(this, other, null); + } + + equivalent(other: any) { + return compareWithDefaultResult(this, other, false); + } + + sameAs(other: any, precision?: any): boolean | null { + if (!(other.isDate || other.isDateTime)) { + return null; + } else if (this.isDate && other.isDateTime) { + return this.getDateTime().sameAs(other, precision); + } else if ((this as any).isDateTime && other.isDate) { + other = other.getDateTime(); + } + + // @ts-ignore + if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { + throw new Error(`Invalid precision: ${precision}`); + } + + // make a copy of other in the correct timezone offset if they don't match. + if ((this as any).timezoneOffset !== other.timezoneOffset) { + other = other.convertToTimezoneOffset((this as any).timezoneOffset); + } + + // @ts-ignore + for (const field of this.constructor.FIELDS) { + // if both have this precision defined + // @ts-ignore + if (this[field] != null && other[field] != null) { + // if they are different then return with false + // @ts-ignore + if (this[field] !== other[field]) { + return false; + } + + // if both dont have this precision, return true of precision is not defined + // @ts-ignore + } else if (this[field] == null && other[field] == null) { + if (precision == null) { + return true; + } else { + // we havent met precision yet + return null; + } + + // otherwise they have inconclusive precision, return null + } else { + return null; + } + + // if precision is defined and we have reached expected precision, we can leave the loop + if (precision != null && precision === field) { + break; + } + } + + // if we made it here, then all fields matched. + return true; + } + + sameOrBefore(other: any, precision?: any): boolean | null { + if (!(other.isDate || other.isDateTime)) { + return null; + } else if (this.isDate && other.isDateTime) { + return this.getDateTime().sameOrBefore(other, precision); + } else if ((this as any).isDateTime && other.isDate) { + other = other.getDateTime(); + } + + // @ts-ignore + if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { + throw new Error(`Invalid precision: ${precision}`); + } + + // make a copy of other in the correct timezone offset if they don't match. + if ((this as any).timezoneOffset !== other.timezoneOffset) { + other = other.convertToTimezoneOffset((this as any).timezoneOffset); + } + + // @ts-ignore + for (const field of this.constructor.FIELDS) { + // if both have this precision defined + // @ts-ignore + if (this[field] != null && other[field] != null) { + // if this value is less than the other return with true. this is before other + // @ts-ignore + if (this[field] < other[field]) { + return true; + // if this value is greater than the other return with false. this is after + // @ts-ignore + } else if (this[field] > other[field]) { + return false; + } + // execution continues if the values are the same + + // if both dont have this precision, return true if precision is not defined + // @ts-ignore + } else if (this[field] == null && other[field] == null) { + if (precision == null) { + return true; + } else { + // we havent met precision yet + return null; + } + + // otherwise they have inconclusive precision, return null + } else { + return null; + } + + // if precision is defined and we have reached expected precision, we can leave the loop + if (precision != null && precision === field) { + break; + } + } + + // if we made it here, then all fields matched and they are same + return true; + } + + sameOrAfter(other: any, precision?: any): boolean | null { + if (!(other.isDate || other.isDateTime)) { + return null; + } else if (this.isDate && other.isDateTime) { + return this.getDateTime().sameOrAfter(other, precision); + } else if ((this as any).isDateTime && other.isDate) { + other = other.getDateTime(); + } + + // @ts-ignore + if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { + throw new Error(`Invalid precision: ${precision}`); + } + + // make a copy of other in the correct timezone offset if they don't match. + if ((this as any).timezoneOffset !== other.timezoneOffset) { + other = other.convertToTimezoneOffset((this as any).timezoneOffset); + } + + // @ts-ignore + for (const field of this.constructor.FIELDS) { + // if both have this precision defined + // @ts-ignore + if (this[field] != null && other[field] != null) { + // if this value is greater than the other return with true. this is after other + // @ts-ignore + if (this[field] > other[field]) { + return true; + // if this value is greater than the other return with false. this is before + // @ts-ignore + } else if (this[field] < other[field]) { + return false; + } + // execution continues if the values are the same + + // if both dont have this precision, return true if precision is not defined + // @ts-ignore + } else if (this[field] == null && other[field] == null) { + if (precision == null) { + return true; + } else { + // we havent met precision yet + return null; + } + + // otherwise they have inconclusive precision, return null + } else { + return null; + } + + // if precision is defined and we have reached expected precision, we can leave the loop + if (precision != null && precision === field) { + break; + } + } + + // if we made it here, then all fields matched and they are same + return true; + } + + before(other: any, precision?: any): boolean | null { + if (!(other.isDate || other.isDateTime)) { + return null; + } else if (this.isDate && other.isDateTime) { + return this.getDateTime().before(other, precision); + } else if ((this as any).isDateTime && other.isDate) { + other = other.getDateTime(); + } + + // @ts-ignore + if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { + throw new Error(`Invalid precision: ${precision}`); + } + + // make a copy of other in the correct timezone offset if they don't match. + if ((this as any).timezoneOffset !== other.timezoneOffset) { + other = other.convertToTimezoneOffset((this as any).timezoneOffset); + } + + // @ts-ignore + for (const field of this.constructor.FIELDS) { + // if both have this precision defined + // @ts-ignore + if (this[field] != null && other[field] != null) { + // if this value is less than the other return with true. this is before other + // @ts-ignore + if (this[field] < other[field]) { + return true; + // if this value is greater than the other return with false. this is after + // @ts-ignore + } else if (this[field] > other[field]) { + return false; + } + // execution continues if the values are the same + + // if both dont have this precision, return false if precision is not defined + // @ts-ignore + } else if (this[field] == null && other[field] == null) { + if (precision == null) { + return false; + } else { + // we havent met precision yet + return null; + } + + // otherwise they have inconclusive precision, return null + } else { + return null; + } + + // if precision is defined and we have reached expected precision, we can leave the loop + if (precision != null && precision === field) { + break; + } + } + + // if we made it here, then all fields matched and they are same + return false; + } + + after(other: any, precision?: any): boolean | null { + if (!(other.isDate || other.isDateTime)) { + return null; + } else if (this.isDate && other.isDateTime) { + return this.getDateTime().after(other, precision); + } else if ((this as any).isDateTime && other.isDate) { + other = other.getDateTime(); + } + + // @ts-ignore + if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { + throw new Error(`Invalid precision: ${precision}`); + } + + // make a copy of other in the correct timezone offset if they don't match. + if ((this as any).timezoneOffset !== other.timezoneOffset) { + other = other.convertToTimezoneOffset((this as any).timezoneOffset); + } + + // @ts-ignore + for (const field of this.constructor.FIELDS) { + // if both have this precision defined + // @ts-ignore + if (this[field] != null && other[field] != null) { + // if this value is greater than the other return with true. this is after other + // @ts-ignore + if (this[field] > other[field]) { + return true; + // if this value is greater than the other return with false. this is before + // @ts-ignore + } else if (this[field] < other[field]) { + return false; + } + // execution continues if the values are the same + + // if both dont have this precision, return false if precision is not defined + // @ts-ignore + } else if (this[field] == null && other[field] == null) { + if (precision == null) { + return false; + } else { + // we havent met precision yet + return null; + } + + // otherwise they have inconclusive precision, return null + } else { + return null; + } + + // if precision is defined and we have reached expected precision, we can leave the loop + if (precision != null && precision === field) { + break; + } + } + + // if we made it here, then all fields matched and they are same + return false; + } + + add(offset: any, field: any) { + if (offset === 0 || this.year == null) { + return this.copy(); + } + + // Use luxon to do the date math because it honors DST and it has the leap-year/end-of-month semantics we want. + // NOTE: The luxonDateTime will contain default values where this[unit] is null, but we'll account for that. + let luxonDateTime = this.toLuxonDateTime(); + + // From the spec: "The operation is performed by converting the time-based quantity to the most precise value + // specified in the date/time (truncating any resulting decimal portion) and then adding it to the date/time value." + // However, since you can't really convert days to months, if "this" is less precise than the field being added, we can + // add to the earliest possible value of "this" or subtract from the latest possible value of "this" (depending on the + // sign of the offset), and then null out the imprecise fields again after doing the calculation. Due to the way + // luxonDateTime is constructed above, it is already at the earliest value, so only adjust if the offset is negative. + // @ts-ignore + const offsetIsMorePrecise = this[field] == null; //whether the quantity we are adding is more precise than "this". + if (offsetIsMorePrecise && offset < 0) { + luxonDateTime = luxonDateTime.endOf(this.getPrecision() as DateTimeUnit); + } + + // Now do the actual math and convert it back to a Date/DateTime w/ originally null fields nulled out again + const luxonResult = luxonDateTime.plus({ [field]: offset }); + const result = (this.constructor as any) + .fromLuxonDateTime(luxonResult) + .reducedPrecision(this.getPrecision()); + // Luxon never has a null offset, but sometimes "this" does, so reset to null if applicable + if ((this as any).isDateTime && (this as any).timezoneOffset == null) { + result.timezoneOffset = null; + } + + // Can't use overflowsOrUnderflows from math.js due to circular dependencies when we require it + if (result.after(MAX_DATETIME_VALUE || result.before(MIN_DATETIME_VALUE))) { + return null; + } else { + return result; + } + } + + getFieldFloor(field: any) { + switch (field) { + case 'month': + return 1; + case 'day': + return 1; + case 'hour': + return 0; + case 'minute': + return 0; + case 'second': + return 0; + case 'millisecond': + return 0; + default: + throw new Error('Tried to floor a field that has no floor value: ' + field); + } + } + + getFieldCieling(field: any) { + switch (field) { + case 'month': + return 12; + case 'day': + return daysInMonth(this.year, this.month); + case 'hour': + return 23; + case 'minute': + return 59; + case 'second': + return 59; + case 'millisecond': + return 999; + default: + throw new Error('Tried to clieling a field that has no cieling value: ' + field); + } + } +} + +export class DateTime extends AbstractDate { + hour: number | null; + minute: number | null; + second: number | null; + millisecond: number | null; + timezoneOffset: number | null; + + static readonly Unit = { + YEAR: 'year', + MONTH: 'month', + WEEK: 'week', + DAY: 'day', + HOUR: 'hour', + MINUTE: 'minute', + SECOND: 'second', + MILLISECOND: 'millisecond' + }; + + static readonly FIELDS = [ + DateTime.Unit.YEAR, + DateTime.Unit.MONTH, + DateTime.Unit.DAY, + DateTime.Unit.HOUR, + DateTime.Unit.MINUTE, + DateTime.Unit.SECOND, + DateTime.Unit.MILLISECOND + ]; + + static parse(string: any) { if (string === null) { return null; } @@ -108,10 +601,12 @@ class DateTime { } else if (matches[15] === 'Z') { args.push(0); } + // @ts-ignore return new DateTime(...args); } - static fromJSDate(date, timezoneOffset) { + // TODO: Note: using the jsDate type causes issues, fix later + static fromJSDate(date: any, timezoneOffset?: any) { //This is from a JS Date, not a CQL Date if (date instanceof DateTime) { return date; @@ -141,7 +636,7 @@ class DateTime { } } - static fromLuxonDateTime(luxonDT) { + static fromLuxonDateTime(luxonDT: LuxonDateTime): DateTime { if (luxonDT instanceof DateTime) { return luxonDT; } @@ -158,28 +653,27 @@ class DateTime { } constructor( - year = null, - month = null, - day = null, - hour = null, - minute = null, - second = null, - millisecond = null, - timezoneOffset + year: number | null = null, + month: number | null = null, + day: number | null = null, + hour: number | null = null, + minute: number | null = null, + second: number | null = null, + millisecond: number | null = null, + timezoneOffset?: number | null ) { // from the spec: If no timezone is specified, the timezone of the evaluation request timestamp is used. // NOTE: timezoneOffset will be explicitly null for the Time overload, whereas // it will be undefined if simply unspecified - this.year = year; - this.month = month; - this.day = day; + super(year, month, day); this.hour = hour; this.minute = minute; this.second = second; this.millisecond = millisecond; - this.timezoneOffset = timezoneOffset; - if (this.timezoneOffset === undefined) { + if (timezoneOffset === undefined) { this.timezoneOffset = (new jsDate().getTimezoneOffset() / 60) * -1; + } else { + this.timezoneOffset = timezoneOffset; } } @@ -187,6 +681,10 @@ class DateTime { return true; } + get isDate() { + return false; + } + copy() { return new DateTime( this.year, @@ -238,13 +736,13 @@ class DateTime { convertToTimezoneOffset(timezoneOffset = 0) { const shiftedLuxonDT = this.toLuxonDateTime().setZone( - luxon.FixedOffsetZone.instance(timezoneOffset * 60) + FixedOffsetZone.instance(timezoneOffset * 60) ); const shiftedDT = DateTime.fromLuxonDateTime(shiftedLuxonDT); return shiftedDT.reducedPrecision(this.getPrecision()); } - differenceBetween(other, unitField) { + differenceBetween(other: any, unitField: any) { other = this._implicitlyConvert(other); if (other == null || !other.isDateTime) { return null; @@ -286,7 +784,7 @@ class DateTime { ); } - durationBetween(other, unitField) { + durationBetween(other: any, unitField: any) { other = this._implicitlyConvert(other); if (other == null || !other.isDateTime) { return null; @@ -353,21 +851,21 @@ class DateTime { this.timezoneOffset != null ? this.timezoneOffset * 60 : new jsDate().getTimezoneOffset() * -1; - return luxon.DateTime.fromObject({ - year: this.year, - month: this.month, - day: this.day, - hour: this.hour, - minute: this.minute, - second: this.second, - millisecond: this.millisecond, - zone: luxon.FixedOffsetZone.instance(offsetMins) + return LuxonDateTime.fromObject({ + year: this.year ?? undefined, + month: this.month ?? undefined, + day: this.day ?? undefined, + hour: this.hour ?? undefined, + minute: this.minute ?? undefined, + second: this.second ?? undefined, + millisecond: this.millisecond ?? undefined, + zone: FixedOffsetZone.instance(offsetMins) }); } toLuxonUncertainty() { const low = this.toLuxonDateTime(); - const high = low.endOf(this.getPrecision()); + const high = low.endOf(this.getPrecision() as DateTimeUnit); return new Uncertainty(low, high); } @@ -376,7 +874,7 @@ class DateTime { // I don't know if anyone is using "ignoreTimezone" anymore (we aren't), but just in case if (ignoreTimezone) { const offset = new jsDate().getTimezoneOffset() * -1; - luxonDT = luxonDT.setZone(luxon.FixedOffsetZone.instance(offset), { keepLocalTime: true }); + luxonDT = luxonDT.setZone(FixedOffsetZone.instance(offset), { keepLocalTime: true }); } return luxonDT.toJSDate(); } @@ -385,7 +883,7 @@ class DateTime { return this.toString(); } - _pad(num) { + _pad(num: number) { return String('0' + num).slice(-2); } @@ -467,19 +965,20 @@ class DateTime { return this.year === 0 && this.month === 1 && this.day === 1; } - _implicitlyConvert(other) { + _implicitlyConvert(other: any) { if (other != null && other.isDate) { return other.getDateTime(); } return other; } - reducedPrecision(unitField = DateTime.Unit.MILLISECOND) { + reducedPrecision(unitField: string | null = DateTime.Unit.MILLISECOND) { const reduced = this.copy(); - if (unitField !== DateTime.Unit.MILLISECOND) { + if (unitField != null && unitField !== DateTime.Unit.MILLISECOND) { const fieldIndex = DateTime.FIELDS.indexOf(unitField); const fieldsToRemove = DateTime.FIELDS.slice(fieldIndex + 1); - for (let field of fieldsToRemove) { + for (const field of fieldsToRemove) { + // @ts-ignore reduced[field] = null; } } @@ -487,28 +986,11 @@ class DateTime { } } -DateTime.Unit = { - YEAR: 'year', - MONTH: 'month', - WEEK: 'week', - DAY: 'day', - HOUR: 'hour', - MINUTE: 'minute', - SECOND: 'second', - MILLISECOND: 'millisecond' -}; -DateTime.FIELDS = [ - DateTime.Unit.YEAR, - DateTime.Unit.MONTH, - DateTime.Unit.DAY, - DateTime.Unit.HOUR, - DateTime.Unit.MINUTE, - DateTime.Unit.SECOND, - DateTime.Unit.MILLISECOND -]; - -class Date { - static parse(string) { +export class Date extends AbstractDate { + static readonly Unit = { YEAR: 'year', MONTH: 'month', WEEK: 'week', DAY: 'day' }; + static readonly FIELDS = [Date.Unit.YEAR, Date.Unit.MONTH, Date.Unit.DAY]; + + static parse(string: any) { if (string === null) { return null; } @@ -529,19 +1011,22 @@ class Date { // convert args to integers const args = [years, months, days].map(arg => (arg != null ? parseInt(arg) : arg)); + // @ts-ignore return new Date(...args); } - constructor(year = null, month = null, day = null) { - this.year = year; - this.month = month; - this.day = day; + constructor(year: number | null = null, month: number | null = null, day: number | null = null) { + super(year, month, day); } get isDate() { return true; } + get isDateTime() { + return false; + } + copy() { return new Date(this.year, this.month, this.day); } @@ -566,7 +1051,7 @@ class Date { } } - differenceBetween(other, unitField) { + differenceBetween(other: any, unitField: any) { if (other != null && other.isDateTime) { return this.getDateTime().differenceBetween(other, unitField); } @@ -593,7 +1078,7 @@ class Date { ); } - durationBetween(other, unitField) { + durationBetween(other: any, unitField: any) { if (other != null && other.isDateTime) { return this.getDateTime().durationBetween(other, unitField); } @@ -634,17 +1119,17 @@ class Date { } toLuxonDateTime() { - return luxon.DateTime.fromObject({ - year: this.year, - month: this.month, - day: this.day, - zone: luxon.FixedOffsetZone.utcInstance + return LuxonDateTime.fromObject({ + year: this.year ?? undefined, + month: this.month ?? undefined, + day: this.day ?? undefined, + zone: FixedOffsetZone.utcInstance }); } toLuxonUncertainty() { const low = this.toLuxonDateTime(); - const high = low.endOf(this.getPrecision()).startOf('day'); // Date type is always at T00:00:00.0 + const high = low.endOf(this.getPrecision() as any).startOf('day'); // Date type is always at T00:00:00.0 return new Uncertainty(low, high); } @@ -654,17 +1139,17 @@ class Date { this.month != null ? this.month - 1 : 0, this.day != null ? this.day : 1 ]; - return new jsDate(y, mo, d); + return new jsDate(y as number, mo, d); } - static fromJSDate(date) { + static fromJSDate(date: any) { if (date instanceof Date) { return date; } return new Date(date.getFullYear(), date.getMonth() + 1, date.getDate()); } - static fromLuxonDateTime(luxonDT) { + static fromLuxonDateTime(luxonDT: LuxonDateTime) { if (luxonDT instanceof Date) { return luxonDT; } @@ -707,7 +1192,8 @@ class Date { if (unitField !== Date.Unit.DAY) { const fieldIndex = Date.FIELDS.indexOf(unitField); const fieldsToRemove = Date.FIELDS.slice(fieldIndex + 1); - for (let field of fieldsToRemove) { + for (const field of fieldsToRemove) { + // @ts-ignore reduced[field] = null; } } @@ -715,15 +1201,15 @@ class Date { } } -const MIN_DATETIME_VALUE = DateTime.parse('0001-01-01T00:00:00.000'); -const MAX_DATETIME_VALUE = DateTime.parse('9999-12-31T23:59:59.999'); -const MIN_DATE_VALUE = Date.parse('0001-01-01'); -const MAX_DATE_VALUE = Date.parse('9999-12-31'); -const MIN_TIME_VALUE = DateTime.parse('0000-01-01T00:00:00.000').getTime(); -const MAX_TIME_VALUE = DateTime.parse('0000-01-01T23:59:59.999').getTime(); - -Date.Unit = { YEAR: 'year', MONTH: 'month', WEEK: 'week', DAY: 'day' }; -Date.FIELDS = [Date.Unit.YEAR, Date.Unit.MONTH, Date.Unit.DAY]; +// Require MIN/MAX here because math.js requires this file, and when we make this file require +// math.js before it exports DateTime and Date, it errors due to the circular dependency... +// const { MAX_DATETIME_VALUE, MIN_DATETIME_VALUE } = require('../util/math'); +export const MIN_DATETIME_VALUE = DateTime.parse('0001-01-01T00:00:00.000'); +export const MAX_DATETIME_VALUE = DateTime.parse('9999-12-31T23:59:59.999'); +export const MIN_DATE_VALUE = Date.parse('0001-01-01'); +export const MAX_DATE_VALUE = Date.parse('9999-12-31'); +export const MIN_TIME_VALUE = DateTime.parse('0000-01-01T00:00:00.000')?.getTime(); +export const MAX_TIME_VALUE = DateTime.parse('0000-01-01T23:59:59.999')?.getTime(); const DATETIME_PRECISION_VALUE_MAP = (() => { const dtpvMap = new Map(); @@ -746,405 +1232,7 @@ const TIME_PRECISION_VALUE_MAP = (() => { return tpvMap; })(); -// Shared Funtions For Date and DateTime -DateTime.prototype.isPrecise = Date.prototype.isPrecise = function () { - return this.constructor.FIELDS.every(field => this[field] != null); -}; - -DateTime.prototype.isImprecise = Date.prototype.isImprecise = function () { - return !this.isPrecise(); -}; - -// This function can take another Date-ish object, or a precision string (e.g. 'month') -DateTime.prototype.isMorePrecise = Date.prototype.isMorePrecise = function (other) { - if (typeof other === 'string' && this.constructor.FIELDS.includes(other)) { - if (this[other] == null) { - return false; - } - } else { - for (let field of this.constructor.FIELDS) { - if (other[field] != null && this[field] == null) { - return false; - } - } - } - - return !this.isSamePrecision(other); -}; - -// This function can take another Date-ish object, or a precision string (e.g. 'month') -DateTime.prototype.isLessPrecise = Date.prototype.isLessPrecise = function (other) { - return !this.isSamePrecision(other) && !this.isMorePrecise(other); -}; - -// This function can take another Date-ish object, or a precision string (e.g. 'month') -DateTime.prototype.isSamePrecision = Date.prototype.isSamePrecision = function (other) { - if (typeof other === 'string' && this.constructor.FIELDS.includes(other)) { - return other === this.getPrecision(); - } - - for (let field of this.constructor.FIELDS) { - if (this[field] != null && other[field] == null) { - return false; - } - if (this[field] == null && other[field] != null) { - return false; - } - } - return true; -}; - -DateTime.prototype.equals = Date.prototype.equals = function (other) { - return compareWithDefaultResult(this, other, null); -}; - -DateTime.prototype.equivalent = Date.prototype.equivalent = function (other) { - return compareWithDefaultResult(this, other, false); -}; - -DateTime.prototype.sameAs = Date.prototype.sameAs = function (other, precision) { - if (!(other.isDate || other.isDateTime)) { - return null; - } else if (this.isDate && other.isDateTime) { - return this.getDateTime().sameAs(other, precision); - } else if (this.isDateTime && other.isDate) { - other = other.getDateTime(); - } - - if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { - throw new Error(`Invalid precision: ${precision}`); - } - - // make a copy of other in the correct timezone offset if they don't match. - if (this.timezoneOffset !== other.timezoneOffset) { - other = other.convertToTimezoneOffset(this.timezoneOffset); - } - - for (let field of this.constructor.FIELDS) { - // if both have this precision defined - if (this[field] != null && other[field] != null) { - // if they are different then return with false - if (this[field] !== other[field]) { - return false; - } - - // if both dont have this precision, return true of precision is not defined - } else if (this[field] == null && other[field] == null) { - if (precision == null) { - return true; - } else { - // we havent met precision yet - return null; - } - - // otherwise they have inconclusive precision, return null - } else { - return null; - } - - // if precision is defined and we have reached expected precision, we can leave the loop - if (precision != null && precision === field) { - break; - } - } - - // if we made it here, then all fields matched. - return true; -}; - -DateTime.prototype.sameOrBefore = Date.prototype.sameOrBefore = function (other, precision) { - if (!(other.isDate || other.isDateTime)) { - return null; - } else if (this.isDate && other.isDateTime) { - return this.getDateTime().sameOrBefore(other, precision); - } else if (this.isDateTime && other.isDate) { - other = other.getDateTime(); - } - - if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { - throw new Error(`Invalid precision: ${precision}`); - } - - // make a copy of other in the correct timezone offset if they don't match. - if (this.timezoneOffset !== other.timezoneOffset) { - other = other.convertToTimezoneOffset(this.timezoneOffset); - } - - for (let field of this.constructor.FIELDS) { - // if both have this precision defined - if (this[field] != null && other[field] != null) { - // if this value is less than the other return with true. this is before other - if (this[field] < other[field]) { - return true; - // if this value is greater than the other return with false. this is after - } else if (this[field] > other[field]) { - return false; - } - // execution continues if the values are the same - - // if both dont have this precision, return true if precision is not defined - } else if (this[field] == null && other[field] == null) { - if (precision == null) { - return true; - } else { - // we havent met precision yet - return null; - } - - // otherwise they have inconclusive precision, return null - } else { - return null; - } - - // if precision is defined and we have reached expected precision, we can leave the loop - if (precision != null && precision === field) { - break; - } - } - - // if we made it here, then all fields matched and they are same - return true; -}; - -DateTime.prototype.sameOrAfter = Date.prototype.sameOrAfter = function (other, precision) { - if (!(other.isDate || other.isDateTime)) { - return null; - } else if (this.isDate && other.isDateTime) { - return this.getDateTime().sameOrAfter(other, precision); - } else if (this.isDateTime && other.isDate) { - other = other.getDateTime(); - } - - if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { - throw new Error(`Invalid precision: ${precision}`); - } - - // make a copy of other in the correct timezone offset if they don't match. - if (this.timezoneOffset !== other.timezoneOffset) { - other = other.convertToTimezoneOffset(this.timezoneOffset); - } - - for (let field of this.constructor.FIELDS) { - // if both have this precision defined - if (this[field] != null && other[field] != null) { - // if this value is greater than the other return with true. this is after other - if (this[field] > other[field]) { - return true; - // if this value is greater than the other return with false. this is before - } else if (this[field] < other[field]) { - return false; - } - // execution continues if the values are the same - - // if both dont have this precision, return true if precision is not defined - } else if (this[field] == null && other[field] == null) { - if (precision == null) { - return true; - } else { - // we havent met precision yet - return null; - } - - // otherwise they have inconclusive precision, return null - } else { - return null; - } - - // if precision is defined and we have reached expected precision, we can leave the loop - if (precision != null && precision === field) { - break; - } - } - - // if we made it here, then all fields matched and they are same - return true; -}; - -DateTime.prototype.before = Date.prototype.before = function (other, precision) { - if (!(other.isDate || other.isDateTime)) { - return null; - } else if (this.isDate && other.isDateTime) { - return this.getDateTime().before(other, precision); - } else if (this.isDateTime && other.isDate) { - other = other.getDateTime(); - } - - if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { - throw new Error(`Invalid precision: ${precision}`); - } - - // make a copy of other in the correct timezone offset if they don't match. - if (this.timezoneOffset !== other.timezoneOffset) { - other = other.convertToTimezoneOffset(this.timezoneOffset); - } - - for (let field of this.constructor.FIELDS) { - // if both have this precision defined - if (this[field] != null && other[field] != null) { - // if this value is less than the other return with true. this is before other - if (this[field] < other[field]) { - return true; - // if this value is greater than the other return with false. this is after - } else if (this[field] > other[field]) { - return false; - } - // execution continues if the values are the same - - // if both dont have this precision, return false if precision is not defined - } else if (this[field] == null && other[field] == null) { - if (precision == null) { - return false; - } else { - // we havent met precision yet - return null; - } - - // otherwise they have inconclusive precision, return null - } else { - return null; - } - - // if precision is defined and we have reached expected precision, we can leave the loop - if (precision != null && precision === field) { - break; - } - } - - // if we made it here, then all fields matched and they are same - return false; -}; - -DateTime.prototype.after = Date.prototype.after = function (other, precision) { - if (!(other.isDate || other.isDateTime)) { - return null; - } else if (this.isDate && other.isDateTime) { - return this.getDateTime().after(other, precision); - } else if (this.isDateTime && other.isDate) { - other = other.getDateTime(); - } - - if (precision != null && this.constructor.FIELDS.indexOf(precision) < 0) { - throw new Error(`Invalid precision: ${precision}`); - } - - // make a copy of other in the correct timezone offset if they don't match. - if (this.timezoneOffset !== other.timezoneOffset) { - other = other.convertToTimezoneOffset(this.timezoneOffset); - } - - for (let field of this.constructor.FIELDS) { - // if both have this precision defined - if (this[field] != null && other[field] != null) { - // if this value is greater than the other return with true. this is after other - if (this[field] > other[field]) { - return true; - // if this value is greater than the other return with false. this is before - } else if (this[field] < other[field]) { - return false; - } - // execution continues if the values are the same - - // if both dont have this precision, return false if precision is not defined - } else if (this[field] == null && other[field] == null) { - if (precision == null) { - return false; - } else { - // we havent met precision yet - return null; - } - - // otherwise they have inconclusive precision, return null - } else { - return null; - } - - // if precision is defined and we have reached expected precision, we can leave the loop - if (precision != null && precision === field) { - break; - } - } - - // if we made it here, then all fields matched and they are same - return false; -}; - -DateTime.prototype.add = Date.prototype.add = function (offset, field) { - if (offset === 0 || this.year == null) { - return this.copy(); - } - - // Use luxon to do the date math because it honors DST and it has the leap-year/end-of-month semantics we want. - // NOTE: The luxonDateTime will contain default values where this[unit] is null, but we'll account for that. - let luxonDateTime = this.toLuxonDateTime(); - - // From the spec: "The operation is performed by converting the time-based quantity to the most precise value - // specified in the date/time (truncating any resulting decimal portion) and then adding it to the date/time value." - // However, since you can't really convert days to months, if "this" is less precise than the field being added, we can - // add to the earliest possible value of "this" or subtract from the latest possible value of "this" (depending on the - // sign of the offset), and then null out the imprecise fields again after doing the calculation. Due to the way - // luxonDateTime is constructed above, it is already at the earliest value, so only adjust if the offset is negative. - const offsetIsMorePrecise = this[field] == null; //whether the quantity we are adding is more precise than "this". - if (offsetIsMorePrecise && offset < 0) { - luxonDateTime = luxonDateTime.endOf(this.getPrecision()); - } - - // Now do the actual math and convert it back to a Date/DateTime w/ originally null fields nulled out again - const luxonResult = luxonDateTime.plus({ [field]: offset }); - const result = this.constructor - .fromLuxonDateTime(luxonResult) - .reducedPrecision(this.getPrecision()); - // Luxon never has a null offset, but sometimes "this" does, so reset to null if applicable - if (this.isDateTime && this.timezoneOffset == null) { - result.timezoneOffset = null; - } - - // Can't use overflowsOrUnderflows from math.js due to circular dependencies when we require it - if (result.after(MAX_DATETIME_VALUE || result.before(MIN_DATETIME_VALUE))) { - return null; - } else { - return result; - } -}; - -DateTime.prototype.getFieldFloor = Date.prototype.getFieldFloor = function (field) { - switch (field) { - case 'month': - return 1; - case 'day': - return 1; - case 'hour': - return 0; - case 'minute': - return 0; - case 'second': - return 0; - case 'millisecond': - return 0; - default: - throw new Error('Tried to floor a field that has no floor value: ' + field); - } -}; - -DateTime.prototype.getFieldCieling = Date.prototype.getFieldCieling = function (field) { - switch (field) { - case 'month': - return 12; - case 'day': - return daysInMonth(this.year, this.month); - case 'hour': - return 23; - case 'minute': - return 59; - case 'second': - return 59; - case 'millisecond': - return 999; - default: - throw new Error('Tried to clieling a field that has no cieling value: ' + field); - } -}; - -function compareWithDefaultResult(a, b, defaultResult) { +function compareWithDefaultResult(a: any, b: any, defaultResult: any) { // return false there is a type mismatch if ((!a.isDate || !b.isDate) && (!a.isDateTime || !b.isDateTime)) { return false; @@ -1155,7 +1243,7 @@ function compareWithDefaultResult(a, b, defaultResult) { b = b.convertToTimezoneOffset(a.timezoneOffset); } - for (let field of a.constructor.FIELDS) { + for (const field of a.constructor.FIELDS) { // if both have this precision defined if (a[field] != null && b[field] != null) { // For the purposes of comparison, seconds and milliseconds are combined @@ -1190,7 +1278,7 @@ function compareWithDefaultResult(a, b, defaultResult) { return true; } -function daysInMonth(year, month) { +function daysInMonth(year: number | null, month: number | null) { if (year == null || month == null) { throw new Error('daysInMonth requires year and month as arguments'); } @@ -1198,7 +1286,7 @@ function daysInMonth(year, month) { return new jsDate(year, month, 0).getDate(); } -function isValidDateStringFormat(string) { +function isValidDateStringFormat(string: any) { if (typeof string !== 'string') { return false; } @@ -1208,10 +1296,10 @@ function isValidDateStringFormat(string) { return false; } - return luxon.DateTime.fromFormat(string, format).isValid; + return LuxonDateTime.fromFormat(string, format).isValid; } -function isValidDateTimeStringFormat(string) { +function isValidDateTimeStringFormat(string: any) { if (typeof string !== 'string') { return false; } @@ -1226,20 +1314,5 @@ function isValidDateTimeStringFormat(string) { return false; } - return formats.some(fmt => luxon.DateTime.fromFormat(string, fmt).isValid); + return formats.some((fmt: any) => LuxonDateTime.fromFormat(string, fmt).isValid); } - -module.exports = { - DateTime, - Date, - MIN_DATETIME_VALUE, - MAX_DATETIME_VALUE, - MIN_DATE_VALUE, - MAX_DATE_VALUE, - MIN_TIME_VALUE, - MAX_TIME_VALUE -}; - -// Require MIN/MAX here because math.js requires this file, and when we make this file require -// math.js before it exports DateTime and Date, it errors due to the circular dependency... -// const { MAX_DATETIME_VALUE, MIN_DATETIME_VALUE } = require('../util/math'); diff --git a/src/datatypes/exception.js b/src/datatypes/exception.js deleted file mode 100644 index 136cad5bd..000000000 --- a/src/datatypes/exception.js +++ /dev/null @@ -1,8 +0,0 @@ -class Exception { - constructor(message, wrapped) { - this.message = message; - this.wrapped = wrapped; - } -} - -module.exports = { Exception }; diff --git a/src/datatypes/exception.ts b/src/datatypes/exception.ts new file mode 100644 index 000000000..07d940d1d --- /dev/null +++ b/src/datatypes/exception.ts @@ -0,0 +1,3 @@ +export class Exception { + constructor(public message?: string, public wrapped?: any) {} +} diff --git a/src/datatypes/interval.js b/src/datatypes/interval.ts similarity index 92% rename from src/datatypes/interval.js rename to src/datatypes/interval.ts index 34c053887..d27abd68c 100644 --- a/src/datatypes/interval.js +++ b/src/datatypes/interval.ts @@ -1,24 +1,26 @@ -const { Uncertainty } = require('./uncertainty'); -const { Quantity, doSubtraction } = require('../datatypes/quantity'); -const { ThreeValuedLogic } = require('./logic'); -const { +import { Uncertainty } from './uncertainty'; +import { Quantity, doSubtraction } from './quantity'; +import { ThreeValuedLogic } from './logic'; +import { successor, predecessor, maxValueForInstance, minValueForInstance, maxValueForType, minValueForType -} = require('../util/math'); -const cmp = require('../util/comparison'); - -class Interval { - constructor(low, high, lowClosed, highClosed, defaultPointType) { - this.low = low; - this.high = high; +} from '../util/math'; +import * as cmp from '../util/comparison'; + +export class Interval { + constructor( + public low: any, + public high: any, + public lowClosed?: boolean | null, + public highClosed?: boolean | null, + public defaultPointType?: any // defaultPointType is used in the case that both endpoints are null + ) { this.lowClosed = lowClosed != null ? lowClosed : true; this.highClosed = highClosed != null ? highClosed : true; - // defaultPointType is used in the case that both endpoints are null - this.defaultPointType = defaultPointType; } get isInterval() { @@ -30,10 +32,9 @@ class Interval { const point = this.low != null ? this.low : this.high; if (point != null) { if (typeof point === 'number') { - pointType = - parseInt(point) === point - ? '{urn:hl7-org:elm-types:r1}Integer' - : '{urn:hl7-org:elm-types:r1}Decimal'; + pointType = Number.isInteger(point) + ? '{urn:hl7-org:elm-types:r1}Integer' + : '{urn:hl7-org:elm-types:r1}Decimal'; } else if (point.isTime && point.isTime()) { pointType = '{urn:hl7-org:elm-types:r1}Time'; } else if (point.isDate) { @@ -63,7 +64,7 @@ class Interval { return new Interval(newLow, newHigh, this.lowClosed, this.highClosed); } - contains(item, precision) { + contains(item: any, precision?: any) { // These first two checks ensure correct handling of edge case where an item equals the closed boundary if (this.lowClosed && this.low != null && cmp.equals(this.low, item)) { return true; @@ -96,7 +97,7 @@ class Interval { ); } - properlyIncludes(other, precision) { + properlyIncludes(other: any, precision?: any) { if (other == null || !other.isInterval) { throw new Error('Argument to properlyIncludes must be an interval'); } @@ -106,7 +107,7 @@ class Interval { ); } - includes(other, precision) { + includes(other: any, precision?: any) { if (other == null || !other.isInterval) { return this.contains(other, precision); } @@ -118,7 +119,7 @@ class Interval { ); } - includedIn(other, precision) { + includedIn(other: any, precision?: any) { // For the point overload, this operator is a synonym for the in operator if (other == null || !other.isInterval) { return this.contains(other, precision); @@ -127,7 +128,7 @@ class Interval { } } - overlaps(item, precision) { + overlaps(item: any, precision?: any) { const closed = this.toClosed(); const [low, high] = (() => { if (item != null && item.isInterval) { @@ -143,7 +144,7 @@ class Interval { ); } - overlapsAfter(item, precision) { + overlapsAfter(item: any, precision?: any) { const closed = this.toClosed(); const high = item != null && item.isInterval ? item.toClosed().high : item; return ThreeValuedLogic.and( @@ -152,7 +153,7 @@ class Interval { ); } - overlapsBefore(item, precision) { + overlapsBefore(item: any, precision?: any) { const closed = this.toClosed(); const low = item != null && item.isInterval ? item.toClosed().low : item; return ThreeValuedLogic.and( @@ -161,7 +162,7 @@ class Interval { ); } - union(other) { + union(other: any) { if (other == null || !other.isInterval) { throw new Error('Argument to union must be an interval'); } @@ -200,7 +201,7 @@ class Interval { } } - intersect(other) { + intersect(other: any) { if (other == null || !other.isInterval) { throw new Error('Argument to union must be an interval'); } @@ -239,7 +240,7 @@ class Interval { } } - except(other) { + except(other: any) { if (other === null) { return null; } @@ -266,7 +267,7 @@ class Interval { } } - sameAs(other, precision) { + sameAs(other: any, precision?: any) { // This large if and else if block handles the scenarios where there is an open ended null // If both lows or highs exists, it can be determined that intervals are not Same As if ( @@ -345,7 +346,7 @@ class Interval { } } - sameOrBefore(other, precision) { + sameOrBefore(other: any, precision?: any) { if (this.end() == null || other == null || other.start() == null) { return null; } else { @@ -353,7 +354,7 @@ class Interval { } } - sameOrAfter(other, precision) { + sameOrAfter(other: any, precision?: any) { if (this.start() == null || other == null || other.end() == null) { return null; } else { @@ -361,7 +362,7 @@ class Interval { } } - equals(other) { + equals(other: any) { if (other != null && other.isInterval) { const [a, b] = [this.toClosed(), other.toClosed()]; return ThreeValuedLogic.and(cmp.equals(a.low, b.low), cmp.equals(a.high, b.high)); @@ -370,7 +371,7 @@ class Interval { } } - after(other, precision) { + after(other: any, precision?: any) { const closed = this.toClosed(); // Meets spec, but not 100% correct (e.g., (null, 5] after [6, 10] --> null) // Simple way to fix it: and w/ not overlaps @@ -381,7 +382,7 @@ class Interval { } } - before(other, precision) { + before(other: any, precision?: any) { const closed = this.toClosed(); // Meets spec, but not 100% correct (e.g., (null, 5] after [6, 10] --> null) // Simple way to fix it: and w/ not overlaps @@ -392,14 +393,14 @@ class Interval { } } - meets(other, precision) { + meets(other: any, precision?: any) { return ThreeValuedLogic.or( this.meetsBefore(other, precision), this.meetsAfter(other, precision) ); } - meetsAfter(other, precision) { + meetsAfter(other: any, precision?: any) { try { if (precision != null && this.low != null && this.low.isDateTime) { return this.toClosed().low.sameAs( @@ -414,7 +415,7 @@ class Interval { } } - meetsBefore(other, precision) { + meetsBefore(other: any, precision?: any) { try { if (precision != null && this.high != null && this.high.isDateTime) { return this.toClosed().high.sameAs( @@ -451,7 +452,7 @@ class Interval { return this.toClosed().high; } - starts(other, precision) { + starts(other: any, precision?: any) { let startEqual; if (precision != null && this.low != null && this.low.isDateTime) { startEqual = this.low.sameAs(other.low, precision); @@ -462,7 +463,7 @@ class Interval { return startEqual && endLessThanOrEqual; } - ends(other, precision) { + ends(other: any, precision?: any) { let endEqual; const startGreaterThanOrEqual = cmp.greaterThanOrEquals(this.low, other.low, precision); if (precision != null && (this.low != null ? this.low.isDateTime : undefined)) { @@ -603,17 +604,17 @@ class Interval { } } -function areDateTimes(x, y) { +function areDateTimes(x: any, y: any) { return [x, y].every(z => z != null && z.isDateTime); } -function areNumeric(x, y) { +function areNumeric(x: any, y: any) { return [x, y].every(z => { return typeof z === 'number' || (z != null && z.isUncertainty && typeof z.low === 'number'); }); } -function lowestNumericUncertainty(x, y) { +function lowestNumericUncertainty(x: any, y: any) { if (x == null || !x.isUncertainty) { x = new Uncertainty(x); } @@ -629,7 +630,7 @@ function lowestNumericUncertainty(x, y) { } } -function highestNumericUncertainty(x, y) { +function highestNumericUncertainty(x: any, y: any) { if (x == null || !x.isUncertainty) { x = new Uncertainty(x); } @@ -644,5 +645,3 @@ function highestNumericUncertainty(x, y) { return low; } } - -module.exports = { Interval }; diff --git a/src/datatypes/logic.js b/src/datatypes/logic.ts similarity index 64% rename from src/datatypes/logic.js rename to src/datatypes/logic.ts index 00b12629b..cdca44e4e 100644 --- a/src/datatypes/logic.js +++ b/src/datatypes/logic.ts @@ -1,5 +1,5 @@ -class ThreeValuedLogic { - static and(...val) { +export class ThreeValuedLogic { + static and(...val: (boolean | null)[]) { if (val.includes(false)) { return false; } else if (val.includes(null)) { @@ -9,7 +9,7 @@ class ThreeValuedLogic { } } - static or(...val) { + static or(...val: (boolean | null)[]) { if (val.includes(true)) { return true; } else if (val.includes(null)) { @@ -19,15 +19,17 @@ class ThreeValuedLogic { } } - static xor(...val) { + static xor(...val: (boolean | null)[]) { if (val.includes(null)) { return null; } else { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore return val.reduce((a, b) => (!a ^ !b) === 1); } } - static not(val) { + static not(val: boolean | null) { if (val != null) { return !val; } else { @@ -35,5 +37,3 @@ class ThreeValuedLogic { } } } - -module.exports = { ThreeValuedLogic }; diff --git a/src/datatypes/quantity.js b/src/datatypes/quantity.ts similarity index 85% rename from src/datatypes/quantity.js rename to src/datatypes/quantity.ts index 7e131961a..1eec97557 100644 --- a/src/datatypes/quantity.js +++ b/src/datatypes/quantity.ts @@ -1,17 +1,15 @@ -const { decimalAdjust, isValidDecimal, overflowsOrUnderflows } = require('../util/math'); -const { +import { decimalAdjust, isValidDecimal, overflowsOrUnderflows } from '../util/math'; +import { checkUnit, convertUnit, normalizeUnitsWhenPossible, convertToCQLDateUnit, getProductOfUnits, getQuotientOfUnits -} = require('../util/units'); +} from '../util/units'; -class Quantity { - constructor(value, unit) { - this.value = value; - this.unit = unit; +export class Quantity { + constructor(public value: any, public unit?: any) { if (this.value == null || isNaN(this.value)) { throw new Error('Cannot create a quantity with an undefined value'); } else if (!isValidDecimal(this.value)) { @@ -39,7 +37,7 @@ class Quantity { return `${this.value} '${this.unit}'`; } - sameOrBefore(other) { + sameOrBefore(other: any) { if (other != null && other.isQuantity) { const otherVal = convertUnit(other.value, other.unit, this.unit); if (otherVal == null) { @@ -50,7 +48,7 @@ class Quantity { } } - sameOrAfter(other) { + sameOrAfter(other: any) { if (other != null && other.isQuantity) { const otherVal = convertUnit(other.value, other.unit, this.unit); if (otherVal == null) { @@ -61,7 +59,7 @@ class Quantity { } } - after(other) { + after(other: any) { if (other != null && other.isQuantity) { const otherVal = convertUnit(other.value, other.unit, this.unit); if (otherVal == null) { @@ -72,7 +70,7 @@ class Quantity { } } - before(other) { + before(other: any) { if (other != null && other.isQuantity) { const otherVal = convertUnit(other.value, other.unit, this.unit); if (otherVal == null) { @@ -83,7 +81,7 @@ class Quantity { } } - equals(other) { + equals(other: any) { if (other != null && other.isQuantity) { if ((!this.unit && other.unit) || (this.unit && !other.unit)) { return false; @@ -100,13 +98,13 @@ class Quantity { } } - convertUnit(toUnit) { + convertUnit(toUnit: any) { const value = convertUnit(this.value, this.unit, toUnit); // Need to pass through constructor again to catch invalid units return new Quantity(value, toUnit); } - dividedBy(other) { + dividedBy(other: any) { if (other == null || other === 0 || other.value === 0) { return null; } else if (!other.isQuantity) { @@ -114,7 +112,7 @@ class Quantity { other = new Quantity(other, '1'); } - let [val1, unit1, val2, unit2] = normalizeUnitsWhenPossible( + const [val1, unit1, val2, unit2] = normalizeUnitsWhenPossible( this.value, this.unit, other.value, @@ -130,7 +128,7 @@ class Quantity { return new Quantity(decimalAdjust('round', resultValue, -8), resultUnit); } - multiplyBy(other) { + multiplyBy(other: any) { if (other == null) { return null; } else if (!other.isQuantity) { @@ -138,7 +136,7 @@ class Quantity { other = new Quantity(other, '1'); } - let [val1, unit1, val2, unit2] = normalizeUnitsWhenPossible( + const [val1, unit1, val2, unit2] = normalizeUnitsWhenPossible( this.value, this.unit, other.value, @@ -155,7 +153,7 @@ class Quantity { } } -function parseQuantity(str) { +export function parseQuantity(str: string) { const components = /([+|-]?\d+\.?\d*)\s*('(.+)')?/.exec(str); if (components != null && components[1] != null) { const value = parseFloat(components[1]); @@ -174,7 +172,7 @@ function parseQuantity(str) { } } -function doScaledAddition(a, b, scaleForB) { +function doScaledAddition(a: any, b: any, scaleForB: any) { if (a != null && a.isQuantity && b != null && b.isQuantity) { const [val1, unit1, val2, unit2] = normalizeUnitsWhenPossible( a.value, @@ -200,33 +198,24 @@ function doScaledAddition(a, b, scaleForB) { } } -function doAddition(a, b) { +export function doAddition(a: any, b: any) { return doScaledAddition(a, b, 1); } -function doSubtraction(a, b) { +export function doSubtraction(a: any, b: any) { return doScaledAddition(a, b, -1); } -function doDivision(a, b) { +export function doDivision(a: any, b: any) { if (a != null && a.isQuantity) { return a.dividedBy(b); } } -function doMultiplication(a, b) { +export function doMultiplication(a: any, b: any) { if (a != null && a.isQuantity) { return a.multiplyBy(b); } else { return b.multiplyBy(a); } } - -module.exports = { - Quantity, - parseQuantity, - doAddition, - doSubtraction, - doDivision, - doMultiplication -}; diff --git a/src/datatypes/ratio.js b/src/datatypes/ratio.ts similarity index 69% rename from src/datatypes/ratio.js rename to src/datatypes/ratio.ts index 4c7d48f9b..67a2316b7 100644 --- a/src/datatypes/ratio.js +++ b/src/datatypes/ratio.ts @@ -1,11 +1,12 @@ -class Ratio { - constructor(numerator, denominator) { - this.numerator = numerator; - this.denominator = denominator; - if (this.numerator == null) { +import { Quantity } from './datatypes'; + +export class Ratio { + constructor(public numerator: Quantity, public denominator: Quantity) { + if (numerator == null) { throw new Error('Cannot create a ratio with an undefined numerator'); } - if (this.denominator == null) { + + if (denominator == null) { throw new Error('Cannot create a ratio with an undefined denominator'); } } @@ -22,20 +23,18 @@ class Ratio { return `${this.numerator.toString()} : ${this.denominator.toString()}`; } - equals(other) { + equals(other: Ratio) { if (other != null && other.isRatio) { const divided_this = this.numerator.dividedBy(this.denominator); const divided_other = other.numerator.dividedBy(other.denominator); - return divided_this.equals(divided_other); + return divided_this?.equals(divided_other); } else { return false; } } - equivalent(other) { + equivalent(other: Ratio) { const equal = this.equals(other); return equal != null ? equal : false; } } - -module.exports = { Ratio }; diff --git a/src/datatypes/uncertainty.js b/src/datatypes/uncertainty.ts similarity index 82% rename from src/datatypes/uncertainty.js rename to src/datatypes/uncertainty.ts index 30114ae0c..9b35d3737 100644 --- a/src/datatypes/uncertainty.js +++ b/src/datatypes/uncertainty.ts @@ -1,7 +1,7 @@ -const { ThreeValuedLogic } = require('./logic'); +import { ThreeValuedLogic } from './logic'; -class Uncertainty { - static from(obj) { +export class Uncertainty { + static from(obj: any) { if (obj != null && obj.isUncertainty) { return obj; } else { @@ -9,10 +9,8 @@ class Uncertainty { } } - constructor(low = null, high) { - this.low = low; - this.high = high; - const gt = (a, b) => { + constructor(public low: any = null, public high?: any) { + const gt = (a: any, b: any) => { if (typeof a !== typeof b) { // TODO: This should probably throw rather than return false. // Uncertainties with different types probably shouldn't be supported. @@ -24,7 +22,8 @@ class Uncertainty { return a > b; } }; - const isNonEnumerable = val => val != null && (val.isCode || val.isConcept || val.isValueSet); + const isNonEnumerable = (val: any) => + val != null && (val.isCode || val.isConcept || val.isValueSet); if (typeof this.high === 'undefined') { this.high = this.low; } @@ -56,7 +55,7 @@ class Uncertainty { isPoint() { // Note: Can't use normal equality, as that fails for Javascript dates // TODO: Fix after we don't need to support Javascript date uncertainties anymore - const lte = (a, b) => { + const lte = (a: any, b: any) => { if (typeof a !== typeof b) { return false; } @@ -66,7 +65,7 @@ class Uncertainty { return a <= b; } }; - const gte = (a, b) => { + const gte = (a: any, b: any) => { if (typeof a !== typeof b) { return false; } @@ -81,13 +80,13 @@ class Uncertainty { ); } - equals(other) { + equals(other: any) { other = Uncertainty.from(other); return ThreeValuedLogic.not(ThreeValuedLogic.or(this.lessThan(other), this.greaterThan(other))); } - lessThan(other) { - const lt = (a, b) => { + lessThan(other: any) { + const lt = (a: any, b: any) => { if (typeof a !== typeof b) { return false; } @@ -107,17 +106,15 @@ class Uncertainty { } } - greaterThan(other) { + greaterThan(other: any) { return Uncertainty.from(other).lessThan(this); } - lessThanOrEquals(other) { + lessThanOrEquals(other: any) { return ThreeValuedLogic.not(this.greaterThan(Uncertainty.from(other))); } - greaterThanOrEquals(other) { + greaterThanOrEquals(other: any) { return ThreeValuedLogic.not(this.lessThan(Uncertainty.from(other))); } } - -module.exports = { Uncertainty }; diff --git a/src/elm/aggregate.js b/src/elm/aggregate.ts similarity index 73% rename from src/elm/aggregate.js rename to src/elm/aggregate.ts index 258fd22b6..5d2131810 100644 --- a/src/elm/aggregate.js +++ b/src/elm/aggregate.ts @@ -1,23 +1,26 @@ -const { Expression } = require('./expression'); -const { typeIsArray, allTrue, anyTrue, removeNulls, numerical_sort } = require('../util/util'); -const { build } = require('./builder'); -const { Exception } = require('../datatypes/exception'); -const { greaterThan, lessThan } = require('../util/comparison'); -const { Quantity } = require('../datatypes/quantity'); +import { Expression } from './expression'; +import { typeIsArray, allTrue, anyTrue, removeNulls, numerical_sort } from '../util/util'; +import { Quantity } from '../datatypes/datatypes'; +import { Context } from '../runtime/context'; +import { Exception } from '../datatypes/exception'; +import { greaterThan, lessThan } from '../util/comparison'; +import { build } from './builder'; class AggregateExpression extends Expression { - constructor(json) { + source: any; + + constructor(json: any) { super(json); this.source = build(json.source); } } -class Count extends AggregateExpression { - constructor(json) { +export class Count extends AggregateExpression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const items = this.source.execute(ctx); if (typeIsArray(items)) { return removeNulls(items).length; @@ -26,12 +29,12 @@ class Count extends AggregateExpression { } } -class Sum extends AggregateExpression { - constructor(json) { +export class Sum extends AggregateExpression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { let items = this.source.execute(ctx); if (!typeIsArray(items)) { return null; @@ -52,17 +55,17 @@ class Sum extends AggregateExpression { const sum = values.reduce((x, y) => x + y); return new Quantity(sum, items[0].unit); } else { - return items.reduce((x, y) => x + y); + return items.reduce((x: number, y: number) => x + y); } } } -class Min extends AggregateExpression { - constructor(json) { +export class Min extends AggregateExpression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const list = this.source.execute(ctx); if (list == null) { return null; @@ -82,7 +85,7 @@ class Min extends AggregateExpression { } // We assume the list is an array of all the same type. let minimum = listWithoutNulls[0]; - for (let element of listWithoutNulls) { + for (const element of listWithoutNulls) { if (lessThan(element, minimum)) { minimum = element; } @@ -91,12 +94,12 @@ class Min extends AggregateExpression { } } -class Max extends AggregateExpression { - constructor(json) { +export class Max extends AggregateExpression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const items = this.source.execute(ctx); if (items == null) { return null; @@ -116,7 +119,7 @@ class Max extends AggregateExpression { } // We assume the list is an array of all the same type. let maximum = listWithoutNulls[0]; - for (let element of listWithoutNulls) { + for (const element of listWithoutNulls) { if (greaterThan(element, maximum)) { maximum = element; } @@ -125,12 +128,12 @@ class Max extends AggregateExpression { } } -class Avg extends AggregateExpression { - constructor(json) { +export class Avg extends AggregateExpression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { let items = this.source.execute(ctx); if (!typeIsArray(items)) { return null; @@ -151,18 +154,18 @@ class Avg extends AggregateExpression { const sum = values.reduce((x, y) => x + y); return new Quantity(sum / values.length, items[0].unit); } else { - const sum = items.reduce((x, y) => x + y); + const sum = items.reduce((x: number, y: number) => x + y); return sum / items.length; } } } -class Median extends AggregateExpression { - constructor(json) { +export class Median extends AggregateExpression { + constructor(json: number) { super(json); } - exec(ctx) { + exec(ctx: Context) { let items = this.source.execute(ctx); if (!typeIsArray(items)) { return null; @@ -187,12 +190,12 @@ class Median extends AggregateExpression { } } -class Mode extends AggregateExpression { - constructor(json) { +export class Mode extends AggregateExpression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const items = this.source.execute(ctx); if (!typeIsArray(items)) { return null; @@ -216,7 +219,7 @@ class Mode extends AggregateExpression { } return new Quantity(mode, items[0].unit); } else { - let mode = this.mode(filtered); + const mode = this.mode(filtered); if (mode.length === 1) { return mode[0]; } else { @@ -225,11 +228,11 @@ class Mode extends AggregateExpression { } } - mode(arr) { + mode(arr: any[]) { let max = 0; - const counts = {}; - let results = []; - for (let elem of arr) { + const counts: any = {}; + let results: any[] = []; + for (const elem of arr) { const cnt = (counts[elem] = (counts[elem] != null ? counts[elem] : 0) + 1); if (cnt === max && !results.includes(elem)) { results.push(elem); @@ -242,16 +245,23 @@ class Mode extends AggregateExpression { } } -class StdDev extends AggregateExpression { +type StatisticType = + | 'standard_deviation' + | 'population_deviation' + | 'standard_variance' + | 'population_variance'; + +export class StdDev extends AggregateExpression { // TODO: This should be a derived class of an abstract base class 'Statistic' // rather than the base class + type: StatisticType; - constructor(json) { + constructor(json: any) { super(json); this.type = 'standard_deviation'; } - exec(ctx) { + exec(ctx: Context) { let items = this.source.execute(ctx); if (!typeIsArray(items)) { return null; @@ -276,19 +286,19 @@ class StdDev extends AggregateExpression { } } - standardDeviation(list) { + standardDeviation(list: any[]) { const val = this.stats(list); if (val) { return val[this.type]; } } - stats(list) { + stats(list: any[]) { const sum = list.reduce((x, y) => x + y); const mean = sum / list.length; let sumOfSquares = 0; - for (let sq of list) { + for (const sq of list) { sumOfSquares += Math.pow(sq - mean, 2); } @@ -305,12 +315,12 @@ class StdDev extends AggregateExpression { } } -class Product extends AggregateExpression { - constructor(json) { +export class Product extends AggregateExpression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { let items = this.source.execute(ctx); if (!typeIsArray(items)) { return null; @@ -331,17 +341,17 @@ class Product extends AggregateExpression { // Units are not multiplied for the geometric product return new Quantity(product, items[0].unit); } else { - return items.reduce((x, y) => x * y); + return items.reduce((x: number, y: number) => x * y); } } } -class GeometricMean extends AggregateExpression { - constructor(json) { +export class GeometricMean extends AggregateExpression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { let items = this.source.execute(ctx); if (!typeIsArray(items)) { return null; @@ -363,56 +373,56 @@ class GeometricMean extends AggregateExpression { const geoMean = Math.pow(product, 1.0 / items.length); return new Quantity(geoMean, items[0].unit); } else { - const product = items.reduce((x, y) => x * y); + const product = items.reduce((x: number, y: number) => x * y); return Math.pow(product, 1.0 / items.length); } } } -class PopulationStdDev extends StdDev { - constructor(json) { +export class PopulationStdDev extends StdDev { + constructor(json: any) { super(json); this.type = 'population_deviation'; } } -class Variance extends StdDev { - constructor(json) { +export class Variance extends StdDev { + constructor(json: any) { super(json); this.type = 'standard_variance'; } } -class PopulationVariance extends StdDev { - constructor(json) { +export class PopulationVariance extends StdDev { + constructor(json: any) { super(json); this.type = 'population_variance'; } } -class AllTrue extends AggregateExpression { - constructor(json) { +export class AllTrue extends AggregateExpression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const items = this.source.execute(ctx); return allTrue(removeNulls(items)); } } -class AnyTrue extends AggregateExpression { - constructor(json) { +export class AnyTrue extends AggregateExpression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const items = this.source.execute(ctx); return anyTrue(items); } } -function processQuantities(values) { +function processQuantities(values: any[]) { const items = removeNulls(values); if (hasOnlyQuantities(items)) { return convertAllUnits(items); @@ -425,24 +435,24 @@ function processQuantities(values) { } } -function getValuesFromQuantities(quantities) { +function getValuesFromQuantities(quantities: Quantity[]): number[] { return quantities.map(quantity => quantity.value); } -function hasOnlyQuantities(arr) { +function hasOnlyQuantities(arr: any[]) { return arr.every(x => x.isQuantity); } -function hasSomeQuantities(arr) { +function hasSomeQuantities(arr: any[]) { return arr.some(x => x.isQuantity); } -function convertAllUnits(arr) { +function convertAllUnits(arr: any[]) { // convert all quantities in array to match the unit of the first item return arr.map(q => q.convertUnit(arr[0].unit)); } -function medianOfNumbers(numbers) { +function medianOfNumbers(numbers: number[]) { const items = numerical_sort(numbers, 'asc'); if (items.length % 2 === 1) { // Odd number of items @@ -452,21 +462,3 @@ function medianOfNumbers(numbers) { return (items[items.length / 2 - 1] + items[items.length / 2]) / 2; } } - -module.exports = { - Count, - Sum, - Min, - Max, - Avg, - Median, - Mode, - StdDev, - Product, - GeometricMean, - PopulationStdDev, - Variance, - PopulationVariance, - AllTrue, - AnyTrue -}; diff --git a/src/elm/arithmetic.js b/src/elm/arithmetic.ts similarity index 65% rename from src/elm/arithmetic.js rename to src/elm/arithmetic.ts index 7ad09ab4d..e372c5d0e 100644 --- a/src/elm/arithmetic.js +++ b/src/elm/arithmetic.ts @@ -1,27 +1,29 @@ -const { Expression } = require('./expression'); -const { build } = require('./builder'); -const MathUtil = require('../util/math'); -const { +import { Expression } from './expression'; +import * as MathUtil from '../util/math'; +import { Quantity, doAddition, doSubtraction, doMultiplication, doDivision -} = require('../datatypes/quantity'); -const { Uncertainty } = require('../datatypes/uncertainty'); - -class Add extends Expression { - constructor(json) { +} from '../datatypes/quantity'; +import { Uncertainty } from '../datatypes/uncertainty'; +import { Context } from '../runtime/context'; +import { build } from './builder'; +import { DateTime } from '../datatypes/datetime'; + +export class Add extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); - if (args == null || args.some(x => x == null)) { + if (args == null || args.some((x: any) => x == null)) { return null; } - const sum = args.reduce((x, y) => { + const sum = args.reduce((x: any, y: any) => { if (x.isUncertainty && !y.isUncertainty) { y = new Uncertainty(y, y); } else if (y.isUncertainty && !x.isUncertainty) { @@ -53,18 +55,18 @@ class Add extends Expression { } } -class Subtract extends Expression { - constructor(json) { +export class Subtract extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { - let args = this.execArgs(ctx); - if (args == null || args.some(x => x == null)) { + exec(ctx: Context) { + const args = this.execArgs(ctx); + if (args == null || args.some((x: any) => x == null)) { return null; } - const difference = args.reduce((x, y) => { + const difference = args.reduce((x: any, y: any) => { if (x.isUncertainty && !y.isUncertainty) { y = new Uncertainty(y, y); } else if (y.isUncertainty && !x.isUncertainty) { @@ -91,18 +93,18 @@ class Subtract extends Expression { } } -class Multiply extends Expression { - constructor(json) { +export class Multiply extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { - let args = this.execArgs(ctx); - if (args == null || args.some(x => x == null)) { + exec(ctx: Context) { + const args = this.execArgs(ctx); + if (args == null || args.some((x: any) => x == null)) { return null; } - const product = args.reduce((x, y) => { + const product = args.reduce((x: any, y: any) => { if (x.isUncertainty && !y.isUncertainty) { y = new Uncertainty(y, y); } else if (y.isUncertainty && !x.isUncertainty) { @@ -129,18 +131,18 @@ class Multiply extends Expression { } } -class Divide extends Expression { - constructor(json) { +export class Divide extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); - if (args == null || args.some(x => x == null)) { + if (args == null || args.some((x: any) => x == null)) { return null; } - const quotient = args.reduce(function (x, y) { + const quotient = args.reduce((x: any, y: any) => { if (x.isUncertainty && !y.isUncertainty) { y = new Uncertainty(y, y); } else if (y.isUncertainty && !x.isUncertainty) { @@ -169,18 +171,18 @@ class Divide extends Expression { } } -class TruncatedDivide extends Expression { - constructor(json) { +export class TruncatedDivide extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); - if (args == null || args.some(x => x == null)) { + if (args == null || args.some((x: any) => x == null)) { return null; } - const quotient = args.reduce((x, y) => x / y); + const quotient = args.reduce((x: number, y: number) => x / y); const truncatedQuotient = quotient >= 0 ? Math.floor(quotient) : Math.ceil(quotient); if (MathUtil.overflowsOrUnderflows(truncatedQuotient)) { @@ -190,29 +192,29 @@ class TruncatedDivide extends Expression { } } -class Modulo extends Expression { - constructor(json) { +export class Modulo extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); - if (args == null || args.some(x => x == null)) { + if (args == null || args.some((x: any) => x == null)) { return null; } - const modulo = args.reduce((x, y) => x % y); + const modulo = args.reduce((x: number, y: number) => x % y); return MathUtil.decimalOrNull(modulo); } } -class Ceiling extends Expression { - constructor(json) { +export class Ceiling extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -222,12 +224,12 @@ class Ceiling extends Expression { } } -class Floor extends Expression { - constructor(json) { +export class Floor extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -237,12 +239,12 @@ class Floor extends Expression { } } -class Truncate extends Expression { - constructor(json) { +export class Truncate extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -251,12 +253,12 @@ class Truncate extends Expression { return arg >= 0 ? Math.floor(arg) : Math.ceil(arg); } } -class Abs extends Expression { - constructor(json) { +export class Abs extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -268,12 +270,12 @@ class Abs extends Expression { } } -class Negate extends Expression { - constructor(json) { +export class Negate extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -285,13 +287,15 @@ class Negate extends Expression { } } -class Round extends Expression { - constructor(json) { +export class Round extends Expression { + precision: any; + + constructor(json: any) { super(json); this.precision = build(json.precision); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -302,12 +306,12 @@ class Round extends Expression { } } -class Ln extends Expression { - constructor(json) { +export class Ln extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -319,12 +323,12 @@ class Ln extends Expression { } } -class Exp extends Expression { - constructor(json) { +export class Exp extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -339,35 +343,35 @@ class Exp extends Expression { } } -class Log extends Expression { - constructor(json) { +export class Log extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); - if (args == null || args.some(x => x == null)) { + if (args == null || args.some((x: any) => x == null)) { return null; } - const log = args.reduce((x, y) => Math.log(x) / Math.log(y)); + const log = args.reduce((x: number, y: number) => Math.log(x) / Math.log(y)); return MathUtil.decimalOrNull(log); } } -class Power extends Expression { - constructor(json) { +export class Power extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); - if (args == null || args.some(x => x == null)) { + if (args == null || args.some((x: any) => x == null)) { return null; } - const power = args.reduce((x, y) => Math.pow(x, y)); + const power = args.reduce((x: number, y: number) => Math.pow(x, y)); if (MathUtil.overflowsOrUnderflows(power)) { return null; @@ -376,16 +380,26 @@ class Power extends Expression { } } -class MinValue extends Expression { - constructor(json) { +export class MinValue extends Expression { + static readonly MIN_VALUES = { + '{urn:hl7-org:elm-types:r1}Integer': MathUtil.MIN_INT_VALUE, + '{urn:hl7-org:elm-types:r1}Decimal': MathUtil.MIN_FLOAT_VALUE, + '{urn:hl7-org:elm-types:r1}DateTime': MathUtil.MIN_DATETIME_VALUE, + '{urn:hl7-org:elm-types:r1}Date': MathUtil.MIN_DATE_VALUE, + '{urn:hl7-org:elm-types:r1}Time': MathUtil.MIN_TIME_VALUE + }; + + valueType: keyof typeof MinValue.MIN_VALUES; + + constructor(json: any) { super(json); this.valueType = json.valueType; } - exec(ctx) { + exec(ctx: Context) { if (MinValue.MIN_VALUES[this.valueType]) { if (this.valueType === '{urn:hl7-org:elm-types:r1}DateTime') { - const minDateTime = MinValue.MIN_VALUES[this.valueType].copy(); + const minDateTime = (MinValue.MIN_VALUES[this.valueType] as DateTime).copy(); minDateTime.timezoneOffset = ctx.getTimezoneOffset(); return minDateTime; } else { @@ -397,23 +411,26 @@ class MinValue extends Expression { } } -MinValue.MIN_VALUES = {}; -MinValue.MIN_VALUES['{urn:hl7-org:elm-types:r1}Integer'] = MathUtil.MIN_INT_VALUE; -MinValue.MIN_VALUES['{urn:hl7-org:elm-types:r1}Decimal'] = MathUtil.MIN_FLOAT_VALUE; -MinValue.MIN_VALUES['{urn:hl7-org:elm-types:r1}DateTime'] = MathUtil.MIN_DATETIME_VALUE; -MinValue.MIN_VALUES['{urn:hl7-org:elm-types:r1}Date'] = MathUtil.MIN_DATE_VALUE; -MinValue.MIN_VALUES['{urn:hl7-org:elm-types:r1}Time'] = MathUtil.MIN_TIME_VALUE; +export class MaxValue extends Expression { + static readonly MAX_VALUES = { + '{urn:hl7-org:elm-types:r1}Integer': MathUtil.MAX_INT_VALUE, + '{urn:hl7-org:elm-types:r1}Decimal': MathUtil.MAX_FLOAT_VALUE, + '{urn:hl7-org:elm-types:r1}DateTime': MathUtil.MAX_DATETIME_VALUE, + '{urn:hl7-org:elm-types:r1}Date': MathUtil.MAX_DATE_VALUE, + '{urn:hl7-org:elm-types:r1}Time': MathUtil.MAX_TIME_VALUE + }; + + valueType: keyof typeof MaxValue.MAX_VALUES; -class MaxValue extends Expression { - constructor(json) { + constructor(json: any) { super(json); this.valueType = json.valueType; } - exec(ctx) { + exec(ctx: Context) { if (MaxValue.MAX_VALUES[this.valueType] != null) { if (this.valueType === '{urn:hl7-org:elm-types:r1}DateTime') { - const maxDateTime = MaxValue.MAX_VALUES[this.valueType].copy(); + const maxDateTime = (MaxValue.MAX_VALUES[this.valueType] as DateTime).copy(); maxDateTime.timezoneOffset = ctx.getTimezoneOffset(); return maxDateTime; } else { @@ -425,19 +442,12 @@ class MaxValue extends Expression { } } -MaxValue.MAX_VALUES = {}; -MaxValue.MAX_VALUES['{urn:hl7-org:elm-types:r1}Integer'] = MathUtil.MAX_INT_VALUE; -MaxValue.MAX_VALUES['{urn:hl7-org:elm-types:r1}Decimal'] = MathUtil.MAX_FLOAT_VALUE; -MaxValue.MAX_VALUES['{urn:hl7-org:elm-types:r1}DateTime'] = MathUtil.MAX_DATETIME_VALUE; -MaxValue.MAX_VALUES['{urn:hl7-org:elm-types:r1}Date'] = MathUtil.MAX_DATE_VALUE; -MaxValue.MAX_VALUES['{urn:hl7-org:elm-types:r1}Time'] = MathUtil.MAX_TIME_VALUE; - -class Successor extends Expression { - constructor(json) { +export class Successor extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -461,12 +471,12 @@ class Successor extends Expression { } } -class Predecessor extends Expression { - constructor(json) { +export class Predecessor extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -489,26 +499,3 @@ class Predecessor extends Expression { return predecessor; } } - -module.exports = { - Abs, - Add, - Ceiling, - Divide, - Exp, - Floor, - Ln, - Log, - MaxValue, - MinValue, - Modulo, - Multiply, - Negate, - Power, - Predecessor, - Round, - Subtract, - Successor, - Truncate, - TruncatedDivide -}; diff --git a/src/elm/builder.js b/src/elm/builder.ts similarity index 54% rename from src/elm/builder.js rename to src/elm/builder.ts index a2bc4ab11..a536228c1 100644 --- a/src/elm/builder.js +++ b/src/elm/builder.ts @@ -1,13 +1,14 @@ -const E = require('./expressions'); -const { typeIsArray } = require('../util/util'); +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import * as E from './expressions'; +import { typeIsArray } from '../util/util'; -function build(json) { +export function build(json: any): any { if (json == null) { return json; } if (typeIsArray(json)) { - return json.map(child => build(child)); + return (json as any[]).map(child => build(child)); } if (json.type === 'FunctionRef') { @@ -21,12 +22,12 @@ function build(json) { } } -function functionExists(name) { +function functionExists(name: string) { + // @ts-ignore return typeof E[name] === 'function'; } -function constructByName(name, json) { +function constructByName(name: string, json: any) { + // @ts-ignore return new E[name](json); } - -module.exports = { build }; diff --git a/src/elm/clinical.js b/src/elm/clinical.ts similarity index 69% rename from src/elm/clinical.js rename to src/elm/clinical.ts index 4f0bfe376..5aaf14159 100644 --- a/src/elm/clinical.js +++ b/src/elm/clinical.ts @@ -1,9 +1,14 @@ -const { Expression } = require('./expression'); -const dt = require('../datatypes/datatypes'); -const { build } = require('./builder'); +import { Expression } from './expression'; +import * as dt from '../datatypes/datatypes'; +import { Context } from '../runtime/context'; +import { build } from './builder'; -class ValueSetDef extends Expression { - constructor(json) { +export class ValueSetDef extends Expression { + name: string; + id: string; + version?: string; + + constructor(json: any) { super(json); this.name = json.name; this.id = json.id; @@ -11,7 +16,7 @@ class ValueSetDef extends Expression { } //todo: code systems and versions - exec(ctx) { + exec(ctx: Context) { const valueset = ctx.codeService.findValueSet(this.id, this.version) || new dt.ValueSet(this.id, this.version); ctx.rootContext().set(this.name, valueset); @@ -19,14 +24,17 @@ class ValueSetDef extends Expression { } } -class ValueSetRef extends Expression { - constructor(json) { +export class ValueSetRef extends Expression { + name: string; + libraryName: string; + + constructor(json: any) { super(json); this.name = json.name; this.libraryName = json.libraryName; } - exec(ctx) { + exec(ctx: Context) { // TODO: This calls the code service every time-- should be optimized let valueset = ctx.getValueSet(this.name, this.libraryName); if (valueset instanceof Expression) { @@ -36,14 +44,17 @@ class ValueSetRef extends Expression { } } -class AnyInValueSet extends Expression { - constructor(json) { +export class AnyInValueSet extends Expression { + codes: any; + valueset: ValueSetRef; + + constructor(json: any) { super(json); this.codes = build(json.codes); this.valueset = new ValueSetRef(json.valueset); } - exec(ctx) { + exec(ctx: Context) { const valueset = this.valueset.execute(ctx); // If the value set reference cannot be resolved, a run-time error is thrown. if (valueset == null || !valueset.isValueSet) { @@ -51,18 +62,21 @@ class AnyInValueSet extends Expression { } const codes = this.codes.exec(ctx); - return codes != null && codes.some(code => valueset.hasMatch(code)); + return codes != null && codes.some((code: any) => valueset.hasMatch(code)); } } -class InValueSet extends Expression { - constructor(json) { +export class InValueSet extends Expression { + code: any; + valueset: ValueSetRef; + + constructor(json: any) { super(json); this.code = build(json.code); this.valueset = new ValueSetRef(json.valueset); } - exec(ctx) { + exec(ctx: Context) { // If the code argument is null, the result is false if (this.code == null) { return false; @@ -84,21 +98,30 @@ class InValueSet extends Expression { } } -class CodeSystemDef extends Expression { - constructor(json) { +export class CodeSystemDef extends Expression { + name: string; + id: string; + version: string; + + constructor(json: any) { super(json); this.name = json.name; this.id = json.id; this.version = json.version; } - exec(ctx) { + exec(_ctx: Context) { return new dt.CodeSystem(this.id, this.version); } } -class CodeDef extends Expression { - constructor(json) { +export class CodeDef extends Expression { + name: string; + id: string; + systemName: string; + display?: string; + + constructor(json: any) { super(json); this.name = json.name; this.id = json.id; @@ -106,28 +129,36 @@ class CodeDef extends Expression { this.display = json.display; } - exec(ctx) { + exec(ctx: Context) { const system = ctx.getCodeSystem(this.systemName).execute(ctx); return new dt.Code(this.id, system.id, system.version, this.display); } } -class CodeRef extends Expression { - constructor(json) { +export class CodeRef extends Expression { + name: string; + library: string; + + constructor(json: any) { super(json); this.name = json.name; this.library = json.libraryName; } - exec(ctx) { + exec(ctx: Context) { ctx = this.library ? ctx.getLibraryContext(this.library) : ctx; const codeDef = ctx.getCode(this.name); return codeDef ? codeDef.execute(ctx) : undefined; } } -class Code extends Expression { - constructor(json) { +export class Code extends Expression { + code: any; + systemName: string; + version: string; + display?: string; + + constructor(json: any) { super(json); this.code = json.code; this.systemName = json.system.name; @@ -141,22 +172,26 @@ class Code extends Expression { return true; } - exec(ctx) { + exec(ctx: Context) { const system = ctx.getCodeSystem(this.systemName) || {}; return new dt.Code(this.code, system.id, this.version, this.display); } } -class ConceptDef extends Expression { - constructor(json) { +export class ConceptDef extends Expression { + name: string; + codes: any; + display?: string; + + constructor(json: any) { super(json); this.name = json.name; this.display = json.display; this.codes = json.code; } - exec(ctx) { - const codes = this.codes.map(code => { + exec(ctx: Context) { + const codes = this.codes.map((code: any) => { const codeDef = ctx.getCode(code.name); return codeDef ? codeDef.execute(ctx) : undefined; }); @@ -164,20 +199,25 @@ class ConceptDef extends Expression { } } -class ConceptRef extends Expression { - constructor(json) { +export class ConceptRef extends Expression { + name: string; + + constructor(json: any) { super(json); this.name = json.name; } - exec(ctx) { + exec(ctx: Context) { const conceptDef = ctx.getConcept(this.name); return conceptDef ? conceptDef.execute(ctx) : undefined; } } -class Concept extends Expression { - constructor(json) { +export class Concept extends Expression { + codes: any; + display?: string; + + constructor(json: any) { super(json); this.codes = json.code; this.display = json.display; @@ -189,24 +229,26 @@ class Concept extends Expression { return true; } - toCode(ctx, code) { + toCode(ctx: Context, code: any) { const system = ctx.getCodeSystem(code.system.name) || {}; return new dt.Code(code.code, system.id, code.version, code.display); } - exec(ctx) { - const codes = this.codes.map(code => this.toCode(ctx, code)); + exec(ctx: Context) { + const codes = this.codes.map((code: any) => this.toCode(ctx, code)); return new dt.Concept(codes, this.display); } } -class CalculateAge extends Expression { - constructor(json) { +export class CalculateAge extends Expression { + precision: string; + + constructor(json: any) { super(json); this.precision = json.precision; } - exec(ctx) { + exec(ctx: Context) { const date1 = this.execArgs(ctx); const date2 = dt.DateTime.fromJSDate(ctx.getExecutionDateTime()); const result = @@ -219,13 +261,15 @@ class CalculateAge extends Expression { } } -class CalculateAgeAt extends Expression { - constructor(json) { +export class CalculateAgeAt extends Expression { + precision: string; + constructor(json: any) { super(json); this.precision = json.precision; } - exec(ctx) { + exec(ctx: Context) { + // eslint-disable-next-line prefer-const let [date1, date2] = this.execArgs(ctx); if (date1 != null && date2 != null) { // date1 is the birthdate, convert it to date if date2 is a date (to support ignoring time) @@ -243,19 +287,3 @@ class CalculateAgeAt extends Expression { return null; } } - -module.exports = { - AnyInValueSet, - CalculateAge, - CalculateAgeAt, - Code, - CodeDef, - CodeRef, - CodeSystemDef, - Concept, - ConceptDef, - ConceptRef, - InValueSet, - ValueSetDef, - ValueSetRef -}; diff --git a/src/elm/comparison.js b/src/elm/comparison.js deleted file mode 100644 index 6b6be35a5..000000000 --- a/src/elm/comparison.js +++ /dev/null @@ -1,64 +0,0 @@ -const { Expression } = require('./expression'); -const { Uncertainty } = require('../datatypes/datatypes'); - -// Equal is completely handled by overloaded#Equal - -// NotEqual is completely handled by overloaded#Equal - -class Less extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - const args = this.execArgs(ctx).map(x => Uncertainty.from(x)); - if (args[0] == null || args[1] == null) { - return null; - } - return args[0].lessThan(args[1]); - } -} - -class LessOrEqual extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - const args = this.execArgs(ctx).map(x => Uncertainty.from(x)); - if (args[0] == null || args[1] == null) { - return null; - } - return args[0].lessThanOrEquals(args[1]); - } -} - -class Greater extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - const args = this.execArgs(ctx).map(x => Uncertainty.from(x)); - if (args[0] == null || args[1] == null) { - return null; - } - return args[0].greaterThan(args[1]); - } -} - -class GreaterOrEqual extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - const args = this.execArgs(ctx).map(x => Uncertainty.from(x)); - if (args[0] == null || args[1] == null) { - return null; - } - return args[0].greaterThanOrEquals(args[1]); - } -} - -module.exports = { Greater, GreaterOrEqual, Less, LessOrEqual }; diff --git a/src/elm/comparison.ts b/src/elm/comparison.ts new file mode 100644 index 000000000..bab09c794 --- /dev/null +++ b/src/elm/comparison.ts @@ -0,0 +1,63 @@ +import { Expression } from './expression'; +import { Uncertainty } from '../datatypes/datatypes'; +import { Context } from '../runtime/context'; + +// Equal is completely handled by overloaded#Equal + +// NotEqual is completely handled by overloaded#Equal + +export class Less extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + const args = this.execArgs(ctx).map((x: any) => Uncertainty.from(x)); + if (args[0] == null || args[1] == null) { + return null; + } + return args[0].lessThan(args[1]); + } +} + +export class LessOrEqual extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + const args = this.execArgs(ctx).map((x: any) => Uncertainty.from(x)); + if (args[0] == null || args[1] == null) { + return null; + } + return args[0].lessThanOrEquals(args[1]); + } +} + +export class Greater extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + const args = this.execArgs(ctx).map((x: any) => Uncertainty.from(x)); + if (args[0] == null || args[1] == null) { + return null; + } + return args[0].greaterThan(args[1]); + } +} + +export class GreaterOrEqual extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + const args = this.execArgs(ctx).map((x: any) => Uncertainty.from(x)); + if (args[0] == null || args[1] == null) { + return null; + } + return args[0].greaterThanOrEquals(args[1]); + } +} diff --git a/src/elm/conditional.js b/src/elm/conditional.ts similarity index 56% rename from src/elm/conditional.js rename to src/elm/conditional.ts index ce11a8366..833efa746 100644 --- a/src/elm/conditional.js +++ b/src/elm/conditional.ts @@ -1,17 +1,22 @@ -const { Expression } = require('./expression'); -const { build } = require('./builder'); -const { equals } = require('../util/comparison'); +import { Expression } from './expression'; +import { build } from './builder'; +import { equals } from '../util/comparison'; +import { Context } from '../runtime/context'; // TODO: Spec lists "Conditional", but it's "If" in the XSD -class If extends Expression { - constructor(json) { +export class If extends Expression { + condition: any; + th: any; + els: any; + + constructor(json: any) { super(json); this.condition = build(json.condition); this.th = build(json.then); this.els = build(json.else); } - exec(ctx) { + exec(ctx: Context) { if (this.condition.execute(ctx)) { return this.th.execute(ctx); } else { @@ -20,22 +25,29 @@ class If extends Expression { } } -class CaseItem { - constructor(json) { +export class CaseItem { + when: any; + then: any; + + constructor(json: any) { this.when = build(json.when); this.then = build(json.then); } } -class Case extends Expression { - constructor(json) { +export class Case extends Expression { + comparand: any; + caseItems: CaseItem[]; + els: any; + + constructor(json: any) { super(json); this.comparand = build(json.comparand); - this.caseItems = json.caseItem.map(ci => new CaseItem(ci)); + this.caseItems = json.caseItem.map((ci: any) => new CaseItem(ci)); this.els = build(json.else); } - exec(ctx) { + exec(ctx: Context) { if (this.comparand) { return this.exec_selected(ctx); } else { @@ -43,9 +55,9 @@ class Case extends Expression { } } - exec_selected(ctx) { + exec_selected(ctx: Context) { const val = this.comparand.execute(ctx); - for (let ci of this.caseItems) { + for (const ci of this.caseItems) { if (equals(ci.when.execute(ctx), val)) { return ci.then.execute(ctx); } @@ -53,8 +65,8 @@ class Case extends Expression { return this.els.execute(ctx); } - exec_standard(ctx) { - for (let ci of this.caseItems) { + exec_standard(ctx: Context) { + for (const ci of this.caseItems) { if (ci.when.execute(ctx)) { return ci.then.execute(ctx); } @@ -62,5 +74,3 @@ class Case extends Expression { return this.els.execute(ctx); } } - -module.exports = { Case, CaseItem, If }; diff --git a/src/elm/datetime.js b/src/elm/datetime.ts similarity index 62% rename from src/elm/datetime.js rename to src/elm/datetime.ts index b29e1f7ae..5750db775 100644 --- a/src/elm/datetime.js +++ b/src/elm/datetime.ts @@ -1,20 +1,37 @@ -const { Expression } = require('./expression'); -const { build } = require('./builder'); -const { Literal } = require('./literal'); -const DT = require('../datatypes/datatypes'); - -class DateTime extends Expression { - constructor(json) { +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { Expression } from './expression'; +import { build } from './builder'; +import { Literal } from './literal'; +import * as DT from '../datatypes/datatypes'; +import { Context } from '../runtime/context'; + +export class DateTime extends Expression { + json: any; + + static readonly PROPERTIES = [ + 'year', + 'month', + 'day', + 'hour', + 'minute', + 'second', + 'millisecond', + 'timezoneOffset' + ]; + + constructor(json: any) { super(json); this.json = json; } - exec(ctx) { - for (let property of DateTime.PROPERTIES) { + exec(ctx: Context) { + for (const property of DateTime.PROPERTIES) { // if json does not contain 'timezoneOffset' set it to the executionDateTime from the context if (this.json[property] != null) { + // @ts-ignore this[property] = build(this.json[property]); } else if (property === 'timezoneOffset' && ctx.getTimezoneOffset() != null) { + // @ts-ignore this[property] = Literal.from({ type: 'Literal', value: ctx.getTimezoneOffset(), @@ -22,96 +39,93 @@ class DateTime extends Expression { }); } } + // @ts-ignore const args = DateTime.PROPERTIES.map(p => (this[p] != null ? this[p].execute(ctx) : undefined)); return new DT.DateTime(...args); } } -DateTime.PROPERTIES = [ - 'year', - 'month', - 'day', - 'hour', - 'minute', - 'second', - 'millisecond', - 'timezoneOffset' -]; - -class Date extends Expression { - constructor(json) { +export class Date extends Expression { + json: any; + + static readonly PROPERTIES = ['year', 'month', 'day']; + + constructor(json: any) { super(json); this.json = json; } - exec(ctx) { - for (let property of Date.PROPERTIES) { + exec(ctx: Context) { + for (const property of Date.PROPERTIES) { if (this.json[property] != null) { + // @ts-ignore this[property] = build(this.json[property]); } } + // @ts-ignore const args = Date.PROPERTIES.map(p => (this[p] != null ? this[p].execute(ctx) : undefined)); return new DT.Date(...args); } } -Date.PROPERTIES = ['year', 'month', 'day']; - -class Time extends Expression { - constructor(json) { +export class Time extends Expression { + static readonly PROPERTIES = ['hour', 'minute', 'second', 'millisecond']; + constructor(json: any) { super(json); - for (let property of Time.PROPERTIES) { + for (const property of Time.PROPERTIES) { if (json[property] != null) { + // @ts-ignore this[property] = build(json[property]); } } } - exec(ctx) { + exec(ctx: Context) { + // @ts-ignore const args = Time.PROPERTIES.map(p => (this[p] != null ? this[p].execute(ctx) : undefined)); return new DT.DateTime(0, 1, 1, ...args).getTime(); } } -Time.PROPERTIES = ['hour', 'minute', 'second', 'millisecond']; - -class Today extends Expression { - constructor(json) { +export class Today extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { return ctx.getExecutionDateTime().getDate(); } } -class Now extends Expression { - constructor(json) { +export class Now extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { return ctx.getExecutionDateTime(); } } -class TimeOfDay extends Expression { - constructor(json) { +export class TimeOfDay extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { return ctx.getExecutionDateTime().getTime(); } } -class DateTimeComponentFrom extends Expression { - constructor(json) { +export class DateTimeComponentFrom extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision; } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { return arg[this.precision.toLowerCase()]; @@ -121,12 +135,12 @@ class DateTimeComponentFrom extends Expression { } } -class DateFrom extends Expression { - constructor(json) { +export class DateFrom extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const date = this.execArgs(ctx); if (date != null) { return date.getDate(); @@ -136,12 +150,12 @@ class DateFrom extends Expression { } } -class TimeFrom extends Expression { - constructor(json) { +export class TimeFrom extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const date = this.execArgs(ctx); if (date != null) { return date.getTime(); @@ -151,12 +165,12 @@ class TimeFrom extends Expression { } } -class TimezoneOffsetFrom extends Expression { - constructor(json) { +export class TimezoneOffsetFrom extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const date = this.execArgs(ctx); if (date != null) { return date.timezoneOffset; @@ -167,22 +181,24 @@ class TimezoneOffsetFrom extends Expression { } // Delegated to by overloaded#After -function doAfter(a, b, precision) { +export function doAfter(a: any, b: any, precision: any) { return a.after(b, precision); } // Delegated to by overloaded#Before -function doBefore(a, b, precision) { +export function doBefore(a: any, b: any, precision: any) { return a.before(b, precision); } -class DifferenceBetween extends Expression { - constructor(json) { +export class DifferenceBetween extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision; } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); // Check to make sure args exist and that they have differenceBetween functions so that they can be compared to one another if ( @@ -205,13 +221,15 @@ class DifferenceBetween extends Expression { } } -class DurationBetween extends Expression { - constructor(json) { +export class DurationBetween extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision; } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); // Check to make sure args exist and that they have durationBetween functions so that they can be compared to one another if ( @@ -233,20 +251,3 @@ class DurationBetween extends Expression { } } } - -module.exports = { - Date, - DateFrom, - DateTime, - DateTimeComponentFrom, - DifferenceBetween, - DurationBetween, - Now, - Time, - TimeFrom, - TimeOfDay, - TimezoneOffsetFrom, - Today, - doAfter, - doBefore -}; diff --git a/src/elm/declaration.js b/src/elm/declaration.js deleted file mode 100644 index ee8b0e8e0..000000000 --- a/src/elm/declaration.js +++ /dev/null @@ -1,9 +0,0 @@ -const { UnimplementedExpression } = require('./expression'); - -class UsingDef extends UnimplementedExpression {} - -class IncludeDef extends UnimplementedExpression {} - -class VersionedIdentifier extends UnimplementedExpression {} - -module.exports = { UsingDef, IncludeDef, VersionedIdentifier }; diff --git a/src/elm/declaration.ts b/src/elm/declaration.ts new file mode 100644 index 000000000..d199c869e --- /dev/null +++ b/src/elm/declaration.ts @@ -0,0 +1,7 @@ +import { UnimplementedExpression } from './expression'; + +export class UsingDef extends UnimplementedExpression {} + +export class IncludeDef extends UnimplementedExpression {} + +export class VersionedIdentifier extends UnimplementedExpression {} diff --git a/src/elm/expression.js b/src/elm/expression.ts similarity index 53% rename from src/elm/expression.js rename to src/elm/expression.ts index ef51c92ec..0743000ba 100644 --- a/src/elm/expression.js +++ b/src/elm/expression.ts @@ -1,8 +1,14 @@ -const { build } = require('./builder'); -const { typeIsArray } = require('../util/util'); +import { Context } from '../runtime/context'; +import { typeIsArray } from '../util/util'; -class Expression { - constructor(json) { +import { build } from './builder'; + +export class Expression { + localId?: string; + arg?: any; + args?: any[]; + + constructor(json: any) { if (json.operand != null) { const op = build(json.operand); if (typeIsArray(json.operand)) { @@ -16,7 +22,7 @@ class Expression { } } - execute(ctx) { + execute(ctx: Context) { if (this.localId != null) { // Store the localId and result on the root context of this library const execValue = this.exec(ctx); @@ -27,31 +33,30 @@ class Expression { } } - exec(ctx) { + exec(_ctx: Context): any { return this; } - execArgs(ctx) { - switch (false) { - case this.args == null: - return this.args.map(arg => arg.execute(ctx)); - case this.arg == null: - return this.arg.execute(ctx); - default: - return null; + execArgs(ctx: Context) { + if (this.args != null) { + return this.args.map(arg => arg.execute(ctx)); + } else if (this.arg != null) { + return this.arg.execute(ctx); + } else { + return null; } } } -class UnimplementedExpression extends Expression { - constructor(json) { +export class UnimplementedExpression extends Expression { + json: any; + + constructor(json: any) { super(json); this.json = json; } - exec(ctx) { + exec(_ctx: Context) { throw new Error(`Unimplemented Expression: ${this.json.type}`); } } - -module.exports = { Expression, UnimplementedExpression }; diff --git a/src/elm/expressions.js b/src/elm/expressions.js deleted file mode 100644 index 83eafda0f..000000000 --- a/src/elm/expressions.js +++ /dev/null @@ -1,58 +0,0 @@ -const expression = require('./expression'); -const aggregate = require('./aggregate'); -const arithmetic = require('./arithmetic'); -const clinical = require('./clinical'); -const comparison = require('./comparison'); -const conditional = require('./conditional'); -const datetime = require('./datetime'); -const declaration = require('./declaration'); -const external = require('./external'); -const instance = require('./instance'); -const interval = require('./interval'); -const list = require('./list'); -const literal = require('./literal'); -const logical = require('./logical'); -const message = require('./message'); -const nullological = require('./nullological'); -const parameters = require('./parameters'); -const quantity = require('./quantity'); -const query = require('./query'); -const ratio = require('./ratio'); -const reusable = require('./reusable'); -const string = require('./string'); -const structured = require('./structured'); -const type = require('./type'); -const overloaded = require('./overloaded'); - -const libs = [ - expression, - aggregate, - arithmetic, - clinical, - comparison, - conditional, - datetime, - declaration, - external, - instance, - interval, - list, - literal, - logical, - message, - nullological, - parameters, - query, - quantity, - ratio, - reusable, - string, - structured, - type, - overloaded -]; -for (let lib of libs) { - for (let element of Object.keys(lib)) { - module.exports[element] = lib[element]; - } -} diff --git a/src/elm/expressions.ts b/src/elm/expressions.ts new file mode 100644 index 000000000..c43981727 --- /dev/null +++ b/src/elm/expressions.ts @@ -0,0 +1,51 @@ +export * from './expression'; +export * from './aggregate'; +export * from './arithmetic'; +export * from './clinical'; +export * from './comparison'; +export * from './conditional'; +export * from './datetime'; +export * from './declaration'; +export * from './external'; +export * from './instance'; +export * from './interval'; +export * from './list'; +export * from './literal'; +export * from './logical'; +export * from './message'; +export * from './nullological'; +export * from './parameters'; +export * from './quantity'; +export * from './query'; +export * from './ratio'; +export * from './reusable'; +export * from './string'; +export * from './structured'; +export * from './type'; +export * from './overloaded'; + +// Re-exporting interval functions as overrides to avoid ambiguity +// https://stackoverflow.com/questions/41293108/how-to-do-re-export-with-overrides +// TODO: we should improve this by perhaps renaming and reworking these functions +// it's a bit confusing right now giving the interval exports precedence over the others +import { + doBefore, + doUnion, + doAfter, + doProperIncludes, + doIntersect, + doIncludes, + doExcept, + doContains +} from './interval'; + +export { + doBefore, + doUnion, + doAfter, + doProperIncludes, + doIntersect, + doIncludes, + doExcept, + doContains +}; diff --git a/src/elm/external.js b/src/elm/external.ts similarity index 60% rename from src/elm/external.js rename to src/elm/external.ts index 7eacc6664..634462d7d 100644 --- a/src/elm/external.js +++ b/src/elm/external.ts @@ -1,9 +1,17 @@ -const { Expression } = require('./expression'); -const { build } = require('./builder'); -const { typeIsArray } = require('../util/util'); +import { Expression } from './expression'; +import { typeIsArray } from '../util/util'; +import { Context } from '../runtime/context'; +import { build } from './builder'; -class Retrieve extends Expression { - constructor(json) { +export class Retrieve extends Expression { + datatype: string; + templateId: string; + codeProperty: string; + codes: any; + dateProperty: string; + dateRange: any; + + constructor(json: any) { super(json); this.datatype = json.dataType; this.templateId = json.templateId; @@ -13,7 +21,7 @@ class Retrieve extends Expression { this.dateRange = build(json.dateRange); } - exec(ctx) { + exec(ctx: Context) { let records = ctx.findRecords(this.templateId != null ? this.templateId : this.datatype); let codes = this.codes; if (this.codes && typeof this.codes.exec === 'function') { @@ -23,12 +31,12 @@ class Retrieve extends Expression { } } if (codes) { - records = records.filter(r => this.recordMatchesCodesOrVS(r, codes)); + records = records.filter((r: any) => this.recordMatchesCodesOrVS(r, codes)); } // TODO: Added @dateProperty check due to previous fix in cql4browsers in cql_qdm_patient_api hash: ddbc57 if (this.dateRange && this.dateProperty) { const range = this.dateRange.execute(ctx); - records = records.filter(r => range.includes(r.getDateOrInterval(this.dateProperty))); + records = records.filter((r: any) => range.includes(r.getDateOrInterval(this.dateProperty))); } if (Array.isArray(records)) { @@ -39,13 +47,11 @@ class Retrieve extends Expression { return records; } - recordMatchesCodesOrVS(record, codes) { + recordMatchesCodesOrVS(record: any, codes: any) { if (typeIsArray(codes)) { - return codes.some(c => c.hasMatch(record.getCode(this.codeProperty))); + return (codes as any[]).some(c => c.hasMatch(record.getCode(this.codeProperty))); } else { return codes.hasMatch(record.getCode(this.codeProperty)); } } } - -module.exports = { Retrieve }; diff --git a/src/elm/instance.js b/src/elm/instance.ts similarity index 52% rename from src/elm/instance.js rename to src/elm/instance.ts index 1b14a8ea5..cd2a2d7a3 100644 --- a/src/elm/instance.js +++ b/src/elm/instance.ts @@ -1,27 +1,35 @@ -const { Expression } = require('./expression'); -const { build } = require('./builder'); -const { Quantity } = require('../datatypes/quantity'); -const { Code, Concept } = require('../datatypes/datatypes'); +import { Expression } from './expression'; +import { Quantity } from '../datatypes/quantity'; +import { Code, Concept } from '../datatypes/datatypes'; +import { Context } from '../runtime/context'; +import { build } from './builder'; + class Element { - constructor(json) { + name: string; + value: any; + + constructor(json: any) { this.name = json.name; this.value = build(json.value); } - exec(ctx) { + exec(ctx: Context) { return this.value != null ? this.value.execute(ctx) : undefined; } } -class Instance extends Expression { - constructor(json) { +export class Instance extends Expression { + classType: string; + element: Element[]; + + constructor(json: any) { super(json); this.classType = json.classType; - this.element = json.element.map(child => new Element(child)); + this.element = json.element.map((child: any) => new Element(child)); } - exec(ctx) { - const obj = {}; - for (let el of this.element) { + exec(ctx: Context) { + const obj: any = {}; + for (const el of this.element) { obj[el.name] = el.exec(ctx); } switch (this.classType) { @@ -36,5 +44,3 @@ class Instance extends Expression { } } } - -module.exports = { Instance }; diff --git a/src/elm/interval.js b/src/elm/interval.ts similarity index 83% rename from src/elm/interval.js rename to src/elm/interval.ts index d6d1b59d7..d343d1bf5 100644 --- a/src/elm/interval.js +++ b/src/elm/interval.ts @@ -1,12 +1,20 @@ -const { Expression } = require('./expression'); -const { build } = require('./builder'); -const { Quantity, doAddition } = require('../datatypes/quantity'); -const { successor, predecessor, MAX_DATETIME_VALUE, MIN_DATETIME_VALUE } = require('../util/math'); -const { convertUnit, compareUnits, convertToCQLDateUnit } = require('../util/units'); -const dtivl = require('../datatypes/interval'); - -class Interval extends Expression { - constructor(json) { +import { Expression } from './expression'; +import { Quantity, doAddition } from '../datatypes/quantity'; +import { successor, predecessor, MAX_DATETIME_VALUE, MIN_DATETIME_VALUE } from '../util/math'; +import { convertUnit, compareUnits, convertToCQLDateUnit } from '../util/units'; +import * as dtivl from '../datatypes/interval'; +import { Context } from '../runtime/context'; +import { build } from './builder'; + +export class Interval extends Expression { + lowClosed: boolean; + lowClosedExpression: any; + highClosed: boolean; + highClosedExpression: any; + low: any; + high: any; + + constructor(json: any) { super(json); this.lowClosed = json.lowClosed; this.lowClosedExpression = build(json.lowClosedExpression); @@ -22,7 +30,7 @@ class Interval extends Expression { return true; } - exec(ctx) { + exec(ctx: Context) { const lowValue = this.low.execute(ctx); const highValue = this.high.execute(ctx); const lowClosed = @@ -54,37 +62,39 @@ class Interval extends Expression { // NotEqual is completely handled by overloaded#Equal // Delegated to by overloaded#Contains and overloaded#In -function doContains(interval, item, precision) { +export function doContains(interval: any, item: any, precision?: any) { return interval.contains(item, precision); } // Delegated to by overloaded#Includes and overloaded#IncludedIn -function doIncludes(interval, subinterval, precision) { +export function doIncludes(interval: any, subinterval: any, precision?: any) { return interval.includes(subinterval, precision); } // Delegated to by overloaded#ProperIncludes and overloaded@ProperIncludedIn -function doProperIncludes(interval, subinterval, precision) { +export function doProperIncludes(interval: any, subinterval: any, precision?: any) { return interval.properlyIncludes(subinterval, precision); } // Delegated to by overloaded#After -function doAfter(a, b, precision) { +export function doAfter(a: any, b: any, precision?: any) { return a.after(b, precision); } // Delegated to by overloaded#Before -function doBefore(a, b, precision) { +export function doBefore(a: any, b: any, precision?: any) { return a.before(b, precision); } -class Meets extends Expression { - constructor(json) { +export class Meets extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a != null && b != null) { return a.meets(b, this.precision); @@ -94,13 +104,15 @@ class Meets extends Expression { } } -class MeetsAfter extends Expression { - constructor(json) { +export class MeetsAfter extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a != null && b != null) { return a.meetsAfter(b, this.precision); @@ -110,13 +122,15 @@ class MeetsAfter extends Expression { } } -class MeetsBefore extends Expression { - constructor(json) { +export class MeetsBefore extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a != null && b != null) { return a.meetsBefore(b, this.precision); @@ -126,13 +140,15 @@ class MeetsBefore extends Expression { } } -class Overlaps extends Expression { - constructor(json) { +export class Overlaps extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a != null && b != null) { return a.overlaps(b, this.precision); @@ -142,13 +158,15 @@ class Overlaps extends Expression { } } -class OverlapsAfter extends Expression { - constructor(json) { +export class OverlapsAfter extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a != null && b != null) { return a.overlapsAfter(b, this.precision); @@ -158,13 +176,15 @@ class OverlapsAfter extends Expression { } } -class OverlapsBefore extends Expression { - constructor(json) { +export class OverlapsBefore extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a != null && b != null) { return a.overlapsBefore(b, this.precision); @@ -175,12 +195,12 @@ class OverlapsBefore extends Expression { } // Delegated to by overloaded#Union -function doUnion(a, b) { +export function doUnion(a: any, b: any) { return a.union(b); } // Delegated to by overloaded#Except -function doExcept(a, b) { +export function doExcept(a: any, b: any) { if (a != null && b != null) { return a.except(b); } else { @@ -189,7 +209,7 @@ function doExcept(a, b) { } // Delegated to by overloaded#Intersect -function doIntersect(a, b) { +export function doIntersect(a: any, b: any) { if (a != null && b != null) { return a.intersect(b); } else { @@ -197,12 +217,12 @@ function doIntersect(a, b) { } } -class Width extends Expression { - constructor(json) { +export class Width extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const interval = this.arg.execute(ctx); if (interval == null) { return null; @@ -211,12 +231,12 @@ class Width extends Expression { } } -class Size extends Expression { - constructor(json) { +export class Size extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const interval = this.arg.execute(ctx); if (interval == null) { return null; @@ -225,12 +245,12 @@ class Size extends Expression { } } -class Start extends Expression { - constructor(json) { +export class Start extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const interval = this.arg.execute(ctx); if (interval == null) { return null; @@ -244,12 +264,12 @@ class Start extends Expression { } } -class End extends Expression { - constructor(json) { +export class End extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const interval = this.arg.execute(ctx); if (interval == null) { return null; @@ -263,13 +283,15 @@ class End extends Expression { } } -class Starts extends Expression { - constructor(json) { +export class Starts extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a != null && b != null) { return a.starts(b, this.precision); @@ -279,13 +301,15 @@ class Starts extends Expression { } } -class Ends extends Expression { - constructor(json) { +export class Ends extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a != null && b != null) { return a.ends(b, this.precision); @@ -295,11 +319,11 @@ class Ends extends Expression { } } -function intervalListType(intervals) { +function intervalListType(intervals: any) { // Returns one of null, 'time', 'date', 'datetime', 'quantity', 'integer', 'decimal' or 'mismatch' let type = null; - for (let itvl of intervals) { + for (const itvl of intervals) { if (itvl == null) { continue; } @@ -376,12 +400,12 @@ function intervalListType(intervals) { return type; } -class Expand extends Expression { - constructor(json) { +export class Expand extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { // expand(argument List>, per Quantity) List> let defaultPer, expandFunction; let [intervals, per] = this.execArgs(ctx); @@ -405,19 +429,19 @@ class Expand extends Expression { if (['time', 'date', 'datetime'].includes(type)) { expandFunction = this.expandDTishInterval; - defaultPer = interval => new Quantity(1, interval.low.getPrecision()); + defaultPer = (interval: any) => new Quantity(1, interval.low.getPrecision()); } else if (['quantity'].includes(type)) { expandFunction = this.expandQuantityInterval; - defaultPer = interval => new Quantity(1, interval.low.unit); + defaultPer = (interval: any) => new Quantity(1, interval.low.unit); } else if (['integer', 'decimal'].includes(type)) { expandFunction = this.expandNumericInterval; - defaultPer = interval => new Quantity(1, '1'); + defaultPer = (_interval: any) => new Quantity(1, '1'); } else { throw new Error('Interval list type not yet supported.'); } const results = []; - for (let interval of intervals) { + for (const interval of intervals) { if (interval == null) { continue; } @@ -443,7 +467,7 @@ class Expand extends Expression { return results; } - expandDTishInterval(interval, per) { + expandDTishInterval(interval: any, per: any) { per.unit = convertToCQLDateUnit(per.unit); if (per.unit === 'week') { @@ -490,11 +514,11 @@ class Expand extends Expression { return results; } - truncateToPrecision(value, unit) { + truncateToPrecision(value: any, unit: any) { // If interval boundaries are more precise than per quantity, truncate to // the precision specified by the per let shouldTruncate = false; - for (let field of value.constructor.FIELDS) { + for (const field of value.constructor.FIELDS) { if (shouldTruncate) { value[field] = null; } @@ -506,10 +530,11 @@ class Expand extends Expression { return value; } - expandQuantityInterval(interval, per) { + expandQuantityInterval(interval: any, per: any) { // we want to convert everything to the more precise of the interval.low or per let result_units; - if (compareUnits(interval.low.unit, per.unit) > 0) { + const res = compareUnits(interval.low.unit, per.unit); + if (res != null && res > 0) { //interval.low.unit is 'bigger' aka les precise result_units = per.unit; } else { @@ -532,14 +557,14 @@ class Expand extends Expression { per_value ); - for (let itvl of results) { + for (const itvl of results) { itvl.low = new Quantity(itvl.low, result_units); itvl.high = new Quantity(itvl.high, result_units); } return results; } - expandNumericInterval(interval, per) { + expandNumericInterval(interval: any, per: any) { if (per.unit !== '1' && per.unit !== '') { return null; } @@ -552,7 +577,13 @@ class Expand extends Expression { ); } - makeNumericIntervalList(low, high, lowClosed, highClosed, perValue) { + makeNumericIntervalList( + low: any, + high: any, + lowClosed: boolean, + highClosed: boolean, + perValue: any + ) { // If the per value is a Decimal (has a .), 8 decimal places are appropriate // Integers should have 0 Decimal places const perIsDecimal = perValue.toString().includes('.'); @@ -604,22 +635,22 @@ class Expand extends Expression { } } -class Collapse extends Expression { - constructor(json) { +export class Collapse extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { // collapse(argument List>, per Quantity) List> const [intervals, perWidth] = this.execArgs(ctx); return collapseIntervals(intervals, perWidth); } } -function collapseIntervals(intervals, perWidth) { +function collapseIntervals(intervals: any, perWidth: any) { // Clone intervals so this function remains idempotent const intervalsClone = []; - for (let interval of intervals) { + for (const interval of intervals) { // The spec says to ignore null intervals if (interval != null) { intervalsClone.push(interval.copy()); @@ -731,35 +762,9 @@ function collapseIntervals(intervals, perWidth) { } } -function truncateDecimal(decimal, decimalPlaces) { +function truncateDecimal(decimal: any, decimalPlaces: number) { // like parseFloat().toFixed() but floor rather than round // Needed for when per precision is less than the interval input precision const re = new RegExp('^-?\\d+(?:.\\d{0,' + (decimalPlaces || -1) + '})?'); return parseFloat(decimal.toString().match(re)[0]); } - -module.exports = { - Collapse, - End, - Ends, - Expand, - Interval, - Meets, - MeetsAfter, - MeetsBefore, - Overlaps, - OverlapsAfter, - OverlapsBefore, - Size, - Start, - Starts, - Width, - doContains, - doIncludes, - doProperIncludes, - doAfter, - doBefore, - doUnion, - doExcept, - doIntersect -}; diff --git a/src/elm/library.js b/src/elm/library.ts similarity index 75% rename from src/elm/library.js rename to src/elm/library.ts index ea5791834..d901c2aca 100644 --- a/src/elm/library.js +++ b/src/elm/library.ts @@ -1,48 +1,70 @@ -class Library { - constructor(json, libraryManager) { +import { Parameter } from '../types/runtime.types'; +import { + ExpressionDef, + FunctionDef, + ParameterDef, + ValueSetDef, + CodeSystemDef, + CodeDef, + ConceptDef +} from './expressions'; + +export class Library { + source: any; + usings: any; + parameters: Parameter; + codesystems: any; + valuesets: any; + codes: any; + concepts: any; + expressions: any; + functions: any; + includes: any; + + constructor(json: any, libraryManager?: any) { this.source = json; // usings const usingDefs = (json.library.usings && json.library.usings.def) || []; this.usings = usingDefs - .filter(u => u.localIdentifier !== 'System') - .map(u => { + .filter((u: any) => u.localIdentifier !== 'System') + .map((u: any) => { return { name: u.localIdentifier, version: u.version }; }); // parameters const paramDefs = (json.library.parameters && json.library.parameters.def) || []; this.parameters = {}; - for (let param of paramDefs) { + for (const param of paramDefs) { this.parameters[param.name] = new ParameterDef(param); } // code systems const csDefs = (json.library.codeSystems && json.library.codeSystems.def) || []; this.codesystems = {}; - for (let codesystem of csDefs) { + for (const codesystem of csDefs) { this.codesystems[codesystem.name] = new CodeSystemDef(codesystem); } // value sets const vsDefs = (json.library.valueSets && json.library.valueSets.def) || []; this.valuesets = {}; - for (let valueset of vsDefs) { + for (const valueset of vsDefs) { this.valuesets[valueset.name] = new ValueSetDef(valueset); } // codes const codeDefs = (json.library.codes && json.library.codes.def) || []; this.codes = {}; - for (let code of codeDefs) { + for (const code of codeDefs) { this.codes[code.name] = new CodeDef(code); } // concepts const conceptDefs = (json.library.concepts && json.library.concepts.def) || []; this.concepts = {}; - for (let concept of conceptDefs) { + for (const concept of conceptDefs) { this.concepts[concept.name] = new ConceptDef(concept); } // expressions const exprDefs = (json.library.statements && json.library.statements.def) || []; this.expressions = {}; this.functions = {}; - for (let expr of exprDefs) { + for (const expr of exprDefs) { if (expr.type === 'FunctionDef') { if (!this.functions[expr.name]) { this.functions[expr.name] = []; @@ -55,7 +77,7 @@ class Library { // includes const inclDefs = (json.library.includes && json.library.includes.def) || []; this.includes = {}; - for (let incl of inclDefs) { + for (const incl of inclDefs) { if (libraryManager) { this.includes[incl.localIdentifier] = libraryManager.resolve(incl.path, incl.version); } @@ -71,17 +93,17 @@ class Library { } } - getFunction(identifier) { + getFunction(identifier: string) { return this.functions[identifier]; } - get(identifier) { + get(identifier: string) { return ( this.expressions[identifier] || this.includes[identifier] || this.getFunction(identifier) ); } - getValueSet(identifier, libraryName) { + getValueSet(identifier: string, libraryName: string) { if (this.valuesets[identifier] != null) { return this.valuesets[identifier]; } @@ -90,33 +112,19 @@ class Library { : undefined; } - getCodeSystem(identifier) { + getCodeSystem(identifier: string) { return this.codesystems[identifier]; } - getCode(identifier) { + getCode(identifier: string) { return this.codes[identifier]; } - getConcept(identifier) { + getConcept(identifier: string) { return this.concepts[identifier]; } - getParameter(name) { + getParameter(name: string) { return this.parameters[name]; } } - -// These requires are at the end of the file because having them first in the -// file creates errors due to the order that the libraries are loaded. -const { - ExpressionDef, - FunctionDef, - ParameterDef, - ValueSetDef, - CodeSystemDef, - CodeDef, - ConceptDef -} = require('./expressions'); - -module.exports = { Library }; diff --git a/src/elm/list.js b/src/elm/list.ts similarity index 64% rename from src/elm/list.js rename to src/elm/list.ts index 5f7ec427a..ddabf6192 100644 --- a/src/elm/list.js +++ b/src/elm/list.ts @@ -1,10 +1,13 @@ -const { Expression, UnimplementedExpression } = require('./expression'); -const { build } = require('./builder'); -const { typeIsArray } = require('../util/util'); -const { equals } = require('../util/comparison'); +import { Expression, UnimplementedExpression } from './expression'; +import { build } from './builder'; +import { typeIsArray } from '../util/util'; +import { equals } from '../util/comparison'; +import { Context } from '../runtime/context'; -class List extends Expression { - constructor(json) { +export class List extends Expression { + elements: any[]; + + constructor(json: any) { super(json); this.elements = build(json.element) || []; } @@ -13,21 +16,21 @@ class List extends Expression { return true; } - exec(ctx) { + exec(ctx: Context) { return this.elements.map(item => item.execute(ctx)); } } -class Exists extends Expression { - constructor(json) { +export class Exists extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const list = this.execArgs(ctx); // if list exists and has non empty length we need to make sure it isnt just full of nulls if (list) { - return list.some(item => item != null); + return list.some((item: any) => item != null); } return false; } @@ -38,37 +41,37 @@ class Exists extends Expression { // NotEqual is completely handled by overloaded#Equal // Delegated to by overloaded#Union -function doUnion(a, b) { +export function doUnion(a: any, b: any) { const distinct = doDistinct(a.concat(b)); return removeDuplicateNulls(distinct); } // Delegated to by overloaded#Except -function doExcept(a, b) { +export function doExcept(a: any, b: any) { const distinct = doDistinct(a); const setList = removeDuplicateNulls(distinct); return setList.filter(item => !doContains(b, item, true)); } // Delegated to by overloaded#Intersect -function doIntersect(a, b) { +export function doIntersect(a: any, b: any) { const distinct = doDistinct(a); const setList = removeDuplicateNulls(distinct); return setList.filter(item => doContains(b, item, true)); } // ELM-only, not a product of CQL -class Times extends UnimplementedExpression {} +export class Times extends UnimplementedExpression {} // ELM-only, not a product of CQL -class Filter extends UnimplementedExpression {} +export class Filter extends UnimplementedExpression {} -class SingletonFrom extends Expression { - constructor(json) { +export class SingletonFrom extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null && arg.length > 1) { throw new Error("IllegalArgument: 'SingletonFrom' requires a 0 or 1 arg array"); @@ -80,12 +83,12 @@ class SingletonFrom extends Expression { } } -class ToList extends Expression { - constructor(json) { +export class ToList extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { return [arg]; @@ -95,14 +98,17 @@ class ToList extends Expression { } } -class IndexOf extends Expression { - constructor(json) { +export class IndexOf extends Expression { + source: any; + element: any; + + constructor(json: any) { super(json); this.source = build(json.source); this.element = build(json.element); } - exec(ctx) { + exec(ctx: Context) { let index; const src = this.source.execute(ctx); const el = this.element.execute(ctx); @@ -127,46 +133,46 @@ class IndexOf extends Expression { // Indexer is completely handled by overloaded#Indexer // Delegated to by overloaded#Contains and overloaded#In -function doContains(container, item, nullEquivalence = false) { +export function doContains(container: any[], item: any, nullEquivalence = false) { return container.some( - element => equals(element, item) || (nullEquivalence && element == null && item == null) + (element: any) => equals(element, item) || (nullEquivalence && element == null && item == null) ); } // Delegated to by overloaded#Includes and overloaded@IncludedIn -function doIncludes(list, sublist) { - return sublist.every(x => doContains(list, x)); +export function doIncludes(list: any, sublist: any) { + return sublist.every((x: any) => doContains(list, x)); } // Delegated to by overloaded#ProperIncludes and overloaded@ProperIncludedIn -function doProperIncludes(list, sublist) { +export function doProperIncludes(list: any, sublist: any) { return list.length > sublist.length && doIncludes(list, sublist); } // ELM-only, not a product of CQL -class ForEach extends UnimplementedExpression {} +export class ForEach extends UnimplementedExpression {} -class Flatten extends Expression { - constructor(json) { +export class Flatten extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); - if (typeIsArray(arg) && arg.every(x => typeIsArray(x))) { - return arg.reduce((x, y) => x.concat(y), []); + if (typeIsArray(arg) && (arg as any[]).every(x => typeIsArray(x))) { + return (arg as any[]).reduce((x, y) => x.concat(y), []); } else { return arg; } } } -class Distinct extends Expression { - constructor(json) { +export class Distinct extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const result = this.execArgs(ctx); if (result == null) { return null; @@ -175,8 +181,8 @@ class Distinct extends Expression { } } -function doDistinct(list) { - const distinct = []; +function doDistinct(list: any[]) { + const distinct: any[] = []; list.forEach(item => { const isNew = distinct.every(seenItem => !equals(item, seenItem)); if (isNew) { @@ -186,11 +192,11 @@ function doDistinct(list) { return removeDuplicateNulls(distinct); } -function removeDuplicateNulls(list) { +function removeDuplicateNulls(list: any[]) { // Remove duplicate null elements let firstNullFound = false; const setList = []; - for (let item of list) { + for (const item of list) { if (item !== null) { setList.push(item); } else if (item === null && !firstNullFound) { @@ -202,15 +208,17 @@ function removeDuplicateNulls(list) { } // ELM-only, not a product of CQL -class Current extends UnimplementedExpression {} +export class Current extends UnimplementedExpression {} + +export class First extends Expression { + source: any; -class First extends Expression { - constructor(json) { + constructor(json: any) { super(json); this.source = build(json.source); } - exec(ctx) { + exec(ctx: Context) { const src = this.source.exec(ctx); if (src != null && typeIsArray(src) && src.length > 0) { return src[0]; @@ -220,13 +228,15 @@ class First extends Expression { } } -class Last extends Expression { - constructor(json) { +export class Last extends Expression { + source: any; + + constructor(json: any) { super(json); this.source = build(json.source); } - exec(ctx) { + exec(ctx: Context) { const src = this.source.exec(ctx); if (src != null && typeIsArray(src) && src.length > 0) { return src[src.length - 1]; @@ -236,15 +246,19 @@ class Last extends Expression { } } -class Slice extends Expression { - constructor(json) { +export class Slice extends Expression { + source: any; + startIndex: any; + endIndex: any; + + constructor(json: any) { super(json); this.source = build(json.source); this.startIndex = build(json.startIndex); this.endIndex = build(json.endIndex); } - exec(ctx) { + exec(ctx: Context) { const src = this.source.exec(ctx); if (src != null && typeIsArray(src)) { const startIndex = this.startIndex.exec(ctx); @@ -261,26 +275,3 @@ class Slice extends Expression { } // Length is completely handled by overloaded#Length - -module.exports = { - Current, - Distinct, - Exists, - Filter, - First, - Flatten, - ForEach, - IndexOf, - Last, - List, - SingletonFrom, - Slice, - Times, - ToList, - doContains, - doIncludes, - doProperIncludes, - doUnion, - doExcept, - doIntersect -}; diff --git a/src/elm/literal.js b/src/elm/literal.ts similarity index 76% rename from src/elm/literal.js rename to src/elm/literal.ts index e4b3d8c60..6ff8dc2e2 100644 --- a/src/elm/literal.js +++ b/src/elm/literal.ts @@ -1,7 +1,11 @@ -const { Expression } = require('./expression'); +import { Context } from '../runtime/context'; +import { Expression } from './expression'; -class Literal extends Expression { - static from(json) { +export class Literal extends Expression { + valueType: string; + value: any; + + static from(json: any) { switch (json.valueType) { case '{urn:hl7-org:elm-types:r1}Boolean': return new BooleanLiteral(json); @@ -16,21 +20,21 @@ class Literal extends Expression { } } - constructor(json) { + constructor(json: any) { super(json); this.valueType = json.valueType; this.value = json.value; } - exec(ctx) { + exec(_ctx: Context) { return this.value; } } // The following are not defined in ELM, but helpful for execution -class BooleanLiteral extends Literal { - constructor(json) { +export class BooleanLiteral extends Literal { + constructor(json: any) { super(json); this.value = this.value === 'true'; } @@ -41,13 +45,13 @@ class BooleanLiteral extends Literal { return true; } - exec(ctx) { + exec(_ctx: Context) { return this.value; } } -class IntegerLiteral extends Literal { - constructor(json) { +export class IntegerLiteral extends Literal { + constructor(json: any) { super(json); this.value = parseInt(this.value, 10); } @@ -58,13 +62,13 @@ class IntegerLiteral extends Literal { return true; } - exec(ctx) { + exec(_ctx: Context) { return this.value; } } -class DecimalLiteral extends Literal { - constructor(json) { +export class DecimalLiteral extends Literal { + constructor(json: any) { super(json); this.value = parseFloat(this.value); } @@ -75,13 +79,13 @@ class DecimalLiteral extends Literal { return true; } - exec(ctx) { + exec(_ctx: Context) { return this.value; } } -class StringLiteral extends Literal { - constructor(json) { +export class StringLiteral extends Literal { + constructor(json: any) { super(json); } @@ -91,10 +95,8 @@ class StringLiteral extends Literal { return true; } - exec(ctx) { + exec(_ctx: Context) { // TODO: Remove these replacements when CQL-to-ELM fixes bug: https://github.com/cqframework/clinical_quality_language/issues/82 return this.value.replace(/\\'/g, "'").replace(/\\"/g, '"'); } } - -module.exports = { BooleanLiteral, DecimalLiteral, IntegerLiteral, Literal, StringLiteral }; diff --git a/src/elm/logical.js b/src/elm/logical.js deleted file mode 100644 index 50877a5a6..000000000 --- a/src/elm/logical.js +++ /dev/null @@ -1,64 +0,0 @@ -const { Expression } = require('./expression'); -const { ThreeValuedLogic } = require('../datatypes/datatypes'); - -class And extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - return ThreeValuedLogic.and(...this.execArgs(ctx)); - } -} - -class Or extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - return ThreeValuedLogic.or(...this.execArgs(ctx)); - } -} - -class Not extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - return ThreeValuedLogic.not(this.execArgs(ctx)); - } -} - -class Xor extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - return ThreeValuedLogic.xor(...this.execArgs(ctx)); - } -} - -class IsTrue extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - return true === this.execArgs(ctx); - } -} - -class IsFalse extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - return false === this.execArgs(ctx); - } -} - -module.exports = { And, IsFalse, IsTrue, Not, Or, Xor }; diff --git a/src/elm/logical.ts b/src/elm/logical.ts new file mode 100644 index 000000000..d9544cf51 --- /dev/null +++ b/src/elm/logical.ts @@ -0,0 +1,63 @@ +import { Expression } from './expression'; +import { ThreeValuedLogic } from '../datatypes/datatypes'; +import { Context } from '../runtime/context'; + +export class And extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + return ThreeValuedLogic.and(...this.execArgs(ctx)); + } +} + +export class Or extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + return ThreeValuedLogic.or(...this.execArgs(ctx)); + } +} + +export class Not extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + return ThreeValuedLogic.not(this.execArgs(ctx)); + } +} + +export class Xor extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + return ThreeValuedLogic.xor(...this.execArgs(ctx)); + } +} + +export class IsTrue extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + return true === this.execArgs(ctx); + } +} + +export class IsFalse extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + return false === this.execArgs(ctx); + } +} diff --git a/src/elm/message.js b/src/elm/message.ts similarity index 70% rename from src/elm/message.js rename to src/elm/message.ts index a16e7cf10..48293536e 100644 --- a/src/elm/message.js +++ b/src/elm/message.ts @@ -1,8 +1,15 @@ -const { Expression } = require('./expression'); -const { build } = require('./builder'); +import { Context } from '../runtime/context'; +import { Expression } from './expression'; +import { build } from './builder'; -class Message extends Expression { - constructor(json) { +export class Message extends Expression { + source: any; + condition: any; + code: any; + severity: any; + message: any; + + constructor(json: any) { super(json); this.source = build(json.source); this.condition = build(json.condition); @@ -11,7 +18,7 @@ class Message extends Expression { this.message = build(json.message); } - exec(ctx) { + exec(ctx: Context) { const source = this.source.execute(ctx); const condition = this.condition.execute(ctx); if (condition) { @@ -26,5 +33,3 @@ class Message extends Expression { return source; } } - -module.exports = { Message }; diff --git a/src/elm/nullological.js b/src/elm/nullological.js deleted file mode 100644 index da1830bab..000000000 --- a/src/elm/nullological.js +++ /dev/null @@ -1,47 +0,0 @@ -const { Expression } = require('./expression'); - -class Null extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - return null; - } -} - -class IsNull extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - return this.execArgs(ctx) == null; - } -} - -class Coalesce extends Expression { - constructor(json) { - super(json); - } - - exec(ctx) { - for (let arg of this.args) { - const result = arg.execute(ctx); - // if a single arg that's a list, coalesce over the list - if (this.args.length === 1 && Array.isArray(result)) { - const item = result.find(item => item != null); - if (item != null) { - return item; - } - } else { - if (result != null) { - return result; - } - } - } - return null; - } -} - -module.exports = { Coalesce, IsNull, Null }; diff --git a/src/elm/nullological.ts b/src/elm/nullological.ts new file mode 100644 index 000000000..888c1ee3b --- /dev/null +++ b/src/elm/nullological.ts @@ -0,0 +1,48 @@ +import { Context } from '../runtime/context'; +import { Expression } from './expression'; + +export class Null extends Expression { + constructor(json: any) { + super(json); + } + + exec(_ctx: Context): any { + return null; + } +} + +export class IsNull extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + return this.execArgs(ctx) == null; + } +} + +export class Coalesce extends Expression { + constructor(json: any) { + super(json); + } + + exec(ctx: Context) { + if (this.args) { + for (const arg of this.args) { + const result = arg.execute(ctx); + // if a single arg that's a list, coalesce over the list + if (this.args.length === 1 && Array.isArray(result)) { + const item = result.find(item => item != null); + if (item != null) { + return item; + } + } else { + if (result != null) { + return result; + } + } + } + } + return null; + } +} diff --git a/src/elm/overloaded.js b/src/elm/overloaded.ts similarity index 70% rename from src/elm/overloaded.js rename to src/elm/overloaded.ts index fe1cc4d61..f278091c9 100644 --- a/src/elm/overloaded.js +++ b/src/elm/overloaded.ts @@ -1,32 +1,35 @@ -const { Expression } = require('./expression'); -const { ThreeValuedLogic } = require('../datatypes/logic'); -const { DateTime } = require('../datatypes/datetime'); -const { typeIsArray } = require('../util/util'); -const { equals, equivalent } = require('../util/comparison'); -const DT = require('./datetime'); -const LIST = require('./list'); -const IVL = require('./interval'); - -class Equal extends Expression { - constructor(json) { +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { Expression } from './expression'; +import { ThreeValuedLogic } from '../datatypes/logic'; +import { DateTime } from '../datatypes/datetime'; +import { typeIsArray } from '../util/util'; +import { equals, equivalent } from '../util/comparison'; +import * as DT from './datetime'; +import * as LIST from './list'; +import * as IVL from './interval'; +import { Context } from '../runtime/context'; + +export class Equal extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); if (args[0] == null || args[1] == null) { return null; } + // @ts-ignore return equals(...args); } } -class Equivalent extends Expression { - constructor(json) { +export class Equivalent extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a == null && b == null) { return true; @@ -38,26 +41,27 @@ class Equivalent extends Expression { } } -class NotEqual extends Expression { - constructor(json) { +export class NotEqual extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); if (args[0] == null || args[1] == null) { return null; } + // @ts-ignore return ThreeValuedLogic.not(equals(...this.execArgs(ctx))); } } -class Union extends Expression { - constructor(json) { +export class Union extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a == null && b == null) { return this.listTypeArgs() ? [] : null; @@ -75,18 +79,18 @@ class Union extends Expression { } listTypeArgs() { - return this.args.some(arg => { + return this.args?.some(arg => { return arg.asTypeSpecifier != null && arg.asTypeSpecifier.type === 'ListTypeSpecifier'; }); } } -class Except extends Expression { - constructor(json) { +export class Except extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a == null) { return null; @@ -99,12 +103,12 @@ class Except extends Expression { } } -class Intersect extends Expression { - constructor(json) { +export class Intersect extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a == null || b == null) { return null; @@ -114,12 +118,12 @@ class Intersect extends Expression { } } -class Indexer extends Expression { - constructor(json) { +export class Indexer extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const [operand, index] = this.execArgs(ctx); if (operand == null || index == null) { return null; @@ -131,13 +135,15 @@ class Indexer extends Expression { } } -class In extends Expression { - constructor(json) { +export class In extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [item, container] = this.execArgs(ctx); if (item == null) { return null; @@ -150,13 +156,15 @@ class In extends Expression { } } -class Contains extends Expression { - constructor(json) { +export class Contains extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [container, item] = this.execArgs(ctx); if (container == null) { return false; @@ -169,13 +177,15 @@ class Contains extends Expression { } } -class Includes extends Expression { - constructor(json) { +export class Includes extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [container, contained] = this.execArgs(ctx); if (container == null || contained == null) { return null; @@ -185,13 +195,15 @@ class Includes extends Expression { } } -class IncludedIn extends Expression { - constructor(json) { +export class IncludedIn extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [contained, container] = this.execArgs(ctx); if (container == null || contained == null) { return null; @@ -201,13 +213,15 @@ class IncludedIn extends Expression { } } -class ProperIncludes extends Expression { - constructor(json) { +export class ProperIncludes extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [container, contained] = this.execArgs(ctx); if (container == null || contained == null) { return null; @@ -217,13 +231,15 @@ class ProperIncludes extends Expression { } } -class ProperIncludedIn extends Expression { - constructor(json) { +export class ProperIncludedIn extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [contained, container] = this.execArgs(ctx); if (container == null || contained == null) { return null; @@ -233,12 +249,12 @@ class ProperIncludedIn extends Expression { } } -class Length extends Expression { - constructor(json) { +export class Length extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { return arg.length; @@ -250,13 +266,15 @@ class Length extends Expression { } } -class After extends Expression { - constructor(json) { +export class After extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a == null || b == null) { return null; @@ -266,13 +284,15 @@ class After extends Expression { } } -class Before extends Expression { - constructor(json) { +export class Before extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision != null ? json.precision.toLowerCase() : undefined; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a == null || b == null) { return null; @@ -282,13 +302,15 @@ class Before extends Expression { } } -class SameAs extends Expression { - constructor(json) { +export class SameAs extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision; } - exec(ctx) { + exec(ctx: Context) { const [a, b] = this.execArgs(ctx); if (a != null && b != null) { return a.sameAs(b, this.precision != null ? this.precision.toLowerCase() : undefined); @@ -298,13 +320,15 @@ class SameAs extends Expression { } } -class SameOrAfter extends Expression { - constructor(json) { +export class SameOrAfter extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision; } - exec(ctx) { + exec(ctx: Context) { const [d1, d2] = this.execArgs(ctx); if (d1 != null && d2 != null) { return d1.sameOrAfter(d2, this.precision != null ? this.precision.toLowerCase() : undefined); @@ -314,13 +338,15 @@ class SameOrAfter extends Expression { } } -class SameOrBefore extends Expression { - constructor(json) { +export class SameOrBefore extends Expression { + precision?: any; + + constructor(json: any) { super(json); this.precision = json.precision; } - exec(ctx) { + exec(ctx: Context) { const [d1, d2] = this.execArgs(ctx); if (d1 != null && d2 != null) { return d1.sameOrBefore(d2, this.precision != null ? this.precision.toLowerCase() : undefined); @@ -331,12 +357,12 @@ class SameOrBefore extends Expression { } // Implemented for DateTime, Date, and Time but not for Decimal yet -class Precision extends Expression { - constructor(json) { +export class Precision extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -351,26 +377,3 @@ class Precision extends Expression { return arg.getPrecisionValue(); } } - -module.exports = { - After, - Before, - Contains, - Equal, - Equivalent, - Except, - In, - IncludedIn, - Includes, - Indexer, - Intersect, - Length, - NotEqual, - Precision, - ProperIncludedIn, - ProperIncludes, - SameAs, - SameOrAfter, - SameOrBefore, - Union -}; diff --git a/src/elm/parameters.js b/src/elm/parameters.ts similarity index 70% rename from src/elm/parameters.js rename to src/elm/parameters.ts index b2b9df005..7c08f1e4a 100644 --- a/src/elm/parameters.js +++ b/src/elm/parameters.ts @@ -1,15 +1,20 @@ -const { Expression } = require('./expression'); -const { build } = require('./builder'); +import { Context } from '../runtime/context'; +import { Expression } from './expression'; +import { build } from './builder'; -class ParameterDef extends Expression { - constructor(json) { +export class ParameterDef extends Expression { + name: string; + default: any; + parameterTypeSpecifier: any; + + constructor(json: any) { super(json); this.name = json.name; this.default = build(json.default); this.parameterTypeSpecifier = json.parameterTypeSpecifier; } - exec(ctx) { + exec(ctx: Context) { // If context parameters contains the name, return value. if (ctx && ctx.parameters[this.name] !== undefined) { return ctx.parameters[this.name]; @@ -24,18 +29,19 @@ class ParameterDef extends Expression { } } -class ParameterRef extends Expression { - constructor(json) { +export class ParameterRef extends Expression { + name: string; + library: any; + + constructor(json: any) { super(json); this.name = json.name; this.library = json.libraryName; } - exec(ctx) { + exec(ctx: Context) { ctx = this.library ? ctx.getLibraryContext(this.library) : ctx; const param = ctx.getParameter(this.name); return param != null ? param.execute(ctx) : undefined; } } - -module.exports = { ParameterDef, ParameterRef }; diff --git a/src/elm/quantity.js b/src/elm/quantity.ts similarity index 55% rename from src/elm/quantity.js rename to src/elm/quantity.ts index 9c2444165..515f83965 100644 --- a/src/elm/quantity.js +++ b/src/elm/quantity.ts @@ -1,18 +1,20 @@ -const { Expression } = require('./expression'); -const DT = require('../datatypes/datatypes'); +import { Expression } from './expression'; +import * as DT from '../datatypes/datatypes'; +import { Context } from '../runtime/context'; // Unit conversation is currently implemented on for time duration comparison operations // TODO: Implement unit conversation for time duration mathematical operations -class Quantity extends Expression { - constructor(json) { +export class Quantity extends Expression { + value: number; + unit: any; + + constructor(json: any) { super(json); this.value = parseFloat(json.value); this.unit = json.unit; } - exec(ctx) { + exec(_ctx: Context) { return new DT.Quantity(this.value, this.unit); } } - -module.exports = { Quantity }; diff --git a/src/elm/query.js b/src/elm/query.ts similarity index 66% rename from src/elm/query.js rename to src/elm/query.ts index dfa60d1d3..e1aee7bce 100644 --- a/src/elm/query.js +++ b/src/elm/query.ts @@ -1,65 +1,81 @@ -const { Expression, UnimplementedExpression } = require('./expression'); -const { Context } = require('../runtime/context'); -const { build } = require('./builder'); -const { typeIsArray, allTrue } = require('../util/util'); -const { equals } = require('../util/comparison'); - -class AliasedQuerySource { - constructor(json) { +import { Expression, UnimplementedExpression } from './expression'; +import { Context } from '../runtime/context'; +import { typeIsArray, allTrue, Direction } from '../util/util'; +import { equals } from '../util/comparison'; +import { build } from './builder'; + +export class AliasedQuerySource { + alias: any; + expression: any; + + constructor(json: any) { this.alias = json.alias; this.expression = build(json.expression); } } -class LetClause { - constructor(json) { +export class LetClause { + identifier: string; + expression: any; + + constructor(json: any) { this.identifier = json.identifier; this.expression = build(json.expression); } } -class With extends Expression { - constructor(json) { +export class With extends Expression { + alias: any; + expression: any; + suchThat: any; + + constructor(json: any) { super(json); this.alias = json.alias; this.expression = build(json.expression); this.suchThat = build(json.suchThat); } - exec(ctx) { + exec(ctx: Context) { let records = this.expression.execute(ctx); if (!typeIsArray(records)) { records = [records]; } - const returns = records.map(rec => { + const returns = records.map((rec: any) => { const childCtx = ctx.childContext(); childCtx.set(this.alias, rec); return this.suchThat.execute(childCtx); }); - return returns.some(x => x); + return returns.some((x: any) => x); } } -class Without extends With { - constructor(json) { +export class Without extends With { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { return !super.exec(ctx); } } // ELM-only, not a product of CQL -class Sort extends UnimplementedExpression {} +export class Sort extends UnimplementedExpression {} -class ByDirection extends Expression { - constructor(json) { +export class ByDirection extends Expression { + direction: Direction; + low_order: number; + high_order: number; + + constructor(json: any) { super(json); this.direction = json.direction; this.low_order = this.direction === 'asc' || this.direction === 'ascending' ? -1 : 1; this.high_order = this.low_order * -1; } - exec(ctx, a, b) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + exec(ctx: Context, a: any, b: any) { if (a === b) { return 0; } else if (a.isQuantity && b.isQuantity) { @@ -76,8 +92,13 @@ class ByDirection extends Expression { } } -class ByExpression extends Expression { - constructor(json) { +export class ByExpression extends Expression { + expression: any; + direction: Direction; + low_order: number; + high_order: number; + + constructor(json: any) { super(json); this.expression = build(json.expression); this.direction = json.direction; @@ -85,7 +106,9 @@ class ByExpression extends Expression { this.high_order = this.low_order * -1; } - exec(ctx, a, b) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + exec(ctx: Context, a: any, b: any) { let sctx = ctx.childContext(a); const a_val = this.expression.execute(sctx); sctx = ctx.childContext(b); @@ -103,8 +126,8 @@ class ByExpression extends Expression { } } -class ByColumn extends ByExpression { - constructor(json) { +export class ByColumn extends ByExpression { + constructor(json: any) { super(json); this.expression = build({ name: json.path, @@ -113,23 +136,28 @@ class ByColumn extends ByExpression { } } -class ReturnClause { - constructor(json) { +export class ReturnClause { + expression: any; + distinct: boolean; + + constructor(json: any) { this.expression = build(json.expression); this.distinct = json.distinct != null ? json.distinct : true; } } -class SortClause { - constructor(json) { +export class SortClause { + by: any; + + constructor(json: any) { this.by = build(json != null ? json.by : undefined); } - sort(ctx, values) { + sort(ctx: Context, values: any) { if (this.by) { - return values.sort((a, b) => { + return values.sort((a: any, b: any) => { let order = 0; - for (let item of this.by) { + for (const item of this.by) { // Do not use execute here because the value of the sort order is not important. order = item.exec(ctx, a, b); if (order !== 0) { @@ -142,8 +170,8 @@ class SortClause { } } -const toDistinctList = function (xList) { - const yList = []; +const toDistinctList = function (xList: any[]) { + const yList: any[] = []; xList.forEach(x => { if (!yList.some(y => equals(x, y))) { yList.push(x); @@ -153,7 +181,12 @@ const toDistinctList = function (xList) { }; class AggregateClause extends Expression { - constructor(json) { + identifier: string; + expression: any; + starting: any; + distinct: boolean; + + constructor(json: any) { super(json); this.identifier = json.identifier; this.expression = build(json.expression); @@ -161,10 +194,10 @@ class AggregateClause extends Expression { this.distinct = json.distinct != null ? json.distinct : true; } - aggregate(returnedValues, ctx) { + aggregate(returnedValues: any, ctx: Context) { let aggregateValue = this.starting != null ? this.starting.exec(ctx) : null; - returnedValues.forEach(contextValues => { - let childContext = ctx.childContext(contextValues); + returnedValues.forEach((contextValues: any) => { + const childContext = ctx.childContext(contextValues); childContext.set(this.identifier, aggregateValue); aggregateValue = this.expression.exec(childContext); }); @@ -172,11 +205,20 @@ class AggregateClause extends Expression { } } -class Query extends Expression { - constructor(json) { +export class Query extends Expression { + sources: MultiSource; + letClauses: LetClause[]; + relationship: any[]; + where: any; + returnClause: ReturnClause | null; + aggregateClause: AggregateClause | null; + aliases: any; + sortClause: SortClause | null; + + constructor(json: any) { super(json); - this.sources = new MultiSource(json.source.map(s => new AliasedQuerySource(s))); - this.letClauses = json.let != null ? json.let.map(d => new LetClause(d)) : []; + this.sources = new MultiSource(json.source.map((s: any) => new AliasedQuerySource(s))); + this.letClauses = json.let != null ? json.let.map((d: any) => new LetClause(d)) : []; this.relationship = json.relationship != null ? build(json.relationship) : []; this.where = build(json.where); this.returnClause = json.return != null ? new ReturnClause(json.return) : null; @@ -194,10 +236,10 @@ class Query extends Expression { return true; } - exec(ctx) { - let returnedValues = []; - this.sources.forEach(ctx, rctx => { - for (let def of this.letClauses) { + exec(ctx: Context) { + let returnedValues: any[] = []; + this.sources.forEach(ctx, (rctx: any) => { + for (const def of this.letClauses) { rctx.set(def.identifier, def.expression.execute(rctx)); } @@ -239,19 +281,21 @@ class Query extends Expression { } } -class AliasRef extends Expression { - constructor(json) { +export class AliasRef extends Expression { + name: string; + + constructor(json: any) { super(json); this.name = json.name; } - exec(ctx) { + exec(ctx: Context) { return ctx != null ? ctx.get(this.name) : undefined; } } -class QueryLetRef extends AliasRef { - constructor(json) { +export class QueryLetRef extends AliasRef { + constructor(json: any) { super(json); } } @@ -259,7 +303,13 @@ class QueryLetRef extends AliasRef { // The following is not defined by ELM but is helpful for execution class MultiSource { - constructor(sources) { + sources: any[]; + alias: any; + expression: any; + isList: boolean; + rest?: MultiSource; + + constructor(sources: any) { this.sources = sources; this.alias = this.sources[0].alias; this.expression = this.sources[0].expression; @@ -277,15 +327,15 @@ class MultiSource { return a; } - returnsList() { + returnsList(): boolean | undefined { return this.isList || (this.rest && this.rest.returnsList()); } - forEach(ctx, func) { + forEach(ctx: Context, func: any) { let records = this.expression.execute(ctx); this.isList = typeIsArray(records); records = this.isList ? records : [records]; - return records.map(rec => { + return records.map((rec: any) => { const rctx = new Context(ctx); rctx.set(this.alias, rec); if (this.rest) { @@ -296,19 +346,3 @@ class MultiSource { }); } } - -module.exports = { - AliasedQuerySource, - AliasRef, - ByColumn, - ByDirection, - ByExpression, - LetClause, - Query, - QueryLetRef, - ReturnClause, - Sort, - SortClause, - With, - Without -}; diff --git a/src/elm/ratio.js b/src/elm/ratio.ts similarity index 62% rename from src/elm/ratio.js rename to src/elm/ratio.ts index 3622696c3..f6bd3ee5e 100644 --- a/src/elm/ratio.js +++ b/src/elm/ratio.ts @@ -1,9 +1,13 @@ -const { Expression } = require('./expression'); -const { Quantity } = require('../datatypes/quantity'); -const DT = require('../datatypes/datatypes'); +import { Expression } from './expression'; +import { Quantity } from '../datatypes/quantity'; +import * as DT from '../datatypes/datatypes'; +import { Context } from '../runtime/context'; -class Ratio extends Expression { - constructor(json) { +export class Ratio extends Expression { + numerator: Quantity; + denominator: Quantity; + + constructor(json: any) { super(json); if (json.numerator == null) { throw new Error('Cannot create a ratio with an undefined numerator value'); @@ -18,9 +22,7 @@ class Ratio extends Expression { } } - exec(ctx) { + exec(_ctx: Context) { return new DT.Ratio(this.numerator, this.denominator); } } - -module.exports = { Ratio }; diff --git a/src/elm/reusable.js b/src/elm/reusable.ts similarity index 77% rename from src/elm/reusable.js rename to src/elm/reusable.ts index d6f0217d9..9ab63d309 100644 --- a/src/elm/reusable.js +++ b/src/elm/reusable.ts @@ -1,27 +1,36 @@ -const { Expression } = require('./expression'); -const { build } = require('./builder'); +import { Context } from '../runtime/context'; +import { Expression } from './expression'; +import { build } from './builder'; +import { Parameter } from '../types/runtime.types'; -class ExpressionDef extends Expression { - constructor(json) { +export class ExpressionDef extends Expression { + name: string; + context: any; + expression: any; + + constructor(json: any) { super(json); this.name = json.name; this.context = json.context; this.expression = build(json.expression); } - exec(ctx) { + exec(ctx: Context) { const value = this.expression != null ? this.expression.execute(ctx) : undefined; ctx.rootContext().set(this.name, value); return value; } } -class ExpressionRef extends Expression { - constructor(json) { +export class ExpressionRef extends Expression { + name: string; + library: string; + + constructor(json: any) { super(json); this.name = json.name; this.library = json.libraryName; } - exec(ctx) { + exec(ctx: Context) { ctx = this.library ? ctx.getLibraryContext(this.library) : ctx; let value = ctx.get(this.name); if (value instanceof Expression) { @@ -31,25 +40,33 @@ class ExpressionRef extends Expression { } } -class FunctionDef extends Expression { - constructor(json) { +export class FunctionDef extends Expression { + name: string; + expression: any; + parameters?: Parameter; + + constructor(json: any) { super(json); this.name = json.name; this.expression = build(json.expression); this.parameters = json.operand; } - exec(ctx) { + exec(_ctx: Context) { return this; } } -class FunctionRef extends Expression { - constructor(json) { +export class FunctionRef extends Expression { + name: string; + library: string; + + constructor(json: any) { super(json); this.name = json.name; this.library = json.libraryName; } - exec(ctx) { + + exec(ctx: Context) { let functionDefs, child_ctx; if (this.library) { const lib = ctx.get(this.library); @@ -63,10 +80,10 @@ class FunctionRef extends Expression { const args = this.execArgs(ctx); // Filter out functions w/ wrong number of arguments. - functionDefs = functionDefs.filter(f => f.parameters.length === args.length); + functionDefs = functionDefs.filter((f: any) => f.parameters.length === args.length); // If there is still > 1 matching function, filter by argument types if (functionDefs.length > 1) { - functionDefs = functionDefs.filter(f => { + functionDefs = functionDefs.filter((f: any) => { let match = true; for (let i = 0; i < args.length && match; i++) { if (args[i] !== null) { @@ -102,23 +119,29 @@ class FunctionRef extends Expression { } } -class OperandRef extends Expression { - constructor(json) { +export class OperandRef extends Expression { + name: string; + + constructor(json: any) { super(json); this.name = json.name; } - exec(ctx) { + + exec(ctx: Context) { return ctx.get(this.name); } } -class IdentifierRef extends Expression { - constructor(json) { +export class IdentifierRef extends Expression { + name: string; + library: string; + + constructor(json: any) { super(json); this.name = json.name; this.library = json.libraryName; } - exec(ctx) { + exec(ctx: Context) { // TODO: Technically, the ELM Translator should never output one of these // but this code is needed since it does, as a work-around to get queries // to work properly when sorting by a field in a tuple @@ -129,7 +152,7 @@ class IdentifierRef extends Expression { val = ctx.get(parts[0]); if (val != null && parts.length > 1) { let curr_obj = val; - for (let part of parts.slice(1)) { + for (const part of parts.slice(1)) { // _obj = curr_obj?[part] ? curr_obj?.get?(part) // curr_obj = if _obj instanceof Function then _obj.call(curr_obj) else _obj let _obj; @@ -151,12 +174,3 @@ class IdentifierRef extends Expression { } } } - -module.exports = { - ExpressionDef, - ExpressionRef, - FunctionDef, - FunctionRef, - IdentifierRef, - OperandRef -}; diff --git a/src/elm/string.js b/src/elm/string.ts similarity index 67% rename from src/elm/string.js rename to src/elm/string.ts index 4b35a7410..a72f71972 100644 --- a/src/elm/string.js +++ b/src/elm/string.ts @@ -1,35 +1,39 @@ -const { Expression } = require('./expression'); -const { build } = require('./builder'); +import { Expression } from './expression'; +import { Context } from '../runtime/context'; +import { build } from './builder'; -class Concatenate extends Expression { - constructor(json) { +export class Concatenate extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); - if (args.some(x => x == null)) { + if (args.some((x: any) => x == null)) { return null; } else { - return args.reduce((x, y) => x + y); + return args.reduce((x: any, y: any) => x + y); } } } -class Combine extends Expression { - constructor(json) { +export class Combine extends Expression { + source: any; + separator: any; + + constructor(json: any) { super(json); this.source = build(json.source); this.separator = build(json.separator); } - exec(ctx) { + exec(ctx: Context) { const source = this.source.execute(ctx); const separator = this.separator != null ? this.separator.execute(ctx) : ''; if (source == null) { return null; } else { - const filteredArray = source.filter(x => x != null); + const filteredArray = source.filter((x: any) => x != null); if (filteredArray.length === 0) { return null; } else { @@ -39,14 +43,17 @@ class Combine extends Expression { } } -class Split extends Expression { - constructor(json) { +export class Split extends Expression { + stringToSplit: any; + separator: any; + + constructor(json: any) { super(json); this.stringToSplit = build(json.stringToSplit); this.separator = build(json.separator); } - exec(ctx) { + exec(ctx: Context) { const stringToSplit = this.stringToSplit.execute(ctx); const separator = this.separator.execute(ctx); if (stringToSplit && separator) { @@ -56,14 +63,17 @@ class Split extends Expression { } } -class SplitOnMatches extends Expression { - constructor(json) { +export class SplitOnMatches extends Expression { + stringToSplit: any; + separatorPattern: any; + + constructor(json: any) { super(json); this.stringToSplit = build(json.stringToSplit); this.separatorPattern = build(json.separatorPattern); } - exec(ctx) { + exec(ctx: Context) { const stringToSplit = this.stringToSplit.execute(ctx); const separatorPattern = this.separatorPattern.execute(ctx); if (stringToSplit && separatorPattern) { @@ -75,12 +85,12 @@ class SplitOnMatches extends Expression { // Length is completely handled by overloaded#Length -class Upper extends Expression { - constructor(json) { +export class Upper extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { return arg.toUpperCase(); @@ -90,12 +100,12 @@ class Upper extends Expression { } } -class Lower extends Expression { - constructor(json) { +export class Lower extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { return arg.toLowerCase(); @@ -107,14 +117,17 @@ class Lower extends Expression { // Indexer is completely handled by overloaded#Indexer -class PositionOf extends Expression { - constructor(json) { +export class PositionOf extends Expression { + pattern: any; + string: any; + + constructor(json: any) { super(json); this.pattern = build(json.pattern); this.string = build(json.string); } - exec(ctx) { + exec(ctx: Context) { const pattern = this.pattern.execute(ctx); const string = this.string.execute(ctx); if (pattern == null || string == null) { @@ -125,14 +138,17 @@ class PositionOf extends Expression { } } -class LastPositionOf extends Expression { - constructor(json) { +export class LastPositionOf extends Expression { + pattern: any; + string: any; + + constructor(json: any) { super(json); this.pattern = build(json.pattern); this.string = build(json.string); } - exec(ctx) { + exec(ctx: Context) { const pattern = this.pattern.execute(ctx); const string = this.string.execute(ctx); if (pattern == null || string == null) { @@ -143,12 +159,12 @@ class LastPositionOf extends Expression { } } -class Matches extends Expression { - constructor(json) { +export class Matches extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const [string, pattern] = this.execArgs(ctx); if (string == null || pattern == null) { return null; @@ -158,15 +174,19 @@ class Matches extends Expression { } } -class Substring extends Expression { - constructor(json) { +export class Substring extends Expression { + stringToSub: any; + startIndex: any; + length: any; + + constructor(json: any) { super(json); this.stringToSub = build(json.stringToSub); this.startIndex = build(json.startIndex); this.length = build(json['length']); } - exec(ctx) { + exec(ctx: Context) { const stringToSub = this.stringToSub.execute(ctx); const startIndex = this.startIndex.execute(ctx); const length = this.length != null ? this.length.execute(ctx) : null; @@ -186,14 +206,14 @@ class Substring extends Expression { } } -class StartsWith extends Expression { - constructor(json) { +export class StartsWith extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); - if (args.some(x => x == null)) { + if (args.some((x: any) => x == null)) { return null; } else { return args[0].slice(0, args[1].length) === args[1]; @@ -201,14 +221,14 @@ class StartsWith extends Expression { } } -class EndsWith extends Expression { - constructor(json) { +export class EndsWith extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); - if (args.some(x => x == null)) { + if (args.some((x: any) => x == null)) { return null; } else { return args[1] === '' || args[0].slice(-args[1].length) === args[1]; @@ -216,33 +236,17 @@ class EndsWith extends Expression { } } -class ReplaceMatches extends Expression { - constructor(json) { +export class ReplaceMatches extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const args = this.execArgs(ctx); - if (args.some(x => x == null)) { + if (args.some((x: any) => x == null)) { return null; } else { return args[0].replace(new RegExp(args[1], 'g'), args[2]); } } } - -module.exports = { - Combine, - Concatenate, - EndsWith, - LastPositionOf, - Lower, - Matches, - PositionOf, - ReplaceMatches, - Split, - SplitOnMatches, - StartsWith, - Substring, - Upper -}; diff --git a/src/elm/structured.js b/src/elm/structured.ts similarity index 62% rename from src/elm/structured.js rename to src/elm/structured.ts index 0597eb7c3..769843f5b 100644 --- a/src/elm/structured.js +++ b/src/elm/structured.ts @@ -1,15 +1,20 @@ -const { Expression, UnimplementedExpression } = require('./expression'); -const { build } = require('./builder'); +import { Context } from '../runtime/context'; +import { Expression, UnimplementedExpression } from './expression'; +import { build } from './builder'; -class Property extends Expression { - constructor(json) { +export class Property extends Expression { + scope: any; + source: any; + path: any; + + constructor(json: any) { super(json); this.scope = json.scope; this.source = build(json.source); this.path = json.path; } - exec(ctx) { + exec(ctx: Context) { let obj = this.scope != null ? ctx.get(this.scope) : this.source; if (obj instanceof Expression) { obj = obj.execute(ctx); @@ -18,7 +23,7 @@ class Property extends Expression { if (val == null) { const parts = this.path.split('.'); let curr_obj = obj; - for (let part of parts) { + for (const part of parts) { const _obj = getPropertyFromObject(curr_obj, part); curr_obj = _obj instanceof Function ? _obj.call(curr_obj) : _obj; } @@ -32,7 +37,7 @@ class Property extends Expression { } } -function getPropertyFromObject(obj, path) { +function getPropertyFromObject(obj: any, path: any) { let val; if (obj != null) { val = obj[path]; @@ -43,11 +48,13 @@ function getPropertyFromObject(obj, path) { return val; } -class Tuple extends Expression { - constructor(json) { +export class Tuple extends Expression { + elements: any[]; + + constructor(json: any) { super(json); const elements = json.element != null ? json.element : []; - this.elements = elements.map(el => { + this.elements = elements.map((el: any) => { return { name: el.name, value: build(el.value) @@ -59,17 +66,15 @@ class Tuple extends Expression { return true; } - exec(ctx) { - const val = {}; - for (let el of this.elements) { + exec(ctx: Context) { + const val: any = {}; + for (const el of this.elements) { val[el.name] = el.value != null ? el.value.execute(ctx) : undefined; } return val; } } -class TupleElement extends UnimplementedExpression {} - -class TupleElementDefinition extends UnimplementedExpression {} +export class TupleElement extends UnimplementedExpression {} -module.exports = { Property, Tuple, TupleElement, TupleElementDefinition }; +export class TupleElementDefinition extends UnimplementedExpression {} diff --git a/src/elm/type.js b/src/elm/type.ts similarity index 77% rename from src/elm/type.js rename to src/elm/type.ts index 931c92f9a..2469f5406 100644 --- a/src/elm/type.js +++ b/src/elm/type.ts @@ -1,16 +1,21 @@ -const { Expression, UnimplementedExpression } = require('./expression'); -const { DateTime, Date } = require('../datatypes/datetime'); -const { Concept } = require('../datatypes/clinical'); -const { Quantity, parseQuantity } = require('../datatypes/quantity'); -const { isValidDecimal, isValidInteger, limitDecimalPrecision } = require('../util/math'); -const { normalizeMillisecondsField } = require('../util/util'); -const { Ratio } = require('../datatypes/ratio'); -const { Uncertainty } = require('../datatypes/uncertainty'); +import { Context } from '../runtime/context'; + +import { Expression, UnimplementedExpression } from './expression'; +import { DateTime, Date } from '../datatypes/datetime'; +import { Concept } from '../datatypes/clinical'; +import { Quantity, parseQuantity } from '../datatypes/quantity'; +import { isValidDecimal, isValidInteger, limitDecimalPrecision } from '../util/math'; +import { normalizeMillisecondsField } from '../util/util'; +import { Ratio } from '../datatypes/ratio'; +import { Uncertainty } from '../datatypes/uncertainty'; // TODO: Casting and Conversion needs unit tests! -class As extends Expression { - constructor(json) { +export class As extends Expression { + asTypeSpecifier: any; + strict: boolean; + + constructor(json: any) { super(json); if (json.asTypeSpecifier) { this.asTypeSpecifier = json.asTypeSpecifier; @@ -24,7 +29,7 @@ class As extends Expression { this.strict = json.strict != null ? json.strict : false; } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); // If it is null, return null if (arg == null) { @@ -43,12 +48,12 @@ class As extends Expression { } } -class ToBoolean extends Expression { - constructor(json) { +export class ToBoolean extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { const strArg = arg.toString().toLowerCase(); @@ -62,12 +67,12 @@ class ToBoolean extends Expression { } } -class ToConcept extends Expression { - constructor(json) { +export class ToConcept extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { return new Concept([arg], arg.display); @@ -77,12 +82,12 @@ class ToConcept extends Expression { } } -class ToDate extends Expression { - constructor(json) { +export class ToDate extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -94,12 +99,12 @@ class ToDate extends Expression { } } -class ToDateTime extends Expression { - constructor(json) { +export class ToDateTime extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg == null) { return null; @@ -111,12 +116,12 @@ class ToDateTime extends Expression { } } -class ToDecimal extends Expression { - constructor(json) { +export class ToDecimal extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { if (arg.isUncertainty) { @@ -134,15 +139,15 @@ class ToDecimal extends Expression { } } -class ToInteger extends Expression { - constructor(json) { +export class ToInteger extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (typeof arg === 'string') { - const integer = parseInt(arg.toString()); + const integer = parseInt(arg); if (isValidInteger(integer)) { return integer; } @@ -153,16 +158,16 @@ class ToInteger extends Expression { } } -class ToQuantity extends Expression { - constructor(json) { +export class ToQuantity extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { return this.convertValue(this.execArgs(ctx)); } - convertValue(val) { + convertValue(val: any): any { if (val == null) { return null; } else if (typeof val === 'number') { @@ -179,12 +184,12 @@ class ToQuantity extends Expression { } } -class ToRatio extends Expression { - constructor(json) { +export class ToRatio extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { // Argument will be of form ':' @@ -215,12 +220,12 @@ class ToRatio extends Expression { } } -class ToString extends Expression { - constructor(json) { +export class ToString extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { return arg.toString(); @@ -230,12 +235,12 @@ class ToString extends Expression { } } -class ToTime extends Expression { - constructor(json) { +export class ToTime extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg != null) { const timeString = arg.toString(); @@ -247,9 +252,9 @@ class ToTime extends Expression { if (matches == null) { return null; } - let hours = matches[2]; - let minutes = matches[4]; - let seconds = matches[6]; + let hours: any = matches[2]; + let minutes: any = matches[4]; + let seconds: any = matches[6]; // Validate h/m/s if they exist, but allow null if (hours != null) { if (hours < 0 || hours > 23) { @@ -269,7 +274,7 @@ class ToTime extends Expression { } seconds = parseInt(seconds, 10); } - let milliseconds = matches[8]; + let milliseconds: any = matches[8]; if (milliseconds != null) { milliseconds = parseInt(normalizeMillisecondsField(milliseconds)); } @@ -282,14 +287,17 @@ class ToTime extends Expression { } } -class Convert extends Expression { - constructor(json) { +export class Convert extends Expression { + operand: any; + toType: any; + + constructor(json: any) { super(json); this.operand = json.operand; this.toType = json.toType; } - exec(ctx) { + exec(ctx: Context) { switch (this.toType) { case '{urn:hl7-org:elm-types:r1}Boolean': return new ToBoolean({ type: 'ToBoolean', operand: this.operand }).execute(ctx); @@ -315,13 +323,15 @@ class Convert extends Expression { } } -class ConvertsToBoolean extends Expression { - constructor(json) { +export class ConvertsToBoolean extends Expression { + operand: any; + + constructor(json: any) { super(json); this.operand = json.operand; } - exec(ctx) { + exec(ctx: Context) { const operatorValue = this.execArgs(ctx); if (operatorValue === null) { return null; @@ -331,13 +341,15 @@ class ConvertsToBoolean extends Expression { } } -class ConvertsToDate extends Expression { - constructor(json) { +export class ConvertsToDate extends Expression { + operand: any; + + constructor(json: any) { super(json); this.operand = json.operand; } - exec(ctx) { + exec(ctx: Context) { const operatorValue = this.execArgs(ctx); if (operatorValue === null) { return null; @@ -347,13 +359,15 @@ class ConvertsToDate extends Expression { } } -class ConvertsToDateTime extends Expression { - constructor(json) { +export class ConvertsToDateTime extends Expression { + operand: any; + + constructor(json: any) { super(json); this.operand = json.operand; } - exec(ctx) { + exec(ctx: Context) { const operatorValue = this.execArgs(ctx); if (operatorValue === null) { return null; @@ -363,13 +377,15 @@ class ConvertsToDateTime extends Expression { } } -class ConvertsToDecimal extends Expression { - constructor(json) { +export class ConvertsToDecimal extends Expression { + operand: any; + + constructor(json: any) { super(json); this.operand = json.operand; } - exec(ctx) { + exec(ctx: Context) { const operatorValue = this.execArgs(ctx); if (operatorValue === null) { return null; @@ -379,13 +395,15 @@ class ConvertsToDecimal extends Expression { } } -class ConvertsToInteger extends Expression { - constructor(json) { +export class ConvertsToInteger extends Expression { + operand: any; + + constructor(json: any) { super(json); this.operand = json.operand; } - exec(ctx) { + exec(ctx: Context) { const operatorValue = this.execArgs(ctx); if (operatorValue === null) { return null; @@ -395,13 +413,15 @@ class ConvertsToInteger extends Expression { } } -class ConvertsToQuantity extends Expression { - constructor(json) { +export class ConvertsToQuantity extends Expression { + operand: any; + + constructor(json: any) { super(json); this.operand = json.operand; } - exec(ctx) { + exec(ctx: Context) { const operatorValue = this.execArgs(ctx); if (operatorValue === null) { return null; @@ -411,13 +431,15 @@ class ConvertsToQuantity extends Expression { } } -class ConvertsToRatio extends Expression { - constructor(json) { +export class ConvertsToRatio extends Expression { + operand: any; + + constructor(json: any) { super(json); this.operand = json.operand; } - exec(ctx) { + exec(ctx: Context) { const operatorValue = this.execArgs(ctx); if (operatorValue === null) { return null; @@ -427,13 +449,15 @@ class ConvertsToRatio extends Expression { } } -class ConvertsToString extends Expression { - constructor(json) { +export class ConvertsToString extends Expression { + operand: any; + + constructor(json: any) { super(json); this.operand = json.operand; } - exec(ctx) { + exec(ctx: Context) { const operatorValue = this.execArgs(ctx); if (operatorValue === null) { return null; @@ -443,13 +467,15 @@ class ConvertsToString extends Expression { } } -class ConvertsToTime extends Expression { - constructor(json) { +export class ConvertsToTime extends Expression { + operand: any; + + constructor(json: any) { super(json); this.operand = json.operand; } - exec(ctx) { + exec(ctx: Context) { const operatorValue = this.execArgs(ctx); if (operatorValue === null) { return null; @@ -459,7 +485,7 @@ class ConvertsToTime extends Expression { } } -function canConvertToType(toFunction, operand, ctx) { +function canConvertToType(toFunction: any, operand: any, ctx: Context) { try { const value = new toFunction({ type: toFunction.name, operand: operand }).execute(ctx); if (value != null) { @@ -472,12 +498,12 @@ function canConvertToType(toFunction, operand, ctx) { } } -class ConvertQuantity extends Expression { - constructor(json) { +export class ConvertQuantity extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const [quantity, newUnit] = this.execArgs(ctx); if (quantity != null && newUnit != null) { @@ -491,12 +517,12 @@ class ConvertQuantity extends Expression { } } -class CanConvertQuantity extends Expression { - constructor(json) { +export class CanConvertQuantity extends Expression { + constructor(json: any) { super(json); } - exec(ctx) { + exec(ctx: Context) { const [quantity, newUnit] = this.execArgs(ctx); if (quantity != null && newUnit != null) { @@ -511,8 +537,10 @@ class CanConvertQuantity extends Expression { } } -class Is extends Expression { - constructor(json) { +export class Is extends Expression { + isTypeSpecifier: any; + + constructor(json: any) { super(json); if (json.isTypeSpecifier) { this.isTypeSpecifier = json.isTypeSpecifier; @@ -525,7 +553,7 @@ class Is extends Expression { } } - exec(ctx) { + exec(ctx: Context) { const arg = this.execArgs(ctx); if (arg === null) { return false; @@ -538,24 +566,24 @@ class Is extends Expression { } } -function isSystemType(spec) { +function isSystemType(spec: any): any { switch (spec.type) { case 'NamedTypeSpecifier': return spec.name.startsWith('{urn:hl7-org:elm-types:r1}'); case 'ListTypeSpecifier': return isSystemType(spec.elementType); case 'TupleTypeSpecifier': - return spec.element.every(e => isSystemType(e.elementType)); + return spec.element.every((e: any) => isSystemType(e.elementType)); case 'IntervalTypeSpecifier': return isSystemType(spec.pointType); case 'ChoiceTypeSpecifier': - return spec.choice.every(c => isSystemType(c)); + return spec.choice.every((c: any) => isSystemType(c)); default: return false; } } -function specifierToString(spec) { +function specifierToString(spec: any): any { if (typeof spec === 'string') { return spec; } else if (spec == null || spec.type == null) { @@ -568,18 +596,18 @@ function specifierToString(spec) { return `List<${specifierToString(spec.elementType)}>`; case 'TupleTypeSpecifier': return `Tuple<${spec.element - .map(e => `${e.name} ${specifierToString(e.elementType)}`) + .map((e: any) => `${e.name} ${specifierToString(e.elementType)}`) .join(', ')}>`; case 'IntervalTypeSpecifier': return `Interval<${specifierToString(spec.pointType)}>`; case 'ChoiceTypeSpecifier': - return `Choice<${spec.choice.map(c => specifierToString(c)).join(', ')}>`; + return `Choice<${spec.choice.map((c: any) => specifierToString(c)).join(', ')}>`; default: return JSON.stringify(spec); } } -function guessSpecifierType(val) { +function guessSpecifierType(val: any): any { if (val == null) { return 'Null'; } @@ -629,38 +657,7 @@ function guessSpecifierType(val) { return 'Unknown'; } -class IntervalTypeSpecifier extends UnimplementedExpression {} -class ListTypeSpecifier extends UnimplementedExpression {} -class NamedTypeSpecifier extends UnimplementedExpression {} -class TupleTypeSpecifier extends UnimplementedExpression {} - -module.exports = { - As, - CanConvertQuantity, - Convert, - ConvertQuantity, - ConvertsToBoolean, - ConvertsToDate, - ConvertsToDateTime, - ConvertsToDecimal, - ConvertsToInteger, - ConvertsToQuantity, - ConvertsToRatio, - ConvertsToString, - ConvertsToTime, - IntervalTypeSpecifier, - Is, - ListTypeSpecifier, - NamedTypeSpecifier, - ToBoolean, - ToConcept, - ToDate, - ToDateTime, - ToDecimal, - ToInteger, - ToQuantity, - ToRatio, - ToString, - ToTime, - TupleTypeSpecifier -}; +export class IntervalTypeSpecifier extends UnimplementedExpression {} +export class ListTypeSpecifier extends UnimplementedExpression {} +export class NamedTypeSpecifier extends UnimplementedExpression {} +export class TupleTypeSpecifier extends UnimplementedExpression {} diff --git a/src/runtime/context.js b/src/runtime/context.ts similarity index 75% rename from src/runtime/context.js rename to src/runtime/context.ts index 0c1be08ba..5f3dea418 100644 --- a/src/runtime/context.js +++ b/src/runtime/context.ts @@ -1,10 +1,34 @@ -const { Exception } = require('../datatypes/exception'); -const { typeIsArray } = require('../util/util'); -const { NullMessageListener } = require('./messageListeners'); -const dt = require('../datatypes/datatypes'); +import { Exception } from '../datatypes/exception'; +import { typeIsArray } from '../util/util'; +import * as dt from '../datatypes/datatypes'; +import { MessageListener, NullMessageListener } from './messageListeners'; +import { Patient } from '../cql-patient'; +import { Parameter } from '../types/runtime.types'; +import { TerminologyProvider } from '../types'; + +export class Context { + // Public Construcor args + parent: any; + executionDateTime?: dt.DateTime; + messageListener?: MessageListener; + + // Private Construcor args + private _codeService?: TerminologyProvider | null; + private _parameters?: Parameter; + + // Auto-initialized properties + context_values: any; + library_context: any; + localId_context: any; + evaluatedRecords: any[]; -class Context { - constructor(parent, _codeService, _parameters, executionDateTime, messageListener) { + constructor( + parent: Context, + _codeService?: TerminologyProvider | null, + _parameters?: Parameter, + executionDateTime?: dt.DateTime, + messageListener?: MessageListener + ) { this.parent = parent; this._codeService = _codeService; this.context_values = {}; @@ -12,13 +36,13 @@ class Context { this.localId_context = {}; this.evaluatedRecords = []; // TODO: If there is an issue with number of parameters look into cql4browsers fix: 387ea77538182833283af65e6341e7a05192304c - this.checkParameters(_parameters); // not crazy about possibly throwing an error in a constructor, but... + this.checkParameters(_parameters ?? {}); // not crazy about possibly throwing an error in a constructor, but... this._parameters = _parameters || {}; this.executionDateTime = executionDateTime; this.messageListener = messageListener; } - get parameters() { + get parameters(): any { return this._parameters || (this.parent && this.parent.parameters); } @@ -27,7 +51,7 @@ class Context { this._parameters = params; } - get codeService() { + get codeService(): TerminologyProvider { return this._codeService || (this.parent && this.parent.codeService); } @@ -35,12 +59,12 @@ class Context { this._codeService = cs; } - withParameters(params) { + withParameters(params: Parameter) { this.parameters = params || {}; return this; } - withCodeService(cs) { + withCodeService(cs: TerminologyProvider) { this.codeService = cs; return this; } @@ -53,7 +77,7 @@ class Context { } } - findRecords(profile) { + findRecords(profile: any): any { return this.parent && this.parent.findRecords(profile); } @@ -63,19 +87,19 @@ class Context { return ctx; } - getLibraryContext(library) { + getLibraryContext(library: any) { return this.parent && this.parent.getLibraryContext(library); } - getLocalIdContext(localId) { + getLocalIdContext(localId: any): Context { return this.parent && this.parent.getLocalIdContext(localId); } - getParameter(name) { + getParameter(name: string): any { return this.parent && this.parent.getParameter(name); } - getParentParameter(name) { + getParentParameter(name: string): any { if (this.parent) { if (this.parent.parameters[name] != null) { return this.parent.parameters[name]; @@ -85,7 +109,7 @@ class Context { } } - getTimezoneOffset() { + getTimezoneOffset(): number | null { if (this.executionDateTime != null) { return this.executionDateTime.timezoneOffset; } else if (this.parent && this.parent.getTimezoneOffset != null) { @@ -95,7 +119,7 @@ class Context { } } - getExecutionDateTime() { + getExecutionDateTime(): dt.DateTime { if (this.executionDateTime != null) { return this.executionDateTime; } else if (this.parent && this.parent.getExecutionDateTime != null) { @@ -105,7 +129,7 @@ class Context { } } - getMessageListener() { + getMessageListener(): MessageListener { if (this.messageListener != null) { return this.messageListener; } else if (this.parent && this.parent.getMessageListener != null) { @@ -115,23 +139,23 @@ class Context { } } - getValueSet(name, library) { + getValueSet(name: string, library: any) { return this.parent && this.parent.getValueSet(name, library); } - getCodeSystem(name) { + getCodeSystem(name: string) { return this.parent && this.parent.getCodeSystem(name); } - getCode(name) { + getCode(name: string) { return this.parent && this.parent.getCode(name); } - getConcept(name) { + getConcept(name: string) { return this.parent && this.parent.getConcept(name); } - get(identifier) { + get(identifier: string): any { // Check for undefined because if its null, we actually *do* want to return null (rather than // looking at parent), but if it's really undefined, *then* look at the parent if (typeof this.context_values[identifier] !== 'undefined') { @@ -143,11 +167,11 @@ class Context { } } - set(identifier, value) { + set(identifier: string, value: any) { this.context_values[identifier] = value; } - setLocalIdWithResult(localId, value) { + setLocalIdWithResult(localId: string, value: any) { // Temporary fix. Real fix will be to return a list of all result values for a given localId. const ctx = this.localId_context[localId]; if (ctx === false || ctx === null || ctx === undefined || ctx.length === 0) { @@ -155,20 +179,20 @@ class Context { } } - getLocalIdResult(localId) { + getLocalIdResult(localId: string) { return this.localId_context[localId]; } // Returns an object of objects containing each library name // with the localIds and result values getAllLocalIds() { - const localIdResults = {}; + const localIdResults: any = {}; // Add the localIds and result values from the main library localIdResults[this.parent.source.library.identifier.id] = {}; localIdResults[this.parent.source.library.identifier.id] = this.localId_context; // Iterate over support libraries and store localIds - for (let libName in this.library_context) { + for (const libName in this.library_context) { const lib = this.library_context[libName]; this.supportLibraryLocalIds(lib, localIdResults); } @@ -176,7 +200,7 @@ class Context { } // Recursive function that will grab nested support library localId results - supportLibraryLocalIds(lib, localIdResults) { + supportLibraryLocalIds(lib: any, localIdResults: any) { // Set library identifier name as the key and the object of localIds with their results as the value // if it already exists then we need to merge the results instead of overwriting if (localIdResults[lib.library.source.library.identifier.id] != null) { @@ -196,8 +220,8 @@ class Context { // Merges the localId results for a library into the already collected results. The logic used for which result // to keep is the same as the logic used above in setLocalIdWithResult, "falsey" results are always replaced. - mergeLibraryLocalIdResults(localIdResults, libraryId, libraryResults) { - for (let localId in libraryResults) { + mergeLibraryLocalIdResults(localIdResults: any, libraryId: string, libraryResults: any) { + for (const localId in libraryResults) { const localIdResult = libraryResults[localId]; const existingResult = localIdResults[libraryId][localId]; // overwite this localid result if the existing result is "falsey". future work could track all results for each localid @@ -212,8 +236,8 @@ class Context { } } - checkParameters(params) { - for (let pName in params) { + checkParameters(params: Parameter) { + for (const pName in params) { const pVal = params[pName]; const pDef = this.getParameter(pName); if (pVal == null) { @@ -233,7 +257,7 @@ class Context { return true; } - matchesTypeSpecifier(val, spec) { + matchesTypeSpecifier(val: any, spec: any) { switch (spec.type) { case 'NamedTypeSpecifier': return this.matchesNamedTypeSpecifier(val, spec); @@ -250,11 +274,13 @@ class Context { } } - matchesListTypeSpecifier(val, spec) { - return typeIsArray(val) && val.every(x => this.matchesTypeSpecifier(x, spec.elementType)); + matchesListTypeSpecifier(val: any, spec: any): boolean { + return ( + typeIsArray(val) && (val as any[]).every(x => this.matchesTypeSpecifier(x, spec.elementType)) + ); } - matchesTupleTypeSpecifier(val, spec) { + matchesTupleTypeSpecifier(val: any, spec: any): boolean { // TODO: Spec is not clear about exactly how tuples should be matched return ( val != null && @@ -267,14 +293,14 @@ class Context { !val.isDate && !val.isQuantity && spec.element.every( - x => + (x: any) => typeof val[x.name] === 'undefined' || this.matchesTypeSpecifier(val[x.name], x.elementType) ) ); } - matchesIntervalTypeSpecifier(val, spec) { + matchesIntervalTypeSpecifier(val: any, spec: any): boolean { return ( val.isInterval && (val.low == null || this.matchesTypeSpecifier(val.low, spec.pointType)) && @@ -282,11 +308,11 @@ class Context { ); } - matchesChoiceTypeSpecifier(val, spec) { - return spec.choice.some(c => this.matchesTypeSpecifier(val, c)); + matchesChoiceTypeSpecifier(val: any, spec: any): boolean { + return spec.choice.some((c: any) => this.matchesTypeSpecifier(val, c)); } - matchesNamedTypeSpecifier(val, spec) { + matchesNamedTypeSpecifier(val: any, spec: any): boolean { if (val == null) { return true; } @@ -335,7 +361,7 @@ class Context { } } - matchesInstanceType(val, inst) { + matchesInstanceType(val: any, inst: any): boolean { if (inst.isBooleanLiteral) { return typeof val === 'boolean'; } else if (inst.isDecimalLiteral) { @@ -366,21 +392,24 @@ class Context { return true; // default to true when we don't know for sure } - matchesListInstanceType(val, list) { - return typeIsArray(val) && val.every(x => this.matchesInstanceType(x, list.elements[0])); + matchesListInstanceType(val: any, list: any) { + return ( + typeIsArray(val) && (val as any[]).every(x => this.matchesInstanceType(x, list.elements[0])) + ); } - matchesTupleInstanceType(val, tpl) { + matchesTupleInstanceType(val: any, tpl: any) { return ( typeof val === 'object' && !typeIsArray(val) && tpl.elements.every( - x => typeof val[x.name] === 'undefined' || this.matchesInstanceType(val[x.name], x.value) + (x: any) => + typeof val[x.name] === 'undefined' || this.matchesInstanceType(val[x.name], x.value) ) ); } - matchesIntervalInstanceType(val, ivl) { + matchesIntervalInstanceType(val: any, ivl: any) { const pointType = ivl.low != null ? ivl.low : ivl.high; return ( val.isInterval && @@ -390,25 +419,23 @@ class Context { } } -class PatientContext extends Context { +export class PatientContext extends Context { constructor( - library, - patient, - codeService, - parameters, - executionDateTime = dt.DateTime.fromJSDate(new Date()), - messageListener = new NullMessageListener() + public library: any, + public patient?: Patient | null, + codeService?: TerminologyProvider | null, + parameters?: Parameter, + executionDateTime: dt.DateTime = dt.DateTime.fromJSDate(new Date()), + messageListener: MessageListener = new NullMessageListener() ) { super(library, codeService, parameters, executionDateTime, messageListener); - this.library = library; - this.patient = patient; } rootContext() { return this; } - getLibraryContext(library) { + getLibraryContext(library: any) { if (this.library_context[library] == null) { this.library_context[library] = new PatientContext( this.get(library), @@ -421,7 +448,7 @@ class PatientContext extends Context { return this.library_context[library]; } - getLocalIdContext(localId) { + getLocalIdContext(localId: string) { if (this.localId_context[localId] == null) { this.localId_context[localId] = new PatientContext( this.get(localId), @@ -434,38 +461,36 @@ class PatientContext extends Context { return this.localId_context[localId]; } - findRecords(profile) { + findRecords(profile: any) { return this.patient && this.patient.findRecords(profile); } } -class UnfilteredContext extends Context { +export class UnfilteredContext extends Context { constructor( - library, - results, - codeService, - parameters, - executionDateTime = dt.DateTime.fromJSDate(new Date()), - messageListener = new NullMessageListener() + public library: any, + public results: any, + codeService?: TerminologyProvider | null, + parameters?: Parameter, + executionDateTime: dt.DateTime = dt.DateTime.fromJSDate(new Date()), + messageListener: MessageListener = new NullMessageListener() ) { super(library, codeService, parameters, executionDateTime, messageListener); - this.library = library; - this.results = results; } rootContext() { return this; } - findRecords(template) { + findRecords(_template: any) { throw new Exception('Retreives are not currently supported in Unfiltered Context'); } - getLibraryContext(library) { + getLibraryContext(_library: any) { throw new Exception('Library expressions are not currently supported in Unfiltered Context'); } - get(identifier) { + get(identifier: string) { //First check to see if the identifier is a unfiltered context expression that has already been cached if (this.context_values[identifier]) { return this.context_values[identifier]; @@ -476,8 +501,6 @@ class UnfilteredContext extends Context { } //lastley attempt to gather all patient level results that have that identifier // should this compact null values before return ? - return Object.values(this.results.patientResults).map(pr => pr[identifier]); + return Object.values(this.results.patientResults).map((pr: any) => pr[identifier]); } } - -module.exports = { Context, PatientContext, UnfilteredContext }; diff --git a/src/runtime/executor.js b/src/runtime/executor.ts similarity index 62% rename from src/runtime/executor.js rename to src/runtime/executor.ts index f028edb18..abdd3d99e 100644 --- a/src/runtime/executor.js +++ b/src/runtime/executor.ts @@ -1,36 +1,39 @@ -const { NullMessageListener } = require('./messageListeners'); -const { Results } = require('./results'); -const { UnfilteredContext, PatientContext } = require('./context'); +import { MessageListener, NullMessageListener } from './messageListeners'; +import { Results } from './results'; +import { UnfilteredContext, PatientContext } from './context'; +import { DateTime } from '../datatypes/datetime'; +import { Parameter } from '../types/runtime.types'; +import { DataProvider, TerminologyProvider } from '../types'; -class Executor { - constructor(library, codeService, parameters, messageListener = new NullMessageListener()) { - this.library = library; - this.codeService = codeService; - this.parameters = parameters; - this.messageListener = messageListener; - } +export class Executor { + constructor( + public library: any, + public codeService?: TerminologyProvider, + public parameters?: Parameter, + public messageListener: MessageListener = new NullMessageListener() + ) {} - withLibrary(lib) { + withLibrary(lib: any) { this.library = lib; return this; } - withParameters(params) { + withParameters(params: Parameter) { this.parameters = params != null ? params : {}; return this; } - withCodeService(cs) { + withCodeService(cs: TerminologyProvider) { this.codeService = cs; return this; } - withMessageListener(ml) { + withMessageListener(ml: MessageListener) { this.messageListener = ml; return this; } - exec_expression(expression, patientSource, executionDateTime) { + exec_expression(expression: any, patientSource: DataProvider, executionDateTime: DateTime) { const r = new Results(); const expr = this.library.expressions[expression]; if (expr != null) { @@ -50,7 +53,7 @@ class Executor { return r; } - exec(patientSource, executionDateTime) { + exec(patientSource: DataProvider, executionDateTime?: DateTime) { const r = this.exec_patient_context(patientSource, executionDateTime); const unfilteredContext = new UnfilteredContext( this.library, @@ -60,8 +63,8 @@ class Executor { executionDateTime, this.messageListener ); - const resultMap = {}; - for (let key in this.library.expressions) { + const resultMap: any = {}; + for (const key in this.library.expressions) { const expr = this.library.expressions[key]; if (expr.context === 'Unfiltered') { resultMap[key] = expr.exec(unfilteredContext); @@ -71,7 +74,7 @@ class Executor { return r; } - exec_patient_context(patientSource, executionDateTime) { + exec_patient_context(patientSource: DataProvider, executionDateTime?: DateTime) { const r = new Results(); while (patientSource.currentPatient()) { const patient_ctx = new PatientContext( @@ -82,8 +85,8 @@ class Executor { executionDateTime, this.messageListener ); - const resultMap = {}; - for (let key in this.library.expressions) { + const resultMap: any = {}; + for (const key in this.library.expressions) { const expr = this.library.expressions[key]; if (expr.context === 'Patient') { resultMap[key] = expr.execute(patient_ctx); @@ -95,5 +98,3 @@ class Executor { return r; } } - -module.exports = { Executor }; diff --git a/src/runtime/messageListeners.js b/src/runtime/messageListeners.js deleted file mode 100644 index b8853c3f8..000000000 --- a/src/runtime/messageListeners.js +++ /dev/null @@ -1,23 +0,0 @@ -class NullMessageListener { - onMessage(source, code, severity, message) { - // do nothing - } -} - -class ConsoleMessageListener { - constructor(logSourceOnTrace = false) { - this.logSourceOnTrace = logSourceOnTrace; - } - - onMessage(source, code, severity, message) { - // eslint-disable-next-line no-console - const print = severity === 'Error' ? console.error : console.log; - let content = `${severity}: [${code}] ${message}`; - if (severity === 'Trace' && this.logSourceOnTrace) { - content += `\n<<<<< SOURCE:\n${JSON.stringify(source)}\n>>>>>`; - } - print(content); - } -} - -module.exports = { NullMessageListener, ConsoleMessageListener }; diff --git a/src/runtime/messageListeners.ts b/src/runtime/messageListeners.ts new file mode 100644 index 000000000..0c55e783d --- /dev/null +++ b/src/runtime/messageListeners.ts @@ -0,0 +1,21 @@ +export class NullMessageListener { + onMessage(_source: any, _code: string, _severity: string, _message: string) { + // do nothing + } +} + +export class ConsoleMessageListener { + constructor(public logSourceOnTrace = false) {} + + onMessage(source: any, code: string, severity: string, message: string) { + // eslint-disable-next-line no-console + const print = severity === 'Error' ? console.error : console.log; + let content = `${severity}: [${code}] ${message}`; + if (severity === 'Trace' && this.logSourceOnTrace) { + content += `\n<<<<< SOURCE:\n${JSON.stringify(source)}\n>>>>>`; + } + print(content); + } +} + +export type MessageListener = NullMessageListener | ConsoleMessageListener; diff --git a/src/runtime/repository.js b/src/runtime/repository.ts similarity index 77% rename from src/runtime/repository.js rename to src/runtime/repository.ts index fcabc3e40..b4a2bf9af 100644 --- a/src/runtime/repository.js +++ b/src/runtime/repository.ts @@ -1,12 +1,15 @@ -const { Library } = require('../elm/library'); +import { Library } from '../elm/library'; -class Repository { - constructor(data) { +export class Repository { + data: any; + libraries: any[]; + + constructor(data: any) { this.data = data; this.libraries = Array.from(Object.values(data)); } - resolve(path, version) { + resolve(path: string, version?: string) { for (const lib of this.libraries) { if (lib.library && lib.library.identifier) { const { id, system, version: libraryVersion } = lib.library.identifier; @@ -25,5 +28,3 @@ class Repository { } } } - -module.exports = { Repository }; diff --git a/src/runtime/results.js b/src/runtime/results.ts similarity index 74% rename from src/runtime/results.js rename to src/runtime/results.ts index c5e06ee12..74f45fe73 100644 --- a/src/runtime/results.js +++ b/src/runtime/results.ts @@ -1,4 +1,9 @@ -class Results { +export class Results { + patientResults: any; + unfilteredResults: any; + localIdPatientResultsMap: any; + patientEvaluatedRecords: any; + constructor() { this.patientResults = {}; this.unfilteredResults = {}; @@ -8,10 +13,10 @@ class Results { // Expose an evaluatedRecords array for backwards compatibility get evaluatedRecords() { - return [].concat(...Object.values(this.patientEvaluatedRecords)); + return [].concat(...(Object.values(this.patientEvaluatedRecords) as any[])); } - recordPatientResults(patient_ctx, resultMap) { + recordPatientResults(patient_ctx: any, resultMap: any) { const p = patient_ctx.patient; // NOTE: From now on prefer getId() over id() because some data models may have an id property // that is not a string (e.g., FHIR) -- so reserve getId() for the API (and expect a string @@ -26,14 +31,12 @@ class Results { // Record the evaluatedRecords, merging with an aggregated array across all libraries this.patientEvaluatedRecords[patientId] = [...patient_ctx.evaluatedRecords]; - Object.values(patient_ctx.library_context).forEach(ctx => { + Object.values(patient_ctx.library_context).forEach((ctx: any) => { this.patientEvaluatedRecords[patientId].push(...ctx.evaluatedRecords); }); } - recordUnfilteredResults(resultMap) { + recordUnfilteredResults(resultMap: any) { this.unfilteredResults = resultMap; } } - -module.exports = { Results }; diff --git a/src/types/cql-code-service.interfaces.ts b/src/types/cql-code-service.interfaces.ts new file mode 100644 index 000000000..1b3f18bc1 --- /dev/null +++ b/src/types/cql-code-service.interfaces.ts @@ -0,0 +1,32 @@ +import { ValueSet } from '../datatypes/datatypes'; + +/* + * Lookup of all codes used based on their ValueSet + */ +export interface ValueSetDictionary { + [oid: string]: { + [version: string]: { + code: string; + system: string; + version?: string; + display?: string; + }[]; + }; +} + +/* + * Lookup of ValueSet objects + */ +export interface ValueSetObject { + [oid: string]: { + [version: string]: ValueSet; + }; +} + +/* + * Structure of an implementation to look up ValueSets based on oid and version + */ +export interface TerminologyProvider { + findValueSetsByOid: (oid: string) => any; + findValueSet: (oid: string, version?: string) => any; +} diff --git a/src/types/cql-patient.interfaces.ts b/src/types/cql-patient.interfaces.ts new file mode 100644 index 000000000..4fa8976e2 --- /dev/null +++ b/src/types/cql-patient.interfaces.ts @@ -0,0 +1,29 @@ +import { AnyTypeSpecifier } from './type-specifiers.interfaces'; + +/* + * Iterator for the patients provided to the execution engine + */ +export interface DataProvider { + currentPatient(): any; + nextPatient(): any; +} + +/* + * Structure of a Record + */ +export interface RecordObject { + get(field: any): any; + getId(): any; + getCode(field: any): any; + getDate(field: any): any; + getDateOrInterval(field: any): any; + _is?(typeSpecifier: AnyTypeSpecifier): boolean; + _typeHierarchy?(): AnyTypeSpecifier[]; +} + +/* + * Patient data object that implements logic for searching for records based on the Patient + */ +export interface PatientObject extends RecordObject { + findRecords(profile: string | null): RecordObject[]; +} diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 000000000..88e3037f5 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,4 @@ +export * from './cql-code-service.interfaces'; +export * from './cql-patient.interfaces'; +export * from './runtime.types'; +export * from './type-specifiers.interfaces'; diff --git a/src/types/runtime.types.ts b/src/types/runtime.types.ts new file mode 100644 index 000000000..2e83ea33f --- /dev/null +++ b/src/types/runtime.types.ts @@ -0,0 +1 @@ +export type Parameter = { [key: string]: any }; diff --git a/src/types/type-specifiers.interfaces.ts b/src/types/type-specifiers.interfaces.ts new file mode 100644 index 000000000..47a58195a --- /dev/null +++ b/src/types/type-specifiers.interfaces.ts @@ -0,0 +1,50 @@ +// Types derived from http://cql.hl7.org/04-logicalspecification.html#typespecifier + +/* + * Utility type for any possible TypeSpecifier + */ +export type AnyTypeSpecifier = + | NamedTypeSpecifier + | IntervalTypeSpecifier + | ListTypeSpecifier + | TupleTypeSpecifier + | ChoiceTypeSpecifier; + +/* + * Base interface for other TypeSpecifiers to extend from + */ +export interface TypeSpecifier { + type: string; + localId?: string; +} + +export interface NamedTypeSpecifier extends TypeSpecifier { + type: 'NamedTypeSpecifier'; + name: string; +} + +export interface IntervalTypeSpecifier extends TypeSpecifier { + type: 'IntervalTypeSpecifier'; + pointType: AnyTypeSpecifier; +} + +export interface ListTypeSpecifier extends TypeSpecifier { + type: 'ListTypeSpecifier'; + elementType: AnyTypeSpecifier; +} + +export interface TupleElementDefinition { + localId?: string; + name: string; + elementType: AnyTypeSpecifier; +} + +export interface TupleTypeSpecifier extends TypeSpecifier { + type: 'TupleTypeSpecifier'; + element?: TupleElementDefinition[]; +} + +export interface ChoiceTypeSpecifier extends TypeSpecifier { + type: 'ChoiceTypeSpecifier'; + choice?: AnyTypeSpecifier[]; +} diff --git a/src/types/ucum-lhc.d.ts b/src/types/ucum-lhc.d.ts new file mode 100644 index 000000000..88a623098 --- /dev/null +++ b/src/types/ucum-lhc.d.ts @@ -0,0 +1,44 @@ +// Types are incomplete; just utilized functions are included +// No existing type defs were found in the DefinitelyTyped repo +// Structures created based on JSDoc comments here: https://github.com/lhncbc/ucum-lhc/blob/master/source-cjs/ucumLhcUtils.js +declare module '@lhncbc/ucum-lhc' { + export interface Unit { + code: string; + name: string; + guidance: string; + } + + export interface ValidationSuggestion { + msg: string; + invalidUnit: string; + units: Unit[]; + } + + export interface ConversionSuggestion { + from?: ValidationSuggestion[]; + to?: ValidationSuggestion[]; + } + + export interface ValidationResponse { + status: 'valid' | 'invalid' | 'error'; + ucumCode: string | null; + msg: string[]; + unit: Unit | null; + suggestions?: ValidationSuggestion[]; + } + + export interface ConversionResponse { + status: 'succeeded' | 'failed' | 'error'; + toVal: string; + msg: string[]; + suggestions?: ConversionSuggestion[]; + fromUnit: Unit; + toUnit: Unit; + } + + export class UcumLhcUtils { + static getInstance(): UcumLhcUtils; + validateUnitString(uStr: string, suggest?: boolean, valConv?: string): ValidationResponse; + convertUnitTo(fromUnitCode: string, fromVal: number, toUnitCode: string): ConversionResponse; + } +} diff --git a/src/util/comparison.js b/src/util/comparison.ts similarity index 85% rename from src/util/comparison.js rename to src/util/comparison.ts index 36e6c39c3..34bd08baa 100644 --- a/src/util/comparison.js +++ b/src/util/comparison.ts @@ -1,14 +1,14 @@ -const { Uncertainty } = require('../datatypes/uncertainty'); +import { Uncertainty } from '../datatypes/datatypes'; -function areNumbers(a, b) { +function areNumbers(a: any, b: any) { return typeof a === 'number' && typeof b === 'number'; } -function areStrings(a, b) { +function areStrings(a: any, b: any) { return typeof a === 'string' && typeof b === 'string'; } -function areDateTimesOrQuantities(a, b) { +function areDateTimesOrQuantities(a: any, b: any) { return ( (a && a.isDateTime && b && b.isDateTime) || (a && a.isDate && b && b.isDate) || @@ -16,11 +16,11 @@ function areDateTimesOrQuantities(a, b) { ); } -function isUncertainty(x) { +function isUncertainty(x: any) { return x instanceof Uncertainty; } -function lessThan(a, b, precision) { +export function lessThan(a: any, b: any, precision?: any) { if (areNumbers(a, b) || areStrings(a, b)) { return a < b; } else if (areDateTimesOrQuantities(a, b)) { @@ -34,7 +34,7 @@ function lessThan(a, b, precision) { } } -function lessThanOrEquals(a, b, precision) { +export function lessThanOrEquals(a: any, b: any, precision?: any) { if (areNumbers(a, b) || areStrings(a, b)) { return a <= b; } else if (areDateTimesOrQuantities(a, b)) { @@ -48,7 +48,7 @@ function lessThanOrEquals(a, b, precision) { } } -function greaterThan(a, b, precision) { +export function greaterThan(a: any, b: any, precision?: any) { if (areNumbers(a, b) || areStrings(a, b)) { return a > b; } else if (areDateTimesOrQuantities(a, b)) { @@ -62,7 +62,7 @@ function greaterThan(a, b, precision) { } } -function greaterThanOrEquals(a, b, precision) { +export function greaterThanOrEquals(a: any, b: any, precision?: any) { if (areNumbers(a, b) || areStrings(a, b)) { return a >= b; } else if (areDateTimesOrQuantities(a, b)) { @@ -76,7 +76,7 @@ function greaterThanOrEquals(a, b, precision) { } } -function equivalent(a, b) { +export function equivalent(a: any, b: any) { if (a == null && b == null) { return true; } @@ -119,37 +119,37 @@ function equivalent(a, b) { return equals(a, b); } -function isCode(object) { +function isCode(object: any) { return object.hasMatch && typeof object.hasMatch === 'function'; } -function codesAreEquivalent(code1, code2) { +function codesAreEquivalent(code1: any, code2: any) { return code1.hasMatch(code2); } -function getClassOfObjects(object1, object2) { +function getClassOfObjects(object1: any, object2: any) { return [object1, object2].map(obj => ({}.toString.call(obj))); } -function compareEveryItemInArrays(array1, array2, comparisonFunction) { +function compareEveryItemInArrays(array1: any[], array2: any[], comparisonFunction: any) { return ( array1.length === array2.length && array1.every((item, i) => comparisonFunction(item, array2[i])) ); } -function compareObjects(a, b, comparisonFunction) { +function compareObjects(a: any, b: any, comparisonFunction: any) { if (!classesEqual(a, b)) { return false; } return deepCompareKeysAndValues(a, b, comparisonFunction); } -function classesEqual(object1, object2) { +function classesEqual(object1: any, object2: any) { return object2 instanceof object1.constructor && object1 instanceof object2.constructor; } -function deepCompareKeysAndValues(a, b, comparisonFunction) { +function deepCompareKeysAndValues(a: any, b: any, comparisonFunction: any) { let finalComparisonResult; const aKeys = getKeysFromObject(a).sort(); const bKeys = getKeysFromObject(b).sort(); @@ -178,15 +178,15 @@ function deepCompareKeysAndValues(a, b, comparisonFunction) { return finalComparisonResult; } -function getKeysFromObject(object) { +function getKeysFromObject(object: any) { return Object.keys(object).filter(k => !isFunction(object[k])); } -function isFunction(input) { +function isFunction(input: any) { return input instanceof Function || {}.toString.call(input) === '[object Function]'; } -function equals(a, b) { +export function equals(a: any, b: any) { // Handle null cases first: spec says if either is null, return null if (a == null || b == null) { return null; @@ -255,12 +255,3 @@ function equals(a, b) { // If we made it this far, we can't handle it return false; } - -module.exports = { - lessThan, - lessThanOrEquals, - greaterThan, - greaterThanOrEquals, - equivalent, - equals -}; diff --git a/src/util/math.js b/src/util/math.ts similarity index 73% rename from src/util/math.js rename to src/util/math.ts index 3811b762a..ec101e6b6 100644 --- a/src/util/math.js +++ b/src/util/math.ts @@ -1,21 +1,29 @@ -const { Exception } = require('../datatypes/exception'); -const { - MIN_DATETIME_VALUE, - MAX_DATETIME_VALUE, - MIN_DATE_VALUE, - MAX_DATE_VALUE, - MIN_TIME_VALUE, - MAX_TIME_VALUE -} = require('../datatypes/datetime'); -const { Uncertainty } = require('../datatypes/uncertainty'); +/* eslint-disable @typescript-eslint/no-loss-of-precision */ +import { Exception } from '../datatypes/exception'; +import { Quantity } from '../datatypes/quantity'; +import { + MIN_DATETIME_VALUE as dtMinDateTimeValue, + MAX_DATETIME_VALUE as dtMaxDateTimeValue, + MIN_DATE_VALUE as dtMinDateValue, + MAX_DATE_VALUE as dtMaxDateValue, + MIN_TIME_VALUE as dtMinTimeValue, + MAX_TIME_VALUE as dtMaxTimeValue +} from '../datatypes/datetime'; +import { Uncertainty } from '../datatypes/uncertainty'; -const MAX_INT_VALUE = Math.pow(2, 31) - 1; -const MIN_INT_VALUE = Math.pow(-2, 31); -const MAX_FLOAT_VALUE = 99999999999999999999.99999999; -const MIN_FLOAT_VALUE = -99999999999999999999.99999999; -const MIN_FLOAT_PRECISION_VALUE = Math.pow(10, -8); +export const MAX_INT_VALUE = Math.pow(2, 31) - 1; +export const MIN_INT_VALUE = Math.pow(-2, 31); +export const MAX_FLOAT_VALUE = 99999999999999999999.99999999; +export const MIN_FLOAT_VALUE = -99999999999999999999.99999999; +export const MIN_FLOAT_PRECISION_VALUE = Math.pow(10, -8); +export const MIN_DATETIME_VALUE = dtMinDateTimeValue; +export const MAX_DATETIME_VALUE = dtMaxDateTimeValue; +export const MIN_DATE_VALUE = dtMinDateValue; +export const MAX_DATE_VALUE = dtMaxDateValue; +export const MIN_TIME_VALUE = dtMinTimeValue; +export const MAX_TIME_VALUE = dtMaxTimeValue; -function overflowsOrUnderflows(value) { +export function overflowsOrUnderflows(value: any): boolean { if (value == null) { return false; } @@ -58,7 +66,7 @@ function overflowsOrUnderflows(value) { return false; } -function isValidInteger(integer) { +export function isValidInteger(integer: any) { if (isNaN(integer)) { return false; } @@ -71,7 +79,7 @@ function isValidInteger(integer) { return true; } -function isValidDecimal(decimal) { +export function isValidDecimal(decimal: any) { if (isNaN(decimal)) { return false; } @@ -84,7 +92,7 @@ function isValidDecimal(decimal) { return true; } -function limitDecimalPrecision(decimal) { +export function limitDecimalPrecision(decimal: any) { let decimalString = decimal.toString(); // For decimals so large that they are represented in scientific notation, javascript has already limited // the decimal to its own constraints, so we can't determine the original precision. Leave as-is unless @@ -101,11 +109,11 @@ function limitDecimalPrecision(decimal) { return parseFloat(decimalString); } -class OverFlowException extends Exception {} +export class OverFlowException extends Exception {} -function successor(val) { +export function successor(val: any): any { if (typeof val === 'number') { - if (parseInt(val) === val) { + if (Number.isInteger(val)) { if (val >= MAX_INT_VALUE) { throw new OverFlowException(); } else { @@ -155,9 +163,9 @@ function successor(val) { } } -function predecessor(val) { +export function predecessor(val: any): any { if (typeof val === 'number') { - if (parseInt(val) === val) { + if (Number.isInteger(val)) { if (val <= MIN_INT_VALUE) { throw new OverFlowException(); } else { @@ -190,7 +198,7 @@ function predecessor(val) { } } else if (val && val.isUncertainty) { // For uncertainties, if the low is the min val, don't decrement it - const low = (() => { + const low = ((): any => { try { return predecessor(val.low); } catch (e) { @@ -207,19 +215,19 @@ function predecessor(val) { } } -function maxValueForInstance(val) { +export function maxValueForInstance(val: any) { if (typeof val === 'number') { - if (parseInt(val) === val) { + if (Number.isInteger(val)) { return MAX_INT_VALUE; } else { return MAX_FLOAT_VALUE; } } else if (val && val.isTime && val.isTime()) { - return MAX_TIME_VALUE.copy(); + return MAX_TIME_VALUE?.copy(); } else if (val && val.isDateTime) { - return MAX_DATETIME_VALUE.copy(); + return MAX_DATETIME_VALUE?.copy(); } else if (val && val.isDate) { - return MAX_DATE_VALUE.copy(); + return MAX_DATE_VALUE?.copy(); } else if (val && val.isQuantity) { const val2 = val.clone(); val2.value = maxValueForInstance(val2.value); @@ -229,18 +237,18 @@ function maxValueForInstance(val) { } } -function maxValueForType(type, quantityInstance) { +export function maxValueForType(type: string, quantityInstance?: Quantity) { switch (type) { case '{urn:hl7-org:elm-types:r1}Integer': return MAX_INT_VALUE; case '{urn:hl7-org:elm-types:r1}Decimal': return MAX_FLOAT_VALUE; case '{urn:hl7-org:elm-types:r1}DateTime': - return MAX_DATETIME_VALUE.copy(); + return MAX_DATETIME_VALUE?.copy(); case '{urn:hl7-org:elm-types:r1}Date': - return MAX_DATE_VALUE.copy(); + return MAX_DATE_VALUE?.copy(); case '{urn:hl7-org:elm-types:r1}Time': - return MAX_TIME_VALUE.copy(); + return MAX_TIME_VALUE?.copy(); case '{urn:hl7-org:elm-types:r1}Quantity': { if (quantityInstance == null) { // can't infer a quantity unit type from nothing] @@ -254,19 +262,19 @@ function maxValueForType(type, quantityInstance) { return null; } -function minValueForInstance(val) { +export function minValueForInstance(val: any) { if (typeof val === 'number') { - if (parseInt(val) === val) { + if (Number.isInteger(val)) { return MIN_INT_VALUE; } else { return MIN_FLOAT_VALUE; } } else if (val && val.isTime && val.isTime()) { - return MIN_TIME_VALUE.copy(); + return MIN_TIME_VALUE?.copy(); } else if (val && val.isDateTime) { - return MIN_DATETIME_VALUE.copy(); + return MIN_DATETIME_VALUE?.copy(); } else if (val && val.isDate) { - return MIN_DATE_VALUE.copy(); + return MIN_DATE_VALUE?.copy(); } else if (val && val.isQuantity) { const val2 = val.clone(); val2.value = minValueForInstance(val2.value); @@ -276,18 +284,18 @@ function minValueForInstance(val) { } } -function minValueForType(type, quantityInstance) { +export function minValueForType(type: string, quantityInstance?: Quantity) { switch (type) { case '{urn:hl7-org:elm-types:r1}Integer': return MIN_INT_VALUE; case '{urn:hl7-org:elm-types:r1}Decimal': return MIN_FLOAT_VALUE; case '{urn:hl7-org:elm-types:r1}DateTime': - return MIN_DATETIME_VALUE.copy(); + return MIN_DATETIME_VALUE?.copy(); case '{urn:hl7-org:elm-types:r1}Date': - return MIN_DATE_VALUE.copy(); + return MIN_DATE_VALUE?.copy(); case '{urn:hl7-org:elm-types:r1}Time': - return MIN_TIME_VALUE.copy(); + return MIN_TIME_VALUE?.copy(); case '{urn:hl7-org:elm-types:r1}Quantity': { if (quantityInstance == null) { // can't infer a quantity unit type from nothing] @@ -301,10 +309,12 @@ function minValueForType(type, quantityInstance) { return null; } -function decimalAdjust(type, value, exp) { +type MathFn = keyof typeof Math; + +export function decimalAdjust(type: MathFn, value: any, exp: any) { //If the exp is undefined or zero... if (typeof exp === 'undefined' || +exp === 0) { - return Math[type](value); + return (Math[type] as (x: number) => number)(value); } value = +value; exp = +exp; @@ -315,40 +325,13 @@ function decimalAdjust(type, value, exp) { //Shift value = value.toString().split('e'); let v = value[1] ? +value[1] - exp : -exp; - value = Math[type](+(value[0] + 'e' + v)); + value = (Math[type] as (x: number) => number)(+(value[0] + 'e' + v)); //Shift back value = value.toString().split('e'); v = value[1] ? +value[1] + exp : exp; return +(value[0] + 'e' + v); } -function decimalOrNull(value) { +export function decimalOrNull(value: any) { return isValidDecimal(value) ? value : null; } - -module.exports = { - MAX_INT_VALUE, - MIN_INT_VALUE, - MAX_FLOAT_VALUE, - MIN_FLOAT_VALUE, - MIN_FLOAT_PRECISION_VALUE, - MIN_DATETIME_VALUE, - MAX_DATETIME_VALUE, - MIN_DATE_VALUE, - MAX_DATE_VALUE, - MIN_TIME_VALUE, - MAX_TIME_VALUE, - overflowsOrUnderflows, - isValidInteger, - isValidDecimal, - limitDecimalPrecision, - OverFlowException, - successor, - predecessor, - maxValueForInstance, - minValueForInstance, - maxValueForType, - minValueForType, - decimalAdjust, - decimalOrNull -}; diff --git a/src/util/units.js b/src/util/units.ts similarity index 83% rename from src/util/units.js rename to src/util/units.ts index 8b42891be..68e2f3b69 100644 --- a/src/util/units.js +++ b/src/util/units.ts @@ -1,11 +1,51 @@ -const ucum = require('@lhncbc/ucum-lhc'); -const { decimalAdjust } = require('./math'); +import * as ucum from '@lhncbc/ucum-lhc'; +import { decimalAdjust } from './math'; const utils = ucum.UcumLhcUtils.getInstance(); +// The CQL specification says that dates are based on the Gregorian calendar, so CQL-based year and month +// identifiers will be matched to the UCUM gregorian units. See http://unitsofmeasure.org/ucum.html#para-31 +const CQL_TO_UCUM_DATE_UNITS = { + years: 'a_g', + year: 'a_g', + months: 'mo_g', + month: 'mo_g', + weeks: 'wk', + week: 'wk', + days: 'd', + day: 'd', + hours: 'h', + hour: 'h', + minutes: 'min', + minute: 'min', + seconds: 's', + second: 's', + milliseconds: 'ms', + millisecond: 'ms' +}; + +type CQLUnitKey = keyof typeof CQL_TO_UCUM_DATE_UNITS; + +const UCUM_TO_CQL_DATE_UNITS = { + a: 'year', + a_j: 'year', + a_g: 'year', + mo: 'month', + mo_j: 'month', + mo_g: 'month', + wk: 'week', + d: 'day', + h: 'hour', + min: 'minute', + s: 'second', + ms: 'millisecond' +}; + +type UCUMUnitKey = keyof typeof UCUM_TO_CQL_DATE_UNITS; + // Cache Map for unit validity results so we dont have to go to ucum-lhc for every check. const unitValidityCache = new Map(); -function checkUnit(unit, allowEmptyUnits = true, allowCQLDateUnits = true) { +export function checkUnit(unit: any, allowEmptyUnits = true, allowCQLDateUnits = true) { if (allowEmptyUnits) { unit = fixEmptyUnit(unit); } @@ -27,7 +67,7 @@ function checkUnit(unit, allowEmptyUnits = true, allowCQLDateUnits = true) { return unitValidityCache.get(unit); } -function convertUnit(fromVal, fromUnit, toUnit, adjustPrecision = true) { +export function convertUnit(fromVal: any, fromUnit: any, toUnit: any, adjustPrecision = true) { [fromUnit, toUnit] = [fromUnit, toUnit].map(fixUnit); const result = utils.convertUnitTo(fixUnit(fromUnit), fromVal, fixUnit(toUnit)); if (result.status !== 'succeeded') { @@ -36,15 +76,14 @@ function convertUnit(fromVal, fromUnit, toUnit, adjustPrecision = true) { return adjustPrecision ? decimalAdjust('round', result.toVal, -8) : result.toVal; } -function normalizeUnitsWhenPossible(val1, unit1, val2, unit2) { +export function normalizeUnitsWhenPossible(val1: any, unit1: any, val2: any, unit2: any) { // If both units are CQL date units, return CQL date units - const useCQLDateUnits = - CQL_TO_UCUM_DATE_UNITS[unit1] != null && CQL_TO_UCUM_DATE_UNITS[unit2] != null; - const resultConverter = unit => { + const useCQLDateUnits = unit1 in CQL_TO_UCUM_DATE_UNITS && unit2 in CQL_TO_UCUM_DATE_UNITS; + const resultConverter = (unit: any) => { return useCQLDateUnits ? convertToCQLDateUnit(unit) : unit; }; - [unit1, unit2] = [unit1, unit2].map(fixUnit); + [unit1, unit2] = [unit1, unit2].map(u => fixUnit(u) as CQLUnitKey); if (unit1 === unit2) { return [val1, unit1, val2, unit2]; } @@ -68,21 +107,24 @@ function normalizeUnitsWhenPossible(val1, unit1, val2, unit2) { return [newVal1, resultConverter(newUnit1), val2, resultConverter(unit2)]; } -function convertToCQLDateUnit(unit) { - if (CQL_TO_UCUM_DATE_UNITS[unit]) { +export function convertToCQLDateUnit(unit: any) { + let dateUnit; + if (unit in CQL_TO_UCUM_DATE_UNITS) { // it's already a CQL unit, so return it as-is, removing trailing 's' if necessary (e.g., years -> year) - return unit.replace(/s$/, ''); + dateUnit = unit.replace(/s$/, ''); + } else if (unit in UCUM_TO_CQL_DATE_UNITS) { + dateUnit = UCUM_TO_CQL_DATE_UNITS[unit as UCUMUnitKey]; } - return UCUM_TO_CQL_DATE_UNITS[unit]; + return dateUnit; } -function compareUnits(unit1, unit2) { +export function compareUnits(unit1: any, unit2: any) { try { const c = convertUnit(1, unit1, unit2); - if (c > 1) { + if (c && c > 1) { // unit1 is bigger (less precise) return 1; - } else if (c < 1) { + } else if (c && c < 1) { // unit1 is smaller return -1; } @@ -93,7 +135,7 @@ function compareUnits(unit1, unit2) { } } -function getProductOfUnits(unit1, unit2) { +export function getProductOfUnits(unit1: any, unit2: any): any { [unit1, unit2] = [unit1, unit2].map(fixEmptyUnit); if (!checkUnit(unit1).valid || !checkUnit(unit2).valid) { return null; @@ -105,8 +147,8 @@ function getProductOfUnits(unit1, unit2) { const match1 = unit1.match(/([^/]*)(\/(.*))?/); const match2 = unit2.match(/([^/]*)(\/(.*))?/); // In the previous regexes, numerator is match[1], denominator is match[3] - let newNum = getProductOfUnits(match1[1], match2[1]); - let newDen = getProductOfUnits(match1[3], match2[3]); + const newNum = getProductOfUnits(match1[1], match2[1]); + const newDen = getProductOfUnits(match1[3], match2[3]); return getQuotientOfUnits(newNum, newDen); } @@ -135,7 +177,7 @@ function getProductOfUnits(unit1, unit2) { ); } -function getQuotientOfUnits(unit1, unit2) { +export function getQuotientOfUnits(unit1: any, unit2: any) { [unit1, unit2] = [unit1, unit2].map(fixEmptyUnit); if (!checkUnit(unit1).valid || !checkUnit(unit2).valid) { return null; @@ -148,12 +190,12 @@ function getQuotientOfUnits(unit1, unit2) { // powers since they are being divided. // e.g., 'm3.L' / 'm' ==> { m: 2, L: -1}; 'm.L' / '1' ==> { m: 1, L: 1 }; '1' / '1' ==> { 1: 0 } const factorPowerMap = new Map(); - unit1.split('.').forEach(factor => { + unit1.split('.').forEach((factor: any) => { const [baseUnit, power] = getBaseUnitAndPower(factor); const accumulatedPower = (factorPowerMap.get(baseUnit) || 0) + power; factorPowerMap.set(baseUnit, accumulatedPower); }); - unit2.split('.').forEach(factor => { + unit2.split('.').forEach((factor: any) => { const [baseUnit, power] = getBaseUnitAndPower(factor); const accumulatedPower = (factorPowerMap.get(baseUnit) || 0) - power; factorPowerMap.set(baseUnit, accumulatedPower); @@ -197,14 +239,14 @@ function getQuotientOfUnits(unit1, unit2) { // UNEXPORTED FUNCTIONS -function convertToBaseUnit(fromVal, fromUnit, toBaseUnit) { +function convertToBaseUnit(fromVal: any, fromUnit: any, toBaseUnit: any) { const fromPower = getBaseUnitAndPower(fromUnit)[1]; const toUnit = fromPower === 1 ? toBaseUnit : `${toBaseUnit}${fromPower}`; const newVal = convertUnit(fromVal, fromUnit, toUnit); return newVal != null ? [newVal, toUnit] : []; } -function getBaseUnitAndPower(unit) { +function getBaseUnitAndPower(unit: any) { // don't try to extract power from complex units (containing multipliers or divisors) if (/[./]/.test(unit)) { return [unit, 1]; @@ -220,63 +262,17 @@ function getBaseUnitAndPower(unit) { return [term, parseInt(power)]; } -// The CQL specification says that dates are based on the Gregorian calendar, so CQL-based year and month -// identifiers will be matched to the UCUM gregorian units. See http://unitsofmeasure.org/ucum.html#para-31 -const CQL_TO_UCUM_DATE_UNITS = { - years: 'a_g', - year: 'a_g', - months: 'mo_g', - month: 'mo_g', - weeks: 'wk', - week: 'wk', - days: 'd', - day: 'd', - hours: 'h', - hour: 'h', - minutes: 'min', - minute: 'min', - seconds: 's', - second: 's', - milliseconds: 'ms', - millisecond: 'ms' -}; - -const UCUM_TO_CQL_DATE_UNITS = { - a: 'year', - a_j: 'year', - a_g: 'year', - mo: 'month', - mo_j: 'month', - mo_g: 'month', - wk: 'week', - d: 'day', - h: 'hour', - min: 'minute', - s: 'second', - ms: 'millisecond' -}; - -function fixEmptyUnit(unit) { +function fixEmptyUnit(unit: any) { if (unit == null || (unit.trim && unit.trim() === '')) { return '1'; } return unit; } -function fixCQLDateUnit(unit) { +function fixCQLDateUnit(unit: CQLUnitKey) { return CQL_TO_UCUM_DATE_UNITS[unit] || unit; } -function fixUnit(unit) { +function fixUnit(unit: any) { return fixCQLDateUnit(fixEmptyUnit(unit)); } - -module.exports = { - checkUnit, - convertUnit, - normalizeUnitsWhenPossible, - convertToCQLDateUnit, - compareUnits, - getProductOfUnits, - getQuotientOfUnits -}; diff --git a/src/util/util.js b/src/util/util.ts similarity index 65% rename from src/util/util.js rename to src/util/util.ts index f4b71b09d..db689cfe3 100644 --- a/src/util/util.js +++ b/src/util/util.ts @@ -1,8 +1,10 @@ -function removeNulls(things) { +export type Direction = 'asc' | 'ascending' | 'desc' | 'descending'; + +export function removeNulls(things: any[]) { return things.filter(x => x != null); } -function numerical_sort(things, direction) { +export function numerical_sort(things: any[], direction: Direction | null) { return things.sort((a, b) => { if (direction == null || direction === 'asc' || direction === 'ascending') { return a - b; @@ -12,32 +14,33 @@ function numerical_sort(things, direction) { }); } -function isNull(value) { +export function isNull(value: any) { return value === null; } -const typeIsArray = Array.isArray || (value => ({}.toString.call(value) === '[object Array]')); +export const typeIsArray = + Array.isArray || (value => ({}.toString.call(value) === '[object Array]')); -function allTrue(things) { +export function allTrue(things: any) { if (typeIsArray(things)) { - return things.every(x => x); + return (things as any[]).every(x => x); } else { return things; } } -function anyTrue(things) { +export function anyTrue(things: any) { if (typeIsArray(things)) { - return things.some(x => x); + return (things as any[]).some(x => x); } else { return things; } } //The export below is to make it easier if js Date is overwritten with CQL Date -const jsDate = Date; +export const jsDate = Date; -function normalizeMillisecondsFieldInString(string, msString) { +export function normalizeMillisecondsFieldInString(string: string, msString: string) { // TODO: verify we are only removing numeral digits let timezoneField; msString = normalizeMillisecondsField(msString); @@ -53,12 +56,12 @@ function normalizeMillisecondsFieldInString(string, msString) { return (string = beforeMs + '.' + msString + timezoneSeparator + timezoneField); } -function normalizeMillisecondsField(msString) { +export function normalizeMillisecondsField(msString: string) { // fix up milliseconds by padding zeros and/or truncating (5 --> 500, 50 --> 500, 54321 --> 543, etc.) return (msString = (msString + '00').substring(0, 3)); } -function getTimezoneSeparatorFromString(string) { +export function getTimezoneSeparatorFromString(string: string) { if (string != null) { let matches = string.match(/-/); if (matches && matches.length === 1) { @@ -71,16 +74,3 @@ function getTimezoneSeparatorFromString(string) { } return ''; } - -module.exports = { - removeNulls, - numerical_sort, - isNull, - typeIsArray, - allTrue, - anyTrue, - jsDate, - normalizeMillisecondsFieldInString, - normalizeMillisecondsField, - getTimezoneSeparatorFromString -}; diff --git a/test/cql-code-service-test.js b/test/cql-code-service-test.ts similarity index 91% rename from test/cql-code-service-test.js rename to test/cql-code-service-test.ts index 6d704bcdd..db9b57c32 100644 --- a/test/cql-code-service-test.js +++ b/test/cql-code-service-test.ts @@ -1,9 +1,9 @@ -const should = require('should'); -const { CodeService } = require('../src/cql-code-service'); -const { Code, ValueSet } = require('../src/datatypes/datatypes'); +import { CodeService } from '../src/cql-code-service'; +import { Code, ValueSet } from '../src/datatypes/datatypes'; +import should from 'should'; describe('CodeService', () => { - let svc, vsOne, vsTwo, vsThree; + let svc: CodeService, vsOne: ValueSet, vsTwo: ValueSet, vsThree: ValueSet; beforeEach(() => { svc = new CodeService({ '1.2.3.4.5': { diff --git a/test/cql-exports-test.js b/test/cql-exports-test.ts similarity index 85% rename from test/cql-exports-test.js rename to test/cql-exports-test.ts index 358df37d6..85a8428ec 100644 --- a/test/cql-exports-test.js +++ b/test/cql-exports-test.ts @@ -1,6 +1,7 @@ -const cql = require('../src/cql'); +import cql from '../src/cql'; +import 'should'; -const libNames = []; +const libNames: string[] = []; // Library-related classes libNames.push('Library', 'Repository', 'Expression'); // Execution-related classes @@ -28,5 +29,5 @@ describe('CQL Exports', () => it(`should export ${name}`, () => { cql[name].should.be.Function(); cql[name].name.should.equal(name); - }))(libName) + }))(libName as keyof typeof cql) )); diff --git a/test/cql-patient-test.js b/test/cql-patient-test.ts similarity index 93% rename from test/cql-patient-test.js rename to test/cql-patient-test.ts index 62a16016c..50cce3603 100644 --- a/test/cql-patient-test.js +++ b/test/cql-patient-test.ts @@ -1,8 +1,9 @@ -const { Patient } = require('../src/cql-patient'); -const DT = require('../src/datatypes/datatypes'); +import { Patient } from '../src/cql-patient'; +import * as DT from '../src/datatypes/datatypes'; +import 'should'; describe('Record', () => { - let encRecord, cndRecord; + let encRecord: any, cndRecord: any; beforeEach(() => { const patient = new Patient({ records: [ @@ -30,7 +31,7 @@ describe('Record', () => { } ] }); - [encRecord, cndRecord] = Object.values(patient.records).map(r => r[0]); + [encRecord, cndRecord] = Object.values(patient.records).map((r: any) => r[0]); }); it('should get simple record entries', () => { @@ -76,7 +77,7 @@ describe('Record', () => { }); describe('Patient', () => { - let patient; + let patient: Patient; beforeEach(() => { patient = new Patient({ id: '1', @@ -114,7 +115,7 @@ describe('Patient', () => { patient.id.should.equal('1'); patient.name.should.equal('Bob Jones'); patient.gender.should.equal('M'); - patient.birthDate.should.eql(DT.DateTime.parse('1974-07-12T11:15')); + patient.birthDate?.should.eql(DT.DateTime.parse('1974-07-12T11:15')); }); it('should find records by profile', () => { diff --git a/test/datatypes/clinical-test.js b/test/datatypes/clinical-test.ts similarity index 96% rename from test/datatypes/clinical-test.js rename to test/datatypes/clinical-test.ts index d9bf92c62..551b5061e 100644 --- a/test/datatypes/clinical-test.js +++ b/test/datatypes/clinical-test.ts @@ -1,7 +1,7 @@ -const { Code, Concept, ValueSet } = require('../../src/datatypes/clinical'); +import { Code, Concept, ValueSet } from '../../src/datatypes/clinical'; describe('Code', () => { - let code, code_no_version, code_no_codesystem; + let code: Code, code_no_version: Code, code_no_codesystem: Code; beforeEach(() => { code = new Code('ABC', '5.4.3.2.1', '1'); code_no_version = new Code('ABC', '5.4.3.2.1'); @@ -80,7 +80,7 @@ describe('Code', () => { }); describe('Concept', () => { - let concept; + let concept: Concept; beforeEach(() => { concept = new Concept([new Code('ABC', '5.4.3.2.1', '1'), new Code('ABC', '5.4.3.2.1', '2')]); }); @@ -119,7 +119,7 @@ describe('Concept', () => { }); describe('ValueSet', () => { - let valueSet; + let valueSet: ValueSet; beforeEach(() => { valueSet = new ValueSet('1.2.3.4.5', '1', [ new Code('ABC', '5.4.3.2.1', '1'), diff --git a/test/datatypes/date-test.js b/test/datatypes/date-test.ts similarity index 99% rename from test/datatypes/date-test.js rename to test/datatypes/date-test.ts index a9690df13..e1a2956bc 100644 --- a/test/datatypes/date-test.js +++ b/test/datatypes/date-test.ts @@ -1,8 +1,8 @@ -const should = require('should'); -const luxon = require('luxon'); -const { jsDate } = require('../../src/util/util'); -const { Date, DateTime } = require('../../src/datatypes/datetime'); -const { Uncertainty } = require('../../src/datatypes/uncertainty'); +import should from 'should'; +import * as luxon from 'luxon'; +import { jsDate } from '../../src/util/util'; +import { Date, DateTime } from '../../src/datatypes/datetime'; +import { Uncertainty } from '../../src/datatypes/uncertainty'; describe('Date', () => { it('should properly set all properties when constructed', () => { @@ -175,6 +175,8 @@ describe('Date.add', () => { it('should return a different object (copy)', () => { const date1 = Date.parse('2000-06-15'); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore const date2 = date1.add(0, Date.Unit.SECOND); date1.should.eql(date2); date1.should.not.equal(date2); diff --git a/test/datatypes/date_datetime_implicit_conversion-test.js b/test/datatypes/date_datetime_implicit_conversion-test.ts similarity index 99% rename from test/datatypes/date_datetime_implicit_conversion-test.js rename to test/datatypes/date_datetime_implicit_conversion-test.ts index babfdd856..9b615ce63 100644 --- a/test/datatypes/date_datetime_implicit_conversion-test.js +++ b/test/datatypes/date_datetime_implicit_conversion-test.ts @@ -1,6 +1,6 @@ -const should = require('should'); -const { DateTime, Date } = require('../../src/datatypes/datetime'); -const { Uncertainty } = require('../../src/datatypes/uncertainty'); +import should from 'should'; +import { DateTime, Date } from '../../src/datatypes/datetime'; +import { Uncertainty } from '../../src/datatypes/uncertainty'; describe('Overlapping DateTime and Date units', () => it('should match', () => { diff --git a/test/datatypes/datetime-test.js b/test/datatypes/datetime-test.ts similarity index 99% rename from test/datatypes/datetime-test.js rename to test/datatypes/datetime-test.ts index dcb3eeb24..332e05f46 100644 --- a/test/datatypes/datetime-test.js +++ b/test/datatypes/datetime-test.ts @@ -1,16 +1,35 @@ -const should = require('should'); -const luxon = require('luxon'); -const { DateTime } = require('../../src/datatypes/datetime'); -const { Uncertainty } = require('../../src/datatypes/uncertainty'); - -const tzDate = function (y, mo, d, h, mi, s, ms, offset) { +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import should from 'should'; +import * as luxon from 'luxon'; +import { DateTime } from '../../src/datatypes/datetime'; +import { Uncertainty } from '../../src/datatypes/uncertainty'; + +const tzDate = function ( + y: number, + mo: number, + d: number, + h: number, + mi: number, + s: number, + ms: number, + offset?: number +) { if (offset == null) { offset = (new Date().getTimezoneOffset() / 60) * -1; } return new Date(Date.UTC(y, mo, d, h, mi, s, ms) - offset * 60 * 60 * 1000); }; -const luxonTzDate = function (y, mo, d, h, mi, s, ms, offset) { +const luxonTzDate = function ( + y: number, + mo: number, + d: number, + h: number, + mi: number, + s: number, + ms: number, + offset?: number +) { if (offset == null) { offset = new Date().getTimezoneOffset() * -1; } @@ -22,6 +41,7 @@ const luxonTzDate = function (y, mo, d, h, mi, s, ms, offset) { minute: mi, second: s, millisecond: ms, + // @ts-ignore zone: luxon.FixedOffsetZone.instance(offset) }); }; @@ -3736,11 +3756,6 @@ describe('DateTime.getDate', () => { d.year.should.equal(2012); d.month.should.equal(10); d.day.should.equal(25); - should.not.exist(d.hour); - should.not.exist(d.minute); - should.not.exist(d.second); - should.not.exist(d.millisecond); - should.not.exist(d.timezoneOffset); }); it('should properly extract the date from datetime without time', () => { @@ -3748,10 +3763,6 @@ describe('DateTime.getDate', () => { d.year.should.equal(2012); d.month.should.equal(10); d.day.should.equal(25); - should.not.exist(d.hour); - should.not.exist(d.minute); - should.not.exist(d.second); - should.not.exist(d.millisecond); }); it('should properly extract the date from datetime without days', () => { @@ -3759,10 +3770,6 @@ describe('DateTime.getDate', () => { d.year.should.equal(2012); d.month.should.equal(10); should.not.exist(d.day); - should.not.exist(d.hour); - should.not.exist(d.minute); - should.not.exist(d.second); - should.not.exist(d.millisecond); }); it('should properly extract the date from datetime without months', () => { @@ -3770,10 +3777,6 @@ describe('DateTime.getDate', () => { d.year.should.equal(2012); should.not.exist(d.month); should.not.exist(d.day); - should.not.exist(d.hour); - should.not.exist(d.minute); - should.not.exist(d.second); - should.not.exist(d.millisecond); }); }); diff --git a/test/datatypes/interval-data.js b/test/datatypes/interval-data.ts similarity index 89% rename from test/datatypes/interval-data.js rename to test/datatypes/interval-data.ts index 2b1ac1b90..c9bbd0d27 100644 --- a/test/datatypes/interval-data.js +++ b/test/datatypes/interval-data.ts @@ -1,16 +1,25 @@ -const { Interval } = require('../../src/datatypes/interval'); -const { DateTime } = require('../../src/datatypes/datetime'); +import { Interval } from '../../src/datatypes/interval'; +import { DateTime } from '../../src/datatypes/datetime'; class TestDateTime { - static parse(string) { + static parse(string: string) { return TestDateTime.fromDateTime(DateTime.parse(string)); } - static fromDateTime(d) { + static fromDateTime(d: any) { return new TestDateTime(d.year, d.month, d.day, d.hour, d.minute, d.second, d.millisecond); } - constructor(year, month = 0, day = 1, hour = 0, minute = 0, second = 0, millisecond = 0) { + full: DateTime; + toYear: DateTime; + toMonth: DateTime; + toDay: DateTime; + toHour: DateTime; + toMinute: DateTime; + toSecond: DateTime; + toMillisecond: DateTime; + + constructor(year: number, month = 0, day = 1, hour = 0, minute = 0, second = 0, millisecond = 0) { this.full = new DateTime(year, month, day, hour, minute, second, millisecond); this.toYear = new DateTime(year); this.toMonth = new DateTime(year, month); @@ -23,7 +32,19 @@ class TestDateTime { } class TestInterval { - constructor(low, high) { + closed: Interval; + open: Interval; + closedOpen: Interval; + openClosed: Interval; + toYear: Interval; + toMonth: Interval; + toDay: Interval; + toHour: Interval; + toMinute: Interval; + toSecond: Interval; + toMillisecond: Interval; + + constructor(low: any, high: any) { const [thLow, thHigh] = Array.from([ TestDateTime.fromDateTime(low), TestDateTime.fromDateTime(high) @@ -42,8 +63,8 @@ class TestInterval { } } -module.exports = () => { - const data = {}; +export default () => { + const data: any = {}; data['all2012'] = new TestInterval( DateTime.parse('2012-01-01T00:00:00.0'), DateTime.parse('2012-12-31T23:59:59.999') diff --git a/test/datatypes/interval-test.js b/test/datatypes/interval-test.ts similarity index 99% rename from test/datatypes/interval-test.js rename to test/datatypes/interval-test.ts index 1a9ce82a1..04181dd4c 100644 --- a/test/datatypes/interval-test.js +++ b/test/datatypes/interval-test.ts @@ -1,10 +1,10 @@ -const should = require('should'); -const data = require('./interval-data'); -const { Interval } = require('../../src/datatypes/interval'); -const { DateTime } = require('../../src/datatypes/datetime'); -const { Uncertainty } = require('../../src/datatypes/uncertainty'); +import should from 'should'; +import data from './interval-data'; +import { Interval } from '../../src/datatypes/interval'; +import { DateTime } from '../../src/datatypes/datetime'; +import { Uncertainty } from '../../src/datatypes/uncertainty'; -const xy = obj => [obj.x, obj.y]; +const xy = (obj: any) => [obj.x, obj.y]; describe('Interval', () => { it('should properly set all properties when constructed as DateTime interval', () => { @@ -33,7 +33,7 @@ describe('Interval', () => { }); describe('DateTimeInterval.contains', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -109,7 +109,7 @@ describe('DateTimeInterval.contains', () => { }); describe('DateTimeInterval.includes', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -235,7 +235,7 @@ describe('DateTimeInterval.includes', () => { }); describe('DateTimeInterval.includedIn', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -362,7 +362,7 @@ describe('DateTimeInterval.includedIn', () => { }); describe('DateTimeInterval.overlaps(DateTimeInterval)', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -484,7 +484,7 @@ describe('DateTimeInterval.overlaps(DateTimeInterval)', () => { }); describe('DateTimeInterval.overlaps(DateTime)', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -535,7 +535,7 @@ describe('DateTimeInterval.overlaps(DateTime)', () => { }); describe('DateTimeInterval.equals', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -691,7 +691,7 @@ describe('DateTimeInterval.equals', () => { }); describe('DateTimeInterval.union', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -873,7 +873,7 @@ describe('DateTimeInterval.union', () => { }); describe('DateTimeInterval.intersect', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -999,7 +999,7 @@ describe('DateTimeInterval.intersect', () => { }); describe('DateTimeInterval.except', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -1131,7 +1131,7 @@ describe('DateTimeInterval.except', () => { }); describe('DateTimeInterval.after', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -1264,7 +1264,7 @@ describe('DateTimeInterval.after', () => { }); describe('DateTimeInterval.before', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -1397,7 +1397,7 @@ describe('DateTimeInterval.before', () => { // TODO Add tests that pass in precision parameters describe('DateTimeInterval.meets', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -1520,7 +1520,7 @@ describe('DateTimeInterval.meets', () => { // TODO Add tests that pass in precision parameter describe('DateTimeInterval.meetsAfter', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -1648,7 +1648,7 @@ describe('DateTimeInterval.meetsAfter', () => { // TODO Add tests that pass in precision parameter describe('DateTimeInterval.meetsBefore', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -1771,7 +1771,7 @@ describe('DateTimeInterval.meetsBefore', () => { }); describe('IntegerInterval.contains', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -1846,7 +1846,7 @@ describe('IntegerInterval.contains', () => { }); describe('IntegerInterval.includes', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -1963,7 +1963,7 @@ describe('IntegerInterval.includes', () => { }); describe('IntegerInterval.includedIn', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -2082,7 +2082,7 @@ describe('IntegerInterval.includedIn', () => { }); describe('IntegerInterval.overlaps(IntegerInterval)', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -2195,7 +2195,7 @@ describe('IntegerInterval.overlaps(IntegerInterval)', () => { }); describe('IntegerInterval.overlaps(Integer)', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -2253,7 +2253,7 @@ describe('IntegerInterval.overlaps(Integer)', () => { }); describe('IntegerInterval.equals', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -2395,7 +2395,7 @@ describe('IntegerInterval.equals', () => { }); describe('IntegerInterval.union', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -2539,7 +2539,7 @@ describe('IntegerInterval.union', () => { }); describe('IntegerInterval.intersect', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -2675,7 +2675,7 @@ describe('IntegerInterval.intersect', () => { }); describe('IntegerInterval.except', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -2809,7 +2809,7 @@ describe('IntegerInterval.except', () => { }); describe('IntegerInterval.after', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -2930,7 +2930,7 @@ describe('IntegerInterval.after', () => { }); describe('IntegerInterval.before', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -3051,7 +3051,7 @@ describe('IntegerInterval.before', () => { }); describe('IntegerInterval.meets', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -3172,7 +3172,7 @@ describe('IntegerInterval.meets', () => { }); describe('IntegerInterval.meetsAfter', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); @@ -3293,7 +3293,7 @@ describe('IntegerInterval.meetsAfter', () => { }); describe('IntegerInterval.meetsBefore', () => { - let d; + let d: any; beforeEach(() => { d = data(); }); diff --git a/test/datatypes/logic-test.js b/test/datatypes/logic-test.ts similarity index 97% rename from test/datatypes/logic-test.js rename to test/datatypes/logic-test.ts index c26492e2f..a58f7fe1c 100644 --- a/test/datatypes/logic-test.js +++ b/test/datatypes/logic-test.ts @@ -1,5 +1,5 @@ -const should = require('should'); -const { ThreeValuedLogic } = require('../../src/datatypes/logic'); +import should from 'should'; +import { ThreeValuedLogic } from '../../src/datatypes/logic'; describe('ThreeValuedLogic.and', () => { it('should return true when all is true', () => diff --git a/test/datatypes/uncertainty-test.js b/test/datatypes/uncertainty-test.ts similarity index 98% rename from test/datatypes/uncertainty-test.js rename to test/datatypes/uncertainty-test.ts index cf0086329..cd222d4fe 100644 --- a/test/datatypes/uncertainty-test.js +++ b/test/datatypes/uncertainty-test.ts @@ -1,8 +1,8 @@ -const should = require('should'); -const { Uncertainty } = require('../../src/datatypes/uncertainty'); -const { Code } = require('../../src/datatypes/datatypes'); -const { Concept } = require('../../src/datatypes/clinical'); -const { ValueSet } = require('../../src/datatypes/clinical'); +import should from 'should'; +import { Uncertainty } from '../../src/datatypes/uncertainty'; +import { Code } from '../../src/datatypes/datatypes'; +import { Concept } from '../../src/datatypes/clinical'; +import { ValueSet } from '../../src/datatypes/clinical'; describe('Uncertainty', () => { it('should contruct uncertainties with correct properties', () => { diff --git a/test/elm/aggregate/aggregate-test.js b/test/elm/aggregate/aggregate-test.ts similarity index 99% rename from test/elm/aggregate/aggregate-test.js rename to test/elm/aggregate/aggregate-test.ts index fdb291776..0fb667262 100644 --- a/test/elm/aggregate/aggregate-test.js +++ b/test/elm/aggregate/aggregate-test.ts @@ -1,7 +1,7 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); -const validateQuantity = function (object, expectedValue, expectedUnit) { +const validateQuantity = function (object: any, expectedValue: any, expectedUnit: any) { object.isQuantity.should.be.true(); object.value.should.equal(expectedValue); object.unit.should.equal(expectedUnit); diff --git a/test/elm/arithmetic/arithmetic-test.js b/test/elm/arithmetic/arithmetic-test.ts similarity index 98% rename from test/elm/arithmetic/arithmetic-test.js rename to test/elm/arithmetic/arithmetic-test.ts index ae9d25352..72efb042c 100644 --- a/test/elm/arithmetic/arithmetic-test.js +++ b/test/elm/arithmetic/arithmetic-test.ts @@ -1,23 +1,24 @@ -const should = require('should'); -const setup = require('../../setup'); -const data = require('./data'); -const { +import should from 'should'; +import setup from '../../setup'; +import { Quantity, doMultiplication, doDivision, doAddition, doSubtraction, parseQuantity -} = require('../../../src/datatypes/quantity'); +} from '../../../src/datatypes/quantity'; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const data = require('./data'); -const validateQuantity = function (object, expectedValue, expectedUnit) { +const validateQuantity = function (object: any, expectedValue: number, expectedUnit: string) { object.isQuantity.should.be.true(); const q = new Quantity(expectedValue, expectedUnit); q.equals(object).should.be.true('Expected ' + object + ' to equal ' + q); }; -const doQuantityMathTests = function (tests, operator) { - let func; +const doQuantityMathTests = function (tests: string[][], operator: string) { + let func: any; if (operator === '*') { func = doMultiplication; } else if (operator === '/') { @@ -28,7 +29,7 @@ const doQuantityMathTests = function (tests, operator) { func = doSubtraction; } - for (let t of tests) { + for (const t of tests) { const a = parseQuantity(t[0]); const b = parseQuantity(t[1]); // try to parse the expected value but if it comes back null @@ -238,6 +239,7 @@ describe('MinValue', () => { }); it('of Decimal should return minimum representable Decimal value', function () { + // eslint-disable-next-line @typescript-eslint/no-loss-of-precision const minDecimalValue = -99999999999999999999.99999999; this.minDecimal.exec(this.ctx).should.be.approximately(minDecimalValue, 0.000000001); }); @@ -277,6 +279,7 @@ describe('MaxValue', () => { }); it('of Decimal should return maximum representable Decimal value', function () { + // eslint-disable-next-line @typescript-eslint/no-loss-of-precision const maxDecimalValue = 99999999999999999999.99999999; this.maxDecimal.exec(this.ctx).should.be.approximately(maxDecimalValue, 0.000000001); }); diff --git a/test/elm/clinical/clinical-test.js b/test/elm/clinical/clinical-test.ts similarity index 97% rename from test/elm/clinical/clinical-test.js rename to test/elm/clinical/clinical-test.ts index 4303260cf..75ca1a4b8 100644 --- a/test/elm/clinical/clinical-test.js +++ b/test/elm/clinical/clinical-test.ts @@ -1,12 +1,12 @@ -const should = require('should'); -const setup = require('../../setup'); -const data = require('./data'); +import should from 'should'; +import setup from '../../setup'; const vsets = require('./valuesets'); -const DT = require('../../../src/datatypes/datatypes'); -const { PatientContext } = require('../../../src/cql'); -const { Uncertainty } = require('../../../src/datatypes/uncertainty'); +import * as DT from '../../../src/datatypes/datatypes'; +import { PatientContext } from '../../../src/cql'; +import { Uncertainty } from '../../../src/datatypes/uncertainty'; const { p1, p2, p3 } = require('./patients'); -const { PatientSource } = require('../../../src/cql-patient'); +import { PatientSource } from '../../../src/cql-patient'; +const data = require('./data'); describe('ValueSetDef', () => { beforeEach(function () { diff --git a/test/elm/comparison/comparison-test.js b/test/elm/comparison/comparison-test.ts similarity index 99% rename from test/elm/comparison/comparison-test.js rename to test/elm/comparison/comparison-test.ts index e9d6f5040..6b5d2dcd2 100644 --- a/test/elm/comparison/comparison-test.js +++ b/test/elm/comparison/comparison-test.ts @@ -1,5 +1,5 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); // TODO: Comparisons for Dates @@ -385,6 +385,7 @@ describe('Equivalent', () => { this.emptyTuples.exec(this.ctx).should.be.true(); }); + // eslint-disable-next-line @typescript-eslint/no-empty-function it.skip('should return false if Tuples are not of the same type', function () {}); // Note: There is currently no way to tell the type of Tuples as they are all treated as Objects diff --git a/test/elm/conditional/conditional-test.js b/test/elm/conditional/conditional-test.ts similarity index 92% rename from test/elm/conditional/conditional-test.js rename to test/elm/conditional/conditional-test.ts index 3c3ee194e..9a3471355 100644 --- a/test/elm/conditional/conditional-test.js +++ b/test/elm/conditional/conditional-test.ts @@ -1,4 +1,4 @@ -const setup = require('../../setup'); +import setup from '../../setup'; const data = require('./data'); describe('If', () => { @@ -26,7 +26,7 @@ describe('Case', () => { { x: 2, y: 1, message: 'X > Y' }, { x: 1, y: 1, message: 'X == Y' } ]; - for (let item of vals) { + for (const item of vals) { this.ctx.withParameters({ X: item.x, Y: item.y }); this.standard.exec(this.ctx).should.equal(item.message); } @@ -38,7 +38,7 @@ describe('Case', () => { { var: 2, message: 'two' }, { var: 3, message: '?' } ]; - for (let item of vals) { + for (const item of vals) { this.ctx.withParameters({ var: item.var }); this.selected.exec(this.ctx).should.equal(item.message); } diff --git a/test/elm/convert/convert-test.js b/test/elm/convert/convert-test.ts similarity index 96% rename from test/elm/convert/convert-test.js rename to test/elm/convert/convert-test.ts index c00b712a0..bc5910c7b 100644 --- a/test/elm/convert/convert-test.js +++ b/test/elm/convert/convert-test.ts @@ -1,10 +1,10 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); -const { isNull } = require('../../../src/util/util'); -const { DateTime } = require('../../../src/datatypes/datetime'); -const { Quantity } = require('../../../src/datatypes/quantity'); -const { Uncertainty } = require('../../../src/datatypes/uncertainty'); +import { isNull } from '../../../src/util/util'; +import { DateTime } from '../../../src/datatypes/datetime'; +import { Quantity } from '../../../src/datatypes/quantity'; +import { Uncertainty } from '../../../src/datatypes/uncertainty'; describe('FromString', () => { beforeEach(function () { @@ -223,8 +223,8 @@ describe('FromDate', () => { }); it('should convert @2015-01 to DateTime with null for day and time components', function () { - let field; - let dateTime = this.dateYMToDateTime.exec(this.ctx); + let field: string; + const dateTime = this.dateYMToDateTime.exec(this.ctx); dateTime.year.should.equal(2015); dateTime.month.should.equal(1); should.not.exist(dateTime.day); @@ -233,9 +233,11 @@ describe('FromDate', () => { } dateTime.timezoneOffset.should.equal(this.ctx.getTimezoneOffset()); dateTime.isDateTime.should.equal.true; + }); - it('should convert @2015-01 to DateTime with null for day, month, and time components', function () {}); - dateTime = this.dateYToDateTime.exec(this.ctx); + it('should convert @2015-01 to DateTime with null for day, month, and time components', function () { + let field: string; + const dateTime = this.dateYToDateTime.exec(this.ctx); dateTime.year.should.equal(2015); should.not.exist(dateTime.month); should.not.exist(dateTime.day); @@ -251,7 +253,7 @@ describe('FromDate', () => { date.year.should.equal(2015); date.month.should.equal(1); date.day.should.equal(1); - for (let field of ['hour', 'minute', 'second', 'millisecond', 'timezoneOffset']) { + for (const field of ['hour', 'minute', 'second', 'millisecond', 'timezoneOffset']) { should.not.exist(date[field]); } date.isDate.should.equal.true; @@ -542,7 +544,7 @@ describe('ToDate', () => { date.year.should.equal(2015); date.month.should.equal(1); date.day.should.equal(2); - for (let field of ['hour', 'minute', 'second', 'millisecond', 'timezoneOffset']) { + for (const field of ['hour', 'minute', 'second', 'millisecond', 'timezoneOffset']) { should.not.exist(date[field]); } date.isDate.should.equal.true; @@ -553,7 +555,7 @@ describe('ToDate', () => { date.year.should.equal(2000); date.month.should.equal(3); date.day.should.equal(15); - for (let field of ['hour', 'minute', 'second', 'millisecond', 'timezoneOffset']) { + for (const field of ['hour', 'minute', 'second', 'millisecond', 'timezoneOffset']) { should.not.exist(date[field]); } date.isDate.should.equal.true; diff --git a/test/elm/date/date-test.js b/test/elm/date/date-test.ts similarity index 98% rename from test/elm/date/date-test.js rename to test/elm/date/date-test.ts index 29641fb3f..1a7eef0f4 100644 --- a/test/elm/date/date-test.js +++ b/test/elm/date/date-test.ts @@ -1,7 +1,7 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); -const { Uncertainty } = require('../../../src/datatypes/uncertainty'); +import { Uncertainty } from '../../../src/datatypes/uncertainty'; describe('Date', () => { beforeEach(function () { @@ -429,7 +429,7 @@ describe('DateMath', () => { }); }); -function dateCheck(date, year, month, day) { +function dateCheck(date: any, year: number, month: number, day: number) { date.year.should.equal(year); date.month.should.equal(month); date.day.should.equal(day); diff --git a/test/elm/datetime/datetime-test.js b/test/elm/datetime/datetime-test.ts similarity index 99% rename from test/elm/datetime/datetime-test.js rename to test/elm/datetime/datetime-test.ts index 7c42b27a0..c31f62150 100644 --- a/test/elm/datetime/datetime-test.js +++ b/test/elm/datetime/datetime-test.ts @@ -1,9 +1,9 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); -const DT = require('../../../src/datatypes/datatypes'); -const { PatientContext } = require('../../../src/cql'); -const { Uncertainty } = require('../../../src/datatypes/uncertainty'); +import * as DT from '../../../src/datatypes/datatypes'; +import { PatientContext } from '../../../src/cql'; +import { Uncertainty } from '../../../src/datatypes/uncertainty'; describe('DateTime', () => { beforeEach(function () { @@ -1115,7 +1115,16 @@ describe('DateMath', () => { }); }); -function dateCheck(date, year, month, day, hour, minute, second, millisecond) { +function dateCheck( + date: any, + year: number, + month: number, + day: number, + hour: number, + minute: number, + second: number, + millisecond: number +) { date.year.should.equal(year); date.month.should.equal(month); date.day.should.equal(day); diff --git a/test/elm/executor/executor-test.js b/test/elm/executor/executor-test.ts similarity index 92% rename from test/elm/executor/executor-test.js rename to test/elm/executor/executor-test.ts index f8efcbf22..1410d3743 100644 --- a/test/elm/executor/executor-test.js +++ b/test/elm/executor/executor-test.ts @@ -1,8 +1,8 @@ -const setup = require('../../setup'); +import setup from '../../setup'; const data = require('./data'); const { p1, p2 } = require('./patients'); -const { Patient } = require('../../../src/cql-patient'); +import { Patient } from '../../../src/cql-patient'; describe('Age', () => { beforeEach(function () { diff --git a/test/elm/external/external-test.js b/test/elm/external/external-test.ts similarity index 97% rename from test/elm/external/external-test.js rename to test/elm/external/external-test.ts index 91d826d87..08fb15343 100644 --- a/test/elm/external/external-test.js +++ b/test/elm/external/external-test.ts @@ -1,8 +1,8 @@ -const setup = require('../../setup'); +import setup from '../../setup'; const data = require('./data'); const vsets = require('./valuesets'); const { p1 } = require('./patients'); -const { Repository } = require('../../../src/cql'); +import { Repository } from '../../../src/cql'; describe('Retrieve', () => { beforeEach(function () { diff --git a/test/elm/instance/instance-test.js b/test/elm/instance/instance-test.ts similarity index 88% rename from test/elm/instance/instance-test.js rename to test/elm/instance/instance-test.ts index d29d1af4c..94d1cbf6b 100644 --- a/test/elm/instance/instance-test.js +++ b/test/elm/instance/instance-test.ts @@ -1,7 +1,7 @@ -const setup = require('../../setup'); +import setup from '../../setup'; const data = require('./data'); -const { Code, Concept } = require('../../../src/datatypes/clinical'); -const { Quantity } = require('../../../src/datatypes/quantity'); +import { Code, Concept } from '../../../src/datatypes/clinical'; +import { Quantity } from '../../../src/datatypes/quantity'; describe('Instance', () => { beforeEach(function () { diff --git a/test/elm/interval/interval-test.js b/test/elm/interval/interval-test.ts similarity index 99% rename from test/elm/interval/interval-test.js rename to test/elm/interval/interval-test.ts index dcc8bf7b4..abd147ba7 100644 --- a/test/elm/interval/interval-test.js +++ b/test/elm/interval/interval-test.ts @@ -1,9 +1,9 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); -const { Interval } = require('../../../src/datatypes/interval'); -const { DateTime } = require('../../../src/datatypes/datetime'); -const { +import { Interval } from '../../../src/datatypes/interval'; +import { DateTime } from '../../../src/datatypes/datetime'; +import { MIN_INT_VALUE, MAX_INT_VALUE, MIN_FLOAT_VALUE, @@ -11,7 +11,7 @@ const { MAX_FLOAT_VALUE, MIN_DATETIME_VALUE, MAX_DATETIME_VALUE -} = require('../../../src/util/math'); +} from '../../../src/util/math'; describe('Interval', () => { beforeEach(function () { @@ -2145,7 +2145,7 @@ describe('Collapse', () => { }); }); -const prettyList = function (array) { +const prettyList = function (array: any) { if (array == null) { return array; } diff --git a/test/elm/library/library-test.js b/test/elm/library/library-test.ts similarity index 97% rename from test/elm/library/library-test.js rename to test/elm/library/library-test.ts index a96b7c4dc..68ee4a492 100644 --- a/test/elm/library/library-test.js +++ b/test/elm/library/library-test.ts @@ -1,9 +1,9 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); const dataWithNamespace = require('./data-with-namespace'); -const { equivalent } = require('../../../src/util/comparison'); -const { Repository, Code } = require('../../../src/cql'); +import { equivalent } from '../../../src/util/comparison'; +import { Repository, Code } from '../../../src/cql'; const { p1, p2 } = require('./patients'); @@ -29,7 +29,7 @@ describe('Using CommonLib', () => { }); it('should include codesystems from CommonLib', function () { - let codesystems = this.lib.codesystems; + const codesystems = this.lib.codesystems; codesystems.should.not.be.empty(); }); diff --git a/test/elm/list/list-test.js b/test/elm/list/list-test.ts similarity index 99% rename from test/elm/list/list-test.js rename to test/elm/list/list-test.ts index 71eca1877..c3ce24ee5 100644 --- a/test/elm/list/list-test.js +++ b/test/elm/list/list-test.ts @@ -1,5 +1,5 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); describe('List', () => { diff --git a/test/elm/literal/literal-test.js b/test/elm/literal/literal-test.ts similarity index 97% rename from test/elm/literal/literal-test.js rename to test/elm/literal/literal-test.ts index 487ce111d..3f27f6e73 100644 --- a/test/elm/literal/literal-test.js +++ b/test/elm/literal/literal-test.ts @@ -1,5 +1,5 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); describe('Literal', () => { diff --git a/test/elm/logical/logical-test.js b/test/elm/logical/logical-test.ts similarity index 97% rename from test/elm/logical/logical-test.js rename to test/elm/logical/logical-test.ts index 76ec3f12b..d5cdbe1d6 100644 --- a/test/elm/logical/logical-test.js +++ b/test/elm/logical/logical-test.ts @@ -1,5 +1,5 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); describe('And', () => { diff --git a/test/elm/message/message-test.js b/test/elm/message/message-test.ts similarity index 85% rename from test/elm/message/message-test.js rename to test/elm/message/message-test.ts index da9d387c9..9c081dbcd 100644 --- a/test/elm/message/message-test.js +++ b/test/elm/message/message-test.ts @@ -1,9 +1,9 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); describe('Message', () => { - let messageCollector; + let messageCollector: any; beforeEach(function () { setup(this, data); messageCollector = new TestMessageCollector(); @@ -29,11 +29,13 @@ describe('Message', () => { }); class TestMessageCollector { + messages: any[]; + constructor() { this.messages = []; } - onMessage(source, code, severity, message) { + onMessage(source: any, code: string, severity: string, message: string) { this.messages.push(`${severity}: [${code}] ${message} (${JSON.stringify(source)})`); } } diff --git a/test/elm/nullological/nullological-test.js b/test/elm/nullological/nullological-test.ts similarity index 96% rename from test/elm/nullological/nullological-test.js rename to test/elm/nullological/nullological-test.ts index 34bb6a152..d0e2d4090 100644 --- a/test/elm/nullological/nullological-test.js +++ b/test/elm/nullological/nullological-test.ts @@ -1,5 +1,5 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); describe('Nil', () => { diff --git a/test/elm/parameters/parameters-test.js b/test/elm/parameters/parameters-test.ts similarity index 98% rename from test/elm/parameters/parameters-test.js rename to test/elm/parameters/parameters-test.ts index 7251fe44b..a7d11ba8d 100644 --- a/test/elm/parameters/parameters-test.js +++ b/test/elm/parameters/parameters-test.ts @@ -1,10 +1,10 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); -const { Code, Concept } = require('../../../src/datatypes/clinical'); -const { DateTime, Date } = require('../../../src/datatypes/datetime'); -const { Interval } = require('../../../src/datatypes/interval'); -const { Quantity } = require('../../../src/datatypes/quantity'); +import { Code, Concept } from '../../../src/datatypes/clinical'; +import { DateTime, Date } from '../../../src/datatypes/datetime'; +import { Interval } from '../../../src/datatypes/interval'; +import { Quantity } from '../../../src/datatypes/quantity'; describe('ParameterDef', () => { beforeEach(function () { diff --git a/test/elm/quantity/quantity-test.js b/test/elm/quantity/quantity-test.ts similarity index 98% rename from test/elm/quantity/quantity-test.js rename to test/elm/quantity/quantity-test.ts index e892cb5bb..c762a23ee 100644 --- a/test/elm/quantity/quantity-test.js +++ b/test/elm/quantity/quantity-test.ts @@ -1,11 +1,11 @@ -const should = require('should'); -const { +import should from 'should'; +import { Quantity, doAddition, doSubtraction, doMultiplication, doDivision -} = require('../../../src/datatypes/quantity'); +} from '../../../src/datatypes/quantity'; describe('Quantity', () => { it('should allow creation of Quantity with valid ucum units', () => @@ -129,7 +129,7 @@ describe('Quantity', () => { }); const types = [null, undefined, '']; - for (let unit of types) { + for (const unit of types) { (unit => { it('should treat ' + unit + ' the same as a "1" in calculations', () => { const divideWithOneOnRight = new Quantity(8, 'm').dividedBy(new Quantity(2, '1')); diff --git a/test/elm/query/query-test.js b/test/elm/query/query-test.ts similarity index 97% rename from test/elm/query/query-test.js rename to test/elm/query/query-test.ts index 4dfbe5fca..6e9e8c88d 100644 --- a/test/elm/query/query-test.js +++ b/test/elm/query/query-test.ts @@ -1,11 +1,11 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); const vsets = require('./valuesets'); const { p1 } = require('./patients'); -const { Interval } = require('../../../src/datatypes/interval'); -const { DateTime } = require('../../../src/datatypes/datetime'); -const { Quantity } = require('../../../src/datatypes/quantity'); +import { Interval } from '../../../src/datatypes/interval'; +import { DateTime } from '../../../src/datatypes/datetime'; +import { Quantity } from '../../../src/datatypes/quantity'; describe('DateRangeOptimizedQuery', () => { beforeEach(function () { @@ -303,7 +303,7 @@ describe('SingleObjectAlias', () => { const conditions = this.conditions.exec(this.ctx); const firstEncounter = this.firstEncounter.exec(this.ctx); const firstCondition = this.firstCondition.exec(this.ctx); - const expt = conditions.map(con => ({ Con: con, E: firstEncounter, C: firstCondition })); + const expt = conditions.map((con: any) => ({ Con: con, E: firstEncounter, C: firstCondition })); const q = this.singleAliasesAndList.exec(this.ctx); q.should.have.length(conditions.length); q.should.eql(expt); diff --git a/test/elm/ratio/ratio-test.js b/test/elm/ratio/ratio-test.ts similarity index 96% rename from test/elm/ratio/ratio-test.js rename to test/elm/ratio/ratio-test.ts index 445e76399..344b9a721 100644 --- a/test/elm/ratio/ratio-test.js +++ b/test/elm/ratio/ratio-test.ts @@ -1,6 +1,6 @@ -const should = require('should'); -const { Quantity } = require('../../../src/datatypes/quantity'); -const { Ratio } = require('../../../src/datatypes/ratio'); +import should from 'should'; +import { Quantity } from '../../../src/datatypes/quantity'; +import { Ratio } from '../../../src/datatypes/ratio'; describe('Ratio', () => { it('should allow creation of Ratio with two valid quantities with units', () => @@ -33,7 +33,7 @@ describe('Ratio', () => { it('should throw error when creating ratio with null denominator', () => should.throws(() => { - const numerator = null; + const numerator: any = null; const denominator = new Quantity(33.3333, 'mm'); new Ratio(numerator, denominator); })); @@ -41,7 +41,7 @@ describe('Ratio', () => { it('should throw error when creating ratio with null numerator', () => should.throws(() => { const numerator = new Quantity(42.424242, 'mm'); - const denominator = null; + const denominator: any = null; new Ratio(numerator, denominator); })); diff --git a/test/elm/reusable/reusable-test.js b/test/elm/reusable/reusable-test.ts similarity index 98% rename from test/elm/reusable/reusable-test.js rename to test/elm/reusable/reusable-test.ts index 53e5175a1..45f5ec882 100644 --- a/test/elm/reusable/reusable-test.js +++ b/test/elm/reusable/reusable-test.ts @@ -1,4 +1,4 @@ -const setup = require('../../setup'); +import setup from '../../setup'; const data = require('./data'); const { p1 } = require('./patients'); diff --git a/test/elm/string/string-test.js b/test/elm/string/string-test.ts similarity index 98% rename from test/elm/string/string-test.js rename to test/elm/string/string-test.ts index 44c611d37..989d15404 100644 --- a/test/elm/string/string-test.js +++ b/test/elm/string/string-test.ts @@ -1,7 +1,8 @@ -const should = require('should'); -const setup = require('../../setup'); +import should from 'should'; +import setup from '../../setup'; const data = require('./data'); -const str = require('../../../src/elm/string'); +import * as str from '../../../src/elm/string'; +import * as overloaded from '../../../src/elm/overloaded'; describe('Concat', () => { beforeEach(function () { @@ -177,7 +178,7 @@ describe('Length', () => { }); it.skip('should be a Length', function () { - this.elevenLetters.should.be.an.instanceOf(str.Length); + this.elevenLetters.should.be.an.instanceOf(overloaded.Length); }); it('should count letters in string', function () { diff --git a/test/elm/structured/structured-test.js b/test/elm/structured/structured-test.ts similarity index 89% rename from test/elm/structured/structured-test.js rename to test/elm/structured/structured-test.ts index 26791e89e..30e5b9a48 100644 --- a/test/elm/structured/structured-test.js +++ b/test/elm/structured/structured-test.ts @@ -1,5 +1,6 @@ -const setup = require('../../setup'); +import setup from '../../setup'; const data = require('./data'); +import 'should'; describe('Tuple', () => { beforeEach(function () { diff --git a/test/elm/type/type-test.js b/test/elm/type/type-test.ts similarity index 99% rename from test/elm/type/type-test.js rename to test/elm/type/type-test.ts index 3094a2bc4..1b1a70d0c 100644 --- a/test/elm/type/type-test.js +++ b/test/elm/type/type-test.ts @@ -1,6 +1,6 @@ -const should = require('should'); -const { Interval } = require('../../../src/datatypes/interval'); -const setup = require('../../setup'); +import should from 'should'; +import { Interval } from '../../../src/datatypes/interval'; +import setup from '../../setup'; const data = require('./data'); const { p1 } = require('./patients'); diff --git a/test/runtime/messageListeners-test.js b/test/runtime/messageListeners-test.ts similarity index 91% rename from test/runtime/messageListeners-test.js rename to test/runtime/messageListeners-test.ts index 4b58d470d..0e3445c65 100644 --- a/test/runtime/messageListeners-test.js +++ b/test/runtime/messageListeners-test.ts @@ -1,13 +1,9 @@ -const { - NullMessageListener, - ConsoleMessageListener -} = require('../../src/runtime/messageListeners'); -const stdout = require('test-console').stdout; -const stderr = require('test-console').stderr; -const EOL = require('os').EOL; +import { NullMessageListener, ConsoleMessageListener } from '../../src/runtime/messageListeners'; +import { stdout, stderr, Inspector } from 'test-console'; +import { EOL } from 'os'; describe('ConsoleMessageListener', () => { - let stdoutInspect, stderrInspect; + let stdoutInspect: Inspector, stderrInspect: Inspector; beforeEach(() => { stdoutInspect = stdout.inspect(); @@ -58,7 +54,7 @@ describe('ConsoleMessageListener', () => { }); describe('NullMessageListener', () => { - let stdoutInspect, stderrInspect; + let stdoutInspect: Inspector, stderrInspect: Inspector; beforeEach(() => { stdoutInspect = stdout.inspect(); diff --git a/test/runtime/repository.test.js b/test/runtime/repository-test.ts similarity index 81% rename from test/runtime/repository.test.js rename to test/runtime/repository-test.ts index 4507c4f5a..c19d22cab 100644 --- a/test/runtime/repository.test.js +++ b/test/runtime/repository-test.ts @@ -1,11 +1,12 @@ -const should = require('should'); -const { Repository } = require('../../src/runtime/repository'); +import should from 'should'; +import { Library } from '../../src/elm/library'; +import { Repository } from '../../src/runtime/repository'; const simpleELMWithVersion = require('./fixtures/SimpleLibraryWithVersion.json'); const simpleELMIdentifier = simpleELMWithVersion.library.identifier; describe('Repository', () => { - let simpleELMJson; + let simpleELMJson: any; beforeEach(() => { // Deep clone ELM JSON to modify properties simpleELMJson = JSON.parse(JSON.stringify(simpleELMWithVersion)); @@ -13,7 +14,10 @@ describe('Repository', () => { it('should resolve with proper id and version', () => { const repository = new Repository([simpleELMJson]); - const mainLib = repository.resolve(simpleELMIdentifier.id, simpleELMIdentifier.version); + const mainLib = repository.resolve( + simpleELMIdentifier.id, + simpleELMIdentifier.version + ) as Library; mainLib.should.not.be.undefined(); mainLib.source.library.identifier.id.should.equal(simpleELMIdentifier.id); @@ -24,7 +28,7 @@ describe('Repository', () => { delete simpleELMJson.library.identifier.version; const repository = new Repository([simpleELMJson]); - const mainLib = repository.resolve(simpleELMIdentifier.id); + const mainLib = repository.resolve(simpleELMIdentifier.id) as Library; mainLib.should.not.be.undefined(); mainLib.source.library.identifier.id.should.equal(simpleELMIdentifier.id); diff --git a/test/setup.js b/test/setup.ts similarity index 66% rename from test/setup.js rename to test/setup.ts index e04eee83a..3f2787cf7 100644 --- a/test/setup.js +++ b/test/setup.ts @@ -1,37 +1,38 @@ -const { +import { Library, PatientSource, CodeService, PatientContext, Executor, - NullMessageListener -} = require('../src/cql'); + NullMessageListener, + Parameter +} from '../src/cql'; -module.exports = function ( - test, - data, - patients = [], - valuesets = {}, - parameters = {}, - repository = null +export default function ( + test: any, + data: any, + patients: any[] = [], + valuesets: any = {}, + parameters: Parameter = {}, + repository: any = null ) { try { test.lib = new Library(data[test.test.parent.title], repository); const cservice = new CodeService(valuesets); const psource = new PatientSource(patients); - test.ctx = new PatientContext(test.lib, psource.currentPatient(), cservice, parameters); + test.ctx = new PatientContext(test.lib, psource.currentPatient() || null, cservice, parameters); test.executor = new Executor(test.lib, cservice, parameters, new NullMessageListener()); test.patientSource = psource; - for (let k in test.lib.valuesets) { + for (const k in test.lib.valuesets) { const v = test.lib.valuesets[k]; test[k[0].toLowerCase() + k.slice(1)] = v; } - for (let k in test.lib.expressions) { + for (const k in test.lib.expressions) { const v = test.lib.expressions[k]; test[k[0].toLowerCase() + k.slice(1)] = v.expression; } - } catch (e) { + } catch (e: any) { e.message = '[' + test.test.parent.title + '] ' + e.message; throw e; } -}; +} diff --git a/test/spec-tests/spec-test.js b/test/spec-tests/spec-test.ts similarity index 83% rename from test/spec-tests/spec-test.js rename to test/spec-tests/spec-test.ts index 0a17b8ec7..80ac09658 100644 --- a/test/spec-tests/spec-test.js +++ b/test/spec-tests/spec-test.ts @@ -1,18 +1,20 @@ -const fs = require('fs'); -const path = require('path'); -const should = require('should'); -const { PatientContext } = require('../../src/runtime/context'); -require('../../src/elm/expressions'); // Needed for side-effect -const { build } = require('../../src/elm/builder'); -const { Library } = require('../../src/elm/library'); -const { Uncertainty } = require('../../src/datatypes/uncertainty'); +import fs from 'fs'; +import path from 'path'; +import should from 'should'; +import { PatientContext } from '../../src/runtime/context'; +import '../../src/elm/expressions'; // Needed for side-effect +import { build } from '../../src/elm/builder'; +import { Library } from '../../src/elm/library'; +import { Uncertainty } from '../../src/datatypes/uncertainty'; describe('CQL Spec Tests (from XML)', () => { fs.readdirSync(path.join(__dirname, 'cql')).forEach(f => { if (!f.endsWith('.json')) { return; } - const elm = require(path.join(__dirname, 'cql', f)); + const p = path.join(__dirname, 'cql', f); + const elm = JSON.parse(fs.readFileSync(p, 'utf8')); + if ( elm.library == null || elm.library.identifier == null || @@ -26,7 +28,7 @@ describe('CQL Spec Tests (from XML)', () => { const library = new Library(elm); // describe the high-level module being tested describe(elm.library.identifier.id, () => { - elm.library.statements.def.forEach(suite => { + elm.library.statements.def.forEach((suite: any) => { // Skip the Patient definition that is automatically inserted by CQL to ELM if ( suite.name === 'Patient' && @@ -40,7 +42,7 @@ describe('CQL Spec Tests (from XML)', () => { if (suite.expression.type !== 'Tuple') { should.fail(suite.expression.type, 'Tuple', `Invalid test suite: ${suite.name}`); } - suite.expression.element.forEach(t => { + suite.expression.element.forEach((t: any) => { it(`should properly evaluate ${t.name}`, function () { const testCaseMap = convertTupleToMap(t.value); if (testCaseMap.has('skipped')) { @@ -92,13 +94,13 @@ describe('CQL Spec Tests (from XML)', () => { }); }); - function convertTupleToMap(t) { + function convertTupleToMap(t: any) { const map = new Map(); - t.element.forEach(e => map.set(e.name, e.value)); + t.element.forEach((e: any) => map.set(e.name, e.value)); return map; } - function roundDecimalsWhenApplicable(item) { + function roundDecimalsWhenApplicable(item: any) { if (typeof item === 'number') { // Round to 8 places since that's the number of places used by expected outputs item = Math.round(item * 100000000) / 100000000; diff --git a/test/util/comparison-test.js b/test/util/comparison-test.ts similarity index 94% rename from test/util/comparison-test.js rename to test/util/comparison-test.ts index 2f094941d..efd5f7907 100644 --- a/test/util/comparison-test.js +++ b/test/util/comparison-test.ts @@ -1,6 +1,6 @@ -const should = require('should'); -const { equals, equivalent } = require('../../src/util/comparison'); -const { Code, Concept } = require('../../src/datatypes/clinical'); +import should from 'should'; +import { equals, equivalent } from '../../src/util/comparison'; +import { Code, Concept } from '../../src/datatypes/clinical'; describe('equals', () => { it('should detect equality/inequality for numbers', () => { @@ -72,14 +72,17 @@ describe('equals', () => { it('should detect equality/inequality for classes', () => { class Foo { - constructor(prop1, prop2) { + prop1: any; + prop2: any; + + constructor(prop1: any, prop2: any) { this.prop1 = prop1; this.prop2 = prop2; } } class Bar extends Foo { - constructor(prop1, prop2) { + constructor(prop1: any, prop2?: any) { super(prop1, prop2); } } @@ -98,7 +101,10 @@ describe('equals', () => { it('should consider an instance equal to itself even if it has null values', () => { class Foo { - constructor(prop1, prop2) { + prop1: any; + prop2: any; + + constructor(prop1: any, prop2: any) { this.prop1 = prop1; this.prop2 = prop2; } @@ -110,13 +116,15 @@ describe('equals', () => { it('should delegate to equals method when available', () => { class Int { - constructor(num) { + num: any; + + constructor(num: any) { this.num = num; } } class StringFriendlyInt extends Int { - constructor(num) { + constructor(num: any) { super(num); } @@ -131,7 +139,7 @@ describe('equals', () => { } } - equals(other) { + equals(other: any) { return other instanceof StringFriendlyInt && this.asInt() === other.asInt(); } } @@ -180,8 +188,8 @@ describe('equals', () => { should.not.exist(equals({}, null)); should.not.exist(equals(null, [null])); should.not.exist(equals([null], null)); - should.not.exist(equals(null, {}.undef)); - should.not.exist(equals({}.undef, null)); + should.not.exist(equals(null, ({} as any).undef)); + should.not.exist(equals(({} as any).undef, null)); }); }); diff --git a/test/util/units-test.js b/test/util/units-test.ts similarity index 99% rename from test/util/units-test.js rename to test/util/units-test.ts index 9d01956aa..626a0d59e 100644 --- a/test/util/units-test.js +++ b/test/util/units-test.ts @@ -1,5 +1,5 @@ -const should = require('should'); -const { +import should from 'should'; +import { checkUnit, convertUnit, normalizeUnitsWhenPossible, @@ -7,7 +7,7 @@ const { compareUnits, getProductOfUnits, getQuotientOfUnits -} = require('../../src/util/units'); +} from '../../src/util/units'; describe('checkUnit', () => { it('should validate proper simple units', () => { diff --git a/test/util/util-test.js b/test/util/util-test.ts similarity index 92% rename from test/util/util-test.js rename to test/util/util-test.ts index 7f0748efd..320753507 100644 --- a/test/util/util-test.js +++ b/test/util/util-test.ts @@ -1,4 +1,4 @@ -const { typeIsArray } = require('../../src/util/util'); +import { typeIsArray } from '../../src/util/util'; describe('typeIsArray', () => { it('should properly identify arrays', () => { diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..23919d773 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "include": ["src"], + "compilerOptions": { + "target": "es5", + "lib": ["es2015.core", "ESNext"], + "outDir": "./lib", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "sourceMap": true, + } +} diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 000000000..dbbbc26a2 --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig", + "include": ["src", "test"], + "compilerOptions": { + "strictNullChecks": false + } +} diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 263cda0f2..000000000 --- a/yarn.lock +++ /dev/null @@ -1,4364 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/cli@^7.15.7": - version "7.15.7" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.15.7.tgz#62658abedb786d09c1f70229224b11a65440d7a1" - integrity sha512-YW5wOprO2LzMjoWZ5ZG6jfbY9JnkDxuHDwvnrThnuYtByorova/I0HNXJedrUfwuXFQfYOjcqDA4PU3qlZGZjg== - dependencies: - commander "^4.0.1" - convert-source-map "^1.1.0" - fs-readdir-recursive "^1.1.0" - glob "^7.0.0" - make-dir "^2.1.0" - slash "^2.0.0" - source-map "^0.5.0" - optionalDependencies: - "@nicolo-ribaudo/chokidar-2" "2.1.8-no-fsevents.3" - chokidar "^3.4.0" - -"@babel/code-frame@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.13.tgz#dcfc826beef65e75c50e21d3837d7d95798dd658" - integrity sha512-HV1Cm0Q3ZrpCR93tkWOYiuYIgLxZXZFVG2VgK+MBWjUqZTundupbfx2aXarXuw5Ko5aMcjtJgbSs4vUGBS5v6g== - dependencies: - "@babel/highlight" "^7.12.13" - -"@babel/code-frame@^7.14.5", "@babel/code-frame@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.15.8.tgz#45990c47adadb00c03677baa89221f7cc23d2503" - integrity sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg== - dependencies: - "@babel/highlight" "^7.14.5" - -"@babel/compat-data@^7.13.11", "@babel/compat-data@^7.15.0": - version "7.15.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.15.0.tgz#2dbaf8b85334796cafbb0f5793a90a2fc010b176" - integrity sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA== - -"@babel/compat-data@^7.13.12": - version "7.13.12" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.13.12.tgz#a8a5ccac19c200f9dd49624cac6e19d7be1236a1" - integrity sha512-3eJJ841uKxeV8dcN/2yGEUy+RfgQspPEgQat85umsE1rotuquQ2AbIub4S6j7c50a2d+4myc+zSlnXeIHrOnhQ== - -"@babel/core@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.15.8.tgz#195b9f2bffe995d2c6c159e72fe525b4114e8c10" - integrity sha512-3UG9dsxvYBMYwRv+gS41WKHno4K60/9GPy1CJaH6xy3Elq8CTtvtjT5R5jmNhXfCYLX2mTw+7/aq5ak/gOE0og== - dependencies: - "@babel/code-frame" "^7.15.8" - "@babel/generator" "^7.15.8" - "@babel/helper-compilation-targets" "^7.15.4" - "@babel/helper-module-transforms" "^7.15.8" - "@babel/helpers" "^7.15.4" - "@babel/parser" "^7.15.8" - "@babel/template" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.6" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.1.2" - semver "^6.3.0" - source-map "^0.5.0" - -"@babel/core@^7.7.5": - version "7.13.14" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.13.14.tgz#8e46ebbaca460a63497c797e574038ab04ae6d06" - integrity sha512-wZso/vyF4ki0l0znlgM4inxbdrUvCb+cVz8grxDq+6C9k6qbqoIJteQOKicaKjCipU3ISV+XedCqpL2RJJVehA== - dependencies: - "@babel/code-frame" "^7.12.13" - "@babel/generator" "^7.13.9" - "@babel/helper-compilation-targets" "^7.13.13" - "@babel/helper-module-transforms" "^7.13.14" - "@babel/helpers" "^7.13.10" - "@babel/parser" "^7.13.13" - "@babel/template" "^7.12.13" - "@babel/traverse" "^7.13.13" - "@babel/types" "^7.13.14" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.1.2" - semver "^6.3.0" - source-map "^0.5.0" - -"@babel/generator@^7.13.9": - version "7.13.9" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.13.9.tgz#3a7aa96f9efb8e2be42d38d80e2ceb4c64d8de39" - integrity sha512-mHOOmY0Axl/JCTkxTU6Lf5sWOg/v8nUa+Xkt4zMTftX0wqmb6Sh7J8gvcehBw7q0AhrhAR+FDacKjCZ2X8K+Sw== - dependencies: - "@babel/types" "^7.13.0" - jsesc "^2.5.1" - source-map "^0.5.0" - -"@babel/generator@^7.15.4", "@babel/generator@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.15.8.tgz#fa56be6b596952ceb231048cf84ee499a19c0cd1" - integrity sha512-ECmAKstXbp1cvpTTZciZCgfOt6iN64lR0d+euv3UZisU5awfRawOvg07Utn/qBGuH4bRIEZKrA/4LzZyXhZr8g== - dependencies: - "@babel/types" "^7.15.6" - jsesc "^2.5.1" - source-map "^0.5.0" - -"@babel/helper-annotate-as-pure@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.13.tgz#0f58e86dfc4bb3b1fcd7db806570e177d439b6ab" - integrity sha512-7YXfX5wQ5aYM/BOlbSccHDbuXXFPxeoUmfWtz8le2yTkTZc+BxsiEnENFoi2SlmA8ewDkG2LgIMIVzzn2h8kfw== - dependencies: - "@babel/types" "^7.12.13" - -"@babel/helper-annotate-as-pure@^7.14.5", "@babel/helper-annotate-as-pure@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.15.4.tgz#3d0e43b00c5e49fdb6c57e421601a7a658d5f835" - integrity sha512-QwrtdNvUNsPCj2lfNQacsGSQvGX8ee1ttrBrcozUP2Sv/jylewBP/8QFe6ZkBsC8T/GYWonNAWJV4aRR9AL2DA== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-builder-binary-assignment-operator-visitor@^7.14.5": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.15.4.tgz#21ad815f609b84ee0e3058676c33cf6d1670525f" - integrity sha512-P8o7JP2Mzi0SdC6eWr1zF+AEYvrsZa7GSY1lTayjF5XJhVH0kjLYUZPvTMflP7tBgZoe9gIhTa60QwFpqh/E0Q== - dependencies: - "@babel/helper-explode-assignable-expression" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/helper-compilation-targets@^7.13.0", "@babel/helper-compilation-targets@^7.13.13": - version "7.13.13" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.13.13.tgz#2b2972a0926474853f41e4adbc69338f520600e5" - integrity sha512-q1kcdHNZehBwD9jYPh3WyXcsFERi39X4I59I3NadciWtNDyZ6x+GboOxncFK0kXlKIv6BJm5acncehXWUjWQMQ== - dependencies: - "@babel/compat-data" "^7.13.12" - "@babel/helper-validator-option" "^7.12.17" - browserslist "^4.14.5" - semver "^6.3.0" - -"@babel/helper-compilation-targets@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz#cf6d94f30fbefc139123e27dd6b02f65aeedb7b9" - integrity sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ== - dependencies: - "@babel/compat-data" "^7.15.0" - "@babel/helper-validator-option" "^7.14.5" - browserslist "^4.16.6" - semver "^6.3.0" - -"@babel/helper-create-class-features-plugin@^7.14.5", "@babel/helper-create-class-features-plugin@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.15.4.tgz#7f977c17bd12a5fba363cb19bea090394bf37d2e" - integrity sha512-7ZmzFi+DwJx6A7mHRwbuucEYpyBwmh2Ca0RvI6z2+WLZYCqV0JOaLb+u0zbtmDicebgKBZgqbYfLaKNqSgv5Pw== - dependencies: - "@babel/helper-annotate-as-pure" "^7.15.4" - "@babel/helper-function-name" "^7.15.4" - "@babel/helper-member-expression-to-functions" "^7.15.4" - "@babel/helper-optimise-call-expression" "^7.15.4" - "@babel/helper-replace-supers" "^7.15.4" - "@babel/helper-split-export-declaration" "^7.15.4" - -"@babel/helper-create-regexp-features-plugin@^7.12.13": - version "7.12.17" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.12.17.tgz#a2ac87e9e319269ac655b8d4415e94d38d663cb7" - integrity sha512-p2VGmBu9oefLZ2nQpgnEnG0ZlRPvL8gAGvPUMQwUdaE8k49rOMuZpOwdQoy5qJf6K8jL3bcAMhVUlHAjIgJHUg== - dependencies: - "@babel/helper-annotate-as-pure" "^7.12.13" - regexpu-core "^4.7.1" - -"@babel/helper-create-regexp-features-plugin@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.14.5.tgz#c7d5ac5e9cf621c26057722fb7a8a4c5889358c4" - integrity sha512-TLawwqpOErY2HhWbGJ2nZT5wSkR192QpN+nBg1THfBfftrlvOh+WbhrxXCH4q4xJ9Gl16BGPR/48JA+Ryiho/A== - dependencies: - "@babel/helper-annotate-as-pure" "^7.14.5" - regexpu-core "^4.7.1" - -"@babel/helper-define-polyfill-provider@^0.2.2": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.2.3.tgz#0525edec5094653a282688d34d846e4c75e9c0b6" - integrity sha512-RH3QDAfRMzj7+0Nqu5oqgO5q9mFtQEVvCRsi8qCEfzLR9p2BHfn5FzhSB2oj1fF7I2+DcTORkYaQ6aTR9Cofew== - dependencies: - "@babel/helper-compilation-targets" "^7.13.0" - "@babel/helper-module-imports" "^7.12.13" - "@babel/helper-plugin-utils" "^7.13.0" - "@babel/traverse" "^7.13.0" - debug "^4.1.1" - lodash.debounce "^4.0.8" - resolve "^1.14.2" - semver "^6.1.2" - -"@babel/helper-explode-assignable-expression@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.15.4.tgz#f9aec9d219f271eaf92b9f561598ca6b2682600c" - integrity sha512-J14f/vq8+hdC2KoWLIQSsGrC9EFBKE4NFts8pfMpymfApds+fPqR30AOUWc4tyr56h9l/GA1Sxv2q3dLZWbQ/g== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-function-name@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz#93ad656db3c3c2232559fd7b2c3dbdcbe0eb377a" - integrity sha512-TZvmPn0UOqmvi5G4vvw0qZTpVptGkB1GL61R6lKvrSdIxGm5Pky7Q3fpKiIkQCAtRCBUwB0PaThlx9vebCDSwA== - dependencies: - "@babel/helper-get-function-arity" "^7.12.13" - "@babel/template" "^7.12.13" - "@babel/types" "^7.12.13" - -"@babel/helper-function-name@^7.14.5", "@babel/helper-function-name@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz#845744dafc4381a4a5fb6afa6c3d36f98a787ebc" - integrity sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw== - dependencies: - "@babel/helper-get-function-arity" "^7.15.4" - "@babel/template" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/helper-get-function-arity@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.12.13.tgz#bc63451d403a3b3082b97e1d8b3fe5bd4091e583" - integrity sha512-DjEVzQNz5LICkzN0REdpD5prGoidvbdYk1BVgRUOINaWJP2t6avB27X1guXK1kXNrX0WMfsrm1A/ZBthYuIMQg== - dependencies: - "@babel/types" "^7.12.13" - -"@babel/helper-get-function-arity@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz#098818934a137fce78b536a3e015864be1e2879b" - integrity sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-hoist-variables@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz#09993a3259c0e918f99d104261dfdfc033f178df" - integrity sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-member-expression-to-functions@^7.13.12": - version "7.13.12" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.13.12.tgz#dfe368f26d426a07299d8d6513821768216e6d72" - integrity sha512-48ql1CLL59aKbU94Y88Xgb2VFy7a95ykGRbJJaaVv+LX5U8wFpLfiGXJJGUozsmA1oEh/o5Bp60Voq7ACyA/Sw== - dependencies: - "@babel/types" "^7.13.12" - -"@babel/helper-member-expression-to-functions@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz#bfd34dc9bba9824a4658b0317ec2fd571a51e6ef" - integrity sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.13.12": - version "7.13.12" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.13.12.tgz#c6a369a6f3621cb25da014078684da9196b61977" - integrity sha512-4cVvR2/1B693IuOvSI20xqqa/+bl7lqAMR59R4iu39R9aOX8/JoYY1sFaNvUMyMBGnHdwvJgUrzNLoUZxXypxA== - dependencies: - "@babel/types" "^7.13.12" - -"@babel/helper-module-imports@^7.14.5", "@babel/helper-module-imports@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz#e18007d230632dea19b47853b984476e7b4e103f" - integrity sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-module-transforms@^7.13.14": - version "7.13.14" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.13.14.tgz#e600652ba48ccb1641775413cb32cfa4e8b495ef" - integrity sha512-QuU/OJ0iAOSIatyVZmfqB0lbkVP0kDRiKj34xy+QNsnVZi/PA6BoSoreeqnxxa9EHFAIL0R9XOaAR/G9WlIy5g== - dependencies: - "@babel/helper-module-imports" "^7.13.12" - "@babel/helper-replace-supers" "^7.13.12" - "@babel/helper-simple-access" "^7.13.12" - "@babel/helper-split-export-declaration" "^7.12.13" - "@babel/helper-validator-identifier" "^7.12.11" - "@babel/template" "^7.12.13" - "@babel/traverse" "^7.13.13" - "@babel/types" "^7.13.14" - -"@babel/helper-module-transforms@^7.14.5", "@babel/helper-module-transforms@^7.15.4", "@babel/helper-module-transforms@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.15.8.tgz#d8c0e75a87a52e374a8f25f855174786a09498b2" - integrity sha512-DfAfA6PfpG8t4S6npwzLvTUpp0sS7JrcuaMiy1Y5645laRJIp/LiLGIBbQKaXSInK8tiGNI7FL7L8UvB8gdUZg== - dependencies: - "@babel/helper-module-imports" "^7.15.4" - "@babel/helper-replace-supers" "^7.15.4" - "@babel/helper-simple-access" "^7.15.4" - "@babel/helper-split-export-declaration" "^7.15.4" - "@babel/helper-validator-identifier" "^7.15.7" - "@babel/template" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.6" - -"@babel/helper-optimise-call-expression@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.12.13.tgz#5c02d171b4c8615b1e7163f888c1c81c30a2aaea" - integrity sha512-BdWQhoVJkp6nVjB7nkFWcn43dkprYauqtk++Py2eaf/GRDFm5BxRqEIZCiHlZUGAVmtwKcsVL1dC68WmzeFmiA== - dependencies: - "@babel/types" "^7.12.13" - -"@babel/helper-optimise-call-expression@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz#f310a5121a3b9cc52d9ab19122bd729822dee171" - integrity sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": - version "7.13.0" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz#806526ce125aed03373bc416a828321e3a6a33af" - integrity sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ== - -"@babel/helper-plugin-utils@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz#5ac822ce97eec46741ab70a517971e443a70c5a9" - integrity sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ== - -"@babel/helper-remap-async-to-generator@^7.14.5", "@babel/helper-remap-async-to-generator@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.15.4.tgz#2637c0731e4c90fbf58ac58b50b2b5a192fc970f" - integrity sha512-v53MxgvMK/HCwckJ1bZrq6dNKlmwlyRNYM6ypaRTdXWGOE2c1/SCa6dL/HimhPulGhZKw9W0QhREM583F/t0vQ== - dependencies: - "@babel/helper-annotate-as-pure" "^7.15.4" - "@babel/helper-wrap-function" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/helper-replace-supers@^7.13.12": - version "7.13.12" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.13.12.tgz#6442f4c1ad912502481a564a7386de0c77ff3804" - integrity sha512-Gz1eiX+4yDO8mT+heB94aLVNCL+rbuT2xy4YfyNqu8F+OI6vMvJK891qGBTqL9Uc8wxEvRW92Id6G7sDen3fFw== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.13.12" - "@babel/helper-optimise-call-expression" "^7.12.13" - "@babel/traverse" "^7.13.0" - "@babel/types" "^7.13.12" - -"@babel/helper-replace-supers@^7.14.5", "@babel/helper-replace-supers@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz#52a8ab26ba918c7f6dee28628b07071ac7b7347a" - integrity sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.15.4" - "@babel/helper-optimise-call-expression" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/helper-simple-access@^7.13.12": - version "7.13.12" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.13.12.tgz#dd6c538afb61819d205a012c31792a39c7a5eaf6" - integrity sha512-7FEjbrx5SL9cWvXioDbnlYTppcZGuCY6ow3/D5vMggb2Ywgu4dMrpTJX0JdQAIcRRUElOIxF3yEooa9gUb9ZbA== - dependencies: - "@babel/types" "^7.13.12" - -"@babel/helper-simple-access@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz#ac368905abf1de8e9781434b635d8f8674bcc13b" - integrity sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-skip-transparent-expression-wrappers@^7.14.5", "@babel/helper-skip-transparent-expression-wrappers@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.15.4.tgz#707dbdba1f4ad0fa34f9114fc8197aec7d5da2eb" - integrity sha512-BMRLsdh+D1/aap19TycS4eD1qELGrCBJwzaY9IE8LrpJtJb+H7rQkPIdsfgnMtLBA6DJls7X9z93Z4U8h7xw0A== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-split-export-declaration@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.12.13.tgz#e9430be00baf3e88b0e13e6f9d4eaf2136372b05" - integrity sha512-tCJDltF83htUtXx5NLcaDqRmknv652ZWCHyoTETf1CXYJdPC7nohZohjUgieXhv0hTJdRf2FjDueFehdNucpzg== - dependencies: - "@babel/types" "^7.12.13" - -"@babel/helper-split-export-declaration@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz#aecab92dcdbef6a10aa3b62ab204b085f776e257" - integrity sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-validator-identifier@^7.12.11": - version "7.12.11" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.12.11.tgz#c9a1f021917dcb5ccf0d4e453e399022981fc9ed" - integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw== - -"@babel/helper-validator-identifier@^7.14.5", "@babel/helper-validator-identifier@^7.14.9", "@babel/helper-validator-identifier@^7.15.7": - version "7.15.7" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" - integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w== - -"@babel/helper-validator-option@^7.12.17": - version "7.12.17" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.12.17.tgz#d1fbf012e1a79b7eebbfdc6d270baaf8d9eb9831" - integrity sha512-TopkMDmLzq8ngChwRlyjR6raKD6gMSae4JdYDB8bByKreQgG0RBTuKe9LRxW3wFtUnjxOPRKBDwEH6Mg5KeDfw== - -"@babel/helper-validator-option@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz#6e72a1fff18d5dfcb878e1e62f1a021c4b72d5a3" - integrity sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow== - -"@babel/helper-wrap-function@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.15.4.tgz#6f754b2446cfaf3d612523e6ab8d79c27c3a3de7" - integrity sha512-Y2o+H/hRV5W8QhIfTpRIBwl57y8PrZt6JM3V8FOo5qarjshHItyH5lXlpMfBfmBefOqSCpKZs/6Dxqp0E/U+uw== - dependencies: - "@babel/helper-function-name" "^7.15.4" - "@babel/template" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/helpers@^7.13.10": - version "7.13.10" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.13.10.tgz#fd8e2ba7488533cdeac45cc158e9ebca5e3c7df8" - integrity sha512-4VO883+MWPDUVRF3PhiLBUFHoX/bsLTGFpFK/HqvvfBZz2D57u9XzPVNFVBTc0PW/CWR9BXTOKt8NF4DInUHcQ== - dependencies: - "@babel/template" "^7.12.13" - "@babel/traverse" "^7.13.0" - "@babel/types" "^7.13.0" - -"@babel/helpers@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.15.4.tgz#5f40f02050a3027121a3cf48d497c05c555eaf43" - integrity sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ== - dependencies: - "@babel/template" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/highlight@^7.12.13": - version "7.13.10" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.13.10.tgz#a8b2a66148f5b27d666b15d81774347a731d52d1" - integrity sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg== - dependencies: - "@babel/helper-validator-identifier" "^7.12.11" - chalk "^2.0.0" - js-tokens "^4.0.0" - -"@babel/highlight@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.5.tgz#6861a52f03966405001f6aa534a01a24d99e8cd9" - integrity sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg== - dependencies: - "@babel/helper-validator-identifier" "^7.14.5" - chalk "^2.0.0" - js-tokens "^4.0.0" - -"@babel/parser@^7.12.13", "@babel/parser@^7.13.13": - version "7.13.13" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.13.13.tgz#42f03862f4aed50461e543270916b47dd501f0df" - integrity sha512-OhsyMrqygfk5v8HmWwOzlYjJrtLaFhF34MrfG/Z73DgYCI6ojNUTUp2TYbtnjo8PegeJp12eamsNettCQjKjVw== - -"@babel/parser@^7.15.4", "@babel/parser@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.8.tgz#7bacdcbe71bdc3ff936d510c15dcea7cf0b99016" - integrity sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA== - -"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.15.4.tgz#dbdeabb1e80f622d9f0b583efb2999605e0a567e" - integrity sha512-eBnpsl9tlhPhpI10kU06JHnrYXwg3+V6CaP2idsCXNef0aeslpqyITXQ74Vfk5uHgY7IG7XP0yIH8b42KSzHog== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-skip-transparent-expression-wrappers" "^7.15.4" - "@babel/plugin-proposal-optional-chaining" "^7.14.5" - -"@babel/plugin-proposal-async-generator-functions@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.15.8.tgz#a3100f785fab4357987c4223ab1b02b599048403" - integrity sha512-2Z5F2R2ibINTc63mY7FLqGfEbmofrHU9FitJW1Q7aPaKFhiPvSq6QEt/BoWN5oME3GVyjcRuNNSRbb9LC0CSWA== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-remap-async-to-generator" "^7.15.4" - "@babel/plugin-syntax-async-generators" "^7.8.4" - -"@babel/plugin-proposal-class-properties@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.14.5.tgz#40d1ee140c5b1e31a350f4f5eed945096559b42e" - integrity sha512-q/PLpv5Ko4dVc1LYMpCY7RVAAO4uk55qPwrIuJ5QJ8c6cVuAmhu7I/49JOppXL6gXf7ZHzpRVEUZdYoPLM04Gg== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-proposal-class-static-block@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.15.4.tgz#3e7ca6128453c089e8b477a99f970c63fc1cb8d7" - integrity sha512-M682XWrrLNk3chXCjoPUQWOyYsB93B9z3mRyjtqqYJWDf2mfCdIYgDrA11cgNVhAQieaq6F2fn2f3wI0U4aTjA== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-class-static-block" "^7.14.5" - -"@babel/plugin-proposal-dynamic-import@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.14.5.tgz#0c6617df461c0c1f8fff3b47cd59772360101d2c" - integrity sha512-ExjiNYc3HDN5PXJx+bwC50GIx/KKanX2HiggnIUAYedbARdImiCU4RhhHfdf0Kd7JNXGpsBBBCOm+bBVy3Gb0g== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-dynamic-import" "^7.8.3" - -"@babel/plugin-proposal-export-namespace-from@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.14.5.tgz#dbad244310ce6ccd083072167d8cea83a52faf76" - integrity sha512-g5POA32bXPMmSBu5Dx/iZGLGnKmKPc5AiY7qfZgurzrCYgIztDlHFbznSNCoQuv57YQLnQfaDi7dxCtLDIdXdA== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-export-namespace-from" "^7.8.3" - -"@babel/plugin-proposal-json-strings@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.14.5.tgz#38de60db362e83a3d8c944ac858ddf9f0c2239eb" - integrity sha512-NSq2fczJYKVRIsUJyNxrVUMhB27zb7N7pOFGQOhBKJrChbGcgEAqyZrmZswkPk18VMurEeJAaICbfm57vUeTbQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-json-strings" "^7.8.3" - -"@babel/plugin-proposal-logical-assignment-operators@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.14.5.tgz#6e6229c2a99b02ab2915f82571e0cc646a40c738" - integrity sha512-YGn2AvZAo9TwyhlLvCCWxD90Xq8xJ4aSgaX3G5D/8DW94L8aaT+dS5cSP+Z06+rCJERGSr9GxMBZ601xoc2taw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" - -"@babel/plugin-proposal-nullish-coalescing-operator@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.14.5.tgz#ee38589ce00e2cc59b299ec3ea406fcd3a0fdaf6" - integrity sha512-gun/SOnMqjSb98Nkaq2rTKMwervfdAoz6NphdY0vTfuzMfryj+tDGb2n6UkDKwez+Y8PZDhE3D143v6Gepp4Hg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - -"@babel/plugin-proposal-numeric-separator@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.14.5.tgz#83631bf33d9a51df184c2102a069ac0c58c05f18" - integrity sha512-yiclALKe0vyZRZE0pS6RXgjUOt87GWv6FYa5zqj15PvhOGFO69R5DusPlgK/1K5dVnCtegTiWu9UaBSrLLJJBg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-numeric-separator" "^7.10.4" - -"@babel/plugin-proposal-object-rest-spread@^7.15.6": - version "7.15.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.15.6.tgz#ef68050c8703d07b25af402cb96cf7f34a68ed11" - integrity sha512-qtOHo7A1Vt+O23qEAX+GdBpqaIuD3i9VRrWgCJeq7WO6H2d14EK3q11urj5Te2MAeK97nMiIdRpwd/ST4JFbNg== - dependencies: - "@babel/compat-data" "^7.15.0" - "@babel/helper-compilation-targets" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.15.4" - -"@babel/plugin-proposal-optional-catch-binding@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.14.5.tgz#939dd6eddeff3a67fdf7b3f044b5347262598c3c" - integrity sha512-3Oyiixm0ur7bzO5ybNcZFlmVsygSIQgdOa7cTfOYCMY+wEPAYhZAJxi3mixKFCTCKUhQXuCTtQ1MzrpL3WT8ZQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - -"@babel/plugin-proposal-optional-chaining@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.14.5.tgz#fa83651e60a360e3f13797eef00b8d519695b603" - integrity sha512-ycz+VOzo2UbWNI1rQXxIuMOzrDdHGrI23fRiz/Si2R4kv2XZQ1BK8ccdHwehMKBlcH/joGW/tzrUmo67gbJHlQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-skip-transparent-expression-wrappers" "^7.14.5" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - -"@babel/plugin-proposal-private-methods@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.14.5.tgz#37446495996b2945f30f5be5b60d5e2aa4f5792d" - integrity sha512-838DkdUA1u+QTCplatfq4B7+1lnDa/+QMI89x5WZHBcnNv+47N8QEj2k9I2MUU9xIv8XJ4XvPCviM/Dj7Uwt9g== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-proposal-private-property-in-object@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.15.4.tgz#55c5e3b4d0261fd44fe637e3f624cfb0f484e3e5" - integrity sha512-X0UTixkLf0PCCffxgu5/1RQyGGbgZuKoI+vXP4iSbJSYwPb7hu06omsFGBvQ9lJEvwgrxHdS8B5nbfcd8GyUNA== - dependencies: - "@babel/helper-annotate-as-pure" "^7.15.4" - "@babel/helper-create-class-features-plugin" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-private-property-in-object" "^7.14.5" - -"@babel/plugin-proposal-unicode-property-regex@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.14.5.tgz#0f95ee0e757a5d647f378daa0eca7e93faa8bbe8" - integrity sha512-6axIeOU5LnY471KenAB9vI8I5j7NQ2d652hIYwVyRfgaZT5UpiqFKCuVXCDMSrU+3VFafnu2c5m3lrWIlr6A5Q== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-proposal-unicode-property-regex@^7.4.4": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.12.13.tgz#bebde51339be829c17aaaaced18641deb62b39ba" - integrity sha512-XyJmZidNfofEkqFV5VC/bLabGmO5QzenPO/YOfGuEbgU+2sSwMmio3YLb4WtBgcmmdwZHyVyv8on77IUjQ5Gvg== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.12.13" - "@babel/helper-plugin-utils" "^7.12.13" - -"@babel/plugin-syntax-async-generators@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" - integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-class-properties@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" - integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== - dependencies: - "@babel/helper-plugin-utils" "^7.12.13" - -"@babel/plugin-syntax-class-static-block@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" - integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-dynamic-import@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" - integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-export-namespace-from@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz#028964a9ba80dbc094c915c487ad7c4e7a66465a" - integrity sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-syntax-json-strings@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" - integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-logical-assignment-operators@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" - integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" - integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-numeric-separator@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" - integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-object-rest-spread@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" - integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-catch-binding@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" - integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-chaining@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" - integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-private-property-in-object@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" - integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-top-level-await@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" - integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-arrow-functions@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.14.5.tgz#f7187d9588a768dd080bf4c9ffe117ea62f7862a" - integrity sha512-KOnO0l4+tD5IfOdi4x8C1XmEIRWUjNRV8wc6K2vz/3e8yAOoZZvsRXRRIF/yo/MAOFb4QjtAw9xSxMXbSMRy8A== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-async-to-generator@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.14.5.tgz#72c789084d8f2094acb945633943ef8443d39e67" - integrity sha512-szkbzQ0mNk0rpu76fzDdqSyPu0MuvpXgC+6rz5rpMb5OIRxdmHfQxrktL8CYolL2d8luMCZTR0DpIMIdL27IjA== - dependencies: - "@babel/helper-module-imports" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-remap-async-to-generator" "^7.14.5" - -"@babel/plugin-transform-block-scoped-functions@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.14.5.tgz#e48641d999d4bc157a67ef336aeb54bc44fd3ad4" - integrity sha512-dtqWqdWZ5NqBX3KzsVCWfQI3A53Ft5pWFCT2eCVUftWZgjc5DpDponbIF1+c+7cSGk2wN0YK7HGL/ezfRbpKBQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-block-scoping@^7.15.3": - version "7.15.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.15.3.tgz#94c81a6e2fc230bcce6ef537ac96a1e4d2b3afaf" - integrity sha512-nBAzfZwZb4DkaGtOes1Up1nOAp9TDRRFw4XBzBBSG9QK7KVFmYzgj9o9sbPv7TX5ofL4Auq4wZnxCoPnI/lz2Q== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-classes@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.15.4.tgz#50aee17aaf7f332ae44e3bce4c2e10534d5d3bf1" - integrity sha512-Yjvhex8GzBmmPQUvpXRPWQ9WnxXgAFuZSrqOK/eJlOGIXwvv8H3UEdUigl1gb/bnjTrln+e8bkZUYCBt/xYlBg== - dependencies: - "@babel/helper-annotate-as-pure" "^7.15.4" - "@babel/helper-function-name" "^7.15.4" - "@babel/helper-optimise-call-expression" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-replace-supers" "^7.15.4" - "@babel/helper-split-export-declaration" "^7.15.4" - globals "^11.1.0" - -"@babel/plugin-transform-computed-properties@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.14.5.tgz#1b9d78987420d11223d41195461cc43b974b204f" - integrity sha512-pWM+E4283UxaVzLb8UBXv4EIxMovU4zxT1OPnpHJcmnvyY9QbPPTKZfEj31EUvG3/EQRbYAGaYEUZ4yWOBC2xg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-destructuring@^7.14.7": - version "7.14.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.14.7.tgz#0ad58ed37e23e22084d109f185260835e5557576" - integrity sha512-0mDE99nK+kVh3xlc5vKwB6wnP9ecuSj+zQCa/n0voENtP/zymdT4HH6QEb65wjjcbqr1Jb/7z9Qp7TF5FtwYGw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-dotall-regex@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.14.5.tgz#2f6bf76e46bdf8043b4e7e16cf24532629ba0c7a" - integrity sha512-loGlnBdj02MDsFaHhAIJzh7euK89lBrGIdM9EAtHFo6xKygCUGuuWe07o1oZVk287amtW1n0808sQM99aZt3gw== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-dotall-regex@^7.4.4": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.12.13.tgz#3f1601cc29905bfcb67f53910f197aeafebb25ad" - integrity sha512-foDrozE65ZFdUC2OfgeOCrEPTxdB3yjqxpXh8CH+ipd9CHd4s/iq81kcUpyH8ACGNEPdFqbtzfgzbT/ZGlbDeQ== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.12.13" - "@babel/helper-plugin-utils" "^7.12.13" - -"@babel/plugin-transform-duplicate-keys@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.14.5.tgz#365a4844881bdf1501e3a9f0270e7f0f91177954" - integrity sha512-iJjbI53huKbPDAsJ8EmVmvCKeeq21bAze4fu9GBQtSLqfvzj2oRuHVx4ZkDwEhg1htQ+5OBZh/Ab0XDf5iBZ7A== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-exponentiation-operator@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.14.5.tgz#5154b8dd6a3dfe6d90923d61724bd3deeb90b493" - integrity sha512-jFazJhMBc9D27o9jDnIE5ZErI0R0m7PbKXVq77FFvqFbzvTMuv8jaAwLZ5PviOLSFttqKIW0/wxNSDbjLk0tYA== - dependencies: - "@babel/helper-builder-binary-assignment-operator-visitor" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-for-of@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.15.4.tgz#25c62cce2718cfb29715f416e75d5263fb36a8c2" - integrity sha512-DRTY9fA751AFBDh2oxydvVm4SYevs5ILTWLs6xKXps4Re/KG5nfUkr+TdHCrRWB8C69TlzVgA9b3RmGWmgN9LA== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-function-name@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.14.5.tgz#e81c65ecb900746d7f31802f6bed1f52d915d6f2" - integrity sha512-vbO6kv0fIzZ1GpmGQuvbwwm+O4Cbm2NrPzwlup9+/3fdkuzo1YqOZcXw26+YUJB84Ja7j9yURWposEHLYwxUfQ== - dependencies: - "@babel/helper-function-name" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-literals@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.14.5.tgz#41d06c7ff5d4d09e3cf4587bd3ecf3930c730f78" - integrity sha512-ql33+epql2F49bi8aHXxvLURHkxJbSmMKl9J5yHqg4PLtdE6Uc48CH1GS6TQvZ86eoB/ApZXwm7jlA+B3kra7A== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-member-expression-literals@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.14.5.tgz#b39cd5212a2bf235a617d320ec2b48bcc091b8a7" - integrity sha512-WkNXxH1VXVTKarWFqmso83xl+2V3Eo28YY5utIkbsmXoItO8Q3aZxN4BTS2k0hz9dGUloHK26mJMyQEYfkn/+Q== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-modules-amd@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.14.5.tgz#4fd9ce7e3411cb8b83848480b7041d83004858f7" - integrity sha512-3lpOU8Vxmp3roC4vzFpSdEpGUWSMsHFreTWOMMLzel2gNGfHE5UWIh/LN6ghHs2xurUp4jRFYMUIZhuFbody1g== - dependencies: - "@babel/helper-module-transforms" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - babel-plugin-dynamic-import-node "^2.3.3" - -"@babel/plugin-transform-modules-commonjs@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.15.4.tgz#8201101240eabb5a76c08ef61b2954f767b6b4c1" - integrity sha512-qg4DPhwG8hKp4BbVDvX1s8cohM8a6Bvptu4l6Iingq5rW+yRUAhe/YRup/YcW2zCOlrysEWVhftIcKzrEZv3sA== - dependencies: - "@babel/helper-module-transforms" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-simple-access" "^7.15.4" - babel-plugin-dynamic-import-node "^2.3.3" - -"@babel/plugin-transform-modules-systemjs@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.15.4.tgz#b42890c7349a78c827719f1d2d0cd38c7d268132" - integrity sha512-fJUnlQrl/mezMneR72CKCgtOoahqGJNVKpompKwzv3BrEXdlPspTcyxrZ1XmDTIr9PpULrgEQo3qNKp6dW7ssw== - dependencies: - "@babel/helper-hoist-variables" "^7.15.4" - "@babel/helper-module-transforms" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-validator-identifier" "^7.14.9" - babel-plugin-dynamic-import-node "^2.3.3" - -"@babel/plugin-transform-modules-umd@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.14.5.tgz#fb662dfee697cce274a7cda525190a79096aa6e0" - integrity sha512-RfPGoagSngC06LsGUYyM9QWSXZ8MysEjDJTAea1lqRjNECE3y0qIJF/qbvJxc4oA4s99HumIMdXOrd+TdKaAAA== - dependencies: - "@babel/helper-module-transforms" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-named-capturing-groups-regex@^7.14.9": - version "7.14.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.14.9.tgz#c68f5c5d12d2ebaba3762e57c2c4f6347a46e7b2" - integrity sha512-l666wCVYO75mlAtGFfyFwnWmIXQm3kSH0C3IRnJqWcZbWkoihyAdDhFm2ZWaxWTqvBvhVFfJjMRQ0ez4oN1yYA== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.14.5" - -"@babel/plugin-transform-new-target@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.14.5.tgz#31bdae8b925dc84076ebfcd2a9940143aed7dbf8" - integrity sha512-Nx054zovz6IIRWEB49RDRuXGI4Gy0GMgqG0cII9L3MxqgXz/+rgII+RU58qpo4g7tNEx1jG7rRVH4ihZoP4esQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-object-super@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.14.5.tgz#d0b5faeac9e98597a161a9cf78c527ed934cdc45" - integrity sha512-MKfOBWzK0pZIrav9z/hkRqIk/2bTv9qvxHzPQc12RcVkMOzpIKnFCNYJip00ssKWYkd8Sf5g0Wr7pqJ+cmtuFg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-replace-supers" "^7.14.5" - -"@babel/plugin-transform-parameters@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.15.4.tgz#5f2285cc3160bf48c8502432716b48504d29ed62" - integrity sha512-9WB/GUTO6lvJU3XQsSr6J/WKvBC2hcs4Pew8YxZagi6GkTdniyqp8On5kqdK8MN0LMeu0mGbhPN+O049NV/9FQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-property-literals@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.14.5.tgz#0ddbaa1f83db3606f1cdf4846fa1dfb473458b34" - integrity sha512-r1uilDthkgXW8Z1vJz2dKYLV1tuw2xsbrp3MrZmD99Wh9vsfKoob+JTgri5VUb/JqyKRXotlOtwgu4stIYCmnw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-regenerator@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.14.5.tgz#9676fd5707ed28f522727c5b3c0aa8544440b04f" - integrity sha512-NVIY1W3ITDP5xQl50NgTKlZ0GrotKtLna08/uGY6ErQt6VEQZXla86x/CTddm5gZdcr+5GSsvMeTmWA5Ii6pkg== - dependencies: - regenerator-transform "^0.14.2" - -"@babel/plugin-transform-reserved-words@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.14.5.tgz#c44589b661cfdbef8d4300dcc7469dffa92f8304" - integrity sha512-cv4F2rv1nD4qdexOGsRQXJrOcyb5CrgjUH9PKrrtyhSDBNWGxd0UIitjyJiWagS+EbUGjG++22mGH1Pub8D6Vg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-shorthand-properties@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.14.5.tgz#97f13855f1409338d8cadcbaca670ad79e091a58" - integrity sha512-xLucks6T1VmGsTB+GWK5Pl9Jl5+nRXD1uoFdA5TSO6xtiNjtXTjKkmPdFXVLGlK5A2/or/wQMKfmQ2Y0XJfn5g== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-spread@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.15.8.tgz#79d5aa27f68d700449b2da07691dfa32d2f6d468" - integrity sha512-/daZ8s2tNaRekl9YJa9X4bzjpeRZLt122cpgFnQPLGUe61PH8zMEBmYqKkW5xF5JUEh5buEGXJoQpqBmIbpmEQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-skip-transparent-expression-wrappers" "^7.15.4" - -"@babel/plugin-transform-sticky-regex@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.14.5.tgz#5b617542675e8b7761294381f3c28c633f40aeb9" - integrity sha512-Z7F7GyvEMzIIbwnziAZmnSNpdijdr4dWt+FJNBnBLz5mwDFkqIXU9wmBcWWad3QeJF5hMTkRe4dAq2sUZiG+8A== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-template-literals@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.14.5.tgz#a5f2bc233937d8453885dc736bdd8d9ffabf3d93" - integrity sha512-22btZeURqiepOfuy/VkFr+zStqlujWaarpMErvay7goJS6BWwdd6BY9zQyDLDa4x2S3VugxFb162IZ4m/S/+Gg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-typeof-symbol@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.14.5.tgz#39af2739e989a2bd291bf6b53f16981423d457d4" - integrity sha512-lXzLD30ffCWseTbMQzrvDWqljvZlHkXU+CnseMhkMNqU1sASnCsz3tSzAaH3vCUXb9PHeUb90ZT1BdFTm1xxJw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-unicode-escapes@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.14.5.tgz#9d4bd2a681e3c5d7acf4f57fa9e51175d91d0c6b" - integrity sha512-crTo4jATEOjxj7bt9lbYXcBAM3LZaUrbP2uUdxb6WIorLmjNKSpHfIybgY4B8SRpbf8tEVIWH3Vtm7ayCrKocA== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-unicode-regex@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.14.5.tgz#4cd09b6c8425dd81255c7ceb3fb1836e7414382e" - integrity sha512-UygduJpC5kHeCiRw/xDVzC+wj8VaYSoKl5JNVmbP7MadpNinAm3SvZCxZ42H37KZBKztz46YC73i9yV34d0Tzw== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/preset-env@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.15.8.tgz#f527ce5bcb121cd199f6b502bf23e420b3ff8dba" - integrity sha512-rCC0wH8husJgY4FPbHsiYyiLxSY8oMDJH7Rl6RQMknbN9oDDHhM9RDFvnGM2MgkbUJzSQB4gtuwygY5mCqGSsA== - dependencies: - "@babel/compat-data" "^7.15.0" - "@babel/helper-compilation-targets" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-validator-option" "^7.14.5" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.15.4" - "@babel/plugin-proposal-async-generator-functions" "^7.15.8" - "@babel/plugin-proposal-class-properties" "^7.14.5" - "@babel/plugin-proposal-class-static-block" "^7.15.4" - "@babel/plugin-proposal-dynamic-import" "^7.14.5" - "@babel/plugin-proposal-export-namespace-from" "^7.14.5" - "@babel/plugin-proposal-json-strings" "^7.14.5" - "@babel/plugin-proposal-logical-assignment-operators" "^7.14.5" - "@babel/plugin-proposal-nullish-coalescing-operator" "^7.14.5" - "@babel/plugin-proposal-numeric-separator" "^7.14.5" - "@babel/plugin-proposal-object-rest-spread" "^7.15.6" - "@babel/plugin-proposal-optional-catch-binding" "^7.14.5" - "@babel/plugin-proposal-optional-chaining" "^7.14.5" - "@babel/plugin-proposal-private-methods" "^7.14.5" - "@babel/plugin-proposal-private-property-in-object" "^7.15.4" - "@babel/plugin-proposal-unicode-property-regex" "^7.14.5" - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-syntax-class-properties" "^7.12.13" - "@babel/plugin-syntax-class-static-block" "^7.14.5" - "@babel/plugin-syntax-dynamic-import" "^7.8.3" - "@babel/plugin-syntax-export-namespace-from" "^7.8.3" - "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.10.4" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-syntax-private-property-in-object" "^7.14.5" - "@babel/plugin-syntax-top-level-await" "^7.14.5" - "@babel/plugin-transform-arrow-functions" "^7.14.5" - "@babel/plugin-transform-async-to-generator" "^7.14.5" - "@babel/plugin-transform-block-scoped-functions" "^7.14.5" - "@babel/plugin-transform-block-scoping" "^7.15.3" - "@babel/plugin-transform-classes" "^7.15.4" - "@babel/plugin-transform-computed-properties" "^7.14.5" - "@babel/plugin-transform-destructuring" "^7.14.7" - "@babel/plugin-transform-dotall-regex" "^7.14.5" - "@babel/plugin-transform-duplicate-keys" "^7.14.5" - "@babel/plugin-transform-exponentiation-operator" "^7.14.5" - "@babel/plugin-transform-for-of" "^7.15.4" - "@babel/plugin-transform-function-name" "^7.14.5" - "@babel/plugin-transform-literals" "^7.14.5" - "@babel/plugin-transform-member-expression-literals" "^7.14.5" - "@babel/plugin-transform-modules-amd" "^7.14.5" - "@babel/plugin-transform-modules-commonjs" "^7.15.4" - "@babel/plugin-transform-modules-systemjs" "^7.15.4" - "@babel/plugin-transform-modules-umd" "^7.14.5" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.14.9" - "@babel/plugin-transform-new-target" "^7.14.5" - "@babel/plugin-transform-object-super" "^7.14.5" - "@babel/plugin-transform-parameters" "^7.15.4" - "@babel/plugin-transform-property-literals" "^7.14.5" - "@babel/plugin-transform-regenerator" "^7.14.5" - "@babel/plugin-transform-reserved-words" "^7.14.5" - "@babel/plugin-transform-shorthand-properties" "^7.14.5" - "@babel/plugin-transform-spread" "^7.15.8" - "@babel/plugin-transform-sticky-regex" "^7.14.5" - "@babel/plugin-transform-template-literals" "^7.14.5" - "@babel/plugin-transform-typeof-symbol" "^7.14.5" - "@babel/plugin-transform-unicode-escapes" "^7.14.5" - "@babel/plugin-transform-unicode-regex" "^7.14.5" - "@babel/preset-modules" "^0.1.4" - "@babel/types" "^7.15.6" - babel-plugin-polyfill-corejs2 "^0.2.2" - babel-plugin-polyfill-corejs3 "^0.2.5" - babel-plugin-polyfill-regenerator "^0.2.2" - core-js-compat "^3.16.0" - semver "^6.3.0" - -"@babel/preset-modules@^0.1.4": - version "0.1.4" - resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.4.tgz#362f2b68c662842970fdb5e254ffc8fc1c2e415e" - integrity sha512-J36NhwnfdzpmH41M1DrnkkgAqhZaqr/NBdPfQ677mLzlaXo+oDiv1deyCDtgAhz8p328otdob0Du7+xgHGZbKg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" - "@babel/plugin-transform-dotall-regex" "^7.4.4" - "@babel/types" "^7.4.4" - esutils "^2.0.2" - -"@babel/runtime@^7.8.4": - version "7.13.10" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.10.tgz#47d42a57b6095f4468da440388fdbad8bebf0d7d" - integrity sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw== - dependencies: - regenerator-runtime "^0.13.4" - -"@babel/template@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.13.tgz#530265be8a2589dbb37523844c5bcb55947fb327" - integrity sha512-/7xxiGA57xMo/P2GVvdEumr8ONhFOhfgq2ihK3h1e6THqzTAkHbkXgB0xI9yeTfIUoH3+oAeHhqm/I43OTbbjA== - dependencies: - "@babel/code-frame" "^7.12.13" - "@babel/parser" "^7.12.13" - "@babel/types" "^7.12.13" - -"@babel/template@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.15.4.tgz#51898d35dcf3faa670c4ee6afcfd517ee139f194" - integrity sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg== - dependencies: - "@babel/code-frame" "^7.14.5" - "@babel/parser" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/traverse@^7.13.0", "@babel/traverse@^7.13.13": - version "7.13.13" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.13.13.tgz#39aa9c21aab69f74d948a486dd28a2dbdbf5114d" - integrity sha512-CblEcwmXKR6eP43oQGG++0QMTtCjAsa3frUuzHoiIJWpaIIi8dwMyEFUJoXRLxagGqCK+jALRwIO+o3R9p/uUg== - dependencies: - "@babel/code-frame" "^7.12.13" - "@babel/generator" "^7.13.9" - "@babel/helper-function-name" "^7.12.13" - "@babel/helper-split-export-declaration" "^7.12.13" - "@babel/parser" "^7.13.13" - "@babel/types" "^7.13.13" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/traverse@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.4.tgz#ff8510367a144bfbff552d9e18e28f3e2889c22d" - integrity sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA== - dependencies: - "@babel/code-frame" "^7.14.5" - "@babel/generator" "^7.15.4" - "@babel/helper-function-name" "^7.15.4" - "@babel/helper-hoist-variables" "^7.15.4" - "@babel/helper-split-export-declaration" "^7.15.4" - "@babel/parser" "^7.15.4" - "@babel/types" "^7.15.4" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/types@^7.12.13", "@babel/types@^7.13.0", "@babel/types@^7.13.12", "@babel/types@^7.13.13", "@babel/types@^7.13.14", "@babel/types@^7.4.4": - version "7.13.14" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.13.14.tgz#c35a4abb15c7cd45a2746d78ab328e362cbace0d" - integrity sha512-A2aa3QTkWoyqsZZFl56MLUsfmh7O0gN41IPvXAE/++8ojpbz12SszD7JEGYVdn4f9Kt4amIei07swF1h4AqmmQ== - dependencies: - "@babel/helper-validator-identifier" "^7.12.11" - lodash "^4.17.19" - to-fast-properties "^2.0.0" - -"@babel/types@^7.15.4", "@babel/types@^7.15.6": - version "7.15.6" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.6.tgz#99abdc48218b2881c058dd0a7ab05b99c9be758f" - integrity sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig== - dependencies: - "@babel/helper-validator-identifier" "^7.14.9" - to-fast-properties "^2.0.0" - -"@eslint/eslintrc@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.0.3.tgz#41f08c597025605f672251dcc4e8be66b5ed7366" - integrity sha512-DHI1wDPoKCBPoLZA3qDR91+3te/wDSc1YhKg3jR8NxKKRJq2hwHwcWv31cSwSYvIBrmbENoYMWcenW8uproQqg== - dependencies: - ajv "^6.12.4" - debug "^4.3.2" - espree "^9.0.0" - globals "^13.9.0" - ignore "^4.0.6" - import-fresh "^3.2.1" - js-yaml "^3.13.1" - minimatch "^3.0.4" - strip-json-comments "^3.1.1" - -"@humanwhocodes/config-array@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.6.0.tgz#b5621fdb3b32309d2d16575456cbc277fa8f021a" - integrity sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A== - dependencies: - "@humanwhocodes/object-schema" "^1.2.0" - debug "^4.1.1" - minimatch "^3.0.4" - -"@humanwhocodes/object-schema@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz#87de7af9c231826fdd68ac7258f77c429e0e5fcf" - integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w== - -"@istanbuljs/load-nyc-config@^1.0.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" - integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== - dependencies: - camelcase "^5.3.1" - find-up "^4.1.0" - get-package-type "^0.1.0" - js-yaml "^3.13.1" - resolve-from "^5.0.0" - -"@istanbuljs/schema@^0.1.2": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" - integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== - -"@lhncbc/ucum-lhc@^4.1.3": - version "4.1.4" - resolved "https://registry.yarnpkg.com/@lhncbc/ucum-lhc/-/ucum-lhc-4.1.4.tgz#763d26a1e2d58b204fc645ae5128262c8cdc56bc" - integrity sha512-ErlXJv6lrerZbthxc33SWTKrZv4KjMIaCN2lNxsNrGZW4PqyVFEKDie6lok//SvC6QeEoAC1mWN8xD87r72qPQ== - dependencies: - csv-parse "^4.4.6" - csv-stringify "^1.0.4" - escape-html "^1.0.3" - is-integer "^1.0.6" - jsonfile "^2.2.3" - stream "0.0.2" - stream-transform "^0.1.1" - string-to-stream "^1.1.0" - xmldoc "^0.4.0" - -"@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3": - version "2.1.8-no-fsevents.3" - resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b" - integrity sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ== - -"@ungap/promise-all-settled@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" - integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== - -JSONStream@^1.0.3: - version "1.3.5" - resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" - integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== - dependencies: - jsonparse "^1.2.0" - through ">=2.2.7 <3" - -acorn-jsx@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.1.tgz#fc8661e11b7ac1539c47dbfea2e72b3af34d267b" - integrity sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng== - -acorn-node@^1.2.0, acorn-node@^1.3.0, acorn-node@^1.5.2, acorn-node@^1.6.1: - version "1.8.2" - resolved "https://registry.yarnpkg.com/acorn-node/-/acorn-node-1.8.2.tgz#114c95d64539e53dede23de8b9d96df7c7ae2af8" - integrity sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A== - dependencies: - acorn "^7.0.0" - acorn-walk "^7.0.0" - xtend "^4.0.2" - -acorn-walk@^7.0.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" - integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== - -acorn@^7.0.0: - version "7.4.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" - integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== - -acorn@^8.5.0: - version "8.5.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.5.0.tgz#4512ccb99b3698c752591e9bb4472e38ad43cee2" - integrity sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q== - -aggregate-error@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" - integrity sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA== - dependencies: - clean-stack "^2.0.0" - indent-string "^4.0.0" - -ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4: - version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" - integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== - dependencies: - fast-deep-equal "^3.1.1" - fast-json-stable-stringify "^2.0.0" - json-schema-traverse "^0.4.1" - uri-js "^4.2.2" - -ansi-colors@4.1.1, ansi-colors@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" - integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== - -ansi-regex@^5.0.0, ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -anymatch@~3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" - integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -anymatch@~3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" - integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -append-transform@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-2.0.0.tgz#99d9d29c7b38391e6f428d28ce136551f0b77e12" - integrity sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg== - dependencies: - default-require-extensions "^3.0.0" - -archy@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" - integrity sha1-+cjBN1fMHde8N5rHeyxipcKGjEA= - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -asn1.js@^5.2.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" - integrity sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA== - dependencies: - bn.js "^4.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - safer-buffer "^2.1.0" - -asn1@~0.2.3: - version "0.2.4" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136" - integrity sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg== - dependencies: - safer-buffer "~2.1.0" - -assert-plus@1.0.0, assert-plus@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" - integrity sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU= - -assert@^1.4.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/assert/-/assert-1.5.0.tgz#55c109aaf6e0aefdb3dc4b71240c70bf574b18eb" - integrity sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA== - dependencies: - object-assign "^4.1.1" - util "0.10.3" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= - -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg= - -aws4@^1.8.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" - integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== - -babel-plugin-dynamic-import-node@^2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3" - integrity sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ== - dependencies: - object.assign "^4.1.0" - -babel-plugin-polyfill-corejs2@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.2.2.tgz#e9124785e6fd94f94b618a7954e5693053bf5327" - integrity sha512-kISrENsJ0z5dNPq5eRvcctITNHYXWOA4DUZRFYCz3jYCcvTb/A546LIddmoGNMVYg2U38OyFeNosQwI9ENTqIQ== - dependencies: - "@babel/compat-data" "^7.13.11" - "@babel/helper-define-polyfill-provider" "^0.2.2" - semver "^6.1.1" - -babel-plugin-polyfill-corejs3@^0.2.5: - version "0.2.5" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.2.5.tgz#2779846a16a1652244ae268b1e906ada107faf92" - integrity sha512-ninF5MQNwAX9Z7c9ED+H2pGt1mXdP4TqzlHKyPIYmJIYz0N+++uwdM7RnJukklhzJ54Q84vA4ZJkgs7lu5vqcw== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.2.2" - core-js-compat "^3.16.2" - -babel-plugin-polyfill-regenerator@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.2.2.tgz#b310c8d642acada348c1fa3b3e6ce0e851bee077" - integrity sha512-Goy5ghsc21HgPDFtzRkSirpZVW35meGoTmTOb2bxqdl60ghub4xOidgNTHaZfQ2FaxQsKmwvXtOAkcIS4SMBWg== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.2.2" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= - -base64-js@^1.0.2: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4= - dependencies: - tweetnacl "^0.14.3" - -binary-extensions@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" - integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== - -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.11.9: - version "4.12.0" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" - integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== - -bn.js@^5.0.0, bn.js@^5.1.1: - version "5.2.0" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" - integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== - dependencies: - fill-range "^7.0.1" - -brorand@^1.0.1, brorand@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= - -browser-pack@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/browser-pack/-/browser-pack-6.1.0.tgz#c34ba10d0b9ce162b5af227c7131c92c2ecd5774" - integrity sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA== - dependencies: - JSONStream "^1.0.3" - combine-source-map "~0.8.0" - defined "^1.0.0" - safe-buffer "^5.1.1" - through2 "^2.0.0" - umd "^3.0.0" - -browser-resolve@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/browser-resolve/-/browser-resolve-2.0.0.tgz#99b7304cb392f8d73dba741bb2d7da28c6d7842b" - integrity sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ== - dependencies: - resolve "^1.17.0" - -browser-stdout@1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" - integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== - -browserify-aes@^1.0.0, browserify-aes@^1.0.4: - version "1.2.0" - resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" - integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== - dependencies: - buffer-xor "^1.0.3" - cipher-base "^1.0.0" - create-hash "^1.1.0" - evp_bytestokey "^1.0.3" - inherits "^2.0.1" - safe-buffer "^5.0.1" - -browserify-cipher@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" - integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== - dependencies: - browserify-aes "^1.0.4" - browserify-des "^1.0.0" - evp_bytestokey "^1.0.0" - -browserify-des@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" - integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== - dependencies: - cipher-base "^1.0.1" - des.js "^1.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -browserify-rsa@^4.0.0, browserify-rsa@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.1.0.tgz#b2fd06b5b75ae297f7ce2dc651f918f5be158c8d" - integrity sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog== - dependencies: - bn.js "^5.0.0" - randombytes "^2.0.1" - -browserify-sign@^4.0.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.1.tgz#eaf4add46dd54be3bb3b36c0cf15abbeba7956c3" - integrity sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg== - dependencies: - bn.js "^5.1.1" - browserify-rsa "^4.0.1" - create-hash "^1.2.0" - create-hmac "^1.1.7" - elliptic "^6.5.3" - inherits "^2.0.4" - parse-asn1 "^5.1.5" - readable-stream "^3.6.0" - safe-buffer "^5.2.0" - -browserify-zlib@~0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/browserify-zlib/-/browserify-zlib-0.2.0.tgz#2869459d9aa3be245fe8fe2ca1f46e2e7f54d73f" - integrity sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA== - dependencies: - pako "~1.0.5" - -browserify@^16.5.1: - version "16.5.2" - resolved "https://registry.yarnpkg.com/browserify/-/browserify-16.5.2.tgz#d926835e9280fa5fd57f5bc301f2ef24a972ddfe" - integrity sha512-TkOR1cQGdmXU9zW4YukWzWVSJwrxmNdADFbqbE3HFgQWe5wqZmOawqZ7J/8MPCwk/W8yY7Y0h+7mOtcZxLP23g== - dependencies: - JSONStream "^1.0.3" - assert "^1.4.0" - browser-pack "^6.0.1" - browser-resolve "^2.0.0" - browserify-zlib "~0.2.0" - buffer "~5.2.1" - cached-path-relative "^1.0.0" - concat-stream "^1.6.0" - console-browserify "^1.1.0" - constants-browserify "~1.0.0" - crypto-browserify "^3.0.0" - defined "^1.0.0" - deps-sort "^2.0.0" - domain-browser "^1.2.0" - duplexer2 "~0.1.2" - events "^2.0.0" - glob "^7.1.0" - has "^1.0.0" - htmlescape "^1.1.0" - https-browserify "^1.0.0" - inherits "~2.0.1" - insert-module-globals "^7.0.0" - labeled-stream-splicer "^2.0.0" - mkdirp-classic "^0.5.2" - module-deps "^6.2.3" - os-browserify "~0.3.0" - parents "^1.0.1" - path-browserify "~0.0.0" - process "~0.11.0" - punycode "^1.3.2" - querystring-es3 "~0.2.0" - read-only-stream "^2.0.0" - readable-stream "^2.0.2" - resolve "^1.1.4" - shasum "^1.0.0" - shell-quote "^1.6.1" - stream-browserify "^2.0.0" - stream-http "^3.0.0" - string_decoder "^1.1.1" - subarg "^1.0.0" - syntax-error "^1.1.1" - through2 "^2.0.0" - timers-browserify "^1.0.1" - tty-browserify "0.0.1" - url "~0.11.0" - util "~0.10.1" - vm-browserify "^1.0.0" - xtend "^4.0.0" - -browserslist@^4.14.5: - version "4.16.6" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.6.tgz#d7901277a5a88e554ed305b183ec9b0c08f66fa2" - integrity sha512-Wspk/PqO+4W9qp5iUTJsa1B/QrYn1keNCcEP5OvP7WBwT4KaDly0uONYmC6Xa3Z5IqnUgS0KcgLYu1l74x0ZXQ== - dependencies: - caniuse-lite "^1.0.30001219" - colorette "^1.2.2" - electron-to-chromium "^1.3.723" - escalade "^3.1.1" - node-releases "^1.1.71" - -browserslist@^4.16.6, browserslist@^4.17.3: - version "4.17.4" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.17.4.tgz#72e2508af2a403aec0a49847ef31bd823c57ead4" - integrity sha512-Zg7RpbZpIJRW3am9Lyckue7PLytvVxxhJj1CaJVlCWENsGEAOlnlt8X0ZxGRPp7Bt9o8tIRM5SEXy4BCPMJjLQ== - dependencies: - caniuse-lite "^1.0.30001265" - electron-to-chromium "^1.3.867" - escalade "^3.1.1" - node-releases "^2.0.0" - picocolors "^1.0.0" - -buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== - -buffer-xor@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" - integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= - -buffer@~5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.2.1.tgz#dd57fa0f109ac59c602479044dca7b8b3d0b71d6" - integrity sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg== - dependencies: - base64-js "^1.0.2" - ieee754 "^1.1.4" - -builtin-status-codes@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" - integrity sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug= - -cached-path-relative@^1.0.0, cached-path-relative@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/cached-path-relative/-/cached-path-relative-1.0.2.tgz#a13df4196d26776220cc3356eb147a52dba2c6db" - integrity sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg== - -caching-transform@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/caching-transform/-/caching-transform-4.0.0.tgz#00d297a4206d71e2163c39eaffa8157ac0651f0f" - integrity sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA== - dependencies: - hasha "^5.0.0" - make-dir "^3.0.0" - package-hash "^4.0.0" - write-file-atomic "^3.0.0" - -call-bind@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" - integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== - dependencies: - function-bind "^1.1.1" - get-intrinsic "^1.0.2" - -callsites@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" - integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== - -camelcase@^5.0.0, camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - -camelcase@^6.0.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" - integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== - -caniuse-lite@^1.0.30001219: - version "1.0.30001236" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001236.tgz#0a80de4cdf62e1770bb46a30d884fc8d633e3958" - integrity sha512-o0PRQSrSCGJKCPZcgMzl5fUaj5xHe8qA2m4QRvnyY4e1lITqoNkr7q/Oh1NcpGSy0Th97UZ35yoKcINPoq7YOQ== - -caniuse-lite@^1.0.30001265: - version "1.0.30001269" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz#3a71bee03df627364418f9fd31adfc7aa1cc2d56" - integrity sha512-UOy8okEVs48MyHYgV+RdW1Oiudl1H6KolybD6ZquD0VcrPSgj25omXO1S7rDydjpqaISCwA8Pyx+jUQKZwWO5w== - -caseless@~0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" - integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= - -chalk@^2.0.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chalk@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chokidar@3.5.2: - version "3.5.2" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" - integrity sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - -chokidar@^3.4.0: - version "3.5.1" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a" - integrity sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw== - dependencies: - anymatch "~3.1.1" - braces "~3.0.2" - glob-parent "~5.1.0" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.5.0" - optionalDependencies: - fsevents "~2.3.1" - -cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" - integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -clean-stack@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" - integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== - -cliui@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" - integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^6.2.0" - -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -colorette@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" - integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== - -combine-source-map@^0.8.0, combine-source-map@~0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.8.0.tgz#a58d0df042c186fcf822a8e8015f5450d2d79a8b" - integrity sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos= - dependencies: - convert-source-map "~1.1.0" - inline-source-map "~0.6.0" - lodash.memoize "~3.0.3" - source-map "~0.5.3" - -combined-stream@^1.0.6, combined-stream@~1.0.6: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -commander@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" - integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== - -commondir@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" - integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= - -concat-stream@^1.6.0, concat-stream@^1.6.1, concat-stream@~1.6.0: - version "1.6.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" - integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -console-browserify@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" - integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA== - -constants-browserify@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" - integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= - -convert-source-map@^1.1.0, convert-source-map@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" - integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== - dependencies: - safe-buffer "~5.1.1" - -convert-source-map@~1.1.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.1.3.tgz#4829c877e9fe49b3161f3bf3673888e204699860" - integrity sha1-SCnId+n+SbMWHzvzZziI4gRpmGA= - -core-js-compat@^3.16.0, core-js-compat@^3.16.2: - version "3.18.3" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.18.3.tgz#e0e7e87abc55efb547e7fa19169e45fa9df27a67" - integrity sha512-4zP6/y0a2RTHN5bRGT7PTq9lVt3WzvffTNjqnTKsXhkAYNDTkdCLOIfAdOLcQ/7TDdyRj3c+NeHe1NmF1eDScw== - dependencies: - browserslist "^4.17.3" - semver "7.0.0" - -core-util-is@1.0.2, core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= - -coveralls@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.1.0.tgz#13c754d5e7a2dd8b44fe5269e21ca394fb4d615b" - integrity sha512-sHxOu2ELzW8/NC1UP5XVLbZDzO4S3VxfFye3XYCznopHy02YjNkHcj5bKaVw2O7hVaBdBjEdQGpie4II1mWhuQ== - dependencies: - js-yaml "^3.13.1" - lcov-parse "^1.0.0" - log-driver "^1.2.7" - minimist "^1.2.5" - request "^2.88.2" - -create-ecdh@^4.0.0: - version "4.0.4" - resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" - integrity sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A== - dependencies: - bn.js "^4.1.0" - elliptic "^6.5.3" - -create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" - integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - md5.js "^1.3.4" - ripemd160 "^2.0.1" - sha.js "^2.4.0" - -create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" - integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== - dependencies: - cipher-base "^1.0.3" - create-hash "^1.1.0" - inherits "^2.0.1" - ripemd160 "^2.0.0" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - -cross-spawn@^7.0.0, cross-spawn@^7.0.2: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" - integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -crypto-browserify@^3.0.0: - version "3.12.0" - resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" - integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== - dependencies: - browserify-cipher "^1.0.0" - browserify-sign "^4.0.0" - create-ecdh "^4.0.0" - create-hash "^1.1.0" - create-hmac "^1.1.0" - diffie-hellman "^5.0.0" - inherits "^2.0.1" - pbkdf2 "^3.0.3" - public-encrypt "^4.0.0" - randombytes "^2.0.0" - randomfill "^1.0.3" - -csv-parse@^4.4.6: - version "4.15.3" - resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-4.15.3.tgz#8a62759617a920c328cb31c351b05053b8f92b10" - integrity sha512-jlTqDvLdHnYMSr08ynNfk4IAUSJgJjTKy2U5CQBSu4cN9vQOJonLVZP4Qo4gKKrIgIQ5dr07UwOJdi+lRqT12w== - -csv-stringify@^1.0.4: - version "1.1.2" - resolved "https://registry.yarnpkg.com/csv-stringify/-/csv-stringify-1.1.2.tgz#77a41526581bce3380f12b00d7c5bbac70c82b58" - integrity sha1-d6QVJlgbzjOA8SsA18W7rHDIK1g= - dependencies: - lodash.get "~4.4.2" - -dash-ast@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/dash-ast/-/dash-ast-1.0.0.tgz#12029ba5fb2f8aa6f0a861795b23c1b4b6c27d37" - integrity sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA== - -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA= - dependencies: - assert-plus "^1.0.0" - -debug@4.3.2, debug@^4.3.2: - version "4.3.2" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" - integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== - dependencies: - ms "2.1.2" - -debug@^4.1.0, debug@^4.1.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" - integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== - dependencies: - ms "2.1.2" - -decamelize@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" - integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= - -decamelize@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" - integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== - -deep-is@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= - -default-require-extensions@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-3.0.0.tgz#e03f93aac9b2b6443fc52e5e4a37b3ad9ad8df96" - integrity sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg== - dependencies: - strip-bom "^4.0.0" - -define-properties@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" - integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== - dependencies: - object-keys "^1.0.12" - -defined@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" - integrity sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM= - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= - -deps-sort@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.1.tgz#9dfdc876d2bcec3386b6829ac52162cda9fa208d" - integrity sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw== - dependencies: - JSONStream "^1.0.3" - shasum-object "^1.0.0" - subarg "^1.0.0" - through2 "^2.0.0" - -des.js@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" - integrity sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA== - dependencies: - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - -detective@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/detective/-/detective-5.2.0.tgz#feb2a77e85b904ecdea459ad897cc90a99bd2a7b" - integrity sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg== - dependencies: - acorn-node "^1.6.1" - defined "^1.0.0" - minimist "^1.1.1" - -diff@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" - integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== - -diffie-hellman@^5.0.0: - version "5.0.3" - resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" - integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== - dependencies: - bn.js "^4.1.0" - miller-rabin "^4.0.0" - randombytes "^2.0.0" - -doctrine@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" - integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== - dependencies: - esutils "^2.0.2" - -domain-browser@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" - integrity sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA== - -duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: - version "0.1.4" - resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" - integrity sha1-ixLauHjA1p4+eJEFFmKjL8a93ME= - dependencies: - readable-stream "^2.0.2" - -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha1-OoOpBOVDUyh4dMVkt1SThoSamMk= - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - -electron-to-chromium@^1.3.723: - version "1.3.750" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.750.tgz#7e5ef6f478316b0bd656af5942fe502610e97eaf" - integrity sha512-Eqy9eHNepZxJXT+Pc5++zvEi5nQ6AGikwFYDCYwXUFBr+ynJ6pDG7MzZmwGYCIuXShLJM0n4bq+aoKDmvSGJ8A== - -electron-to-chromium@^1.3.867: - version "1.3.873" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.873.tgz#c238c9199e4951952fe815a65c1beab5db4826b8" - integrity sha512-TiHlCgl2uP26Z0c67u442c0a2MZCWZNCRnPTQDPhVJ4h9G6z2zU0lApD9H0K9R5yFL5SfdaiVsVD2izOY24xBQ== - -elliptic@^6.5.3: - version "6.5.4" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" - integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== - dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - hash.js "^1.0.0" - hmac-drbg "^1.0.1" - inherits "^2.0.4" - minimalistic-assert "^1.0.1" - minimalistic-crypto-utils "^1.0.1" - -emitter-component@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/emitter-component/-/emitter-component-1.1.1.tgz#065e2dbed6959bf470679edabeaf7981d1003ab6" - integrity sha1-Bl4tvtaVm/RwZ57avq95gdEAOrY= - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -enquirer@^2.3.5: - version "2.3.6" - resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" - integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== - dependencies: - ansi-colors "^4.1.1" - -es6-error@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d" - integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg== - -escalade@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" - integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== - -escape-html@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= - -escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= - -eslint-config-prettier@^6.11.0: - version "6.15.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.15.0.tgz#7f93f6cb7d45a92f1537a70ecc06366e1ac6fed9" - integrity sha512-a1+kOYLR8wMGustcgAjdydMsQ2A/2ipRPwRKUmfYaSxc9ZPcrku080Ctl6zrZzZNs/U82MjSv+qKREkoq3bJaw== - dependencies: - get-stdin "^6.0.0" - -eslint-scope@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-6.0.0.tgz#9cf45b13c5ac8f3d4c50f46a5121f61b3e318978" - integrity sha512-uRDL9MWmQCkaFus8RF5K9/L/2fn+80yoW3jkD53l4shjCh26fCtvJGasxjUqP5OT87SYTxCVA3BwTUzuELx9kA== - dependencies: - esrecurse "^4.3.0" - estraverse "^5.2.0" - -eslint-utils@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" - integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== - dependencies: - eslint-visitor-keys "^2.0.0" - -eslint-visitor-keys@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" - integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== - -eslint-visitor-keys@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186" - integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q== - -eslint@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.0.1.tgz#3610e7fe4a05c2154669515ca60835a76a19f700" - integrity sha512-LsgcwZgQ72vZ+SMp4K6pAnk2yFDWL7Ti4pJaRvsZ0Hsw2h8ZjUIW38a9AFn2cZXdBMlScMFYYgsSp4ttFI/0bA== - dependencies: - "@eslint/eslintrc" "^1.0.3" - "@humanwhocodes/config-array" "^0.6.0" - ajv "^6.10.0" - chalk "^4.0.0" - cross-spawn "^7.0.2" - debug "^4.3.2" - doctrine "^3.0.0" - enquirer "^2.3.5" - escape-string-regexp "^4.0.0" - eslint-scope "^6.0.0" - eslint-utils "^3.0.0" - eslint-visitor-keys "^3.0.0" - espree "^9.0.0" - esquery "^1.4.0" - esutils "^2.0.2" - fast-deep-equal "^3.1.3" - file-entry-cache "^6.0.1" - functional-red-black-tree "^1.0.1" - glob-parent "^6.0.1" - globals "^13.6.0" - ignore "^4.0.6" - import-fresh "^3.0.0" - imurmurhash "^0.1.4" - is-glob "^4.0.0" - js-yaml "^4.1.0" - json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.4.1" - lodash.merge "^4.6.2" - minimatch "^3.0.4" - natural-compare "^1.4.0" - optionator "^0.9.1" - progress "^2.0.0" - regexpp "^3.2.0" - semver "^7.2.1" - strip-ansi "^6.0.0" - strip-json-comments "^3.1.0" - text-table "^0.2.0" - v8-compile-cache "^2.0.3" - -espree@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.0.0.tgz#e90a2965698228502e771c7a58489b1a9d107090" - integrity sha512-r5EQJcYZ2oaGbeR0jR0fFVijGOcwai07/690YRXLINuhmVeRY4UKSAsQPe/0BNuDgwP7Ophoc1PRsr2E3tkbdQ== - dependencies: - acorn "^8.5.0" - acorn-jsx "^5.3.1" - eslint-visitor-keys "^3.0.0" - -esprima@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -esquery@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" - integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== - dependencies: - estraverse "^5.1.0" - -esrecurse@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" - integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== - dependencies: - estraverse "^5.2.0" - -estraverse@^5.1.0, estraverse@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" - integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -events@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/events/-/events-2.1.0.tgz#2a9a1e18e6106e0e812aa9ebd4a819b3c29c0ba5" - integrity sha512-3Zmiobend8P9DjmKAty0Era4jV8oJ0yGYe2nJJAxgymF9+N8F2m0hhZiMoWtcfepExzNKZumFU3ksdQbInGWCg== - -evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" - integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== - dependencies: - md5.js "^1.3.4" - safe-buffer "^5.1.1" - -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= - -extsprintf@^1.2.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" - integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= - -fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" - integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== - -fast-json-stable-stringify@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== - -fast-levenshtein@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= - -fast-safe-stringify@^2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz#124aa885899261f68aedb42a7c080de9da608743" - integrity sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA== - -file-entry-cache@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" - integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== - dependencies: - flat-cache "^3.0.4" - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== - dependencies: - to-regex-range "^5.0.1" - -find-cache-dir@^3.2.0: - version "3.3.1" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.3.1.tgz#89b33fad4a4670daa94f855f7fbe31d6d84fe880" - integrity sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ== - dependencies: - commondir "^1.0.1" - make-dir "^3.0.2" - pkg-dir "^4.1.0" - -find-up@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" - integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== - dependencies: - locate-path "^6.0.0" - path-exists "^4.0.0" - -find-up@^4.0.0, find-up@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - -flat-cache@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" - integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== - dependencies: - flatted "^3.1.0" - rimraf "^3.0.2" - -flat@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" - integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== - -flatted@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.1.1.tgz#c4b489e80096d9df1dfc97c79871aea7c617c469" - integrity sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA== - -foreground-child@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-2.0.0.tgz#71b32800c9f15aa8f2f83f4a6bd9bff35d861a53" - integrity sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA== - dependencies: - cross-spawn "^7.0.0" - signal-exit "^3.0.2" - -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= - -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - -fromentries@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/fromentries/-/fromentries-1.3.2.tgz#e4bca6808816bf8f93b52750f1127f5a6fd86e3a" - integrity sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg== - -fs-readdir-recursive@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" - integrity sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA== - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= - -fsevents@~2.3.1, fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== - -functional-red-black-tree@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= - -gensync@^1.0.0-beta.2: - version "1.0.0-beta.2" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" - integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== - -get-assigned-identifiers@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz#6dbf411de648cbaf8d9169ebb0d2d576191e2ff1" - integrity sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ== - -get-caller-file@^2.0.1, get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-intrinsic@^1.0.2: - version "1.1.1" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" - integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== - dependencies: - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - -get-package-type@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" - integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== - -get-stdin@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" - integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== - -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo= - dependencies: - assert-plus "^1.0.0" - -glob-parent@^5.1.2, glob-parent@^6.0.1, glob-parent@~5.1.0, glob-parent@~5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" - integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== - dependencies: - is-glob "^4.0.1" - -glob@7.1.7: - version "7.1.7" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" - integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -glob@^7.0.0, glob@^7.1.0, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - -globals@^13.6.0: - version "13.7.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.7.0.tgz#aed3bcefd80ad3ec0f0be2cf0c895110c0591795" - integrity sha512-Aipsz6ZKRxa/xQkZhNg0qIWXT6x6rD46f6x/PCnBomlttdIyAPak4YD9jTmKpZ72uROSMU87qJtcgpgHaVchiA== - dependencies: - type-fest "^0.20.2" - -globals@^13.9.0: - version "13.11.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.11.0.tgz#40ef678da117fe7bd2e28f1fab24951bd0255be7" - integrity sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g== - dependencies: - type-fest "^0.20.2" - -graceful-fs@^4.1.15, graceful-fs@^4.1.6: - version "4.2.6" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.6.tgz#ff040b2b0853b23c3d31027523706f1885d76bee" - integrity sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ== - -growl@1.10.5: - version "1.10.5" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" - integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== - -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= - -har-validator@~5.1.3: - version "5.1.5" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" - integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== - dependencies: - ajv "^6.12.3" - har-schema "^2.0.0" - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has-symbols@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" - integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== - -has@^1.0.0, has@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== - dependencies: - function-bind "^1.1.1" - -hash-base@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" - integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== - dependencies: - inherits "^2.0.4" - readable-stream "^3.6.0" - safe-buffer "^5.2.0" - -hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - -hasha@^5.0.0: - version "5.2.2" - resolved "https://registry.yarnpkg.com/hasha/-/hasha-5.2.2.tgz#a48477989b3b327aea3c04f53096d816d97522a1" - integrity sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ== - dependencies: - is-stream "^2.0.0" - type-fest "^0.8.0" - -he@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" - integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== - -hmac-drbg@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - -html-escaper@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" - integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== - -htmlescape@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/htmlescape/-/htmlescape-1.1.1.tgz#3a03edc2214bca3b66424a3e7959349509cb0351" - integrity sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E= - -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha1-muzZJRFHcvPZW2WmCruPfBj7rOE= - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - -https-browserify@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" - integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= - -ieee754@^1.1.4: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -ignore@^4.0.6: - version "4.0.6" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" - integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== - -import-fresh@^3.0.0, import-fresh@^3.2.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" - integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== - dependencies: - parent-module "^1.0.0" - resolve-from "^4.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= - -indent-string@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" - integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -inherits@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.1.tgz#b17d08d326b4423e568eff719f91b0b1cbdf69f1" - integrity sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE= - -inherits@2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" - integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= - -inline-source-map@~0.6.0: - version "0.6.2" - resolved "https://registry.yarnpkg.com/inline-source-map/-/inline-source-map-0.6.2.tgz#f9393471c18a79d1724f863fa38b586370ade2a5" - integrity sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU= - dependencies: - source-map "~0.5.3" - -insert-module-globals@^7.0.0: - version "7.2.1" - resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.2.1.tgz#d5e33185181a4e1f33b15f7bf100ee91890d5cb3" - integrity sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg== - dependencies: - JSONStream "^1.0.3" - acorn-node "^1.5.2" - combine-source-map "^0.8.0" - concat-stream "^1.6.1" - is-buffer "^1.1.0" - path-is-absolute "^1.0.1" - process "~0.11.0" - through2 "^2.0.0" - undeclared-identifiers "^1.1.2" - xtend "^4.0.0" - -is-binary-path@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - -is-buffer@^1.1.0: - version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" - integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== - -is-core-module@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a" - integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ== - dependencies: - has "^1.0.3" - -is-extglob@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" - integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= - -is-finite@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.1.0.tgz#904135c77fb42c0641d6aa1bcdbc4daa8da082f3" - integrity sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w== - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" - integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== - dependencies: - is-extglob "^2.1.1" - -is-integer@^1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/is-integer/-/is-integer-1.0.7.tgz#6bde81aacddf78b659b6629d629cadc51a886d5c" - integrity sha1-a96Bqs3feLZZtmKdYpytxRqIbVw= - dependencies: - is-finite "^1.0.0" - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-plain-obj@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" - integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== - -is-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" - integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== - -is-typedarray@^1.0.0, is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= - -is-unicode-supported@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" - integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== - -is-windows@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" - integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= - -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= - -istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.0.0-alpha.1: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz#f5944a37c70b550b02a78a5c3b2055b280cec8ec" - integrity sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg== - -istanbul-lib-hook@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz#8f84c9434888cc6b1d0a9d7092a76d239ebf0cc6" - integrity sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ== - dependencies: - append-transform "^2.0.0" - -istanbul-lib-instrument@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz#873c6fff897450118222774696a3f28902d77c1d" - integrity sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ== - dependencies: - "@babel/core" "^7.7.5" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.0.0" - semver "^6.3.0" - -istanbul-lib-processinfo@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.2.tgz#e1426514662244b2f25df728e8fd1ba35fe53b9c" - integrity sha512-kOwpa7z9hme+IBPZMzQ5vdQj8srYgAtaRqeI48NGmAQ+/5yKiHLV0QbYqQpxsdEF0+w14SoB8YbnHKcXE2KnYw== - dependencies: - archy "^1.0.0" - cross-spawn "^7.0.0" - istanbul-lib-coverage "^3.0.0-alpha.1" - make-dir "^3.0.0" - p-map "^3.0.0" - rimraf "^3.0.0" - uuid "^3.3.3" - -istanbul-lib-report@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" - integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== - dependencies: - istanbul-lib-coverage "^3.0.0" - make-dir "^3.0.0" - supports-color "^7.1.0" - -istanbul-lib-source-maps@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz#75743ce6d96bb86dc7ee4352cf6366a23f0b1ad9" - integrity sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.0.2.tgz#d593210e5000683750cb09fc0644e4b6e27fd53b" - integrity sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw== - dependencies: - html-escaper "^2.0.0" - istanbul-lib-report "^3.0.0" - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -js-yaml@4.1.0, js-yaml@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" - integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== - dependencies: - argparse "^2.0.1" - -js-yaml@^3.13.1: - version "3.14.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" - integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= - -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== - -jsesc@~0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" - integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= - -json-schema-traverse@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" - integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== - -json-schema@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" - integrity sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM= - -json-stable-stringify-without-jsonify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" - integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= - -json-stable-stringify@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz#611c23e814db375527df851193db59dd2af27f45" - integrity sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U= - dependencies: - jsonify "~0.0.0" - -json-stringify-safe@~5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" - integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= - -json5@^2.1.2: - version "2.2.0" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3" - integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA== - dependencies: - minimist "^1.2.5" - -jsonfile@^2.2.3: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" - integrity sha1-NzaitCi4e72gzIO1P6PWM6NcKug= - optionalDependencies: - graceful-fs "^4.1.6" - -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" - integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= - -jsonparse@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" - integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA= - -jsprim@^1.2.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" - integrity sha1-MT5mvB5cwG5Di8G3SZwuXFastqI= - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.2.3" - verror "1.10.0" - -labeled-stream-splicer@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz#42a41a16abcd46fd046306cf4f2c3576fffb1c21" - integrity sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw== - dependencies: - inherits "^2.0.1" - stream-splicer "^2.0.0" - -lcov-parse@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-1.0.0.tgz#eb0d46b54111ebc561acb4c408ef9363bdc8f7e0" - integrity sha1-6w1GtUER68VhrLTECO+TY73I9+A= - -levn@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" - integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== - dependencies: - prelude-ls "^1.2.1" - type-check "~0.4.0" - -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" - integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== - dependencies: - p-locate "^4.1.0" - -locate-path@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" - integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== - dependencies: - p-locate "^5.0.0" - -lodash.debounce@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" - integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= - -lodash.flattendeep@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz#fb030917f86a3134e5bc9bec0d69e0013ddfedb2" - integrity sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI= - -lodash.get@~4.4.2: - version "4.4.2" - resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" - integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= - -lodash.memoize@~3.0.3: - version "3.0.4" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f" - integrity sha1-LcvSwofLwKVcxCMovQxzYVDVPj8= - -lodash.merge@^4.6.2: - version "4.6.2" - resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" - integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== - -lodash@^4.17.19: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -log-driver@^1.2.7: - version "1.2.7" - resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8" - integrity sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg== - -log-symbols@4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" - integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== - dependencies: - chalk "^4.1.0" - is-unicode-supported "^0.1.0" - -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - -luxon@^1.25.0: - version "1.26.0" - resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.26.0.tgz#d3692361fda51473948252061d0f8561df02b578" - integrity sha512-+V5QIQ5f6CDXQpWNICELwjwuHdqeJM1UenlZWx5ujcRMc9venvluCjFb4t5NYLhb6IhkbMVOxzVuOqkgMxee2A== - -make-dir@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" - integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== - dependencies: - pify "^4.0.1" - semver "^5.6.0" - -make-dir@^3.0.0, make-dir@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" - integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== - dependencies: - semver "^6.0.0" - -md5.js@^1.3.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" - integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -miller-rabin@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" - integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== - dependencies: - bn.js "^4.0.0" - brorand "^1.0.1" - -mime-db@1.46.0: - version "1.46.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.46.0.tgz#6267748a7f799594de3cbc8cde91def349661cee" - integrity sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ== - -mime-types@^2.1.12, mime-types@~2.1.19: - version "2.1.29" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.29.tgz#1d4ab77da64b91f5f72489df29236563754bb1b2" - integrity sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ== - dependencies: - mime-db "1.46.0" - -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== - -minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= - -minimatch@3.0.4, minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - -mkdirp-classic@^0.5.2: - version "0.5.3" - resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" - integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== - -mocha@^9.1.3: - version "9.1.3" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.1.3.tgz#8a623be6b323810493d8c8f6f7667440fa469fdb" - integrity sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw== - dependencies: - "@ungap/promise-all-settled" "1.1.2" - ansi-colors "4.1.1" - browser-stdout "1.3.1" - chokidar "3.5.2" - debug "4.3.2" - diff "5.0.0" - escape-string-regexp "4.0.0" - find-up "5.0.0" - glob "7.1.7" - growl "1.10.5" - he "1.2.0" - js-yaml "4.1.0" - log-symbols "4.1.0" - minimatch "3.0.4" - ms "2.1.3" - nanoid "3.1.25" - serialize-javascript "6.0.0" - strip-json-comments "3.1.1" - supports-color "8.1.1" - which "2.0.2" - workerpool "6.1.5" - yargs "16.2.0" - yargs-parser "20.2.4" - yargs-unparser "2.0.0" - -module-deps@^6.2.3: - version "6.2.3" - resolved "https://registry.yarnpkg.com/module-deps/-/module-deps-6.2.3.tgz#15490bc02af4b56cf62299c7c17cba32d71a96ee" - integrity sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA== - dependencies: - JSONStream "^1.0.3" - browser-resolve "^2.0.0" - cached-path-relative "^1.0.2" - concat-stream "~1.6.0" - defined "^1.0.0" - detective "^5.2.0" - duplexer2 "^0.1.2" - inherits "^2.0.1" - parents "^1.0.0" - readable-stream "^2.0.2" - resolve "^1.4.0" - stream-combiner2 "^1.1.1" - subarg "^1.0.0" - through2 "^2.0.0" - xtend "^4.0.0" - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -ms@2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -nanoid@3.1.25: - version "3.1.25" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.25.tgz#09ca32747c0e543f0e1814b7d3793477f9c8e152" - integrity sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q== - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= - -node-preload@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/node-preload/-/node-preload-0.2.1.tgz#c03043bb327f417a18fee7ab7ee57b408a144301" - integrity sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ== - dependencies: - process-on-spawn "^1.0.0" - -node-releases@^1.1.71: - version "1.1.73" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.73.tgz#dd4e81ddd5277ff846b80b52bb40c49edf7a7b20" - integrity sha512-uW7fodD6pyW2FZNZnp/Z3hvWKeEW1Y8R1+1CnErE8cXFXzl5blBOoVB41CvMer6P6Q0S5FXDwcHgFd1Wj0U9zg== - -node-releases@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.0.tgz#67dc74903100a7deb044037b8a2e5f453bb05400" - integrity sha512-aA87l0flFYMzCHpTM3DERFSYxc6lv/BltdbRTOMZuxZ0cwZCD3mejE5n9vLhSJCN++/eOqr77G1IO5uXxlQYWA== - -normalize-path@^3.0.0, normalize-path@~3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -nyc@^15.1.0: - version "15.1.0" - resolved "https://registry.yarnpkg.com/nyc/-/nyc-15.1.0.tgz#1335dae12ddc87b6e249d5a1994ca4bdaea75f02" - integrity sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A== - dependencies: - "@istanbuljs/load-nyc-config" "^1.0.0" - "@istanbuljs/schema" "^0.1.2" - caching-transform "^4.0.0" - convert-source-map "^1.7.0" - decamelize "^1.2.0" - find-cache-dir "^3.2.0" - find-up "^4.1.0" - foreground-child "^2.0.0" - get-package-type "^0.1.0" - glob "^7.1.6" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-hook "^3.0.0" - istanbul-lib-instrument "^4.0.0" - istanbul-lib-processinfo "^2.0.2" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.0.2" - make-dir "^3.0.0" - node-preload "^0.2.1" - p-map "^3.0.0" - process-on-spawn "^1.0.0" - resolve-from "^5.0.0" - rimraf "^3.0.0" - signal-exit "^3.0.2" - spawn-wrap "^2.0.0" - test-exclude "^6.0.0" - yargs "^15.0.2" - -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - -object-assign@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - -object-keys@^1.0.12, object-keys@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" - integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== - -object.assign@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" - integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== - dependencies: - call-bind "^1.0.0" - define-properties "^1.1.3" - has-symbols "^1.0.1" - object-keys "^1.1.1" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - dependencies: - wrappy "1" - -optionator@^0.9.1: - version "0.9.1" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" - integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== - dependencies: - deep-is "^0.1.3" - fast-levenshtein "^2.0.6" - levn "^0.4.1" - prelude-ls "^1.2.1" - type-check "^0.4.0" - word-wrap "^1.2.3" - -os-browserify@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" - integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= - -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== - dependencies: - p-try "^2.0.0" - -p-limit@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" - integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== - dependencies: - yocto-queue "^0.1.0" - -p-locate@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" - integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== - dependencies: - p-limit "^2.2.0" - -p-locate@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" - integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== - dependencies: - p-limit "^3.0.2" - -p-map@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-3.0.0.tgz#d704d9af8a2ba684e2600d9a215983d4141a979d" - integrity sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ== - dependencies: - aggregate-error "^3.0.0" - -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== - -package-hash@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/package-hash/-/package-hash-4.0.0.tgz#3537f654665ec3cc38827387fc904c163c54f506" - integrity sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ== - dependencies: - graceful-fs "^4.1.15" - hasha "^5.0.0" - lodash.flattendeep "^4.4.0" - release-zalgo "^1.0.0" - -pako@~1.0.5: - version "1.0.11" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" - integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== - -parent-module@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" - integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== - dependencies: - callsites "^3.0.0" - -parents@^1.0.0, parents@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/parents/-/parents-1.0.1.tgz#fedd4d2bf193a77745fe71e371d73c3307d9c751" - integrity sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E= - dependencies: - path-platform "~0.11.15" - -parse-asn1@^5.0.0, parse-asn1@^5.1.5: - version "5.1.6" - resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.6.tgz#385080a3ec13cb62a62d39409cb3e88844cdaed4" - integrity sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw== - dependencies: - asn1.js "^5.2.0" - browserify-aes "^1.0.0" - evp_bytestokey "^1.0.0" - pbkdf2 "^3.0.3" - safe-buffer "^5.1.1" - -path-browserify@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a" - integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ== - -path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" - integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== - -path-is-absolute@^1.0.0, path-is-absolute@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - -path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-parse@^1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -path-platform@~0.11.15: - version "0.11.15" - resolved "https://registry.yarnpkg.com/path-platform/-/path-platform-0.11.15.tgz#e864217f74c36850f0852b78dc7bf7d4a5721bf2" - integrity sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I= - -pbkdf2@^3.0.3: - version "3.1.1" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.1.tgz#cb8724b0fada984596856d1a6ebafd3584654b94" - integrity sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg== - dependencies: - create-hash "^1.1.2" - create-hmac "^1.1.4" - ripemd160 "^2.0.1" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= - -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== - -picomatch@^2.0.4, picomatch@^2.2.1: - version "2.2.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" - integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== - -pify@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" - integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== - -pkg-dir@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" - integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== - dependencies: - find-up "^4.0.0" - -prelude-ls@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" - integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== - -prettier@^2.1.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" - integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== - -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - -process-on-spawn@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/process-on-spawn/-/process-on-spawn-1.0.0.tgz#95b05a23073d30a17acfdc92a440efd2baefdc93" - integrity sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg== - dependencies: - fromentries "^1.2.0" - -process@~0.11.0: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI= - -progress@^2.0.0: - version "2.0.3" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" - integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== - -psl@^1.1.28: - version "1.8.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" - integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== - -public-encrypt@^4.0.0: - version "4.0.3" - resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" - integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== - dependencies: - bn.js "^4.1.0" - browserify-rsa "^4.0.0" - create-hash "^1.1.0" - parse-asn1 "^5.0.0" - randombytes "^2.0.1" - safe-buffer "^5.1.2" - -punycode@1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" - integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= - -punycode@^1.3.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - integrity sha1-wNWmOycYgArY4esPpSachN1BhF4= - -punycode@^2.1.0, punycode@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== - -qs@~6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" - integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== - -querystring-es3@~0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73" - integrity sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM= - -querystring@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" - integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= - -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - -randomfill@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" - integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== - dependencies: - randombytes "^2.0.5" - safe-buffer "^5.1.0" - -read-only-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-only-stream/-/read-only-stream-2.0.0.tgz#2724fd6a8113d73764ac288d4386270c1dbf17f0" - integrity sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A= - dependencies: - readable-stream "^2.0.2" - -readable-stream@^2.0.2, readable-stream@^2.1.0, readable-stream@^2.2.2, readable-stream@~2.3.6: - version "2.3.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" - integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readable-stream@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readdirp@~3.5.0: - version "3.5.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" - integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ== - dependencies: - picomatch "^2.2.1" - -readdirp@~3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" - integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== - dependencies: - picomatch "^2.2.1" - -regenerate-unicode-properties@^8.2.0: - version "8.2.0" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz#e5de7111d655e7ba60c057dbe9ff37c87e65cdec" - integrity sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA== - dependencies: - regenerate "^1.4.0" - -regenerate@^1.4.0: - version "1.4.2" - resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" - integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== - -regenerator-runtime@^0.13.4: - version "0.13.7" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55" - integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew== - -regenerator-transform@^0.14.2: - version "0.14.5" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.5.tgz#c98da154683671c9c4dcb16ece736517e1b7feb4" - integrity sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw== - dependencies: - "@babel/runtime" "^7.8.4" - -regexpp@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.2.0.tgz#0425a2768d8f23bad70ca4b90461fa2f1213e1b2" - integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg== - -regexpu-core@^4.7.1: - version "4.7.1" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.7.1.tgz#2dea5a9a07233298fbf0db91fa9abc4c6e0f8ad6" - integrity sha512-ywH2VUraA44DZQuRKzARmw6S66mr48pQVva4LBeRhcOltJ6hExvWly5ZjFLYo67xbIxb6W1q4bAGtgfEl20zfQ== - dependencies: - regenerate "^1.4.0" - regenerate-unicode-properties "^8.2.0" - regjsgen "^0.5.1" - regjsparser "^0.6.4" - unicode-match-property-ecmascript "^1.0.4" - unicode-match-property-value-ecmascript "^1.2.0" - -regjsgen@^0.5.1: - version "0.5.2" - resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.2.tgz#92ff295fb1deecbf6ecdab2543d207e91aa33733" - integrity sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A== - -regjsparser@^0.6.4: - version "0.6.9" - resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.6.9.tgz#b489eef7c9a2ce43727627011429cf833a7183e6" - integrity sha512-ZqbNRz1SNjLAiYuwY0zoXW8Ne675IX5q+YHioAGbCw4X96Mjl2+dcX9B2ciaeyYjViDAfvIjFpQjJgLttTEERQ== - dependencies: - jsesc "~0.5.0" - -release-zalgo@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/release-zalgo/-/release-zalgo-1.0.0.tgz#09700b7e5074329739330e535c5a90fb67851730" - integrity sha1-CXALflB0Mpc5Mw5TXFqQ+2eFFzA= - dependencies: - es6-error "^4.0.1" - -request@^2.88.2: - version "2.88.2" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= - -require-main-filename@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" - integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== - -resolve-from@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" - integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== - -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - -resolve@^1.1.4, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.4.0: - version "1.20.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" - integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== - dependencies: - is-core-module "^2.2.0" - path-parse "^1.0.6" - -rimraf@^3.0.0, rimraf@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" - integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== - dependencies: - glob "^7.1.3" - -ripemd160@^2.0.0, ripemd160@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" - integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -sax@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" - integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== - -sax@~1.1.1: - version "1.1.6" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.1.6.tgz#5d616be8a5e607d54e114afae55b7eaf2fcc3240" - integrity sha1-XWFr6KXmB9VOEUr65Vt+ry/MMkA= - -semver@7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" - integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== - -semver@^5.6.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== - -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== - -semver@^7.2.1: - version "7.3.5" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" - integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== - dependencies: - lru-cache "^6.0.0" - -serialize-javascript@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" - integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== - dependencies: - randombytes "^2.1.0" - -set-blocking@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" - integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= - -sha.js@^2.4.0, sha.js@^2.4.8, sha.js@~2.4.4: - version "2.4.11" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" - integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== - dependencies: - inherits "^2.0.1" - safe-buffer "^5.0.1" - -shasum-object@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shasum-object/-/shasum-object-1.0.0.tgz#0b7b74ff5b66ecf9035475522fa05090ac47e29e" - integrity sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg== - dependencies: - fast-safe-stringify "^2.0.7" - -shasum@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/shasum/-/shasum-1.0.2.tgz#e7012310d8f417f4deb5712150e5678b87ae565f" - integrity sha1-5wEjENj0F/TetXEhUOVni4euVl8= - dependencies: - json-stable-stringify "~0.0.0" - sha.js "~2.4.4" - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -shell-quote@^1.6.1: - version "1.7.2" - resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" - integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== - -should-equal@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-2.0.0.tgz#6072cf83047360867e68e98b09d71143d04ee0c3" - integrity sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA== - dependencies: - should-type "^1.4.0" - -should-format@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1" - integrity sha1-m/yPdPo5IFxT04w01xcwPidxJPE= - dependencies: - should-type "^1.3.0" - should-type-adaptors "^1.0.1" - -should-type-adaptors@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz#401e7f33b5533033944d5cd8bf2b65027792e27a" - integrity sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA== - dependencies: - should-type "^1.3.0" - should-util "^1.0.0" - -should-type@^1.3.0, should-type@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3" - integrity sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM= - -should-util@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.1.tgz#fb0d71338f532a3a149213639e2d32cbea8bcb28" - integrity sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g== - -should@^13.2.3: - version "13.2.3" - resolved "https://registry.yarnpkg.com/should/-/should-13.2.3.tgz#96d8e5acf3e97b49d89b51feaa5ae8d07ef58f10" - integrity sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ== - dependencies: - should-equal "^2.0.0" - should-format "^3.0.3" - should-type "^1.4.0" - should-type-adaptors "^1.0.1" - should-util "^1.0.0" - -signal-exit@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" - integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== - -simple-concat@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" - integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q== - -slash@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" - integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== - -source-map@^0.5.0, source-map@~0.5.3: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= - -source-map@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -spawn-wrap@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/spawn-wrap/-/spawn-wrap-2.0.0.tgz#103685b8b8f9b79771318827aa78650a610d457e" - integrity sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg== - dependencies: - foreground-child "^2.0.0" - is-windows "^1.0.2" - make-dir "^3.0.0" - rimraf "^3.0.0" - signal-exit "^3.0.2" - which "^2.0.1" - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= - -sshpk@^1.7.0: - version "1.16.1" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" - integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - -stream-browserify@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.2.tgz#87521d38a44aa7ee91ce1cd2a47df0cb49dd660b" - integrity sha512-nX6hmklHs/gr2FuxYDltq8fJA1GDlxKQCz8O/IM4atRqBH8OORmBNgfvW5gG10GT/qQ9u0CzIvr2X5Pkt6ntqg== - dependencies: - inherits "~2.0.1" - readable-stream "^2.0.2" - -stream-combiner2@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/stream-combiner2/-/stream-combiner2-1.1.1.tgz#fb4d8a1420ea362764e21ad4780397bebcb41cbe" - integrity sha1-+02KFCDqNidk4hrUeAOXvry0HL4= - dependencies: - duplexer2 "~0.1.0" - readable-stream "^2.0.2" - -stream-http@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-3.1.1.tgz#0370a8017cf8d050b9a8554afe608f043eaff564" - integrity sha512-S7OqaYu0EkFpgeGFb/NPOoPLxFko7TPqtEeFg5DXPB4v/KETHG0Ln6fRFrNezoelpaDKmycEmmZ81cC9DAwgYg== - dependencies: - builtin-status-codes "^3.0.0" - inherits "^2.0.4" - readable-stream "^3.6.0" - xtend "^4.0.2" - -stream-splicer@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/stream-splicer/-/stream-splicer-2.0.1.tgz#0b13b7ee2b5ac7e0609a7463d83899589a363fcd" - integrity sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg== - dependencies: - inherits "^2.0.1" - readable-stream "^2.0.2" - -stream-transform@^0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/stream-transform/-/stream-transform-0.1.2.tgz#7d8e6b4e03ac4781778f8c79517501bfb0762a9f" - integrity sha1-fY5rTgOsR4F3j4x5UXUBv7B2Kp8= - -stream@0.0.2: - version "0.0.2" - resolved "https://registry.yarnpkg.com/stream/-/stream-0.0.2.tgz#7f5363f057f6592c5595f00bc80a27f5cec1f0ef" - integrity sha1-f1Nj8Ff2WSxVlfALyAon9c7B8O8= - dependencies: - emitter-component "^1.1.1" - -string-to-stream@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string-to-stream/-/string-to-stream-1.1.1.tgz#aba78f73e70661b130ee3e1c0192be4fef6cb599" - integrity sha512-QySF2+3Rwq0SdO3s7BAp4x+c3qsClpPQ6abAmb0DGViiSBAkT5kL6JT2iyzEVP+T1SmzHrQD1TwlP9QAHCc+Sw== - dependencies: - inherits "^2.0.1" - readable-stream "^2.1.0" - -string-width@^4.1.0, string-width@^4.2.0: - version "4.2.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" - integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.0" - -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -strip-ansi@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" - integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== - dependencies: - ansi-regex "^5.0.0" - -strip-bom@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" - integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== - -strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - -subarg@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" - integrity sha1-9izxdYHplrSPyWVpn1TAauJouNI= - dependencies: - minimist "^1.1.0" - -supports-color@8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -syntax-error@^1.1.1: - version "1.4.0" - resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.4.0.tgz#2d9d4ff5c064acb711594a3e3b95054ad51d907c" - integrity sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w== - dependencies: - acorn-node "^1.2.0" - -test-console@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/test-console/-/test-console-2.0.0.tgz#a279f7e2e148815224d8446ffa5208f0077d68fb" - integrity sha512-ciILzfCQCny8zy1+HEw2yBLKus7LNMsAHymsp2fhvGTVh5pWE5v2EB7V+5ag3WM9aO2ULtgsXVQePWYE+fb7pA== - -test-exclude@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" - integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== - dependencies: - "@istanbuljs/schema" "^0.1.2" - glob "^7.1.4" - minimatch "^3.0.4" - -text-table@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= - -through2@^2.0.0: - version "2.0.5" - resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" - integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ== - dependencies: - readable-stream "~2.3.6" - xtend "~4.0.1" - -"through@>=2.2.7 <3": - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= - -timers-browserify@^1.0.1: - version "1.4.2" - resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-1.4.2.tgz#c9c58b575be8407375cb5e2462dacee74359f41d" - integrity sha1-ycWLV1voQHN1y14kYtrO50NZ9B0= - dependencies: - process "~0.11.0" - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - -tty-browserify@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811" - integrity sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw== - -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0= - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= - -type-check@^0.4.0, type-check@~0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" - integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== - dependencies: - prelude-ls "^1.2.1" - -type-fest@^0.20.2: - version "0.20.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" - integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== - -type-fest@^0.8.0: - version "0.8.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" - integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== - -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" - integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== - dependencies: - is-typedarray "^1.0.0" - -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= - -umd@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.3.tgz#aa9fe653c42b9097678489c01000acb69f0b26cf" - integrity sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow== - -undeclared-identifiers@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz#9254c1d37bdac0ac2b52de4b6722792d2a91e30f" - integrity sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw== - dependencies: - acorn-node "^1.3.0" - dash-ast "^1.0.0" - get-assigned-identifiers "^1.2.0" - simple-concat "^1.0.0" - xtend "^4.0.1" - -unicode-canonical-property-names-ecmascript@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz#2619800c4c825800efdd8343af7dd9933cbe2818" - integrity sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ== - -unicode-match-property-ecmascript@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz#8ed2a32569961bce9227d09cd3ffbb8fed5f020c" - integrity sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg== - dependencies: - unicode-canonical-property-names-ecmascript "^1.0.4" - unicode-property-aliases-ecmascript "^1.0.4" - -unicode-match-property-value-ecmascript@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz#0d91f600eeeb3096aa962b1d6fc88876e64ea531" - integrity sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ== - -unicode-property-aliases-ecmascript@^1.0.4: - version "1.1.0" - resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz#dd57a99f6207bedff4628abefb94c50db941c8f4" - integrity sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg== - -uri-js@^4.2.2: - version "4.4.1" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" - integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== - dependencies: - punycode "^2.1.0" - -url@~0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/url/-/url-0.11.0.tgz#3838e97cfc60521eb73c525a8e55bfdd9e2e28f1" - integrity sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE= - dependencies: - punycode "1.3.2" - querystring "0.2.0" - -util-deprecate@^1.0.1, util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= - -util@0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/util/-/util-0.10.3.tgz#7afb1afe50805246489e3db7fe0ed379336ac0f9" - integrity sha1-evsa/lCAUkZInj23/g7TeTNqwPk= - dependencies: - inherits "2.0.1" - -util@~0.10.1: - version "0.10.4" - resolved "https://registry.yarnpkg.com/util/-/util-0.10.4.tgz#3aa0125bfe668a4672de58857d3ace27ecb76901" - integrity sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A== - dependencies: - inherits "2.0.3" - -uuid@^3.3.2, uuid@^3.3.3: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - -v8-compile-cache@^2.0.3: - version "2.3.0" - resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee" - integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== - -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA= - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - -vm-browserify@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" - integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ== - -which-module@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" - integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= - -which@2.0.2, which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -word-wrap@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== - -workerpool@6.1.5: - version "6.1.5" - resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.5.tgz#0f7cf076b6215fd7e1da903ff6f22ddd1886b581" - integrity sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw== - -wrap-ansi@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= - -write-file-atomic@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" - integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== - dependencies: - imurmurhash "^0.1.4" - is-typedarray "^1.0.0" - signal-exit "^3.0.2" - typedarray-to-buffer "^3.1.5" - -xml-js@^1.6.11: - version "1.6.11" - resolved "https://registry.yarnpkg.com/xml-js/-/xml-js-1.6.11.tgz#927d2f6947f7f1c19a316dd8eea3614e8b18f8e9" - integrity sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g== - dependencies: - sax "^1.2.4" - -xmldoc@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/xmldoc/-/xmldoc-0.4.0.tgz#d257224be8393eaacbf837ef227fd8ec25b36888" - integrity sha1-0lciS+g5PqrL+DfvIn/Y7CWzaIg= - dependencies: - sax "~1.1.1" - -xtend@^4.0.0, xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== - -y18n@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" - integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== - -y18n@^5.0.5: - version "5.0.5" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.5.tgz#8769ec08d03b1ea2df2500acef561743bbb9ab18" - integrity sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg== - -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - -yargs-parser@20.2.4: - version "20.2.4" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" - integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== - -yargs-parser@^18.1.2: - version "18.1.3" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" - integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - -yargs-parser@^20.2.2: - version "20.2.7" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a" - integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw== - -yargs-unparser@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" - integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== - dependencies: - camelcase "^6.0.0" - decamelize "^4.0.0" - flat "^5.0.2" - is-plain-obj "^2.1.0" - -yargs@16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== - dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.0" - y18n "^5.0.5" - yargs-parser "^20.2.2" - -yargs@^15.0.2: - version "15.4.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" - integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== - dependencies: - cliui "^6.0.0" - decamelize "^1.2.0" - find-up "^4.1.0" - get-caller-file "^2.0.1" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^4.2.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^18.1.2" - -yocto-queue@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" - integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==