Skip to content

Commit

Permalink
Merge pull request #48 from sailpoint-oss/fning/PLTCONN-4268
Browse files Browse the repository at this point in the history
PLTCONN-4268: Support patching connector configs
  • Loading branch information
fangming-ning-sp committed Jan 17, 2024
2 parents a7403cb + 871a1ce commit 0a035c6
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion lib/response/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface Response<T> {
send(output: T): void
saveState(state: any): void
keepAlive(): void
patchConfig(patches: Patch[]): void
}

/**
Expand Down Expand Up @@ -47,6 +48,10 @@ export class ResponseStream<T> implements Response<T> {
keepAlive(): void {
this._writable.write(new RawResponse({}, ResponseType.KeepAlive))
}

patchConfig(patches: Patch[]): void {
this._writable.write(new RawResponse(patches, ResponseType.Config))
}
}

/**
Expand All @@ -55,7 +60,8 @@ export class ResponseStream<T> implements Response<T> {
export enum ResponseType {
Output = 'output',
State = 'state',
KeepAlive = 'keepAlive'
KeepAlive = 'keepAlive',
Config = 'config'
}

/**
Expand All @@ -70,3 +76,17 @@ export class RawResponse {
this.type = type
}
}

/**
* Enum PatchOp is the config patch operations
*/
export enum PatchOp {
Add = 'add',
Replace = 'replace',
Remove = 'remove'
}

/**
* Patch is a JSON patch for source config
*/
export type Patch = { op: PatchOp, path: string, value?: any }

0 comments on commit 0a035c6

Please sign in to comment.