Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [v1.19.5](https://github.com/contentstack/contentstack-management-javascript/tree/v1.19.5) (2025-03-17)
- Fix
- Added AuditLog in the stack class
- Fixed the Unit Test cases and added sanity test case for audit log

## [v1.19.4](https://github.com/contentstack/contentstack-management-javascript/tree/v1.19.4) (2025-03-10)
- Fix
- added fix for variants import
Expand Down
2 changes: 1 addition & 1 deletion lib/stack/auditlog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function AuditLog (http, data = {}) {
} || {}
const response = await http.get(this.urlPath, headers)
if (response.data) {
return new AuditLog(http, parseData(response, this.stackHeaders))
return response.data
} else {
throw error(response)
}
Expand Down
48 changes: 24 additions & 24 deletions lib/stack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,30 @@ export function Stack (http, data) {
*
*/
this.delete = deleteEntity(http)

/**
* @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.
* @param {String}
* @returns {AuditLog}
*
* @example
* import * as contentstack from '@contentstack/management'
* const client = contentstack.client()
*
* client.stack({ api_key: 'api_key'}).auditLog().fetchAll()
* .then((logs) => console.log(logs))
*
* client.stack({ api_key: 'api_key' }).auditLog('log_item_uid').fetch()
* .then((log) => console.log(log))
*
*/
this.auditLog = (logItemUid = null) => {
const data = { stackHeaders: this.stackHeaders }
if (logItemUid) {
data.logs = { uid: logItemUid }
}
return new AuditLog(http, data)
}
} else {
/**
* @description The Create stack call creates a new stack in your Contentstack account.
Expand Down Expand Up @@ -845,30 +869,6 @@ export function Stack (http, data) {
* .then((stack) => console.log(stack))
*/
this.query = query({ http: http, wrapperCollection: StackCollection })

/**
* @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.
* @param {String}
* @returns {AuditLog}
*
* @example
* import * as contentstack from '@contentstack/management'
* const client = contentstack.client()
*
* client.stack({ api_key: 'api_key'}).auditLog().fetchAll()
* .then((logs) => console.log(logs))
*
* client.stack({ api_key: 'api_key' }).auditLog('log_item_uid').fetch()
* .then((log) => console.log(log))
*
*/
this.auditLog = (logItemUid = null) => {
const data = { stackHeaders: this.stackHeaders }
if (logItemUid) {
data.logs = { uid: logItemUid }
}
return new AuditLog(http, data)
}
}
return this
}
Expand Down
Loading
Loading