Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Feature: gRPC Support #227

Merged
merged 128 commits into from
Apr 21, 2019
Merged

Feature: gRPC Support #227

merged 128 commits into from
Apr 21, 2019

Conversation

sgammon
Copy link
Contributor

@sgammon sgammon commented Apr 16, 2019

This changeset brings in true support for gRPC, to replace the RPC layer currently in use, and propagate use of the schema throughout the library through the use of typedefs.

Since gRPC-Web is now public, we can depend on it directly via Closure. It's essentially an extension to the schema which already has support for ADVANCED_OPTIMIZATIONS and so on.

Initial work will involve replacing the current JSON/REST-based API layer with an abstracted, interface-defined generic service layer, which will call into the old code, or the new, based on browser support. Then, the new layer must be written against the gRPC-Web library, extended into logic as a service facade, and so on. From there, we'll work our way up through the library to replace the objects currently in use.

Related work:

Changes so far:

  • Add low-level service code
    • Menu v1beta1 service
    • Shop v1 service
    • Platform v1 service
    • Telemetry v1beta4 service
  • Get compile working against binary wire format
  • Makefile support for service files note: manual inlining for now
  • Schema object refactoring
    • Menus and callbacks
    • Testsuite
  • API layer selection logic
    • When to fallback to JSON/REST note: opt-in for now
    • When to fallback to gRPC text note: not doing this
    • Compile flags
  • Abstracted service facade
    • Menu API
      • retrieve: Fetch menus
      • sections: Fetch one or more sections
      • products: Fetch one or more products
      • featured: Fetch featured products across sections
    • Shop API
      • info: Shop status and general information
      • verify: Verify a user for order eligibility
      • zipcheck: Check a zipcode for delivery eligibility and requirements
      • enroll: Sign-up a new user
      • submit: Submit an online order for pickup or delivery
      • getOrder: Retrieve an order and check status
    • Telemetry API
      • ping: Connection warmup and latency check
      • event: Generic event telemetry
      • impression: Impression-based commercial telemetry
      • view: View-based commercial telemetry
      • action: Action-based commercial telemetry

sgammon and others added 8 commits April 16, 2019 08:21
This changeset refreshes local dependencies and cleans up various
other small issues.

- [x] Run `yarn upgrade`
- [x] Update `protobuf` and `closure`
This changeset brings in true support for gRPC, to replace the RPC
layer currently in use, and propagate use of the schema throughout
the library through the use of typedefs.

Since gRPC-Web is now public, we can depend on it directly via
Closure. It's essentially an extension to the schema which already
has support for ADVANCED_OPTIMIZATIONS and so on.

Initial work will involve replacing the current JSON/REST-based
API layer with an abstracted, interface-defined generic service
layer, which will call into the old code, or the new, based on
browser support. Then, the new layer must be written against the
gRPC-Web library, extended into logic as a service facade, and so
on. From there, we'll work our way up through the library to
replace the objects currently in use.

Changes so far:
- [x] Add low-level service code
  - [x] `Menu v1beta1` service
  - [x] `Shop v1` service
  - [x] `Platform v1` service
  - [x] `Telemetry v1beta4` service
- [x] Get compile working against binary wire format
- [ ] `Makefile` support for service files
- [ ] Abstracted service facade
  - [ ] Auth API
    - [ ] `authenticate`: Trigger user auth
    - [ ] `authorize`: Assume a user session
  - [ ] Menu API
    - [ ] `retrieve`: Fetch menus
    - [ ] `sections`: Fetch one or more sections
    - [ ] `products`: Fetch one or more products
    - [ ] `featured`: Fetch featured products across sections
  - [ ] Shop API
    - [ ] `info`: Shop status and general information
    - [ ] `verify`: Verify a user for order eligibility
    - [ ] `enroll`: Sign-up a new user
    - [ ] `submit`: Submit an online order for pickup or delivery
    - [ ] `getOrder`: Retrieve an order and check status
  - [ ] Platform API
    - [ ] `resolve`: Fetch partner scope based on domain
    - [ ] `domains`: Fetch domains for a given partner scope
    - [ ] `brand`: Fetch branding information for a given scope
    - [ ] `siteinfo`: Fetch metadata for web properties
  - [ ] Telemetry API
    - [ ] `event`: Generic event telemetry
    - [ ] `impression`: Impression-based commercial telemetry
    - [ ] `view`: View-based commercial telemetry
    - [ ] `action`: Action-based commercial telemetry
- [ ] API layer selection logic
  - [ ] When to fallback to JSON/REST
  - [ ] When to fallback to gRPC text
  - [ ] Compile flags
- [ ] Schema object refactoring
  - [ ] Menus and callbacks
  - [ ] Testsuite
  - [ ] Test pages
  - [ ] Docs

Co-authored-by: Noah Damiani <noah@bloombox.io>
@sgammon sgammon added this to the v2.0 milestone Apr 16, 2019
@sgammon sgammon self-assigned this Apr 16, 2019
@sgammon sgammon mentioned this pull request Apr 16, 2019
6 tasks
@sgammon sgammon marked this pull request as ready for review April 17, 2019 01:07
sgammon and others added 9 commits April 16, 2019 19:13
This changeset establishes an integration branch to begin work on
the JS SDK for Bloombox v2.0. This is a major batch of work, to
include new support for RPC-based systems, updated dependencies,
source-level integration with other Bloombox code, and more.

For now though, it's just a version bump.

Release stuff:
- [ ] Bump version -> `2.0.0`
- [ ] Push release to prod
- [ ] Test links, docs

Initial stuff:
- [x] Bump version -> `2.0.0b1` for testing

Constituent work:
- [ ] Update Dependencies (#225)

Co-authored-by: Noah Damiani <noah@bloombox.io>
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.11 to 4.1.0. **This update includes security fixes.**
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/v4.1.0/release-notes.md)
- [Commits](handlebars-lang/handlebars.js@v4.0.11...v4.1.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
Bumps [extend](https://github.com/justmoon/node-extend) from 3.0.1 to 3.0.2. **This update includes security fixes.**
- [Release notes](https://github.com/justmoon/node-extend/releases)
- [Changelog](https://github.com/justmoon/node-extend/blob/master/CHANGELOG.md)
- [Commits](justmoon/node-extend@v3.0.1...v3.0.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
This changeset brings in true support for gRPC, to replace the RPC
layer currently in use, and propagate use of the schema throughout
the library through the use of typedefs.

Since gRPC-Web is now public, we can depend on it directly via
Closure. It's essentially an extension to the schema which already
has support for ADVANCED_OPTIMIZATIONS and so on.

Initial work will involve replacing the current JSON/REST-based
API layer with an abstracted, interface-defined generic service
layer, which will call into the old code, or the new, based on
browser support. Then, the new layer must be written against the
gRPC-Web library, extended into logic as a service facade, and so
on. From there, we'll work our way up through the library to
replace the objects currently in use.

Changes so far:
- [x] Add low-level service code
  - [x] `Menu v1beta1` service
  - [x] `Shop v1` service
  - [x] `Platform v1` service
  - [x] `Telemetry v1beta4` service
- [x] Get compile working against binary wire format
- [ ] `Makefile` support for service files
- [ ] Abstracted service facade
  - [ ] Auth API
    - [ ] `authenticate`: Trigger user auth
    - [ ] `authorize`: Assume a user session
  - [ ] Menu API
    - [ ] `retrieve`: Fetch menus
    - [ ] `sections`: Fetch one or more sections
    - [ ] `products`: Fetch one or more products
    - [ ] `featured`: Fetch featured products across sections
  - [ ] Shop API
    - [ ] `info`: Shop status and general information
    - [ ] `verify`: Verify a user for order eligibility
    - [ ] `enroll`: Sign-up a new user
    - [ ] `submit`: Submit an online order for pickup or delivery
    - [ ] `getOrder`: Retrieve an order and check status
  - [ ] Platform API
    - [ ] `resolve`: Fetch partner scope based on domain
    - [ ] `domains`: Fetch domains for a given partner scope
    - [ ] `brand`: Fetch branding information for a given scope
    - [ ] `siteinfo`: Fetch metadata for web properties
  - [ ] Telemetry API
    - [ ] `event`: Generic event telemetry
    - [ ] `impression`: Impression-based commercial telemetry
    - [ ] `view`: View-based commercial telemetry
    - [ ] `action`: Action-based commercial telemetry
- [ ] API layer selection logic
  - [ ] When to fallback to JSON/REST
  - [ ] When to fallback to gRPC text
  - [ ] Compile flags
- [ ] Schema object refactoring
  - [ ] Menus and callbacks
  - [ ] Testsuite
  - [ ] Test pages
  - [ ] Docs

Co-authored-by: Noah Damiani <noah@bloombox.io>
- Refactor into interface-based API
- Implement v0 menu API via legacy JSON/REST
- Prep new v1 menu interface
@codecov
Copy link

codecov bot commented Apr 17, 2019

Codecov Report

Merging #227 into release/v2 will increase coverage by 17.29%.
The diff coverage is 73.41%.

Impacted file tree graph

@@               Coverage Diff               @@
##           release/v2     #227       +/-   ##
===============================================
+ Coverage       58.48%   75.77%   +17.29%     
===============================================
  Files              57       46       -11     
  Lines            2553     2171      -382     
  Branches          430      342       -88     
===============================================
+ Hits             1493     1645      +152     
+ Misses           1060      526      -534
Impacted Files Coverage Δ
src/util/serializable.js 100% <ø> (ø) ⬆️
src/base/config/integration/ga.js 100% <ø> (ø) ⬆️
src/telemetry/context/base.js 75% <ø> (-3.58%) ⬇️
src/telemetry/context/collection.js 93.33% <ø> (ø) ⬆️
src/telemetry/context/webapp.js 100% <ø> (ø) ⬆️
src/util/proto/merge.js 94.73% <ø> (ø) ⬆️
src/telemetry/optout.js 78.57% <ø> (ø) ⬆️
src/telemetry/context/native.js 85.93% <ø> (-14.07%) ⬇️
src/telemetry/context/state.js 90.56% <ø> (+12.47%) ⬆️
src/util/error-reporting.js 20.3% <ø> (-0.16%) ⬇️
... and 82 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41f3d69...c543327. Read the comment docs.

sgammon and others added 29 commits April 20, 2019 18:31
- Add implementation on new gRPC layer for:
  - `ping`: Ping the server
  - `event`: Emit an event
- Add interface specs for `product` and `featured` methods
- Add stubbed (throwing) implementations in `v1beta0`
- Add full implementation of each in `v1beta1`
- Add support for featured products, product data
- Add testsuite support for both

Co-authored-by: Kyle Vandagriff <kyle@bloombox.io>
@sgammon sgammon merged commit e7a756d into release/v2 Apr 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants