Skip to content

Commit

Permalink
🐞Transform not correctly saved #68
Browse files Browse the repository at this point in the history
  • Loading branch information
yannick-beot-sp committed Mar 5, 2024
1 parent acefd65 commit 41c6aa3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ This changelog is following the recommended format by [keepachangelog](https://k

## [Unreleased]

## [1.0.1] - 2024-03-05

### Fixed

- Transform not correctly saved (cf. [#68](https://github.com/yannick-beot-sp/vscode-sailpoint-identitynow/issues/68))

## [1.0.0] - 2024-03-04

### Added
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,10 @@ The patterns defined above use the following tokens:

## Release Notes

## 1.0.1

- Transform not correctly saved (cf. [#68](https://github.com/yannick-beot-sp/vscode-sailpoint-identitynow/issues/68))

### 1.0.0

- Import/Export entitlements for roles
Expand Down
22 changes: 14 additions & 8 deletions src/files/IdentityNowResourceProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,8 @@ export class IdentityNowResourceProvider implements FileSystemProvider {

this._emitter.fire([{ type: vscode.FileChangeType.Created, uri }]);
} else {
// Need to update the content to remove id and internal properties from the payload
// to prevent a bad request error
if (resourcePath.match("transform")) {
let transform = JSON.parse(data);
delete transform.id;
delete transform.internal;
data = JSON.stringify(transform);
} else if (resourcePath.match("form-definitions")) {

if (resourcePath.match("form-definitions")) {
// UI is pushing all data as a Patch. Doing the same for form definitions
const newData = JSON.parse(data) as FormDefinitionResponseBeta
const jsonpatch: Operation[] = [
Expand Down Expand Up @@ -227,8 +221,20 @@ export class IdentityNowResourceProvider implements FileSystemProvider {
JSON.stringify(jsonpatch)
);
} else {
// Need to update the content to remove id and internal properties from the payload
// to prevent a bad request error
if (resourcePath.match("transform")) {
console.log("Removing id from transform payload")
let transform = JSON.parse(data);
delete transform.id;
delete transform.internal;
data = JSON.stringify(transform);
}

const updatedData = await client.updateResource(resourcePath, data);
console.log(`Payload updated for ${resourcePath}`)
if (!updatedData) {
console.error(`Issue with ${uri}`);
throw vscode.FileSystemError.FileNotFound(uri);
}
}
Expand Down

0 comments on commit 41c6aa3

Please sign in to comment.