Skip to content

Commit

Permalink
[SHIM] added an interim shim to streams.update for the API change (#235)
Browse files Browse the repository at this point in the history
- added an api shim to `stream.update()` to handle old usages in the wild for the interim
  • Loading branch information
aricart committed Dec 2, 2021
1 parent 35eef83 commit d698a5a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nats-base-client/jsmstream_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ export class StreamAPIImpl extends BaseApiClient implements StreamAPI {
name: string,
cfg = {} as StreamUpdateConfig,
): Promise<StreamInfo> {
if (typeof name === "object") {
const sc = name as StreamConfig;
name = sc.name;
cfg = sc;
console.trace(
`\u001B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \u001B[0m`,
);
}
validateStreamName(name);
const r = await this._request(
`${this.prefix}.STREAM.UPDATE.${name}`,
Expand Down

0 comments on commit d698a5a

Please sign in to comment.