@metriport/shared 0.20.0 → 0.20.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/common/string.d.ts +1 -0
  2. package/dist/common/string.d.ts.map +1 -1
  3. package/dist/common/string.js +5 -1
  4. package/dist/common/string.js.map +1 -1
  5. package/dist/common/titleCase.d.ts +2 -0
  6. package/dist/common/titleCase.d.ts.map +1 -0
  7. package/dist/common/titleCase.js +10 -0
  8. package/dist/common/titleCase.js.map +1 -0
  9. package/dist/domain/address/__tests__/country.test.d.ts +2 -0
  10. package/dist/domain/address/__tests__/country.test.d.ts.map +1 -0
  11. package/dist/domain/address/__tests__/country.test.js +51 -0
  12. package/dist/domain/address/__tests__/country.test.js.map +1 -0
  13. package/dist/domain/address/__tests__/normalize-zip.test.d.ts +1 -1
  14. package/dist/domain/address/country.d.ts +4 -0
  15. package/dist/domain/address/country.d.ts.map +1 -0
  16. package/dist/domain/address/country.js +31 -0
  17. package/dist/domain/address/country.js.map +1 -0
  18. package/dist/domain/db.d.ts +58 -0
  19. package/dist/domain/db.d.ts.map +1 -0
  20. package/dist/domain/db.js +25 -0
  21. package/dist/domain/db.js.map +1 -0
  22. package/dist/index.d.ts +2 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +2 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/interface/external/athenahealth/patient.d.ts +41 -388
  27. package/dist/interface/external/athenahealth/patient.d.ts.map +1 -1
  28. package/dist/interface/external/athenahealth/patient.js +11 -30
  29. package/dist/interface/external/athenahealth/patient.js.map +1 -1
  30. package/dist/interface/external/ehr/athenahealth/appointment.d.ts +79 -0
  31. package/dist/interface/external/ehr/athenahealth/appointment.d.ts.map +1 -0
  32. package/dist/interface/external/ehr/athenahealth/appointment.js +20 -0
  33. package/dist/interface/external/ehr/athenahealth/appointment.js.map +1 -0
  34. package/dist/interface/external/ehr/athenahealth/cx-mapping.d.ts +13 -0
  35. package/dist/interface/external/ehr/athenahealth/cx-mapping.d.ts.map +1 -0
  36. package/dist/interface/external/ehr/athenahealth/cx-mapping.js +9 -0
  37. package/dist/interface/external/ehr/athenahealth/cx-mapping.js.map +1 -0
  38. package/dist/interface/external/ehr/athenahealth/department.d.ts +28 -0
  39. package/dist/interface/external/ehr/athenahealth/department.d.ts.map +1 -0
  40. package/dist/interface/external/ehr/athenahealth/department.js +11 -0
  41. package/dist/interface/external/ehr/athenahealth/department.js.map +1 -0
  42. package/dist/interface/external/ehr/athenahealth/index.d.ts +10 -0
  43. package/dist/interface/external/ehr/athenahealth/index.d.ts.map +1 -0
  44. package/dist/interface/external/ehr/athenahealth/index.js +26 -0
  45. package/dist/interface/external/ehr/athenahealth/index.js.map +1 -0
  46. package/dist/interface/external/ehr/athenahealth/jwt-token.d.ts +46 -0
  47. package/dist/interface/external/ehr/athenahealth/jwt-token.d.ts.map +1 -0
  48. package/dist/interface/external/ehr/athenahealth/jwt-token.js +26 -0
  49. package/dist/interface/external/ehr/athenahealth/jwt-token.js.map +1 -0
  50. package/dist/interface/external/ehr/athenahealth/medication.d.ts +50 -0
  51. package/dist/interface/external/ehr/athenahealth/medication.d.ts.map +1 -0
  52. package/dist/interface/external/ehr/athenahealth/medication.js +19 -0
  53. package/dist/interface/external/ehr/athenahealth/medication.js.map +1 -0
  54. package/dist/interface/external/ehr/athenahealth/patient.d.ts +44 -0
  55. package/dist/interface/external/ehr/athenahealth/patient.d.ts.map +1 -0
  56. package/dist/interface/external/ehr/athenahealth/patient.js +15 -0
  57. package/dist/interface/external/ehr/athenahealth/patient.js.map +1 -0
  58. package/dist/interface/external/ehr/athenahealth/problem.d.ts +27 -0
  59. package/dist/interface/external/ehr/athenahealth/problem.d.ts.map +1 -0
  60. package/dist/interface/external/ehr/athenahealth/problem.js +14 -0
  61. package/dist/interface/external/ehr/athenahealth/problem.js.map +1 -0
  62. package/dist/interface/external/ehr/athenahealth/subscription.d.ts +20 -0
  63. package/dist/interface/external/ehr/athenahealth/subscription.d.ts.map +1 -0
  64. package/dist/interface/external/ehr/athenahealth/subscription.js +11 -0
  65. package/dist/interface/external/ehr/athenahealth/subscription.js.map +1 -0
  66. package/dist/interface/external/ehr/athenahealth/vitals.d.ts +82 -0
  67. package/dist/interface/external/ehr/athenahealth/vitals.d.ts.map +1 -0
  68. package/dist/interface/external/ehr/athenahealth/vitals.js +15 -0
  69. package/dist/interface/external/ehr/athenahealth/vitals.js.map +1 -0
  70. package/dist/interface/external/ehr/canvas/appointment.d.ts +152 -0
  71. package/dist/interface/external/ehr/canvas/appointment.d.ts.map +1 -0
  72. package/dist/interface/external/ehr/canvas/appointment.js +23 -0
  73. package/dist/interface/external/ehr/canvas/appointment.js.map +1 -0
  74. package/dist/interface/external/ehr/canvas/index.d.ts +3 -0
  75. package/dist/interface/external/ehr/canvas/index.d.ts.map +1 -0
  76. package/dist/interface/external/ehr/canvas/index.js +19 -0
  77. package/dist/interface/external/ehr/canvas/index.js.map +1 -0
  78. package/dist/interface/external/ehr/canvas/jwt-token.d.ts +58 -0
  79. package/dist/interface/external/ehr/canvas/jwt-token.d.ts.map +1 -0
  80. package/dist/interface/external/ehr/canvas/jwt-token.js +31 -0
  81. package/dist/interface/external/ehr/canvas/jwt-token.js.map +1 -0
  82. package/dist/interface/external/ehr/elation/appointment.d.ts +68 -0
  83. package/dist/interface/external/ehr/elation/appointment.d.ts.map +1 -0
  84. package/dist/interface/external/ehr/elation/appointment.js +15 -0
  85. package/dist/interface/external/ehr/elation/appointment.js.map +1 -0
  86. package/dist/interface/external/ehr/elation/index.d.ts +5 -0
  87. package/dist/interface/external/ehr/elation/index.d.ts.map +1 -0
  88. package/dist/interface/external/ehr/elation/index.js +21 -0
  89. package/dist/interface/external/ehr/elation/index.js.map +1 -0
  90. package/dist/interface/external/ehr/elation/jwt-token.d.ts +61 -0
  91. package/dist/interface/external/ehr/elation/jwt-token.d.ts.map +1 -0
  92. package/dist/interface/external/ehr/elation/jwt-token.js +32 -0
  93. package/dist/interface/external/ehr/elation/jwt-token.js.map +1 -0
  94. package/dist/interface/external/ehr/elation/patient.d.ts +96 -0
  95. package/dist/interface/external/ehr/elation/patient.d.ts.map +1 -0
  96. package/dist/interface/external/ehr/elation/patient.js +33 -0
  97. package/dist/interface/external/ehr/elation/patient.js.map +1 -0
  98. package/dist/interface/external/ehr/elation/problem.d.ts +10 -0
  99. package/dist/interface/external/ehr/elation/problem.d.ts.map +1 -0
  100. package/dist/interface/external/ehr/elation/problem.js +8 -0
  101. package/dist/interface/external/ehr/elation/problem.js.map +1 -0
  102. package/dist/interface/external/ehr/index.d.ts +3 -0
  103. package/dist/interface/external/ehr/index.d.ts.map +1 -0
  104. package/dist/interface/external/ehr/index.js +19 -0
  105. package/dist/interface/external/ehr/index.js.map +1 -0
  106. package/dist/interface/external/ehr/patient.d.ts +250 -0
  107. package/dist/interface/external/ehr/patient.d.ts.map +1 -0
  108. package/dist/interface/external/ehr/patient.js +35 -0
  109. package/dist/interface/external/ehr/patient.js.map +1 -0
  110. package/dist/interface/external/ehr/source.d.ts +13 -0
  111. package/dist/interface/external/ehr/source.d.ts.map +1 -0
  112. package/dist/interface/external/ehr/source.js +25 -0
  113. package/dist/interface/external/ehr/source.js.map +1 -0
  114. package/dist/interface/external/elation/patient.d.ts +10 -10
  115. package/dist/interface/external/elation/subscription.d.ts +1 -1
  116. package/dist/interface/external/index.d.ts +2 -0
  117. package/dist/interface/external/index.d.ts.map +1 -0
  118. package/dist/interface/external/index.js +18 -0
  119. package/dist/interface/external/index.js.map +1 -0
  120. package/dist/interface/external/shared/ehr/patient.d.ts +32 -32
  121. package/dist/interface/index.d.ts +1 -0
  122. package/dist/interface/index.d.ts.map +1 -1
  123. package/dist/interface/index.js +1 -0
  124. package/dist/interface/index.js.map +1 -1
  125. package/package.json +2 -2
@@ -1,3 +1,4 @@
1
1
  export declare function limitStringLength<T extends string | undefined>(value: T, max?: number, suffix?: string): T;
2
2
  export declare function stripNonNumericChars(str: string): string;
3
+ export declare function stripPeriods(str: string): string;
3
4
  //# sourceMappingURL=string.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/common/string.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,EAC5D,KAAK,EAAE,CAAC,EACR,GAAG,SAAM,EACT,MAAM,SAAQ,GACb,CAAC,CAOH;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExD"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/common/string.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,SAAS,EAC5D,KAAK,EAAE,CAAC,EACR,GAAG,SAAM,EACT,MAAM,SAAQ,GACb,CAAC,CAOH;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stripNonNumericChars = exports.limitStringLength = void 0;
3
+ exports.stripPeriods = exports.stripNonNumericChars = exports.limitStringLength = void 0;
4
4
  function limitStringLength(value, max = 255, suffix = "...") {
5
5
  if (!value)
6
6
  return value;
@@ -13,4 +13,8 @@ function stripNonNumericChars(str) {
13
13
  return str.trim().replace(/\D/g, "");
14
14
  }
15
15
  exports.stripNonNumericChars = stripNonNumericChars;
16
+ function stripPeriods(str) {
17
+ return str.trim().replace(/\./g, "");
18
+ }
19
+ exports.stripPeriods = stripPeriods;
16
20
  //# sourceMappingURL=string.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/common/string.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB,CAC/B,KAAQ,EACR,GA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0,0 +1,2 @@
1
+ export declare function toTitleCase(str: string): string;
2
+ //# sourceMappingURL=titleCase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"titleCase.d.ts","sourceRoot":"","sources":["../../src/common/titleCase.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG/C"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toTitleCase = void 0;
4
+ const lodash_1 = require("lodash");
5
+ function toTitleCase(str) {
6
+ const trimmedStr = str.trim();
7
+ return (0, lodash_1.startCase)(trimmedStr.toLowerCase());
8
+ }
9
+ exports.toTitleCase = toTitleCase;
10
+ //# sourceMappingURL=titleCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"titleCase.js","sourceRoot":"","sources":["../../src/common/titleCase.ts"],"names":[],"mappings":";;;AAAA,mCAAmC;AAEnC,SAAgB,WAAW,CAAC,GAAW;IACrC,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,OAAO,IAAA,kBAAS,EAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AAC7C,CAAC;AAHD,kCAGC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=country.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country.test.d.ts","sourceRoot":"","sources":["../../../../src/domain/address/__tests__/country.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const country_1 = require("../country");
4
+ describe("country", () => {
5
+ describe("normalizeCountrySafe", () => {
6
+ it("should return undefined when it gets empty string", () => {
7
+ const input = "";
8
+ expect((0, country_1.normalizeCountrySafe)(input)).toBeUndefined();
9
+ });
10
+ it("should return undefined when it gets space", () => {
11
+ const input = " ";
12
+ expect((0, country_1.normalizeCountrySafe)(input)).toBeUndefined();
13
+ });
14
+ const countries = [
15
+ country_1.normalizedCountryUsa,
16
+ "US",
17
+ "U.S",
18
+ "U.S.",
19
+ "U.S.A",
20
+ "UNITED STATES",
21
+ "UNITED STATES OF AMERICA",
22
+ ];
23
+ for (const country of countries) {
24
+ it(`valid - ${country}`, () => {
25
+ const result = (0, country_1.normalizeCountrySafe)(country);
26
+ expect(result).toBe(country_1.normalizedCountryUsa);
27
+ });
28
+ }
29
+ for (const country of countries.map(c => c.toLowerCase())) {
30
+ it(`valid - ${country}`, () => {
31
+ const result = (0, country_1.normalizeCountrySafe)(country);
32
+ expect(result).toBe(country_1.normalizedCountryUsa);
33
+ });
34
+ }
35
+ it("should trim input prefix", () => {
36
+ const expectedOutput = country_1.normalizedCountryUsa;
37
+ const input = " " + expectedOutput;
38
+ expect((0, country_1.normalizeCountrySafe)(input)).toBe(expectedOutput);
39
+ });
40
+ it("should trim input suffix", () => {
41
+ const expectedOutput = country_1.normalizedCountryUsa;
42
+ const input = expectedOutput + " ";
43
+ expect((0, country_1.normalizeCountrySafe)(input)).toBe(expectedOutput);
44
+ });
45
+ it("should return undefined when it gets invalid country", () => {
46
+ const input = "germany";
47
+ expect((0, country_1.normalizeCountrySafe)(input)).toBeUndefined();
48
+ });
49
+ });
50
+ });
51
+ //# sourceMappingURL=country.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country.test.js","sourceRoot":"","sources":["../../../../src/domain/address/__tests__/country.test.ts"],"names":[],"mappings":";;AAAA,wCAAwE;AAExE,QAAQ,CAAC,SAAS,EAAE,GAAG,EAAE;IACvB,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC3D,MAAM,KAAK,GAAG,EAAE,CAAC;YACjB,MAAM,CAAC,IAAA,8BAAoB,EAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACtD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4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AAK,GAAG,cAAc,GAAG,GAAG,CAAC;YACnC,MAAM,CAAC,IAAA,8BAAoB,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;YAC9D,MAAM,KAAK,GAAG,SAAS,CAAC;YACxB,MAAM,CAAC,IAAA,8BAAoB,EAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=normalize-zip.test.d.ts.map
2
+ //# sourceMappingURL=normalize-zip.test.d.ts.map
@@ -0,0 +1,4 @@
1
+ export declare const normalizedCountryUsa = "USA";
2
+ export declare function normalizeCountrySafe(country: string, normalizeBase?: (country: string) => string): string | undefined;
3
+ export declare function normalizeCountry(country: string): string;
4
+ //# sourceMappingURL=country.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country.d.ts","sourceRoot":"","sources":["../../../src/domain/address/country.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAW1C,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,aAAa,GAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAA6B,GAChE,MAAM,GAAG,SAAS,CAIpB;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMxD"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeCountry = exports.normalizeCountrySafe = exports.normalizedCountryUsa = void 0;
4
+ const string_1 = require("../../common/string");
5
+ const bad_request_1 = require("../../error/bad-request");
6
+ const validCountryStrings = ["US", "USA", "UNITED STATES", "UNITED STATES OF AMERICA"];
7
+ exports.normalizedCountryUsa = "USA";
8
+ function isValidCountry(country) {
9
+ if (!validCountryStrings.includes(country))
10
+ return false;
11
+ return true;
12
+ }
13
+ function normalizeCountryBase(country) {
14
+ return (0, string_1.stripPeriods)(country.trim().toUpperCase());
15
+ }
16
+ function normalizeCountrySafe(country, normalizeBase = normalizeCountryBase) {
17
+ const baseCountry = normalizeBase(country);
18
+ if (!isValidCountry(baseCountry))
19
+ return undefined;
20
+ return exports.normalizedCountryUsa;
21
+ }
22
+ exports.normalizeCountrySafe = normalizeCountrySafe;
23
+ function normalizeCountry(country) {
24
+ const countryOrUndefined = normalizeCountrySafe(country);
25
+ if (!countryOrUndefined) {
26
+ throw new bad_request_1.BadRequestError("Invalid country", undefined, { country });
27
+ }
28
+ return countryOrUndefined;
29
+ }
30
+ exports.normalizeCountry = normalizeCountry;
31
+ //# sourceMappingURL=country.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country.js","sourceRoot":"","sources":["../../../src/domain/address/country.ts"],"names":[],"mappings":";;;AAAA,gDAAmD;AACnD,yDAA0D;AAE1D,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,0BAA0B,CAAC,CAAC;AAE1E,QAAA,oBAAoB,GAAG,KAAK,CAAC;AAE1C,SAAS,cAAc,CAAC,OAAe;IACrC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IACzD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAe;IAC3C,OAAO,IAAA,qBAAY,EAAC,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,SAAgB,oBAAoB,CAClC,OAAe,EACf,gBAA6C,oBAAoB;IAEjE,MAAM,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC;QAAE,OAAO,SAAS,CAAC;IACnD,OAAO,4BAAoB,CAAC;AAC9B,CAAC;AAPD,oDAOC;AAED,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACzD,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,IAAI,6BAAe,CAAC,iBAAiB,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;KACtE;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAND,4CAMC"}
@@ -0,0 +1,58 @@
1
+ import { z } from "zod";
2
+ import { Dialect } from "sequelize";
3
+ export declare const dbCredsSchema: z.ZodObject<{
4
+ dbname: z.ZodString;
5
+ username: z.ZodString;
6
+ password: z.ZodString;
7
+ host: z.ZodString;
8
+ port: z.ZodNumber;
9
+ engine: z.ZodType<Dialect, z.ZodTypeDef, Dialect>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ dbname: string;
12
+ username: string;
13
+ password: string;
14
+ host: string;
15
+ port: number;
16
+ engine: Dialect;
17
+ }, {
18
+ dbname: string;
19
+ username: string;
20
+ password: string;
21
+ host: string;
22
+ port: number;
23
+ engine: Dialect;
24
+ }>;
25
+ export declare const dbCredsSchemaReadOnly: z.ZodObject<Omit<{
26
+ dbname: z.ZodString;
27
+ username: z.ZodString;
28
+ password: z.ZodString;
29
+ host: z.ZodString;
30
+ port: z.ZodNumber;
31
+ engine: z.ZodType<Dialect, z.ZodTypeDef, Dialect>;
32
+ }, "dbname" | "username" | "password" | "engine">, "strip", z.ZodTypeAny, {
33
+ host: string;
34
+ port: number;
35
+ }, {
36
+ host: string;
37
+ port: number;
38
+ }>;
39
+ export type DbCreds = z.infer<typeof dbCredsSchema>;
40
+ export type DbCredsReadOnly = z.infer<typeof dbCredsSchemaReadOnly>;
41
+ export declare const dbPoolSettingsSchema: z.ZodObject<{
42
+ max: z.ZodNumber;
43
+ min: z.ZodNumber;
44
+ acquire: z.ZodNumber;
45
+ idle: z.ZodNumber;
46
+ }, "strip", z.ZodTypeAny, {
47
+ min: number;
48
+ max: number;
49
+ acquire: number;
50
+ idle: number;
51
+ }, {
52
+ min: number;
53
+ max: number;
54
+ acquire: number;
55
+ idle: number;
56
+ }>;
57
+ export type DbPoolSettings = z.infer<typeof dbPoolSettingsSchema>;
58
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/domain/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;EAOxB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;EAKhC,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;EAK/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dbPoolSettingsSchema = exports.dbCredsSchemaReadOnly = exports.dbCredsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.dbCredsSchema = zod_1.z.object({
6
+ dbname: zod_1.z.string(),
7
+ username: zod_1.z.string(),
8
+ password: zod_1.z.string(),
9
+ host: zod_1.z.string(),
10
+ port: zod_1.z.number(),
11
+ engine: zod_1.z.custom(),
12
+ });
13
+ exports.dbCredsSchemaReadOnly = exports.dbCredsSchema.omit({
14
+ dbname: true,
15
+ username: true,
16
+ password: true,
17
+ engine: true,
18
+ });
19
+ exports.dbPoolSettingsSchema = zod_1.z.object({
20
+ max: zod_1.z.number(),
21
+ min: zod_1.z.number(),
22
+ acquire: zod_1.z.number(),
23
+ idle: zod_1.z.number(),
24
+ });
25
+ //# sourceMappingURL=db.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/domain/db.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAGX,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAW;CAC5B,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,qBAAa,CAAC,IAAI,CAAC;IACtD,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAKU,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export { toTitleCase } from "./common/title-case";
16
16
  export { AtLeastOne, stringToBoolean } from "./common/types";
17
17
  export { validateNPI } from "./common/validate-npi";
18
18
  export * from "./domain/address/index";
19
+ export * from "./domain/address/country";
19
20
  export * from "./domain/address/state";
20
21
  export * from "./domain/address/territory";
21
22
  export * from "./domain/address/zip";
@@ -31,6 +32,7 @@ export * from "./domain/patient/patient-import";
31
32
  export * from "./domain/secrets";
32
33
  export * from "./domain/rate-limiting";
33
34
  export * from "./domain/jwt-token";
35
+ export * from "./domain/db";
34
36
  export { BadRequestError } from "./error/bad-request";
35
37
  export { MetriportError, AdditionalInfo } from "./error/metriport-error";
36
38
  export { NotFoundError } from "./error/not-found";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC9D,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC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WAAW,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -61,6 +61,7 @@ Object.defineProperty(exports, "stringToBoolean", { enumerable: true, get: funct
61
61
  var validate_npi_1 = require("./common/validate-npi");
62
62
  Object.defineProperty(exports, "validateNPI", { enumerable: true, get: function () { return validate_npi_1.validateNPI; } });
63
63
  __exportStar(require("./domain/address/index"), exports);
64
+ __exportStar(require("./domain/address/country"), exports);
64
65
  __exportStar(require("./domain/address/state"), exports);
65
66
  __exportStar(require("./domain/address/territory"), exports);
66
67
  __exportStar(require("./domain/address/zip"), exports);
@@ -77,6 +78,7 @@ __exportStar(require("./domain/patient/patient-import"), exports);
77
78
  __exportStar(require("./domain/secrets"), exports);
78
79
  __exportStar(require("./domain/rate-limiting"), exports);
79
80
  __exportStar(require("./domain/jwt-token"), exports);
81
+ __exportStar(require("./domain/db"), exports);
80
82
  var bad_request_1 = require("./error/bad-request");
81
83
  Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return bad_request_1.BadRequestError; } });
82
84
  var metriport_error_1 = require("./error/metriport-error");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,wCAAyC;AAAhC,gGAAA,OAAO,OAAA;AAChB,4CAA0C;AAAjC,iGAAA,MAAM,OAAA;AACf,sCAAwF;AAA/E,kGAAA,UAAU,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAAE,+GAAA,uBAAuB,OAAA;AAChE,wCAA8D;AAArD,qHAAA,4BAA4B,OAAA;AACrC,mDAAiC;AACjC,4CAAiD;AAAxC,wGAAA,aAAa,OAAA;AACtB,0EAAwE;AAA/D,+HAAA,qBAAqB,OAAA;AAC9B,oCAA0C;AAAjC,iGAAA,UAAU,OAAA;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