Skip to content

Commit 5d1db53

Browse files
committed
Merge branch 'development' into fix/DX-2224-lint-errors
2 parents d80f1a4 + 1656264 commit 5d1db53

File tree

9 files changed

+88
-2258
lines changed

9 files changed

+88
-2258
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## [v1.19.5](https://github.com/contentstack/contentstack-management-javascript/tree/v1.19.5) (2025-03-17)
4+
- Fix
5+
- Added AuditLog in the stack class
6+
- Fixed the Unit Test cases and added sanity test case for audit log
7+
38
## [v1.19.4](https://github.com/contentstack/contentstack-management-javascript/tree/v1.19.4) (2025-03-10)
49
- Fix
510
- added fix for variants import

lib/stack/auditlog/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function AuditLog (http, data = {}) {
3636
} || {}
3737
const response = await http.get(this.urlPath, headers)
3838
if (response.data) {
39-
return new AuditLog(http, parseData(response, this.stackHeaders))
39+
return response.data
4040
} else {
4141
throw error(response)
4242
}

lib/stack/index.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,30 @@ export function Stack (http, data) {
809809
*
810810
*/
811811
this.delete = deleteEntity(http)
812+
813+
/**
814+
* @description Audit log displays a record of all the activities performed in a stack and helps you keep a track of all published items, updates, deletes, and current status of the existing content.
815+
* @param {String}
816+
* @returns {AuditLog}
817+
*
818+
* @example
819+
* import * as contentstack from '@contentstack/management'
820+
* const client = contentstack.client()
821+
*
822+
* client.stack({ api_key: 'api_key'}).auditLog().fetchAll()
823+
* .then((logs) => console.log(logs))
824+
*
825+
* client.stack({ api_key: 'api_key' }).auditLog('log_item_uid').fetch()
826+
* .then((log) => console.log(log))
827+
*
828+
*/
829+
this.auditLog = (logItemUid = null) => {
830+
const data = { stackHeaders: this.stackHeaders }
831+
if (logItemUid) {
832+
data.logs = { uid: logItemUid }
833+
}
834+
return new AuditLog(http, data)
835+
}
812836
} else {
813837
/**
814838
* @description The Create stack call creates a new stack in your Contentstack account.
@@ -844,30 +868,6 @@ export function Stack (http, data) {
844868
* .then((stack) => console.log(stack))
845869
*/
846870
this.query = query({ http: http, wrapperCollection: StackCollection })
847-
848-
/**
849-
* @description Audit log displays a record of all the activities performed in a stack and helps you keep a track of all published items, updates, deletes, and current status of the existing content.
850-
* @param {String}
851-
* @returns {AuditLog}
852-
*
853-
* @example
854-
* import * as contentstack from '@contentstack/management'
855-
* const client = contentstack.client()
856-
*
857-
* client.stack({ api_key: 'api_key'}).auditLog().fetchAll()
858-
* .then((logs) => console.log(logs))
859-
*
860-
* client.stack({ api_key: 'api_key' }).auditLog('log_item_uid').fetch()
861-
* .then((log) => console.log(log))
862-
*
863-
*/
864-
this.auditLog = (logItemUid = null) => {
865-
const data = { stackHeaders: this.stackHeaders }
866-
if (logItemUid) {
867-
data.logs = { uid: logItemUid }
868-
}
869-
return new AuditLog(http, data)
870-
}
871871
}
872872
return this
873873
}

0 commit comments

Comments
 (0)