diff --git a/lib/collection.ts b/lib/collection.ts index 2475daae..63986d2a 100644 --- a/lib/collection.ts +++ b/lib/collection.ts @@ -1655,6 +1655,7 @@ export class Collection { new MutateInResult({ content: content, cas: resp.cas, + token: resp.token, }) ) return diff --git a/lib/crudoptypes.ts b/lib/crudoptypes.ts index 44f2f870..87f6e3ca 100644 --- a/lib/crudoptypes.ts +++ b/lib/crudoptypes.ts @@ -234,12 +234,18 @@ export class MutateInResult { */ cas: Cas + /** + * The token representing the mutation performed. + */ + token?: MutationToken + /** * @internal */ constructor(data: MutateInResult) { this.content = data.content this.cas = data.cas + this.token = data.token } } diff --git a/test/crud.test.js b/test/crud.test.js index 1258a91a..1704cdf8 100644 --- a/test/crud.test.js +++ b/test/crud.test.js @@ -1252,6 +1252,7 @@ function genericTests(collFn) { ]) assert.isObject(res) assert.isOk(res.cas) + validateMutationToken(res.token) assert.isUndefined(res.content[0].error) assert.strictEqual(res.content[0].value, 5) @@ -1311,6 +1312,7 @@ function genericTests(collFn) { ) assert.isObject(res) assert.isOk(res.cas) + validateMutationToken(res.token) assert.isUndefined(res.content[0].error) assert.strictEqual(res.content[0].value, 5) @@ -1358,6 +1360,7 @@ function genericTests(collFn) { ) assert.isObject(res) assert.isOk(res.cas) + validateMutationToken(res.token) assert.isUndefined(res.content[0].error) assert.strictEqual(res.content[0].value, 5)