@metriport/shared 0.22.0-alpha.2 → 0.23.0-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 (120) hide show
  1. package/dist/common/__tests__/date.test.js +63 -3
  2. package/dist/common/__tests__/date.test.js.map +1 -1
  3. package/dist/common/__tests__/number.test.d.ts +2 -0
  4. package/dist/common/__tests__/number.test.d.ts.map +1 -0
  5. package/dist/common/__tests__/number.test.js +33 -0
  6. package/dist/common/__tests__/number.test.js.map +1 -0
  7. package/dist/common/date.d.ts +1 -0
  8. package/dist/common/date.d.ts.map +1 -1
  9. package/dist/common/date.js +34 -5
  10. package/dist/common/date.js.map +1 -1
  11. package/dist/common/numbers.d.ts +1 -0
  12. package/dist/common/numbers.d.ts.map +1 -1
  13. package/dist/common/numbers.js +11 -1
  14. package/dist/common/numbers.js.map +1 -1
  15. package/dist/common/timer.d.ts +18 -0
  16. package/dist/common/timer.d.ts.map +1 -0
  17. package/dist/common/timer.js +26 -0
  18. package/dist/common/timer.js.map +1 -0
  19. package/dist/domain/job/job-status.d.ts +15 -0
  20. package/dist/domain/job/job-status.d.ts.map +1 -0
  21. package/dist/domain/job/job-status.js +52 -0
  22. package/dist/domain/job/job-status.js.map +1 -0
  23. package/dist/domain/job/patient-job.d.ts +22 -0
  24. package/dist/domain/job/patient-job.d.ts.map +1 -0
  25. package/dist/domain/job/patient-job.js +3 -0
  26. package/dist/domain/job/patient-job.js.map +1 -0
  27. package/dist/domain/job/types.d.ts +8 -0
  28. package/dist/domain/job/types.d.ts.map +1 -0
  29. package/dist/domain/job/types.js +10 -0
  30. package/dist/domain/job/types.js.map +1 -0
  31. package/dist/domain/patient/patient-import/__tests__/status.test.d.ts +2 -0
  32. package/dist/domain/patient/patient-import/__tests__/status.test.d.ts.map +1 -0
  33. package/dist/domain/patient/patient-import/__tests__/status.test.js +74 -0
  34. package/dist/domain/patient/patient-import/__tests__/status.test.js.map +1 -0
  35. package/dist/domain/patient/patient-import/__tests__/types.d.ts +4 -0
  36. package/dist/domain/patient/patient-import/__tests__/types.d.ts.map +1 -0
  37. package/dist/domain/patient/patient-import/__tests__/types.js +20 -0
  38. package/dist/domain/patient/patient-import/__tests__/types.js.map +1 -0
  39. package/dist/domain/patient/patient-import/__tests__/types.test.d.ts +2 -0
  40. package/dist/domain/patient/patient-import/__tests__/types.test.d.ts.map +1 -0
  41. package/dist/domain/patient/patient-import/__tests__/types.test.js +69 -0
  42. package/dist/domain/patient/patient-import/__tests__/types.test.js.map +1 -0
  43. package/dist/domain/patient/patient-import/create.d.ts +19 -0
  44. package/dist/domain/patient/patient-import/create.d.ts.map +1 -0
  45. package/dist/domain/patient/patient-import/create.js +49 -0
  46. package/dist/domain/patient/patient-import/create.js.map +1 -0
  47. package/dist/domain/patient/patient-import/mapping.d.ts +21 -0
  48. package/dist/domain/patient/patient-import/mapping.d.ts.map +1 -0
  49. package/dist/{validators/driver-license/interfaces.js → domain/patient/patient-import/mapping.js} +1 -1
  50. package/dist/domain/patient/patient-import/mapping.js.map +1 -0
  51. package/dist/domain/patient/patient-import/metadata.d.ts +9 -0
  52. package/dist/domain/patient/patient-import/metadata.d.ts.map +1 -0
  53. package/dist/domain/patient/patient-import/metadata.js +22 -0
  54. package/dist/domain/patient/patient-import/metadata.js.map +1 -0
  55. package/dist/domain/patient/patient-import/schemas.d.ts +39 -0
  56. package/dist/domain/patient/patient-import/schemas.d.ts.map +1 -0
  57. package/dist/domain/patient/patient-import/schemas.js +42 -0
  58. package/dist/domain/patient/patient-import/schemas.js.map +1 -0
  59. package/dist/domain/patient/patient-import/status.d.ts +13 -0
  60. package/dist/domain/patient/patient-import/status.d.ts.map +1 -0
  61. package/dist/domain/patient/patient-import/status.js +48 -0
  62. package/dist/domain/patient/patient-import/status.js.map +1 -0
  63. package/dist/domain/patient/patient-import/types.d.ts +41 -0
  64. package/dist/domain/patient/patient-import/types.d.ts.map +1 -0
  65. package/dist/domain/patient/patient-import/types.js +10 -0
  66. package/dist/domain/patient/patient-import/types.js.map +1 -0
  67. package/dist/index.d.ts +4 -1
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +4 -1
  70. package/dist/index.js.map +1 -1
  71. package/dist/interface/external/ehr/elation/patient.d.ts +6 -6
  72. package/dist/interface/external/ehr/fhir-resource.d.ts +122 -0
  73. package/dist/interface/external/ehr/fhir-resource.d.ts.map +1 -0
  74. package/dist/interface/external/ehr/fhir-resource.js +34 -0
  75. package/dist/interface/external/ehr/fhir-resource.js.map +1 -0
  76. package/dist/interface/external/ehr/index.d.ts +1 -0
  77. package/dist/interface/external/ehr/index.d.ts.map +1 -1
  78. package/dist/interface/external/ehr/index.js +1 -0
  79. package/dist/interface/external/ehr/index.js.map +1 -1
  80. package/dist/interface/external/ehr/patient.d.ts +12 -12
  81. package/dist/interface/external/ehr/resource-diff.d.ts +7 -0
  82. package/dist/interface/external/ehr/resource-diff.d.ts.map +1 -0
  83. package/dist/interface/external/ehr/resource-diff.js +12 -0
  84. package/dist/interface/external/ehr/resource-diff.js.map +1 -0
  85. package/dist/medical/webhook/webhook-request.d.ts +72 -59
  86. package/dist/medical/webhook/webhook-request.d.ts.map +1 -1
  87. package/dist/medical/webhook/webhook-request.js +11 -2
  88. package/dist/medical/webhook/webhook-request.js.map +1 -1
  89. package/dist/net/retry.d.ts +2 -0
  90. package/dist/net/retry.d.ts.map +1 -1
  91. package/dist/net/retry.js +37 -12
  92. package/dist/net/retry.js.map +1 -1
  93. package/dist/util/uuid-v7.d.ts +162 -0
  94. package/dist/util/uuid-v7.d.ts.map +1 -0
  95. package/dist/util/uuid-v7.js +401 -0
  96. package/dist/util/uuid-v7.js.map +1 -0
  97. package/package.json +8 -8
  98. package/dist/domain/patient/patient-import.d.ts +0 -131
  99. package/dist/domain/patient/patient-import.d.ts.map +0 -1
  100. package/dist/domain/patient/patient-import.js +0 -32
  101. package/dist/domain/patient/patient-import.js.map +0 -1
  102. package/dist/validators/driver-license/__tests__/index.test.d.ts +0 -2
  103. package/dist/validators/driver-license/__tests__/index.test.d.ts.map +0 -1
  104. package/dist/validators/driver-license/__tests__/index.test.js +0 -87
  105. package/dist/validators/driver-license/__tests__/index.test.js.map +0 -1
  106. package/dist/validators/driver-license/ca-dl.d.ts +0 -6
  107. package/dist/validators/driver-license/ca-dl.d.ts.map +0 -1
  108. package/dist/validators/driver-license/ca-dl.js +0 -87
  109. package/dist/validators/driver-license/ca-dl.js.map +0 -1
  110. package/dist/validators/driver-license/index.d.ts +0 -18
  111. package/dist/validators/driver-license/index.d.ts.map +0 -1
  112. package/dist/validators/driver-license/index.js +0 -86
  113. package/dist/validators/driver-license/index.js.map +0 -1
  114. package/dist/validators/driver-license/interfaces.d.ts +0 -33
  115. package/dist/validators/driver-license/interfaces.d.ts.map +0 -1
  116. package/dist/validators/driver-license/interfaces.js.map +0 -1
  117. package/dist/validators/driver-license/us-dl.d.ts +0 -6
  118. package/dist/validators/driver-license/us-dl.d.ts.map +0 -1
  119. package/dist/validators/driver-license/us-dl.js +0 -471
  120. package/dist/validators/driver-license/us-dl.js.map +0 -1
@@ -0,0 +1,162 @@
1
+ /** Represents a UUID as a 16-byte byte array. */
2
+ export declare class UUID {
3
+ readonly bytes: Readonly<Uint8Array>;
4
+ /** @param bytes - The 16-byte byte array representation. */
5
+ private constructor();
6
+ /**
7
+ * Creates an object from the internal representation, a 16-byte byte array
8
+ * containing the binary UUID representation in the big-endian byte order.
9
+ *
10
+ * This method does NOT shallow-copy the argument, and thus the created object
11
+ * holds the reference to the underlying buffer.
12
+ *
13
+ * @throws TypeError if the length of the argument is not 16.
14
+ */
15
+ static ofInner(bytes: Readonly<Uint8Array>): UUID;
16
+ /**
17
+ * Builds a byte array from UUIDv7 field values.
18
+ *
19
+ * @param unixTsMs - A 48-bit `unix_ts_ms` field value.
20
+ * @param randA - A 12-bit `rand_a` field value.
21
+ * @param randBHi - The higher 30 bits of 62-bit `rand_b` field value.
22
+ * @param randBLo - The lower 32 bits of 62-bit `rand_b` field value.
23
+ * @throws RangeError if any field value is out of the specified range.
24
+ */
25
+ static fromFieldsV7(unixTsMs: number, randA: number, randBHi: number, randBLo: number): UUID;
26
+ /**
27
+ * Builds a byte array from the 8-4-4-4-12 canonical hexadecimal string
28
+ * representation.
29
+ *
30
+ * @throws SyntaxError if the argument could not parse as a valid UUID string.
31
+ * @experimental
32
+ */
33
+ static parse(uuid: string): UUID;
34
+ /** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
35
+ toString(): string;
36
+ /** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
37
+ toJSON(): string;
38
+ /**
39
+ * A deprecated synonym for {@link getVariant}.
40
+ *
41
+ * @deprecated
42
+ * @hidden
43
+ */
44
+ getType(): "VAR_0" | "VAR_10" | "VAR_110" | "VAR_RESERVED" | "NIL" | "MAX";
45
+ /**
46
+ * Reports the variant field value of the UUID or, if appropriate, "NIL" or
47
+ * "MAX".
48
+ *
49
+ * For convenience, this method reports "NIL" or "MAX" if `this` represents
50
+ * the Nil or Max UUID, although the Nil and Max UUIDs are technically
51
+ * subsumed under the variants `0b0` and `0b111`, respectively.
52
+ */
53
+ getVariant(): "VAR_0" | "VAR_10" | "VAR_110" | "VAR_RESERVED" | "NIL" | "MAX";
54
+ /**
55
+ * Returns the version field value of the UUID or `undefined` if the UUID does
56
+ * not have the variant field value of `0b10`.
57
+ */
58
+ getVersion(): number | undefined;
59
+ /** Creates an object from `this`. */
60
+ clone(): UUID;
61
+ /** Returns true if `this` is equivalent to `other`. */
62
+ equals(other: UUID): boolean;
63
+ /**
64
+ * Returns a negative integer, zero, or positive integer if `this` is less
65
+ * than, equal to, or greater than `other`, respectively.
66
+ */
67
+ compareTo(other: UUID): number;
68
+ }
69
+ /**
70
+ * Encapsulates the monotonic counter state.
71
+ *
72
+ * This class provides APIs to utilize a separate counter state from that of the
73
+ * global generator used by {@link uuidv7} and {@link uuidv7obj}. In addition to
74
+ * the default {@link generate} method, this class has {@link generateOrAbort}
75
+ * that is useful to absolutely guarantee the monotonically increasing order of
76
+ * generated UUIDs despite a significant rollback of the system clock.
77
+ */
78
+ export declare class V7Generator {
79
+ private readonly random;
80
+ private timestamp;
81
+ private counter;
82
+ private constructor();
83
+ /**
84
+ * Creates a new generator object configured with the default random number
85
+ * generator.
86
+ */
87
+ static create(): V7Generator;
88
+ /**
89
+ * Generates a new UUIDv7 object from the current timestamp, or resets the
90
+ * generator upon significant timestamp rollback.
91
+ *
92
+ * This method returns monotonically increasing UUIDs unless the up-to-date
93
+ * timestamp is significantly (by ten seconds or more) smaller than the one
94
+ * embedded in the immediately preceding UUID. If such a significant clock
95
+ * rollback is detected, this method resets the generator and returns a new
96
+ * UUID based on the current timestamp.
97
+ */
98
+ generate(): UUID;
99
+ /**
100
+ * Generates a new UUIDv7 object from the current timestamp, or returns
101
+ * `undefined` upon significant timestamp rollback.
102
+ *
103
+ * This method returns monotonically increasing UUIDs unless the up-to-date
104
+ * timestamp is significantly (by ten seconds or more) smaller than the one
105
+ * embedded in the immediately preceding UUID. If such a significant clock
106
+ * rollback is detected, this method aborts and returns `undefined`.
107
+ */
108
+ generateOrAbort(): UUID | undefined;
109
+ /**
110
+ * Generates a new UUIDv7 object from the `unixTsMs` passed, or resets the
111
+ * generator upon significant timestamp rollback.
112
+ *
113
+ * This method is equivalent to {@link generate} except that it takes a custom
114
+ * timestamp and clock rollback allowance.
115
+ *
116
+ * @param rollbackAllowance - The amount of `unixTsMs` rollback that is
117
+ * considered significant. A suggested value is `10_000` (milliseconds).
118
+ * @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
119
+ * @experimental
120
+ */
121
+ generateOrResetCore(unixTsMs: number, rollbackAllowance: number): UUID;
122
+ /**
123
+ * Generates a new UUIDv7 object from the `unixTsMs` passed, or returns
124
+ * `undefined` upon significant timestamp rollback.
125
+ *
126
+ * This method is equivalent to {@link generateOrAbort} except that it takes a
127
+ * custom timestamp and clock rollback allowance.
128
+ *
129
+ * @param rollbackAllowance - The amount of `unixTsMs` rollback that is
130
+ * considered significant. A suggested value is `10_000` (milliseconds).
131
+ * @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
132
+ * @experimental
133
+ */
134
+ generateOrAbortCore(unixTsMs: number, rollbackAllowance: number): UUID | undefined;
135
+ /** Initializes the counter at a 42-bit random integer. */
136
+ private resetCounter;
137
+ }
138
+ /**
139
+ * Generates a UUIDv7 string.
140
+ *
141
+ * @returns The 8-4-4-4-12 canonical hexadecimal string representation
142
+ * ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
143
+ */
144
+ export declare const uuidv7: () => string;
145
+ /** Generates a UUIDv7 object. */
146
+ export declare const uuidv7obj: () => UUID;
147
+ /**
148
+ * Generates a UUIDv4 string.
149
+ *
150
+ * @returns The 8-4-4-4-12 canonical hexadecimal string representation
151
+ * ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
152
+ */
153
+ export declare const uuidv4: () => string;
154
+ /** Generates a UUIDv4 object. */
155
+ export declare const uuidv4obj: () => UUID;
156
+ /**
157
+ * Checks if a string matches the UUID regex
158
+ * @param uuid Any string
159
+ * @returns boolean
160
+ */
161
+ export declare function isValidUuid(uuid: string): boolean;
162
+ //# sourceMappingURL=uuid-v7.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid-v7.d.ts","sourceRoot":"","sources":["../../src/util/uuid-v7.ts"],"names":[],"mappings":"AAeA,iDAAiD;AACjD,qBAAa,IAAI;IAEK,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC;IADxD,4DAA4D;IAC5D,OAAO;IAEP;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI;IAQjD;;;;;;;;OAQG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,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;AACH,eAAO,MAAM,MAAM,QAAO,MAAgC,CAAC;AAE3D,iCAAiC;AACjC,eAAO,MAAM,SAAS,QAAO,IAK5B,CAAC;AAIF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjD"}
@@ -0,0 +1,401 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.isValidUuid = exports.uuidv4obj = exports.uuidv4 = exports.uuidv7obj = exports.uuidv7 = exports.V7Generator = exports.UUID = void 0;
27
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
28
+ /**
29
+ * uuidv7: An experimental implementation of the proposed UUID Version 7
30
+ *
31
+ * @license Apache-2.0
32
+ * @copyright 2021-2023 LiosK
33
+ * @packageDocumentation
34
+ * @see https://github.com/LiosK/uuidv7
35
+ * Based on v0.5.3
36
+ * Permalink: https://github.com/LiosK/uuidv7/blob/2a0bd46635e6b584c13ad1cb55b6984ae0ab45f0/src/index.ts
37
+ */
38
+ const crypto = __importStar(require("crypto"));
39
+ const DIGITS = "0123456789abcdef";
40
+ /** Represents a UUID as a 16-byte byte array. */
41
+ class UUID {
42
+ /** @param bytes - The 16-byte byte array representation. */
43
+ constructor(bytes) {
44
+ this.bytes = bytes;
45
+ }
46
+ /**
47
+ * Creates an object from the internal representation, a 16-byte byte array
48
+ * containing the binary UUID representation in the big-endian byte order.
49
+ *
50
+ * This method does NOT shallow-copy the argument, and thus the created object
51
+ * holds the reference to the underlying buffer.
52
+ *
53
+ * @throws TypeError if the length of the argument is not 16.
54
+ */
55
+ static ofInner(bytes) {
56
+ if (bytes.length !== 16) {
57
+ throw new TypeError("not 128-bit length");
58
+ }
59
+ else {
60
+ return new UUID(bytes);
61
+ }
62
+ }
63
+ /**
64
+ * Builds a byte array from UUIDv7 field values.
65
+ *
66
+ * @param unixTsMs - A 48-bit `unix_ts_ms` field value.
67
+ * @param randA - A 12-bit `rand_a` field value.
68
+ * @param randBHi - The higher 30 bits of 62-bit `rand_b` field value.
69
+ * @param randBLo - The lower 32 bits of 62-bit `rand_b` field value.
70
+ * @throws RangeError if any field value is out of the specified range.
71
+ */
72
+ static fromFieldsV7(unixTsMs, randA, randBHi, randBLo) {
73
+ if (!Number.isInteger(unixTsMs) ||
74
+ !Number.isInteger(randA) ||
75
+ !Number.isInteger(randBHi) ||
76
+ !Number.isInteger(randBLo) ||
77
+ unixTsMs < 0 ||
78
+ randA < 0 ||
79
+ randBHi < 0 ||
80
+ randBLo < 0 ||
81
+ unixTsMs > 281474976710655 ||
82
+ randA > 0xfff ||
83
+ randBHi > 1073741823 ||
84
+ randBLo > 4294967295) {
85
+ throw new RangeError("invalid field value");
86
+ }
87
+ const bytes = new Uint8Array(16);
88
+ bytes[0] = unixTsMs / 2 ** 40;
89
+ bytes[1] = unixTsMs / 2 ** 32;
90
+ bytes[2] = unixTsMs / 2 ** 24;
91
+ bytes[3] = unixTsMs / 2 ** 16;
92
+ bytes[4] = unixTsMs / 2 ** 8;
93
+ bytes[5] = unixTsMs;
94
+ bytes[6] = 0x70 | (randA >>> 8);
95
+ bytes[7] = randA;
96
+ bytes[8] = 0x80 | (randBHi >>> 24);
97
+ bytes[9] = randBHi >>> 16;
98
+ bytes[10] = randBHi >>> 8;
99
+ bytes[11] = randBHi;
100
+ bytes[12] = randBLo >>> 24;
101
+ bytes[13] = randBLo >>> 16;
102
+ bytes[14] = randBLo >>> 8;
103
+ bytes[15] = randBLo;
104
+ return new UUID(bytes);
105
+ }
106
+ /**
107
+ * Builds a byte array from the 8-4-4-4-12 canonical hexadecimal string
108
+ * representation.
109
+ *
110
+ * @throws SyntaxError if the argument could not parse as a valid UUID string.
111
+ * @experimental
112
+ */
113
+ static parse(uuid) {
114
+ const PATTERN = /^([0-9A-Fa-f]{8})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{4})-([0-9A-Fa-f]{12})$/;
115
+ const hex = PATTERN.exec(uuid)?.slice(1, 6).join("");
116
+ if (hex) {
117
+ const inner = new Uint8Array(16);
118
+ for (let i = 0; i < 16; i += 4) {
119
+ const n = parseInt(hex.substring(2 * i, 2 * i + 8), 16);
120
+ inner[i + 0] = n >>> 24;
121
+ inner[i + 1] = n >>> 16;
122
+ inner[i + 2] = n >>> 8;
123
+ inner[i + 3] = n;
124
+ }
125
+ return new UUID(inner);
126
+ }
127
+ else {
128
+ throw new SyntaxError("could not parse UUID string");
129
+ }
130
+ }
131
+ /** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
132
+ toString() {
133
+ let text = "";
134
+ for (let i = 0; i < this.bytes.length; i++) {
135
+ text += DIGITS.charAt(this.bytes[i] >>> 4);
136
+ text += DIGITS.charAt(this.bytes[i] & 0xf);
137
+ if (i === 3 || i === 5 || i === 7 || i === 9) {
138
+ text += "-";
139
+ }
140
+ }
141
+ return text;
142
+ }
143
+ /** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
144
+ toJSON() {
145
+ return this.toString();
146
+ }
147
+ /**
148
+ * A deprecated synonym for {@link getVariant}.
149
+ *
150
+ * @deprecated
151
+ * @hidden
152
+ */
153
+ getType() {
154
+ return this.getVariant();
155
+ }
156
+ /**
157
+ * Reports the variant field value of the UUID or, if appropriate, "NIL" or
158
+ * "MAX".
159
+ *
160
+ * For convenience, this method reports "NIL" or "MAX" if `this` represents
161
+ * the Nil or Max UUID, although the Nil and Max UUIDs are technically
162
+ * subsumed under the variants `0b0` and `0b111`, respectively.
163
+ */
164
+ getVariant() {
165
+ const n = this.bytes[8] >>> 4;
166
+ if (n < 0) {
167
+ throw new Error("unreachable");
168
+ }
169
+ else if (n <= 0b0111) {
170
+ return this.bytes.every(e => e === 0) ? "NIL" : "VAR_0";
171
+ }
172
+ else if (n <= 0b1011) {
173
+ return "VAR_10";
174
+ }
175
+ else if (n <= 0b1101) {
176
+ return "VAR_110";
177
+ }
178
+ else if (n <= 0b1111) {
179
+ return this.bytes.every(e => e === 0xff) ? "MAX" : "VAR_RESERVED";
180
+ }
181
+ else {
182
+ throw new Error("unreachable");
183
+ }
184
+ }
185
+ /**
186
+ * Returns the version field value of the UUID or `undefined` if the UUID does
187
+ * not have the variant field value of `0b10`.
188
+ */
189
+ getVersion() {
190
+ return this.getVariant() === "VAR_10" ? this.bytes[6] >>> 4 : undefined;
191
+ }
192
+ /** Creates an object from `this`. */
193
+ clone() {
194
+ return new UUID(this.bytes.slice(0));
195
+ }
196
+ /** Returns true if `this` is equivalent to `other`. */
197
+ equals(other) {
198
+ return this.compareTo(other) === 0;
199
+ }
200
+ /**
201
+ * Returns a negative integer, zero, or positive integer if `this` is less
202
+ * than, equal to, or greater than `other`, respectively.
203
+ */
204
+ compareTo(other) {
205
+ for (let i = 0; i < 16; i++) {
206
+ const diff = this.bytes[i] - other.bytes[i];
207
+ if (diff !== 0) {
208
+ return Math.sign(diff);
209
+ }
210
+ }
211
+ return 0;
212
+ }
213
+ }
214
+ exports.UUID = UUID;
215
+ /**
216
+ * Encapsulates the monotonic counter state.
217
+ *
218
+ * This class provides APIs to utilize a separate counter state from that of the
219
+ * global generator used by {@link uuidv7} and {@link uuidv7obj}. In addition to
220
+ * the default {@link generate} method, this class has {@link generateOrAbort}
221
+ * that is useful to absolutely guarantee the monotonically increasing order of
222
+ * generated UUIDs despite a significant rollback of the system clock.
223
+ */
224
+ class V7Generator {
225
+ constructor(random) {
226
+ this.random = random;
227
+ this.timestamp = 0;
228
+ this.counter = 0;
229
+ }
230
+ /**
231
+ * Creates a new generator object configured with the default random number
232
+ * generator.
233
+ */
234
+ static create() {
235
+ return new V7Generator(new DefaultRandom());
236
+ }
237
+ /**
238
+ * Generates a new UUIDv7 object from the current timestamp, or resets the
239
+ * generator upon significant timestamp rollback.
240
+ *
241
+ * This method returns monotonically increasing UUIDs unless the up-to-date
242
+ * timestamp is significantly (by ten seconds or more) smaller than the one
243
+ * embedded in the immediately preceding UUID. If such a significant clock
244
+ * rollback is detected, this method resets the generator and returns a new
245
+ * UUID based on the current timestamp.
246
+ */
247
+ generate() {
248
+ return this.generateOrResetCore(Date.now(), 10000);
249
+ }
250
+ /**
251
+ * Generates a new UUIDv7 object from the current timestamp, or returns
252
+ * `undefined` upon significant timestamp rollback.
253
+ *
254
+ * This method returns monotonically increasing UUIDs unless the up-to-date
255
+ * timestamp is significantly (by ten seconds or more) smaller than the one
256
+ * embedded in the immediately preceding UUID. If such a significant clock
257
+ * rollback is detected, this method aborts and returns `undefined`.
258
+ */
259
+ generateOrAbort() {
260
+ return this.generateOrAbortCore(Date.now(), 10000);
261
+ }
262
+ /**
263
+ * Generates a new UUIDv7 object from the `unixTsMs` passed, or resets the
264
+ * generator upon significant timestamp rollback.
265
+ *
266
+ * This method is equivalent to {@link generate} except that it takes a custom
267
+ * timestamp and clock rollback allowance.
268
+ *
269
+ * @param rollbackAllowance - The amount of `unixTsMs` rollback that is
270
+ * considered significant. A suggested value is `10_000` (milliseconds).
271
+ * @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
272
+ * @experimental
273
+ */
274
+ generateOrResetCore(unixTsMs, rollbackAllowance) {
275
+ let value = this.generateOrAbortCore(unixTsMs, rollbackAllowance);
276
+ if (value === undefined) {
277
+ // reset state and resume
278
+ this.timestamp = 0;
279
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
280
+ value = this.generateOrAbortCore(unixTsMs, rollbackAllowance);
281
+ }
282
+ return value;
283
+ }
284
+ /**
285
+ * Generates a new UUIDv7 object from the `unixTsMs` passed, or returns
286
+ * `undefined` upon significant timestamp rollback.
287
+ *
288
+ * This method is equivalent to {@link generateOrAbort} except that it takes a
289
+ * custom timestamp and clock rollback allowance.
290
+ *
291
+ * @param rollbackAllowance - The amount of `unixTsMs` rollback that is
292
+ * considered significant. A suggested value is `10_000` (milliseconds).
293
+ * @throws RangeError if `unixTsMs` is not a 48-bit positive integer.
294
+ * @experimental
295
+ */
296
+ generateOrAbortCore(unixTsMs, rollbackAllowance) {
297
+ const MAX_COUNTER = 4398046511103;
298
+ if (!Number.isInteger(unixTsMs) || unixTsMs < 1 || unixTsMs > 281474976710655) {
299
+ throw new RangeError("`unixTsMs` must be a 48-bit positive integer");
300
+ }
301
+ else if (rollbackAllowance < 0 || rollbackAllowance > 281474976710655) {
302
+ throw new RangeError("`rollbackAllowance` out of reasonable range");
303
+ }
304
+ if (unixTsMs > this.timestamp) {
305
+ this.timestamp = unixTsMs;
306
+ this.resetCounter();
307
+ }
308
+ else if (unixTsMs + rollbackAllowance > this.timestamp) {
309
+ // go on with previous timestamp if new one is not much smaller
310
+ this.counter++;
311
+ if (this.counter > MAX_COUNTER) {
312
+ // increment timestamp at counter overflow
313
+ this.timestamp++;
314
+ this.resetCounter();
315
+ }
316
+ }
317
+ else {
318
+ // abort if clock went backwards to unbearable extent
319
+ return undefined;
320
+ }
321
+ return UUID.fromFieldsV7(this.timestamp, Math.trunc(this.counter / 2 ** 30), this.counter & (2 ** 30 - 1), this.random.nextUint32());
322
+ }
323
+ /** Initializes the counter at a 42-bit random integer. */
324
+ resetCounter() {
325
+ this.counter = this.random.nextUint32() * 0x400 + (this.random.nextUint32() & 0x3ff);
326
+ }
327
+ }
328
+ exports.V7Generator = V7Generator;
329
+ /** Stores `crypto.getRandomValues()` available in the environment. */
330
+ let getRandomValues = buffer => {
331
+ // fall back on Math.random() unless the flag is set to true
332
+ if (typeof UUIDV7_DENY_WEAK_RNG !== "undefined" && UUIDV7_DENY_WEAK_RNG) {
333
+ throw new Error("no cryptographically strong RNG available");
334
+ }
335
+ for (let i = 0; i < buffer.length; i++) {
336
+ buffer[i] =
337
+ Math.trunc(Math.random() * 65536) * 65536 + Math.trunc(Math.random() * 65536);
338
+ }
339
+ return buffer;
340
+ };
341
+ // detect Web Crypto API
342
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
343
+ getRandomValues = buffer => crypto.getRandomValues(buffer);
344
+ }
345
+ /**
346
+ * Wraps `crypto.getRandomValues()` and compatibles to enable buffering; this
347
+ * uses a small buffer by default to avoid unbearable throughput decline in some
348
+ * environments as well as the waste of time and space for unused values.
349
+ */
350
+ class DefaultRandom {
351
+ constructor() {
352
+ this.buffer = new Uint32Array(8);
353
+ this.cursor = 99;
354
+ }
355
+ nextUint32() {
356
+ if (this.cursor >= this.buffer.length) {
357
+ getRandomValues(this.buffer);
358
+ this.cursor = 0;
359
+ }
360
+ return this.buffer[this.cursor++];
361
+ }
362
+ }
363
+ let defaultGenerator;
364
+ /**
365
+ * Generates a UUIDv7 string.
366
+ *
367
+ * @returns The 8-4-4-4-12 canonical hexadecimal string representation
368
+ * ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
369
+ */
370
+ const uuidv7 = () => (0, exports.uuidv7obj)().toString();
371
+ exports.uuidv7 = uuidv7;
372
+ /** Generates a UUIDv7 object. */
373
+ const uuidv7obj = () => (defaultGenerator || (defaultGenerator = V7Generator.create())).generate();
374
+ exports.uuidv7obj = uuidv7obj;
375
+ /**
376
+ * Generates a UUIDv4 string.
377
+ *
378
+ * @returns The 8-4-4-4-12 canonical hexadecimal string representation
379
+ * ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
380
+ */
381
+ const uuidv4 = () => (0, exports.uuidv4obj)().toString();
382
+ exports.uuidv4 = uuidv4;
383
+ /** Generates a UUIDv4 object. */
384
+ const uuidv4obj = () => {
385
+ const bytes = getRandomValues(new Uint8Array(16));
386
+ bytes[6] = 0x40 | (bytes[6] >>> 4);
387
+ bytes[8] = 0x80 | (bytes[8] >>> 2);
388
+ return UUID.ofInner(bytes);
389
+ };
390
+ exports.uuidv4obj = uuidv4obj;
391
+ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
392
+ /**
393
+ * Checks if a string matches the UUID regex
394
+ * @param uuid Any string
395
+ * @returns boolean
396
+ */
397
+ function isValidUuid(uuid) {
398
+ return uuidRegex.test(uuid);
399
+ }
400
+ exports.isValidUuid = isValidUuid;
401
+ //# sourceMappingURL=uuid-v7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid-v7.js","sourceRoot":"","sources":["../../src/util/uuid-v7.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA6D;AAC7D;;;;;;;;;GASG;AACH,+CAAiC;AAEjC,MAAM,MAAM,GAAG,kBAAkB,CAAC;AAElC,iDAAiD;AACjD,MAAa,IAAI;IACf,4DAA4D;IAC5D,YAA6B,KAA2B;QAA3B,UAAK,GAAL,KAAK,CAAsB;IAAG,CAAC;IAE5D;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,CAAC,KAA2B;QACxC,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE;YACvB,MAAM,IAAI,SAAS,CAAC,oBAAoB,CAAC,CAAC;SAC3C;aAAM;YACL,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;SACxB;IACH,CAAC;IAED;;;;;;;;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AC;AADhE,QAAA,SAAS,aACuD;AAE7E;;;;;GAKG;AACI,MAAM,MAAM,GAAG,GAAW,EAAE,CAAC,IAAA,iBAAS,GAAE,CAAC,QAAQ,EAAE,CAAC;AAA9C,QAAA,MAAM,UAAwC;AAE3D,iCAAiC;AAC1B,MAAM,SAAS,GAAG,GAAS,EAAE;IAClC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAClD,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,KAAK,CAAC,CAAC,CAAC;IACpC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,KAAK,CAAC,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC,CAAC;AALW,QAAA,SAAS,aAKpB;AAEF,MAAM,SAAS,GAAG,iEAAiE,CAAC;AAEpF;;;;GAIG;AACH,SAAgB,WAAW,CAAC,IAAY;IACtC,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAFD,kCAEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metriport/shared",
3
- "version": "0.22.0-alpha.2",
3
+ "version": "0.23.0-alpha.0",
4
4
  "description": "Common code shared across packages - by Metriport Inc.",
5
5
  "author": "Metriport Inc. <contact@metriport.com>",
6
6
  "homepage": "https://metriport.com/",
@@ -24,8 +24,8 @@
24
24
  "./domain/*": "./dist/domain/*.js",
25
25
  "./interface/*": "./dist/interface/*.js",
26
26
  "./medical": "./dist/medical/index.js",
27
- "./validators": "./dist/validators/index.js",
28
- "./validators/*": "./dist/validators/*.js"
27
+ "./util": "./dist/util/index.js",
28
+ "./util/*": "./dist/util/*.js"
29
29
  },
30
30
  "typesVersions": {
31
31
  "*": {
@@ -56,11 +56,11 @@
56
56
  "medical": [
57
57
  "dist/medical/index.d.ts"
58
58
  ],
59
- "validators": [
60
- "dist/validators/index.d.ts"
59
+ "util": [
60
+ "dist/util/index.d.ts"
61
61
  ],
62
- "validators/*": [
63
- "dist/validators/*"
62
+ "util/*": [
63
+ "dist/util/*"
64
64
  ]
65
65
  }
66
66
  },
@@ -109,5 +109,5 @@
109
109
  "ts-jest": "29.1.1",
110
110
  "typescript": "^4.9.5"
111
111
  },
112
- "gitHead": "f85e4b0f8014e188661345bd35321d33258c5167"
112
+ "gitHead": "1f673fc89b23dcfd84f5a3bee3ef40ed80dff0a1"
113
113
  }