-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Inline usage reporting protobuf into main package (#6515)"
This reverts commit 0b58585. This leaves the fix of adding cors and body-parser to server's deps and leaves the removal of a TODO(AS4) about this. The build process for this package is completely different from a normal TS package, so keeping it together seems best. This seems like it'll make setting up ESM builds easier.
- Loading branch information
Showing
31 changed files
with
3,492 additions
and
1,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,3 @@ src/**/__tests__/** | |
dist/**/__tests__/** | ||
!package.json | ||
!README.md | ||
!usageReportingProtobuf/**/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/server/src/__tests__/plugin/usageReporting/stats.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/server/src/__tests__/plugin/usageReporting/traceDetails.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/server/src/plugin/usageReporting/defaultSendOperationsAsTrace.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Note that this npmignore file differs from the others because this package | ||
# puts its generated files in "generated" and checks them in to git rather than | ||
# unversioned in "dist". | ||
|
||
* | ||
!src/**/* | ||
src/**/__tests__/** | ||
!generated/**/* | ||
generated/**/__tests__/** | ||
!package.json | ||
!README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# `apollo-reporting-protobuf` | ||
|
||
> **Note:** The Apollo usage reporting API is subject to change. We strongly | ||
> encourage developers to contact Apollo support at `[email protected]` | ||
> to discuss their use case prior to building their own reporting agent using | ||
> this module. | ||
This module provides JavaScript/TypeScript | ||
[Protocol buffer](https://developers.google.com/protocol-buffers/) definitions | ||
for the Apollo usage reporting API. These definitions are generated for | ||
consumption from the `reports.proto` file which is defined internally within | ||
Apollo. | ||
|
||
## Development | ||
|
||
> **Note:** Due to a dependency on Unix tools (e.g. `bash`, `grep`, etc.), the | ||
> development of this module requires a Unix system. There is no reason why | ||
> this can't be avoided, the time just hasn't been taken to make those changes. | ||
> We'd happily accept a PR which makes the appropriate changes! | ||
Currently, this package generates a majority of its code with | ||
`@apollo/protobufjs` (a fork of | ||
[`protobufjs`](https://www.npmjs.com/package/protobufjs) that we maintain | ||
specifically for this package) based on the `reports.proto` file. The output is | ||
generated with the `generate` npm script. | ||
|
||
The root of the repository provides some `devDependencies` necessary to build | ||
these definitions and the `prepare` npm script is invoked programmatically via | ||
the monorepo tooling (e.g. Lerna) thanks to _this_ module's `postinstall` | ||
script. Therefore, when making changes to this module, run scripts via `npx | ||
lerna run SCRIPTNAME` in the **root** of this monorepo in order to update the | ||
definitions in _this_ module. | ||
|
||
To update `reports.proto` to the current version recognized by the Studio usage | ||
reporting ingress, run `lerna run update-proto`. To then regenerate the JS and | ||
TS files, run `npx lerna run generate`. We check in the generated code and only | ||
regenerate it manually, partially to make builds faster (no need to run pbjs on | ||
every `npm install`) and partially so that we don't have to make sure that | ||
`pbjs` runs on every Node version that we support. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import * as protobuf from './protobuf'; | ||
export = protobuf; |
2 changes: 1 addition & 1 deletion
2
...es/server/usageReportingProtobuf/index.js → ...age-reporting-protobuf/generated/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@apollo/usage-reporting-protobuf", | ||
"version": "3.3.1", | ||
"description": "Protobuf format for Apollo usage reporting", | ||
"main": "generated/index.js", | ||
"types": "generated/index.d.ts", | ||
"scripts": { | ||
"generate": "rm -rf generated && mkdir generated && npm run pbjs && npm run pbts && cp src/index.* generated", | ||
"pbjs": "apollo-pbjs --target static-module --out generated/protobuf.js --wrap commonjs --force-number --no-from-object src/reports.proto", | ||
"pbts": "apollo-pbts -o generated/protobuf.d.ts generated/protobuf.js", | ||
"update-proto": "curl -sSfo src/reports.proto https://usage-reporting.api.apollographql.com/proto/reports.proto" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/apollographql/apollo-server", | ||
"directory": "packages/usage-reporting-protobuf" | ||
}, | ||
"keywords": [ | ||
"GraphQL", | ||
"Apollo", | ||
"Server", | ||
"Javascript" | ||
], | ||
"author": "Apollo <[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/apollographql/apollo-server/issues" | ||
}, | ||
"homepage": "https://github.com/apollographql/apollo-server#readme", | ||
"dependencies": { | ||
"@apollo/protobufjs": "1.2.2" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import * as protobuf from './protobuf'; | ||
export = protobuf; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const protobuf = require('./protobuf'); | ||
const protobufJS = require('@apollo/protobufjs/minimal'); | ||
|
||
// Remove Long support. Our uint64s tend to be small (less | ||
// than 104 days). | ||
// XXX Just remove this in our fork? We already deleted | ||
// the generation of Long in protobuf.d.ts in the fork. | ||
// https://github.com/protobufjs/protobuf.js/issues/1253 | ||
protobufJS.util.Long = undefined; | ||
protobufJS.configure(); | ||
|
||
module.exports = protobuf; |
File renamed without changes.