@baukit/data-contracts 0.7.0 → 0.7.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baukit/data-contracts",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Runtime-neutral data contracts, measurement helpers, and executable adapter conformance tests.",
5
5
  "license": "MIT",
6
6
  "author": "Patrick Koss",
package/dist/uuid-v7.d.ts DELETED
@@ -1,15 +0,0 @@
1
- export interface UuidV7Input {
2
- /** Unix epoch time in whole milliseconds, limited to the UUIDv7 48-bit field. */
3
- readonly unixTimestampMilliseconds: number;
4
- /** Ten cryptographically random bytes supplied by the active runtime. */
5
- readonly randomBytes: Uint8Array;
6
- }
7
- /**
8
- * Encodes an RFC 9562 UUIDv7 from caller-supplied time and random bytes.
9
- *
10
- * This function has no clock, random source, or monotonic state. Callers must
11
- * obtain cryptographically secure bytes from their runtime and coordinate any
12
- * ordering guarantee stronger than the UUIDv7 millisecond timestamp.
13
- */
14
- export declare function uuidV7(input: UuidV7Input): string;
15
- //# sourceMappingURL=uuid-v7.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uuid-v7.d.ts","sourceRoot":"","sources":["../src/uuid-v7.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,yBAAyB,EAAE,MAAM,CAAC;IAC3C,yEAAyE;IACzE,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;CAClC;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAyBjD"}
package/dist/uuid-v7.js DELETED
@@ -1,31 +0,0 @@
1
- const UUID_V7_RANDOM_BYTE_COUNT = 10;
2
- const MAX_UUID_V7_TIMESTAMP = 0xffff_ffff_ffff;
3
- /**
4
- * Encodes an RFC 9562 UUIDv7 from caller-supplied time and random bytes.
5
- *
6
- * This function has no clock, random source, or monotonic state. Callers must
7
- * obtain cryptographically secure bytes from their runtime and coordinate any
8
- * ordering guarantee stronger than the UUIDv7 millisecond timestamp.
9
- */
10
- export function uuidV7(input) {
11
- const timestamp = input.unixTimestampMilliseconds;
12
- if (!Number.isSafeInteger(timestamp) || timestamp < 0 || timestamp > MAX_UUID_V7_TIMESTAMP) {
13
- throw new RangeError('UUIDv7 timestamp must be a 48-bit non-negative integer.');
14
- }
15
- if (!(input.randomBytes instanceof Uint8Array) || input.randomBytes.length !== 10) {
16
- throw new RangeError(`UUIDv7 requires exactly ${String(UUID_V7_RANDOM_BYTE_COUNT)} random bytes.`);
17
- }
18
- const bytes = new Uint8Array(16);
19
- let remainingTimestamp = timestamp;
20
- for (let index = 5; index >= 0; index -= 1) {
21
- bytes[index] = remainingTimestamp % 256;
22
- remainingTimestamp = Math.floor(remainingTimestamp / 256);
23
- }
24
- bytes[6] = 0x70 | ((input.randomBytes.at(0) ?? 0) & 0x0f);
25
- bytes[7] = input.randomBytes.at(1) ?? 0;
26
- bytes[8] = 0x80 | ((input.randomBytes.at(2) ?? 0) & 0x3f);
27
- bytes.set(input.randomBytes.subarray(3), 9);
28
- const hexadecimal = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');
29
- return `${hexadecimal.slice(0, 8)}-${hexadecimal.slice(8, 12)}-${hexadecimal.slice(12, 16)}-${hexadecimal.slice(16, 20)}-${hexadecimal.slice(20)}`;
30
- }
31
- //# sourceMappingURL=uuid-v7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uuid-v7.js","sourceRoot":"","sources":["../src/uuid-v7.ts"],"names":[],"mappings":"AAAA,MAAM,yBAAyB,GAAG,EAAE,CAAC;AACrC,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAS/C;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,yBAAyB,CAAC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