Skip to content

Commit 0b159fa

Browse files
fix: deprecate dapr-client NPM package and fix HTTP serializer issues. (#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]>
1 parent aac0a45 commit 0b159fa

File tree

7 files changed

+14
-23
lines changed

7 files changed

+14
-23
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ jobs:
6666

6767
- name: "[dapr-client] Configure to publish to dapr-client for deprecation notice reasons"
6868
if: env.DEPLOY_PACKAGE == 'true'
69-
run: sed -i s#"@dapr/dapr"#"dapr-client"# package.json
69+
run: |
70+
sed -i s#"@dapr/dapr"#"dapr-client"# package.json
71+
echo "This has been deprecated and will not be updated anymore, please use https://www.npmjs.com/package/@dapr/dapr" > README.md
7072
7173
- name: "[dapr-client] Build Package"
7274
if: env.DEPLOY_PACKAGE == 'true'

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ Instantly get started by installing the Dapr JS SDK and reading the [getting sta
2525
npm install --save @dapr/dapr
2626
```
2727

28-
> ⚠️ 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.
29-
3028
## Documentation
3129

3230
Visit [https://docs.dapr.io/developing-applications/sdks/js/](https://docs.dapr.io/developing-applications/sdks/js/) to view the full documentation.

daprdocs/content/en/js-sdk-docs/_index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ To get started with the Javascript SDK, install the Dapr JavaScript SDK package
1717
npm install --save @dapr/dapr
1818
```
1919

20-
> ⚠️ [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.
21-
2220
## Structure
2321

2422
The Dapr Javascript SDK contains two major components:

daprdocs/content/en/js-sdk-docs/js-server/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ start().catch((e) => {
569569
#### Getting a configuration value
570570

571571
```typescript
572-
import { DaprServer } from "dapr-client";
572+
import { DaprServer } from "@dapr/dapr";
573573

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

596596
```typescript
597-
import { DaprServer } from "dapr-client";
597+
import { DaprServer } from "@dapr/dapr";
598598

599599
const daprHost = "127.0.0.1";
600600
const daprPort = "3500";

src/actors/client/ActorClient/ActorClientHTTP.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default class ActorClientHTTP implements IClientActor {
4242
headers: {
4343
"Content-Type": "application/json",
4444
},
45-
body: JSON.stringify(operations),
45+
body: operations,
4646
});
4747
}
4848

@@ -62,12 +62,12 @@ export default class ActorClientHTTP implements IClientActor {
6262
headers: {
6363
"Content-Type": "application/json",
6464
},
65-
body: JSON.stringify({
65+
body: {
6666
period: reminder.period.toString().toLocaleLowerCase().replace("pt", ""),
6767
dueTime: reminder?.dueTime?.toString()?.toLocaleLowerCase().replace("pt", ""),
6868
ttl: reminder?.ttl?.toString()?.toLocaleLowerCase().replace("pt", ""),
6969
data: reminder.data,
70-
}),
70+
},
7171
});
7272
}
7373

@@ -88,13 +88,13 @@ export default class ActorClientHTTP implements IClientActor {
8888
headers: {
8989
"Content-Type": "application/json",
9090
},
91-
body: JSON.stringify({
91+
body: {
9292
period: timer.period.toString().toLocaleLowerCase().replace("pt", ""),
9393
dueTime: timer?.dueTime?.toString()?.toLocaleLowerCase().replace("pt", ""),
9494
ttl: timer?.ttl?.toString()?.toLocaleLowerCase().replace("pt", ""),
9595
data: timer.data,
9696
callback: timer.callback,
97-
}),
97+
},
9898
});
9999
}
100100

src/actors/client/ActorProxyBuilder.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export default class ActorProxyBuilder<T> {
3535
if (args.length == 1) {
3636
const [daprClient] = args;
3737
this.actorClient = new ActorClient(
38-
daprClient.getDaprHost(),
39-
daprClient.getDaprPort(),
40-
daprClient.getCommunicationProtocol(),
41-
daprClient.getOptions(),
38+
daprClient.options.daprHost,
39+
daprClient.options.daprPort,
40+
daprClient.options.communicationProtocol,
41+
daprClient.options,
4242
);
4343
} else {
4444
const [host, port, communicationProtocol, clientOptions] = args;

src/implementation/Client/DaprClient.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ import { Settings } from "../../utils/Settings.util";
5858
import { Logger } from "../../logger/Logger";
5959
import GRPCClientProxy from "./GRPCClient/proxy";
6060
import * as NodeJSUtils from "../../utils/NodeJS.util";
61-
import { SDK_PACKAGE_NAME } from "../../version";
6261
import { getClientOptions } from "../../utils/Client.util";
6362

6463
export default class DaprClient {
@@ -88,12 +87,6 @@ export default class DaprClient {
8887
throw new Error("DAPR_INCORRECT_SIDECAR_PORT");
8988
}
9089

91-
if (String(SDK_PACKAGE_NAME) === "dapr-client") {
92-
this.logger.warn(
93-
"dapr-client is deprecated. Please use @dapr/dapr instead. For more information, see https://github.com/dapr/js-sdk/issues/259",
94-
);
95-
}
96-
9790
// Builder
9891
switch (options.communicationProtocol) {
9992
case CommunicationProtocolEnum.GRPC: {

0 commit comments

Comments
 (0)