Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update developer docs with publishing steps for npm.js #621

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
runs-on: ubuntu-latest
env:
GOVER: 1.22
DAPR_CLI_VER: 1.14.0-rc.8
DAPR_RUNTIME_VER: 1.14.0-rc.7
DAPR_CLI_VER: 1.14.0
DAPR_RUNTIME_VER: 1.14.0
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/master/install/install.sh
DAPR_CLI_REF: ""
DAPR_REF: ""
Expand Down
19 changes: 18 additions & 1 deletion documentation/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,27 @@ npm run start:dev

## Publishing Package Package Maintenance

For publishing a new version, we update the version in `package.json` and we run `./publish.sh`
To publish a new package to [https://www.npmjs.com/package/@dapr/dapr](https://www.npmjs.com/package/@dapr/dapr) we need to do the following building and publishing steps.

For **building** a new version, we:
- update the version in `package.json` in the repo root, e.g. `3.4.0` for a final releaes or `3.4.0-rc.1` for a pre-release
- run `npm install` again to refresh lock file (it should now be dirty and part of the change list)
- verify the dapr runtime and versions in [./scripts/fetch-proto.sh](./scripts/fetch-proto.sh) and update if necessary
- run `./scripts/fetch-proto.sh` from the repo root to regenerate protos to match runtime
- verify [.github/workflows/test-e2e.yml](.github/workflows/test-e2e.yml) env variables, especially the Dapr and Node versions to test against

PR this change into the right release branch, e.g. `release-3.4.0`. Merging to `master` branch should happen last.

A custom script is utilized here since we have 2 libraries in one for HTTP and gRPC

For **publishing** the package, we simply cut a new release by:
- create a new release/tag in the dapr/js-sdk repo
- for a final release the tag should look like `v3.4.0` and mark it as final official release. Generate release notes using the N-1 released version, e.g. using 3.3.1.
- for a pre-release it should look like `v3.4.0-rc.1` and mark it as a pre-release
- verify the package is now uploaded to [https://www.npmjs.com/package/@dapr/dapr](https://www.npmjs.com/package/@dapr/dapr) and shows the new version

Upon creating the github repo release, a Github action workflow [.github/workflows/build.yml](.github/workflows/build.yml) will build and publish to npmjs.org on Dapr project's behalf.

## Running Tests

Tests are written per protocol layer: http or grpc. This is done because Dapr requires endpoints to be registered for for pubsub and bindings, making us having to start up the test, initialize those endpoints and then run. Since Dapr is a sidecar architecture, we thus have to start 2 test suites seperately. It requires the following containers:
Expand Down
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,6 +1,6 @@
{
"name": "@dapr/dapr",
"version": "3.4.0-rc.1",
"version": "3.4.0",
"description": "The official Dapr (https://dapr.io) SDK for Node.js",
"types": "./build/index.d.ts",
"scripts": {
Expand Down Expand Up @@ -48,13 +48,13 @@
"dependencies": {
"@grpc/grpc-js": "^1.9.3",
"@js-temporal/polyfill": "^0.3.0",
"@microsoft/durabletask-js": "^0.1.0-alpha.1",
"@types/google-protobuf": "^3.15.5",
"@types/node-fetch": "^2.6.2",
"body-parser": "^1.19.0",
"express": "^4.18.2",
"google-protobuf": "^3.18.0",
"http-terminator": "^3.2.0",
"@microsoft/durabletask-js": "^0.1.0-alpha.1",
"node-fetch": "^2.6.7"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/fetch-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ OS=$(echo `uname`|tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
ORG_NAME="dapr"
REPO_NAME="dapr"
BRANCH_NAME="v1.14.0-rc.7"
BRANCH_NAME="v1.14.0"

# Path to store output
PATH_ROOT=$(pwd)
Expand Down
160 changes: 160 additions & 0 deletions scripts/src/proto/dapr/proto/common/v1/common.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/*
Copyright 2021 The Dapr Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

syntax = "proto3";

package dapr.proto.common.v1;

import "google/protobuf/any.proto";

option csharp_namespace = "Dapr.Client.Autogen.Grpc.v1";
option java_outer_classname = "CommonProtos";
option java_package = "io.dapr.v1";
option go_package = "github.com/dapr/dapr/pkg/proto/common/v1;common";

// HTTPExtension includes HTTP verb and querystring
// when Dapr runtime delivers HTTP content.
//
// For example, when callers calls http invoke api
// POST http://localhost:3500/v1.0/invoke/<app_id>/method/<method>?query1=value1&query2=value2
//
// Dapr runtime will parse POST as a verb and extract querystring to quersytring map.
message HTTPExtension {
// Type of HTTP 1.1 Methods
// RFC 7231: https://tools.ietf.org/html/rfc7231#page-24
// RFC 5789: https://datatracker.ietf.org/doc/html/rfc5789
enum Verb {
NONE = 0;
GET = 1;
HEAD = 2;
POST = 3;
PUT = 4;
DELETE = 5;
CONNECT = 6;
OPTIONS = 7;
TRACE = 8;
PATCH = 9;
}

// Required. HTTP verb.
Verb verb = 1;

// Optional. querystring represents an encoded HTTP url query string in the following format: name=value&name2=value2
string querystring = 2;
}

// InvokeRequest is the message to invoke a method with the data.
// This message is used in InvokeService of Dapr gRPC Service and OnInvoke
// of AppCallback gRPC service.
message InvokeRequest {
// Required. method is a method name which will be invoked by caller.
string method = 1;

// Required in unary RPCs. Bytes value or Protobuf message which caller sent.
// Dapr treats Any.value as bytes type if Any.type_url is unset.
google.protobuf.Any data = 2;

// The type of data content.
//
// This field is required if data delivers http request body
// Otherwise, this is optional.
string content_type = 3;

// HTTP specific fields if request conveys http-compatible request.
//
// This field is required for http-compatible request. Otherwise,
// this field is optional.
HTTPExtension http_extension = 4;
}

// InvokeResponse is the response message including data and its content type
// from app callback.
// This message is used in InvokeService of Dapr gRPC Service and OnInvoke
// of AppCallback gRPC service.
message InvokeResponse {
// Required in unary RPCs. The content body of InvokeService response.
google.protobuf.Any data = 1;

// Required. The type of data content.
string content_type = 2;
}

// Chunk of data sent in a streaming request or response.
// This is used in requests including InternalInvokeRequestStream.
message StreamPayload {
// Data sent in the chunk.
// The amount of data included in each chunk is up to the discretion of the sender, and can be empty.
// Additionally, the amount of data doesn't need to be fixed and subsequent messages can send more, or less, data.
// Receivers must not make assumptions about the number of bytes they'll receive in each chunk.
bytes data = 1;

// Sequence number. This is a counter that starts from 0 and increments by 1 on each chunk sent.
uint64 seq = 2;
}

// StateItem represents state key, value, and additional options to save state.
message StateItem {
// Required. The state key
string key = 1;

// Required. The state data for key
bytes value = 2;

// The entity tag which represents the specific version of data.
// The exact ETag format is defined by the corresponding data store.
Etag etag = 3;

// The metadata which will be passed to state store component.
map<string,string> metadata = 4;

// Options for concurrency and consistency to save the state.
StateOptions options = 5;
}

// Etag represents a state item version
message Etag {
// value sets the etag value
string value = 1;
}

// StateOptions configures concurrency and consistency for state operations
message StateOptions {
// Enum describing the supported concurrency for state.
enum StateConcurrency {
CONCURRENCY_UNSPECIFIED = 0;
CONCURRENCY_FIRST_WRITE = 1;
CONCURRENCY_LAST_WRITE = 2;
}

// Enum describing the supported consistency for state.
enum StateConsistency {
CONSISTENCY_UNSPECIFIED = 0;
CONSISTENCY_EVENTUAL = 1;
CONSISTENCY_STRONG = 2;
}

StateConcurrency concurrency = 1;
StateConsistency consistency = 2;
}

// ConfigurationItem represents all the configuration with its name(key).
message ConfigurationItem {
// Required. The value of configuration item.
string value = 1;

// Version is response only and cannot be fetched. Store is not expected to keep all versions available
string version = 2;

// the metadata which will be passed to/from configuration store component.
map<string,string> metadata = 3;
}
27 changes: 27 additions & 0 deletions scripts/src/proto/dapr/proto/internals/v1/apiversion.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
Copyright 2021 The Dapr Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

syntax = "proto3";

package dapr.proto.internals.v1;

option go_package = "github.com/dapr/dapr/pkg/proto/internals/v1;internals";

// APIVersion represents the version of Dapr Runtime API.
enum APIVersion {
// unspecified apiversion
APIVERSION_UNSPECIFIED = 0;

// Dapr API v1
V1 = 1;
}
Loading
Loading