Skip to content

Conversation

@radiosilence
Copy link

No description provided.

polvalente and others added 30 commits July 16, 2022 20:43
* fix: use setup-beam GH action

* fix: pull action from erlef
Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

closes elixir-grpc#188
* Add support for `request_id` in `GRPC.Server.Stream`

* Apply suggestions from code review

* chore: format

* test: add tests

* chore: format

* chore: revert

* fix: revert some more

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
* chore: update deps

* chore: format

* chore: format

* chore: remove --warnings-as-errors from test

* chore: update elixir and erlang

* chore: format

* chore: import config instead of use mix.config

* chore: remove container in favor of setup-beam

* fix: use gun 2 rc2

* chore: drop support for older OTP

Co-Authored-By: David Bernheisel <david@bernheisel.com>

* docs: update readme

* fix: set max concurrency to lower number

* import changes from elixir-grpc#202

* chore: add otp 25 to matrix

* chore: exclude some combos

* chore: also exclude 1.12

* fix: tls validation

* chore: format

Co-authored-by: David Bernheisel <david@bernheisel.com>
Use `module` instead of `atom` since the function accept module.

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
* fix: accept more combos of log level

* fix: config

* fix: force elixir 1.10.4

* chore: deprecate elixir 1.10
* Provide a mechanism to inject a custom status handler

* Fix formatting

* Fix typo

* Allow status handler to be injected by configuration

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
* fix: add @impl to logger interceptor callback

* refactor: make fetch opts in logger interceptor consistency

* Use `[]` to get level from `opts` in `init/1`.
* Use `Keyword.fetch!/2` to ensure `opts` always has `:level`.

* Update lib/grpc/logger/client.ex

* Update lib/grpc/logger/server.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
* apply mix format according to standard formatter

* include some specs about type on status

* Update lib/grpc/status.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
* chore: make protobuf optional

* fix: make protobuf a test-only dep

* chore: format
* Create server and client behaviours

* Share types with the types of the behaviours

* Add behaviours definition on test adapters

* Add disconnect to behaviour definition

* Split client and server domains

* Replace all Keyword.get(a, b, c) with Keyword.get(a, b) || c

* avoid proxy types

* Add some documentation

* Complete missing func implementations in test client adapter

* Add parenthesis on every type definition

* Replace specs with impl true on adapters implemetations

* Update lib/grpc/client/adapter.ex

* Update lib/grpc/client/adapter.ex

* Update lib/grpc/client/adapter.ex

Co-authored-by: Ricardo Antolin <ricardoAntolin@users.noreply.github.com>
Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
* Running interop test with latest OTP/Elixir version when Pull Request
  is opened.
* When merge to master branch, the CI will running interop tests for all
  OTP/Elixir version.

Closes elixir-grpc#223

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
Remove cron_ci.yml since we already run interop_tests every commit that
merge to master branch. And remove .ci since it's no uses. In Makefile,
remove cron-ci task since it's no use also.
* Revise children in HelloworldApp to use a new way of
  declaring supervisor.
* Generate proto code with elixir-protobuf 0.10.
* Change supervisor declaration in tree.
* Cleanup dependencies.
* Use jason instead of poison.
* Auto start server.
* Move route_guide.proto to priv/protos.
* feat: improve ci and add dialyzer

* fix: mix_env=test for dialyzer

* fix: ci

* fix: dialyzeR

* chore: run fewer rounds for interop

* fix: scope plt cache by otp/elixir version

* fix: fallback key
* chore: bump to 0.5.0

* fix: deps declaration
* Allow to use iolists in GRPC.Message.to_data/2

* docs: document options for function

* fix: dialyzer

Co-authored-by: Bartosz Szafran <bartosz@shoreline.io>
Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
* chore: resolve some doc warnings

* chore: format

* fix: supervisor call

* fix: follow docs for supervisor

* chore: remove un-needed opts

* chore: remove inch as a dependency

* chore: reduce log level in interop test

* fix: define state in adapter instead

* chore: suppress stdout from deps step

* chore: local.hex and local.rebar

* Update lib/grpc/server/supervisor.ex

* fix: missing paren

* fix: deal with truthy instead of boolean

* refactor: lazy eval

* test: add test for opts logic
* fix: avoid overriding user config if possible

* feat: make transport option replacement work

* fix: || %{}

* fix: override correctly

* docs: improve credential docs
* refactor: server and client opts

* docs: add some variable names

* chore: move coalesce to caller

* chore: make typespect more strict

* docs: add variable names

* fix: test

* fix: dialyzer

* fix: keyword v map issues
* support grpc-web-text

* enable web-text codec as default

* only try to pack encoded data if codec is available

* Fix! prepare decode before turning body -> message

* include web-text in codec test

* use bin concat operator for extracting content subtype

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* rename `pack_encoded` `prepare_decode` and make them optional

* add unpack_from_channel / pack_for_channel docs

* rephrase codec docs

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* set correct content-type for web codecs when using the client

* add codec tests

* use return_headers option on stub to assert server headers are set correctly

* fetch codec from opts

* run format

* pack_for_channel/1 handles iodata

* use Code.ensure_loaded/1 for elixir 1.11 compat

* Update lib/grpc/codec/web_text.ex

* Update lib/grpc/codec/web_text.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
Adriano Santos and others added 30 commits April 23, 2025 16:29
…d-issue

Fix: deprecated s.o base image for github workflows
* Detect preflight requests

These typically come from grpcweb clients doing OPTIONS checks for CORS

* Detect client types: grpc, grpcweb, web

This replaces the `http_transcode` member of the `Server.Stream` struct
as transcoding is correlated with being a web client (*not* a grpcweb
client, however!)

Knowing the type of client also allows for detection of when to send
different types of headers, for e.g. CORS

* Add a CORS header injection Interceptor

It an option `:allow` option to define which origins are allowed.

This may be a static string or a function which will be passed the
current `req` and `stream` structs to choose what to allow.

* Reintroduce the boolean http_transcode member of the Stream struct

NOTE: will merge this with commit
c39c834 post-review/discussion.
I am leaving it as a separate commit for now for ease of continued
discussion on the current PR.

* web can be detected in extract_subtype

* change access_type to access_mode, :web to :http_transcoding

this more accurately and directly maps to the grpc terminology, and is
probably clearer.

* default opts to an empty list, whitespace fix

* add tests for the CORS header interceptor

* Assign to a temporary variable and assign that to Stream.http_transcode

* provide access to request headers in the Stream object

* only set cors when the sec-fetch-mode header indicates it

* another test: if there is NO sec-fetch-mode header

* Make access-control-allow-headers configurable, and optional

Only send access-control-allow-headers when the client requests it with
access-control-request-headers and allow the same configurability as
access-control-allow-origin provides

* align variable names with http header names

* Add a CORS example to the README

* format

* Verbage.

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* remove default for allow_origin in CORS interceptor

* raise on failed allow_origin type, and test for that

* allow_origin, not allow_header

* test: add missing compile-time test

* chore: format readme

* chore: fix Note bold

* docs: cleanup readme linking

* docs: proper module linking in exdoc

* fix: do not use Keyword.validate due to Elixir 1.12 support

---------

Co-authored-by: Adriano Santos <solid.sistemas@gmail.com>
Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
* Encode protobuf to iodata for better performance

* Fix warning

---------

Co-authored-by: Adriano Santos <solid.sistemas@gmail.com>
Co-authored-by: Adriano Santos <adriano.santos@v3.com.br>
…eyword-validate

refactor: use Keyword.validate! and bump to v0.10 and elixir 1.15
Gun passes tcp options in `gen_tcp:connect`, and tls options in
`ssh:connect/2`. `ssh:connect/2` ignores the `nodelay` option.
Pass nodelay as a TCP option instead of a TLS option
* feat: added stream pipeline support

* feat: add streams app example

* chore: added reflection to hello streams example for easy testing

* feat: added new factory function

* feat: added support for header propagation

* feat: added support for header propagation

* chore: adjusts

* feat: added new replace operator

* new line

* refactor: propagate context option

* refactor: rename functions

* refactor: removing the destructive version

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* adjusts

* refactor: separating unary from non-unary

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* chore: remove reject function

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* chore: format

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* refactor: rename operator reject to via

* chore: pointing flow docs

* fix: correct api examples

* chore: change ask and join_with apis

* refactor: rename single to unary

* refactor: rename single to unary in tests

* chore: remove unascessary function

* chore: removes a not so necessary function

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* Update lib/grpc/stream.ex

Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>

* fix: format

---------

Co-authored-by: Adriano Santos <solid.sistemas@gmail.com>
Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
* chore: release new version

* fix: passing adapter_opts along the way

* chore: better validation message

* chore: update version

---------

Co-authored-by: Adriano Santos <adriano.santos@v3.com.br>
- Updated to Elixir 1.15+, OTP 24+
- New dependencies: mint, telemetry, protobuf 0.14
- Kept Fresha CI workflow and grpc_fresha package name
- Adapter paths changed: GRPC.Adapter.* -> GRPC.Client.Adapters.* / GRPC.Server.Adapters.*
- GRPC.Error renamed to GRPC.RPCError
- Added HTTP transcoding, CORS, Mint adapter support
- Remove duplicate Google.Protobuf.* modules (now in protobuf 0.14 dep)
- Regenerate Google.Rpc.* pb files for protobuf 0.14 compatibility
- Fix deprecated .new() calls to use struct syntax
- Update tests for API changes (server_trailers/2, base64 padding)
- Fix compressor test pattern match for 2-tuple response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.