Skip to content

Commit

Permalink
[release-3.3] chore(release): Prepare for v3.3.1 release (#583)
Browse files Browse the repository at this point in the history
* fix(proto): update gRPC requests to use the correct request parameters (#581)

* See if actions break

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

* Update getMetadata and shutdown usage

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

* Fix lint

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

* Lint

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

* Revert temp change

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

* Remove a test

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

* Lint

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

---------

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

* chore(release): Prepare for v3.3.1 release (#582)

Bump package version;

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

---------

Signed-off-by: Shubham Sharma <[email protected]>
  • Loading branch information
shubham1172 authored Mar 6, 2024
1 parent 690b053 commit 37937b3
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 26 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@dapr/dapr",
"version": "3.3.0",
"version": "3.3.1",
"description": "The official Dapr (https://dapr.io) SDK for Node.js",
"types": "./build/index.d.ts",
"scripts": {
"test": "npm run test:unit:all && npm run test:e2e:all",
"test:load": "jest --runInBand --detectOpenHandles",
"test:load:http": "TEST_SECRET_1=secret_val_1 TEST_SECRET_2=secret_val_2 dapr run --app-id test-suite --app-protocol http --app-port 50001 --dapr-http-port 50000 --components-path ./test/components -- npm run test:load 'test/load'",
"test:e2e": "jest --runInBand --detectOpenHandles",
"test:e2e:all": "npm run test:e2e:http; npm run test:e2e:grpc; npm run test:e2e:common; npm run test:e2e:workflow",
"test:e2e:all": "npm run test:e2e:http && npm run test:e2e:grpc && npm run test:e2e:common && npm run test:e2e:workflow",
"test:e2e:grpc": "npm run test:e2e:grpc:client && npm run test:e2e:grpc:server && npm run test:e2e:grpc:clientWithApiToken",
"test:e2e:grpc:client": "npm run prebuild && TEST_SECRET_1=secret_val_1 TEST_SECRET_2=secret_val_2 dapr run --app-id test-suite --app-protocol grpc --app-port 50001 --dapr-grpc-port 50000 --components-path ./test/components -- jest --runInBand --detectOpenHandles --testMatch [ '**/test/e2e/grpc/*client.test.ts' ]",
"test:e2e:grpc:clientWithApiToken": "npm run prebuild && TEST_SECRET_1=secret_val_1 TEST_SECRET_2=secret_val_2 DAPR_API_TOKEN=test dapr run --app-id test-suite --app-protocol grpc --app-port 50001 --dapr-grpc-port 50000 --components-path ./test/components -- jest --runInBand --detectOpenHandles --testMatch [ '**/test/e2e/grpc/clientWithApiToken.test.ts' ]",
Expand Down
4 changes: 2 additions & 2 deletions src/actors/client/ActorClient/ActorClientGRPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { Empty } from "google-protobuf/google/protobuf/empty_pb";
import { Any } from "google-protobuf/google/protobuf/any_pb";
import {
ExecuteActorStateTransactionRequest,
GetActorStateRequest,
GetActorStateResponse,
GetMetadataRequest,
GetMetadataResponse,
InvokeActorRequest,
InvokeActorResponse,
Expand Down Expand Up @@ -279,7 +279,7 @@ export default class ActorClientGRPC implements IClientActor {
const client = await this.client.getClient();

return new Promise((resolve, reject) => {
client.getMetadata(new Empty(), (err, res: GetMetadataResponse) => {
client.getMetadata(new GetMetadataRequest(), (err, res: GetMetadataResponse) => {
if (err) {
return reject(err);
}
Expand Down
5 changes: 2 additions & 3 deletions src/implementation/Client/GRPCClient/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ limitations under the License.

import GRPCClient from "./GRPCClient";
import IClientHealth from "../../../interfaces/Client/IClientHealth";
import { GetMetadataResponse } from "../../../proto/dapr/proto/runtime/v1/dapr_pb";
import { Empty } from "google-protobuf/google/protobuf/empty_pb";
import { GetMetadataRequest, GetMetadataResponse } from "../../../proto/dapr/proto/runtime/v1/dapr_pb";

// https://docs.dapr.io/reference/api/health_api/
export default class GRPCClientHealth implements IClientHealth {
Expand All @@ -30,7 +29,7 @@ export default class GRPCClientHealth implements IClientHealth {

return new Promise((resolve, _reject) => {
try {
client.getMetadata(new Empty(), (err, _res: GetMetadataResponse) => {
client.getMetadata(new GetMetadataRequest(), (err, _res: GetMetadataResponse) => {
if (err) {
return resolve(false);
}
Expand Down
8 changes: 6 additions & 2 deletions src/implementation/Client/GRPCClient/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ limitations under the License.
*/

import GRPCClient from "./GRPCClient";
import { GetMetadataResponse, SetMetadataRequest } from "../../../proto/dapr/proto/runtime/v1/dapr_pb";
import {
GetMetadataRequest,
GetMetadataResponse,
SetMetadataRequest,
} from "../../../proto/dapr/proto/runtime/v1/dapr_pb";
import { Empty } from "google-protobuf/google/protobuf/empty_pb";
import IClientMetadata from "../../../interfaces/Client/IClientMetadata";
import { GetMetadataResponse as GetMetadataResponseResult } from "../../../types/metadata/GetMetadataResponse";
Expand All @@ -30,7 +34,7 @@ export default class GRPCClientMetadata implements IClientMetadata {
const client = await this.client.getClient();

return new Promise((resolve, reject) => {
client.getMetadata(new Empty(), (err, res: GetMetadataResponse) => {
client.getMetadata(new GetMetadataRequest(), (err, res: GetMetadataResponse) => {
if (err) {
return reject(err);
}
Expand Down
6 changes: 3 additions & 3 deletions src/implementation/Client/GRPCClient/sidecar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ limitations under the License.

import GRPCClient from "./GRPCClient";
import IClientSidecar from "../../../interfaces/Client/IClientSidecar";
import { GetMetadataResponse } from "../../../proto/dapr/proto/runtime/v1/dapr_pb";
import { GetMetadataRequest, GetMetadataResponse, ShutdownRequest } from "../../../proto/dapr/proto/runtime/v1/dapr_pb";
import { Empty } from "google-protobuf/google/protobuf/empty_pb";

// https://docs.dapr.io/reference/api/secrets_api/
Expand All @@ -28,7 +28,7 @@ export default class GRPCClientSidecar implements IClientSidecar {
const client = await this.client.getClient();

return new Promise((resolve, reject) => {
client.shutdown(new Empty(), (err, _res: Empty) => {
client.shutdown(new ShutdownRequest(), (err, _res: Empty) => {
if (err) {
return reject(err);
}
Expand All @@ -43,7 +43,7 @@ export default class GRPCClientSidecar implements IClientSidecar {

return new Promise((resolve, _reject) => {
try {
callClient.getMetadata(new Empty(), (err, _res: GetMetadataResponse) => {
callClient.getMetadata(new GetMetadataRequest(), (err, _res: GetMetadataResponse) => {
if (err) {
return resolve(false);
}
Expand Down
20 changes: 10 additions & 10 deletions test/e2e/grpc/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { CommunicationProtocolEnum, DaprClient, LogLevel } from "../../../src";
import { SubscribeConfigurationResponse } from "../../../src/types/configuration/SubscribeConfigurationResponse";
import * as DockerUtils from "../../utils/DockerUtil";
import { DaprClient as DaprClientGrpc } from "../../../src/proto/dapr/proto/runtime/v1/dapr_grpc_pb";
import { Empty } from "google-protobuf/google/protobuf/empty_pb";
import { NextCall } from "@grpc/grpc-js/build/src/client-interceptors";
import { GetMetadataRequest } from "../../../src/proto/dapr/proto/runtime/v1/dapr_pb";

const daprHost = "localhost";
const daprPort = "50000"; // Dapr Sidecar Port of this Example Server
Expand Down Expand Up @@ -76,7 +76,7 @@ describe("grpc/client", () => {
interceptors: [mockInterceptor],
});

await new Promise((resolve) => clientProxy.getMetadata(new Empty(), resolve));
await new Promise((resolve) => clientProxy.getMetadata(new GetMetadataRequest(), resolve));

expect(mockInterceptor.mock.calls.length).toBe(1);
expect(mockMetadataRes.get("dapr-app-id")[0]).toBe("test-suite");
Expand Down Expand Up @@ -104,7 +104,7 @@ describe("grpc/client", () => {
interceptors: [mockInterceptor],
});

await new Promise((resolve) => clientProxy.getMetadata(new Empty(), resolve));
await new Promise((resolve) => clientProxy.getMetadata(new GetMetadataRequest(), resolve));

expect(mockInterceptor.mock.calls.length).toBe(1);
expect(mockMetadataRes.get("dapr-app-id")[0]).toBe(process.env.APP_ID);
Expand Down Expand Up @@ -362,13 +362,13 @@ describe("grpc/client", () => {
expect(config.items["myconfigkey3"].value == "key3_initialvalue");
});

it("should be able to get the configuration items with metadata", async () => {
const conf = await client.configuration.get("config-redis", ["myconfigkey1"], {
hello: "world",
});

expect(conf.items["myconfigkey1"].metadata).toHaveProperty("hello");
});
// todo: enable this once we have a component to test this with.
// Redis does not support metadata, PG and Azure App Config do.
// it("should be able to get the configuration items with metadata", async () => {
// const conf = await client.configuration.get("config-redis", ["myconfigkey1"], {
// hello: "world",
// });
// });

it("should be able to subscribe to configuration item changes on all keys", async () => {
const m = jest.fn(async (_res: SubscribeConfigurationResponse) => {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/grpc/clientWithApiToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ limitations under the License.
import * as grpc from "@grpc/grpc-js";
import { CommunicationProtocolEnum, DaprClient, LogLevel } from "../../../src";
import { DaprClient as DaprClientGrpc } from "../../../src/proto/dapr/proto/runtime/v1/dapr_grpc_pb";
import { Empty } from "google-protobuf/google/protobuf/empty_pb";
import { NextCall } from "@grpc/grpc-js/build/src/client-interceptors";
import { GetMetadataRequest } from "../../../src/proto/dapr/proto/runtime/v1/dapr_pb";

const daprHost = "localhost";
const daprPort = "50000"; // Dapr Sidecar Port of this Example Server
Expand Down Expand Up @@ -50,7 +50,7 @@ describe("grpc/client with api token", () => {
interceptors: [mockInterceptor],
});

await new Promise((resolve) => clientProxy.getMetadata(new Empty(), resolve));
await new Promise((resolve) => clientProxy.getMetadata(new GetMetadataRequest(), resolve));
expect(mockMetadataRes.get("dapr-api-token")[0]).toBe("test");
});
});

0 comments on commit 37937b3

Please sign in to comment.