Skip to content

Commit

Permalink
feat(primitives): expose FHIR versioning
Browse files Browse the repository at this point in the history
Only providing R4 for now.
  • Loading branch information
tangdrew committed Jan 25, 2019
1 parent d7fe4c4 commit f40d24d
Show file tree
Hide file tree
Showing 42 changed files with 88 additions and 81 deletions.
2 changes: 1 addition & 1 deletion packages/primitives/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|\\.(test))\\.(ts|tsx|js)$",
"testRegex": "test/.*.test.ts",
"moduleFileExtensions": [
"ts",
"tsx",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Type, success, failure } from "io-ts";
*/
export class Decimal extends Big {
private dp: number;
constructor(n) {
constructor(n: string | number) {
super(n);
this.dp = this.decimalPlaces(n);
}
Expand Down
File renamed without changes.
64 changes: 64 additions & 0 deletions packages/primitives/src/R4/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* FHIR R4 Primitive Runtime Types
*/

import { Base64BinaryType, base64binary } from "./base64binary";
import { BooleanType, boolean } from "./boolean";
import { CanonicalType, canonical } from "./canonical";
import { CodeType, code } from "./code";
import { DateType, date } from "./date";
import { DateTimeType, dateTime } from "./dateTime";
import { DecimalType, decimal } from "./decimal";
import { IDType, id } from "./id";
import { InstantType, instant } from "./instant";
import { IntegerType, integer } from "./integer";
import { MarkdownType, markdown } from "./markdown";
import { OIDType, oid } from "./oid";
import { PositiveIntegerType, positiveInt } from "./positiveInt";
import { StringType, string } from "./string";
import { TimeType, time } from "./time";
import { UnsignedIntegerType, unsignedInt } from "./unsignedInt";
import { URIType, uri } from "./uri";
import { URLType, url } from "./url";
import { UUIDType, uuid } from "./uuid";

export {
base64binary,
Base64BinaryType,
boolean,
BooleanType,
canonical,
CanonicalType,
code,
CodeType,
date,
DateType,
dateTime,
DateTimeType,
decimal,
DecimalType,
id,
IDType,
instant,
InstantType,
integer,
IntegerType,
markdown,
MarkdownType,
oid,
OIDType,
positiveInt,
PositiveIntegerType,
string,
StringType,
time,
TimeType,
unsignedInt,
UnsignedIntegerType,
uri,
URIType,
url,
URLType,
uuid,
UUIDType
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
61 changes: 2 additions & 59 deletions packages/primitives/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,6 @@
* FHIR Primitive Runtime Types
*/

import { Base64BinaryType, base64binary } from "./base64binary";
import { BooleanType, boolean } from "./boolean";
import { CanonicalType, canonical } from "./canonical";
import { CodeType, code } from "./code";
import { DateType, date } from "./date";
import { DateTimeType, dateTime } from "./dateTime";
import { DecimalType, decimal } from "./decimal";
import { IDType, id } from "./id";
import { InstantType, instant } from "./instant";
import { IntegerType, integer } from "./integer";
import { MarkdownType, markdown } from "./markdown";
import { OIDType, oid } from "./oid";
import { PositiveIntegerType, positiveInt } from "./positiveInt";
import { StringType, string } from "./string";
import { TimeType, time } from "./time";
import { UnsignedIntegerType, unsignedInt } from "./unsignedInt";
import { URIType, uri } from "./uri";
import { URLType, url } from "./url";
import { UUIDType, uuid } from "./uuid";
import * as R4 from "./R4";

export {
base64binary,
Base64BinaryType,
boolean,
BooleanType,
canonical,
CanonicalType,
code,
CodeType,
date,
DateType,
dateTime,
DateTimeType,
decimal,
DecimalType,
id,
IDType,
instant,
InstantType,
integer,
IntegerType,
markdown,
MarkdownType,
oid,
OIDType,
positiveInt,
PositiveIntegerType,
string,
StringType,
time,
TimeType,
unsignedInt,
UnsignedIntegerType,
uri,
URIType,
url,
URLType,
uuid,
UUIDType
};
export { R4 };
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for Base64Binary Runtime Type
*/

import { base64binary } from "../src";
import { base64binary } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("Base64BinaryType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for Boolean Runtime Type
*/

import { boolean } from "../src";
import { boolean } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("BooleanType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";
import { canonical } from "../src";
import { canonical } from "../../src/R4";

describe("CanonicalType", () => {
it("should succeed validating a valid value", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for Code Runtime Type
*/

import { code } from "../src";
import { code } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("CodeType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for Date Runtime Type
*/

import { date } from "../src";
import { date } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("DateType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for DateTime Runtime Type
*/

import { dateTime } from "../src";
import { dateTime } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("DateTimeType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*/

import { assertSuccess, assertFailure } from "./helpers";
import { decimal } from "../src";
import { Decimal } from "../src/decimal";
import { decimal } from "../../src/R4";
import { Decimal } from "../../src/R4/decimal";

describe("DecimalType", () => {
it("should succeed validating a valid value", () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";
import { id } from "../src";
import { id } from "../../src/R4";

describe("IDType", () => {
it("should succeed validating a valid value", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for Instant Runtime Type
*/

import { instant } from "../src";
import { instant } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("InstantType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for Integer Runtime Type
*/

import { integer } from "../src";
import { integer } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("IntegerType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for Markdown Runtime Type
*/

import { markdown } from "../src";
import { markdown } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("MarkdownType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";
import { oid } from "../src";
import { oid } from "../../src/R4";

describe("OIDType", () => {
it("should succeed validating a valid value", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for Postive Integer Runtime Type
*/

import { positiveInt } from "../src";
import { positiveInt } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("PositiveIntegerType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for String Runtime Type
*/

import { string } from "../src";
import { string } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("StringType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for Time Runtime Type
*/

import { time } from "../src";
import { time } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("TimeType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tests for Unsigned Integer Runtime Type
*/

import { unsignedInt } from "../src";
import { unsignedInt } from "../../src/R4";
import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";

describe("UnsignedIntegerType", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";
import { uri } from "../src";
import { uri } from "../../src/R4";

describe("URIType", () => {
it("should succeed validating a valid value", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";
import { url } from "../src";
import { url } from "../../src/R4";

describe("URLType", () => {
it("should succeed validating a valid value", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { assertSuccess, assertFailure, assertStrictEqual } from "./helpers";
import { uuid } from "../src";
import { uuid } from "../../src/R4";

describe("UUIDType", () => {
it("should succeed validating a valid value", () => {
Expand Down

0 comments on commit f40d24d

Please sign in to comment.