Skip to content

Commit

Permalink
fix: deprecate dapr-client NPM package and fix HTTP serializer issues. (
Browse files Browse the repository at this point in the history
#467)

* Deprecate dapr-client NPM package

Signed-off-by: Shubham Sharma <[email protected]>

* Publish dapr-client but update the README to notify deprecation

Signed-off-by: Shubham Sharma <[email protected]>

* Prettify

Signed-off-by: Shubham Sharma <[email protected]>

* Fix Actors proxy

Signed-off-by: Shubham Sharma <[email protected]>

* Fix Actors

Signed-off-by: Shubham Sharma <[email protected]>

---------

Signed-off-by: Shubham Sharma <[email protected]>
Signed-off-by: Xavier Geerinck <[email protected]>
Co-authored-by: Xavier Geerinck <[email protected]>
  • Loading branch information
shubham1172 and XavierGeerinck authored Mar 20, 2023
1 parent aac0a45 commit 0b159fa
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ jobs:

- name: "[dapr-client] Configure to publish to dapr-client for deprecation notice reasons"
if: env.DEPLOY_PACKAGE == 'true'
run: sed -i s#"@dapr/dapr"#"dapr-client"# package.json
run: |
sed -i s#"@dapr/dapr"#"dapr-client"# package.json
echo "This has been deprecated and will not be updated anymore, please use https://www.npmjs.com/package/@dapr/dapr" > README.md
- name: "[dapr-client] Build Package"
if: env.DEPLOY_PACKAGE == 'true'
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ Instantly get started by installing the Dapr JS SDK and reading the [getting sta
npm install --save @dapr/dapr
```

> ⚠️ the [`dapr-client`](https://www.npmjs.com/package/dapr-client) package has been deprecated. Please see https://github.com/dapr/js-sdk/issues/259 for more information.
## Documentation

Visit [https://docs.dapr.io/developing-applications/sdks/js/](https://docs.dapr.io/developing-applications/sdks/js/) to view the full documentation.
Expand Down
2 changes: 0 additions & 2 deletions daprdocs/content/en/js-sdk-docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ To get started with the Javascript SDK, install the Dapr JavaScript SDK package
npm install --save @dapr/dapr
```

> ⚠️ [dapr-client](https://www.npmjs.com/package/dapr-client) is now deprecated. Please see [#259](https://github.com/dapr/js-sdk/issues/259) for more information.
## Structure

The Dapr Javascript SDK contains two major components:
Expand Down
4 changes: 2 additions & 2 deletions daprdocs/content/en/js-sdk-docs/js-server/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ start().catch((e) => {
#### Getting a configuration value

```typescript
import { DaprServer } from "dapr-client";
import { DaprServer } from "@dapr/dapr";

const daprHost = "127.0.0.1";
const daprPort = "3500";
Expand All @@ -594,7 +594,7 @@ start().catch((e) => {
#### Subscribing to Key Changes

```typescript
import { DaprServer } from "dapr-client";
import { DaprServer } from "@dapr/dapr";

const daprHost = "127.0.0.1";
const daprPort = "3500";
Expand Down
10 changes: 5 additions & 5 deletions src/actors/client/ActorClient/ActorClientHTTP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default class ActorClientHTTP implements IClientActor {
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(operations),
body: operations,
});
}

Expand All @@ -62,12 +62,12 @@ export default class ActorClientHTTP implements IClientActor {
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
body: {
period: reminder.period.toString().toLocaleLowerCase().replace("pt", ""),
dueTime: reminder?.dueTime?.toString()?.toLocaleLowerCase().replace("pt", ""),
ttl: reminder?.ttl?.toString()?.toLocaleLowerCase().replace("pt", ""),
data: reminder.data,
}),
},
});
}

Expand All @@ -88,13 +88,13 @@ export default class ActorClientHTTP implements IClientActor {
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
body: {
period: timer.period.toString().toLocaleLowerCase().replace("pt", ""),
dueTime: timer?.dueTime?.toString()?.toLocaleLowerCase().replace("pt", ""),
ttl: timer?.ttl?.toString()?.toLocaleLowerCase().replace("pt", ""),
data: timer.data,
callback: timer.callback,
}),
},
});
}

Expand Down
8 changes: 4 additions & 4 deletions src/actors/client/ActorProxyBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export default class ActorProxyBuilder<T> {
if (args.length == 1) {
const [daprClient] = args;
this.actorClient = new ActorClient(
daprClient.getDaprHost(),
daprClient.getDaprPort(),
daprClient.getCommunicationProtocol(),
daprClient.getOptions(),
daprClient.options.daprHost,
daprClient.options.daprPort,
daprClient.options.communicationProtocol,
daprClient.options,
);
} else {
const [host, port, communicationProtocol, clientOptions] = args;
Expand Down
7 changes: 0 additions & 7 deletions src/implementation/Client/DaprClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import { Settings } from "../../utils/Settings.util";
import { Logger } from "../../logger/Logger";
import GRPCClientProxy from "./GRPCClient/proxy";
import * as NodeJSUtils from "../../utils/NodeJS.util";
import { SDK_PACKAGE_NAME } from "../../version";
import { getClientOptions } from "../../utils/Client.util";

export default class DaprClient {
Expand Down Expand Up @@ -88,12 +87,6 @@ export default class DaprClient {
throw new Error("DAPR_INCORRECT_SIDECAR_PORT");
}

if (String(SDK_PACKAGE_NAME) === "dapr-client") {
this.logger.warn(
"dapr-client is deprecated. Please use @dapr/dapr instead. For more information, see https://github.com/dapr/js-sdk/issues/259",
);
}

// Builder
switch (options.communicationProtocol) {
case CommunicationProtocolEnum.GRPC: {
Expand Down

0 comments on commit 0b159fa

Please sign in to comment.