bson 7.2.0 → 7.3.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/README.md CHANGED
@@ -14,7 +14,7 @@ You can learn more about it in [the specification](http://bsonspec.org).
14
14
 
15
15
  ### Release Integrity
16
16
 
17
- Releases are created automatically and signed using the [Node team's GPG key](https://pgp.mongodb.com/node-driver.asc). This applies to the git tag as well as all release packages provided as part of a GitHub release. To verify the provided packages, download the key and import it using gpg:
17
+ Releases are created automatically and signed using the [Node team's GPG key](https://pgp.mongodb.com/node-driver.asc). All release packages provided as part of a GitHub release are signed. To verify the provided packages, download the key and import it using gpg:
18
18
 
19
19
  ```shell
20
20
  gpg --import node-driver.asc
@@ -36,7 +36,13 @@ gpg --verify bson-X.Y.Z.tgz.sig bson-X.Y.Z.tgz
36
36
  ```
37
37
 
38
38
  >[!Note]
39
- No verification is done when using npm to install the package. The contents of the Github tarball and npm's tarball are identical.
39
+ No GPG verification is done when using npm to install the package. The contents of the GitHub tarball and npm's tarball are identical.
40
+
41
+ Releases published to the npm registry also include a [provenance attestation](https://docs.npmjs.com/generating-provenance-statements), which cryptographically links the package to its source repository and build workflow. To verify provenance:
42
+
43
+ ```shell
44
+ npm audit signatures
45
+ ```
40
46
 
41
47
  ## Bugs / Feature Requests
42
48
 
package/bson.d.ts CHANGED
@@ -1316,7 +1316,7 @@ export declare interface LongExtended {
1316
1316
 
1317
1317
  /** @public */
1318
1318
  export declare type LongWithoutOverrides = new (low: unknown, high?: number | boolean, unsigned?: boolean) => {
1319
- [P in Exclude<keyof Long, TimestampOverrides>]: Long[P];
1319
+ [P in TimestampKept]: Long[P];
1320
1320
  };
1321
1321
 
1322
1322
  /** @public */
@@ -1396,6 +1396,8 @@ export declare const NumberUtils: NumberUtils;
1396
1396
  export declare class ObjectId extends BSONValue {
1397
1397
  get _bsontype(): 'ObjectId';
1398
1398
  /* Excluded from this release type: index */
1399
+ /* Excluded from this release type: PROCESS_UNIQUE */
1400
+ /* Excluded from this release type: resetState */
1399
1401
  static cacheHexString: boolean;
1400
1402
  /* Excluded from this release type: buffer */
1401
1403
  /** To generate a new ObjectId, use ObjectId() with no argument. */
@@ -1618,9 +1620,16 @@ export declare function setInternalBufferSize(size: number): void;
1618
1620
  *
1619
1621
  * // prints '{"int32":10}'
1620
1622
  * console.log(EJSON.stringify(doc));
1623
+ *
1624
+ * // prints '{"int32":{"$numberInt":"10"}}' with 2 space indentation
1625
+ * console.log(EJSON.stringify(doc, { relaxed: false }, 2));
1621
1626
  * ```
1622
1627
  */
1623
- declare function stringify(value: any, replacer?: (number | string)[] | ((this: any, key: string, value: any) => any) | EJSONSerializeOptions, space?: string | number, options?: EJSONSerializeOptions): string;
1628
+ declare function stringify(value: any, replacer?: (number | string)[] | ((this: any, key: string, value: any) => any) | null, space?: string | number, options?: EJSONSerializeOptions): string;
1629
+
1630
+ declare function stringify(value: any, replacer?: (number | string)[] | ((this: any, key: string, value: any) => any) | null, options?: EJSONSerializeOptions): string;
1631
+
1632
+ declare function stringify(value: any, options?: EJSONSerializeOptions, space?: string | number): string;
1624
1633
 
1625
1634
  /**
1626
1635
  * @public
@@ -1631,6 +1640,9 @@ declare function stringify(value: any, replacer?: (number | string)[] | ((this:
1631
1640
  export declare class Timestamp extends LongWithoutOverridesClass {
1632
1641
  get _bsontype(): 'Timestamp';
1633
1642
  get [bsonType](): 'Timestamp';
1643
+ /**
1644
+ * @deprecated Use `Long.MAX_UNSIGNED_VALUE` instead.
1645
+ */
1634
1646
  static readonly MAX_VALUE: Long;
1635
1647
  /**
1636
1648
  * An incrementing ordinal for operations within a given second.
@@ -1658,9 +1670,15 @@ export declare class Timestamp extends LongWithoutOverridesClass {
1658
1670
  toJSON(): {
1659
1671
  $timestamp: string;
1660
1672
  };
1661
- /** Returns a Timestamp represented by the given (32-bit) integer value. */
1673
+ /**
1674
+ * Returns a Timestamp represented by the given (32-bit) integer value.
1675
+ * @deprecated Stores `value` in the low 32 bits (increment), leaving t = 0. Use `new Timestamp({ t, i })` or `Timestamp.fromBits(lowBits, highBits)` for explicit construction.
1676
+ */
1662
1677
  static fromInt(value: number): Timestamp;
1663
- /** Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned. */
1678
+ /**
1679
+ * Returns a Timestamp representing the given number value, provided that it is a finite number. Otherwise, zero is returned.
1680
+ * @deprecated Splits `value` across (t, i) as a uint64; the result rarely matches user intent. Use `new Timestamp({ t, i })` or `Timestamp.fromBits(lowBits, highBits)` for explicit construction.
1681
+ */
1664
1682
  static fromNumber(value: number): Timestamp;
1665
1683
  /**
1666
1684
  * Returns a Timestamp for the given high and low bits. Each is assumed to use 32 bits.
@@ -1679,6 +1697,98 @@ export declare class Timestamp extends LongWithoutOverridesClass {
1679
1697
  /* Excluded from this release type: toExtendedJSON */
1680
1698
  /* Excluded from this release type: fromExtendedJSON */
1681
1699
  inspect(depth?: number, options?: unknown, inspect?: InspectFn): string;
1700
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1701
+ add: Long['add'];
1702
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1703
+ subtract: Long['subtract'];
1704
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1705
+ sub: Long['sub'];
1706
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1707
+ multiply: Long['multiply'];
1708
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1709
+ mul: Long['mul'];
1710
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1711
+ divide: Long['divide'];
1712
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1713
+ div: Long['div'];
1714
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1715
+ modulo: Long['modulo'];
1716
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1717
+ mod: Long['mod'];
1718
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1719
+ rem: Long['rem'];
1720
+ /** @deprecated Not applicable to Timestamp as the underlying Long is always unsigned. */
1721
+ negate: Long['negate'];
1722
+ /** @deprecated Not applicable to Timestamp as the underlying Long is always unsigned. */
1723
+ neg: Long['neg'];
1724
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1725
+ and: Long['and'];
1726
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1727
+ or: Long['or'];
1728
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1729
+ xor: Long['xor'];
1730
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1731
+ not: Long['not'];
1732
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1733
+ shiftLeft: Long['shiftLeft'];
1734
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1735
+ shl: Long['shl'];
1736
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1737
+ shiftRight: Long['shiftRight'];
1738
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1739
+ shr: Long['shr'];
1740
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1741
+ shiftRightUnsigned: Long['shiftRightUnsigned'];
1742
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1743
+ shr_u: Long['shr_u'];
1744
+ /** @deprecated Not applicable to Timestamp; Timestamp is not intended to be used as a Long. */
1745
+ shru: Long['shru'];
1746
+ /** @deprecated Not applicable to Timestamp as the underlying Long is always unsigned. */
1747
+ toSigned: Long['toSigned'];
1748
+ /** @deprecated Not applicable to Timestamp as the underlying Long is always unsigned (this is a no-op). */
1749
+ toUnsigned: Long['toUnsigned'];
1750
+ /** @deprecated Not applicable to Timestamp as the underlying Long is always unsigned (is always false). */
1751
+ isNegative: Long['isNegative'];
1752
+ /** @deprecated Not applicable to Timestamp as the underlying Long is always unsigned (is always true). */
1753
+ isPositive: Long['isPositive'];
1754
+ /** @deprecated Not applicable to Timestamp as the underlying Long is always unsigned (is always true). */
1755
+ unsigned: Long['unsigned'];
1756
+ /** @deprecated Not applicable to Timestamp; use `.t` for seconds since the Unix epoch, or `.i` for the increment ordinal. */
1757
+ toInt: Long['toInt'];
1758
+ /** @deprecated Not applicable to Timestamp; use `.t` for seconds since the Unix epoch, or `.i` for the increment ordinal. */
1759
+ toNumber: Long['toNumber'];
1760
+ /** @deprecated Not applicable to Timestamp; use `.t` for seconds since the Unix epoch, or `.i` for the increment ordinal. */
1761
+ toBytes: Long['toBytes'];
1762
+ /** @deprecated Not applicable to Timestamp; use `.t` for seconds since the Unix epoch, or `.i` for the increment ordinal. */
1763
+ toBytesLE: Long['toBytesLE'];
1764
+ /** @deprecated Not applicable to Timestamp; use `.t` for seconds since the Unix epoch, or `.i` for the increment ordinal. */
1765
+ toBytesBE: Long['toBytesBE'];
1766
+ /** @deprecated Incompatible with Timestamp: returns a signed integer, but Timestamp is always unsigned. Use `.t` for seconds since the Unix epoch. */
1767
+ getHighBits: Long['getHighBits'];
1768
+ /** @deprecated Not applicable to Timestamp; use `.t` for seconds since the Unix epoch. */
1769
+ getHighBitsUnsigned: Long['getHighBitsUnsigned'];
1770
+ /** @deprecated Incompatible with Timestamp: returns a signed integer, but Timestamp is always unsigned. Use `.i` for the increment ordinal. */
1771
+ getLowBits: Long['getLowBits'];
1772
+ /** @deprecated Not applicable to Timestamp; use `.i` for the increment ordinal. */
1773
+ getLowBitsUnsigned: Long['getLowBitsUnsigned'];
1774
+ /** @deprecated Not applicable to Timestamp; use `.i` instead. */
1775
+ low: Long['low'];
1776
+ /** @deprecated Not applicable to Timestamp; use `.t` instead. */
1777
+ high: Long['high'];
1778
+ /** @deprecated Use .compare() for general comparison, or .equals(), .lessThan(), .greaterThan() for specific cases. */
1779
+ comp: Long['comp'];
1780
+ /** @deprecated Compare `.t` and `.i` against `0` explicitly. */
1781
+ isZero: Long['isZero'];
1782
+ /** @deprecated Compare `.t` and `.i` against `0` explicitly. */
1783
+ eqz: Long['eqz'];
1784
+ /** @deprecated Not applicable to Timestamp. Use the bsonType symbol or _bsontype === 'Timestamp' to identify a Timestamp. */
1785
+ __isLong__: Long['__isLong__'];
1786
+ /** @deprecated Not applicable to Timestamp. */
1787
+ getNumBitsAbs: Long['getNumBitsAbs'];
1788
+ /** @deprecated Not applicable to Timestamp; tests parity of the increment only. */
1789
+ isEven: Long['isEven'];
1790
+ /** @deprecated Not applicable to Timestamp; tests parity of the increment only. */
1791
+ isOdd: Long['isOdd'];
1682
1792
  }
1683
1793
 
1684
1794
  /** @public */
@@ -1689,7 +1799,21 @@ export declare interface TimestampExtended {
1689
1799
  };
1690
1800
  }
1691
1801
 
1692
- /** @public */
1802
+ /**
1803
+ * @public
1804
+ *
1805
+ * Inherited `Long` members surfaced on `Timestamp`.
1806
+ * When `Long` gains a new member: add it here if it should pass through, or
1807
+ * add a `@deprecated declare` line on the `Timestamp` class if it should be
1808
+ * surfaced as deprecated. Anything left unclassified is silently dropped from
1809
+ * the public type — preventing accidental behavioral bleed-through.
1810
+ */
1811
+ declare type TimestampKept = 'toBigInt' | 'toString' | 'compare' | 'equals' | 'eq' | 'notEquals' | 'neq' | 'ne' | 'lessThan' | 'lt' | 'lessThanOrEqual' | 'lte' | 'le' | 'greaterThan' | 'gt' | 'greaterThanOrEqual' | 'gte' | 'ge';
1812
+
1813
+ /**
1814
+ * @public
1815
+ * @deprecated This type is no longer used internally and will be removed in a future version.
1816
+ */
1693
1817
  export declare type TimestampOverrides = '_bsontype' | 'toExtendedJSON' | 'fromExtendedJSON' | 'inspect' | typeof bsonType;
1694
1818
 
1695
1819
  /**