From e1ca515e7e308695622cfb9d4e509195aab9d7e7 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Mon, 11 Mar 2024 14:32:03 -0400 Subject: [PATCH 1/6] added in new subtype and synced test --- src/constants.ts | 2 ++ test/node/specs/bson-corpus/binary.json | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/constants.ts b/src/constants.ts index 1311ef06..3b6461b3 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -109,6 +109,8 @@ export const BSON_BINARY_SUBTYPE_ENCRYPTED = 6; /** Column BSON type @internal */ export const BSON_BINARY_SUBTYPE_COLUMN = 7; +export const BSON_BINARY_SUBTYPE_SENSITIVE = 8; + /** Binary User Defined Type @internal */ export const BSON_BINARY_SUBTYPE_USER_DEFINED = 128; diff --git a/test/node/specs/bson-corpus/binary.json b/test/node/specs/bson-corpus/binary.json index beb2e07a..20aaef74 100644 --- a/test/node/specs/bson-corpus/binary.json +++ b/test/node/specs/bson-corpus/binary.json @@ -55,6 +55,11 @@ "canonical_bson": "1D000000057800100000000773FFD26444B34C6990E8E7D1DFC035D400", "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"07\"}}}" }, + { + "description": "subtype 0x08", + "canonical_bson": "1D000000057800100000000873FFD26444B34C6990E8E7D1DFC035D400", + "canonical_extjson": "{\"x\" : { \"$binary\" : {\"base64\" : \"c//SZESzTGmQ6OfR38A11A==\", \"subType\" : \"08\"}}}" + }, { "description": "subtype 0x80", "canonical_bson": "0F0000000578000200000080FFFF00", From 741fc89b867d2ca685717ec7ab1864803ce48c41 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Mon, 11 Mar 2024 14:37:41 -0400 Subject: [PATCH 2/6] added in API docs + @internal tag --- src/constants.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants.ts b/src/constants.ts index 3b6461b3..a71f7993 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -109,6 +109,7 @@ export const BSON_BINARY_SUBTYPE_ENCRYPTED = 6; /** Column BSON type @internal */ export const BSON_BINARY_SUBTYPE_COLUMN = 7; +/** Sensitive BSON type @internal */ export const BSON_BINARY_SUBTYPE_SENSITIVE = 8; /** Binary User Defined Type @internal */ From b8e7cfd5a141296c96b4543717126b3049e5ef50 Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Mon, 11 Mar 2024 16:34:04 -0400 Subject: [PATCH 3/6] added constant to binary class" git push --- src/binary.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/binary.ts b/src/binary.ts index 6c4d54fc..84601486 100644 --- a/src/binary.ts +++ b/src/binary.ts @@ -56,6 +56,8 @@ export class Binary extends BSONValue { static readonly SUBTYPE_ENCRYPTED = 6; /** Column BSON type */ static readonly SUBTYPE_COLUMN = 7; + /** Sensitive BSON type */ + static readonly SENSITIVE_COLUMN = 8; /** User BSON type */ static readonly SUBTYPE_USER_DEFINED = 128; From 324da2310ffbb95fab85c37ceeef7c57d44f6fec Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Mon, 11 Mar 2024 16:38:26 -0400 Subject: [PATCH 4/6] fix typo --- src/binary.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/binary.ts b/src/binary.ts index 84601486..84182fb2 100644 --- a/src/binary.ts +++ b/src/binary.ts @@ -57,7 +57,7 @@ export class Binary extends BSONValue { /** Column BSON type */ static readonly SUBTYPE_COLUMN = 7; /** Sensitive BSON type */ - static readonly SENSITIVE_COLUMN = 8; + static readonly SUBTYPE_SENSITIVE = 8; /** User BSON type */ static readonly SUBTYPE_USER_DEFINED = 128; From 5e710db6637f624bd5aade4e0e281991e6678f5f Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Mon, 11 Mar 2024 16:50:40 -0400 Subject: [PATCH 5/6] added tests --- test/node/constants.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/node/constants.test.ts b/test/node/constants.test.ts index 77d17e94..f535c8ee 100644 --- a/test/node/constants.test.ts +++ b/test/node/constants.test.ts @@ -19,6 +19,8 @@ describe('BSON Constants', () => { | "\x04" UUID | "\x05" MD5 | "\x06" Encrypted BSON value + | "\x07" Column BSON value + | "\x08" Sensitive BSON value | "\x80" User defined */ it('Default should be 0', () => { @@ -55,6 +57,11 @@ describe('BSON Constants', () => { expect(constants.BSON_BINARY_SUBTYPE_COLUMN).to.equal(7); expect(Binary.SUBTYPE_COLUMN).to.equal(7); }); + + it('Sensitive should be 7', () => { + expect(constants.BSON_BINARY_SUBTYPE_SENSITIVE).to.equal(8); + expect(Binary.SUBTYPE_SENSITIVE).to.equal(8); + }); }); context('BSON Type indicators', () => { /* From 10057348f6d1f664d6a4a4b8df527f2d79fbb335 Mon Sep 17 00:00:00 2001 From: Aditi Khare <106987683+aditi-khare-mongoDB@users.noreply.github.com> Date: Tue, 12 Mar 2024 10:37:39 -0400 Subject: [PATCH 6/6] Update test/node/constants.test.ts Co-authored-by: Neal Beeken --- test/node/constants.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/node/constants.test.ts b/test/node/constants.test.ts index f535c8ee..b4e262be 100644 --- a/test/node/constants.test.ts +++ b/test/node/constants.test.ts @@ -58,7 +58,7 @@ describe('BSON Constants', () => { expect(Binary.SUBTYPE_COLUMN).to.equal(7); }); - it('Sensitive should be 7', () => { + it('Sensitive should be 8', () => { expect(constants.BSON_BINARY_SUBTYPE_SENSITIVE).to.equal(8); expect(Binary.SUBTYPE_SENSITIVE).to.equal(8); });