diff --git a/package-lock.json b/package-lock.json index aed765f7..77cdbbc8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "bson", - "version": "4.5.1", + "version": "4.5.2", "license": "Apache-2.0", "dependencies": { "buffer": "^5.6.0" diff --git a/src/binary.ts b/src/binary.ts index 20619dec..8e4e10af 100644 --- a/src/binary.ts +++ b/src/binary.ts @@ -48,6 +48,10 @@ export class Binary { static readonly SUBTYPE_UUID = 4; /** MD5 BSON type */ static readonly SUBTYPE_MD5 = 5; + /** Encrypted BSON type */ + static readonly SUBTYPE_ENCRYPTED = 6; + /** Column BSON type */ + static readonly SUBTYPE_COLUMN = 7; /** User BSON type */ static readonly SUBTYPE_USER_DEFINED = 128; diff --git a/src/bson.ts b/src/bson.ts index 550539d3..22acdb67 100644 --- a/src/bson.ts +++ b/src/bson.ts @@ -30,6 +30,8 @@ export { BSON_BINARY_SUBTYPE_USER_DEFINED, BSON_BINARY_SUBTYPE_UUID, BSON_BINARY_SUBTYPE_UUID_NEW, + BSON_BINARY_SUBTYPE_ENCRYPTED, + BSON_BINARY_SUBTYPE_COLUMN, BSON_DATA_ARRAY, BSON_DATA_BINARY, BSON_DATA_BOOLEAN, diff --git a/src/constants.ts b/src/constants.ts index 22b411eb..6af63e69 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -100,5 +100,11 @@ export const BSON_BINARY_SUBTYPE_UUID_NEW = 4; /** Binary MD5 Type @internal */ export const BSON_BINARY_SUBTYPE_MD5 = 5; +/** Encrypted BSON type @internal */ +export const BSON_BINARY_SUBTYPE_ENCRYPTED = 6; + +/** Column BSON type @internal */ +export const BSON_BINARY_SUBTYPE_COLUMN = 7; + /** Binary User Defined Type @internal */ export const BSON_BINARY_SUBTYPE_USER_DEFINED = 128; diff --git a/test/node/check_constants.js b/test/node/check_constants.js index f223e9c1..6a91d604 100644 --- a/test/node/check_constants.js +++ b/test/node/check_constants.js @@ -39,6 +39,16 @@ describe('BSON Constants', () => { expect(BSON.BSON_BINARY_SUBTYPE_MD5).to.equal(5); expect(BSON.Binary.SUBTYPE_MD5).to.equal(5); }); + + it('Encrypted should be 6', () => { + expect(BSON.BSON_BINARY_SUBTYPE_ENCRYPTED).to.equal(6); + expect(BSON.Binary.SUBTYPE_ENCRYPTED).to.equal(6); + }); + + it('Column should be 7', () => { + expect(BSON.BSON_BINARY_SUBTYPE_COLUMN).to.equal(7); + expect(BSON.Binary.SUBTYPE_COLUMN).to.equal(7); + }); }); context('BSON Type indicators', () => { /* diff --git a/test/node/specs/bson-corpus/binary.json b/test/node/specs/bson-corpus/binary.json index dd1ebfa1..beb2e07a 100644 --- a/test/node/specs/bson-corpus/binary.json +++ b/test/node/specs/bson-corpus/binary.json @@ -50,6 +50,11 @@ "canonical_bson": "1D000000057800100000000573FFD26444B34C6990E8E7D1DFC035D400", "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"05\"}}}" }, + { + "description": "subtype 0x07", + "canonical_bson": "1D000000057800100000000773FFD26444B34C6990E8E7D1DFC035D400", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"07\"}}}" + }, { "description": "subtype 0x80", "canonical_bson": "0F0000000578000200000080FFFF00",