Most likely missed a couple of things (or glossed over minor things), but this is most of it
Removed all traces of Stargate (except for some names)
Includes removing all dead branches
Changed authHeaderName to just be a constant (or env variable)
Some formatting/linting fixes
Updated axios dependency
Also inlined interceptor functions so no longer had to depend on internal axios stuff (InternalAxiosRequestConfig)
Made httpClient accept an optional collectionName to add to the URL to fix the weird URL issues once and ∀
Added my (Kavin's) name to package.json contributors
Tests
[!note] Frankly, I think some of these tests may be unnecessary (or a bit too strict!) as they're testing the API more than the client
Added applicationToken in client options using process.env.APPLICATION_TOKEN so tests could properly authenticate w/ Astra
Set TEST_COLLECTION_NAME to default_keyspace
Removed a handful of tests related to Stargate
Should fail if the number of levels in the doc is > 8
Changed to be >16
Should fail if the string field value is > 16000
Changed to be >8000
Updated error message
Should fail if the field length is > 48
Changed to be >100
Added violator name to expected error message
Should fail if an array field size is > 100
Changed to be >1000
Updated error message
Should fail if a doc contains more than 64 properties
Changed to be >2000
Should fail if the string field value is > 16000
Changed to be >8000
Updated error message
Should fail if a doc contains more than 2000 properties
Changed to be >1000
I think one or two more I forgot
// collections.collection:updateOne:should upsert a doc with upsert flag true in updateOne call
// collections.collection:updateOne:should make _id an ObjectId when upserting with no _id
// collections.collection:updateMany:should upsert with upsert flag set to true when not found
// collections.collection:updateMany:should make _id an ObjectId when upserting with no _id
// collections.collection:findOneAndUpdate:should make _id an ObjectId when upserting with no _id
// collections.collection:deleteMany:findOneAndReplace should make _id an ObjectId when upserting with no _id
// Error: Command "..." failed with the following errors:
[{"message":"Bad value for '_id' property: empty String not allowed","errorCode":"SHRED_BAD_DOCID_EMPTY_STRING"}]
// Looks like 'setDefaultIdForUpsert' is being called, but the function isn't actually setting a default value
Updated 'setDefaultIdForUpsert' to set _id to new ObjectId instead of String()
Unfixed fails:
// collections.collection:findOne, findMany & filter:should find & find doc $size 0 test
// Expected values to be strictly equal: 19 !== 1
assert.strictEqual(findRespDocs.length, 1);
// I'm not really sure why it's failing—it looks like the command is being sent correctly??
// '{"find":{"filter":{"tags":{"$size":0}}}}'
// And only one of those docs has an empty array for "tags" as well
// Therefore, I hae no clue why every doc is being returned
Most likely missed a couple of things (or glossed over minor things), but this is most of it
Removed all traces of Stargate (except for some names)
Changed
authHeaderName
to just be a constant (or env variable)Some formatting/linting fixes
Updated
axios
dependencyInternalAxiosRequestConfig
)Made
httpClient
accept an optionalcollectionName
to add to the URL to fix the weird URL issues once and ∀Added my (Kavin's) name to
package.json
contributorsTests
Added
applicationToken
in client options usingprocess.env.APPLICATION_TOKEN
so tests could properly authenticate w/ AstraSet
TEST_COLLECTION_NAME
todefault_keyspace
Removed a handful of tests related to Stargate
Should fail if the number of levels in the doc is > 8
Should fail if the string field value is > 16000
Should fail if the field length is > 48
Should fail if an array field size is > 100
Should fail if a doc contains more than 64 properties
Should fail if the string field value is > 16000
Should fail if a doc contains more than 2000 properties
I think one or two more I forgot
_id
tonew ObjectId
instead ofString()
Unfixed fails: