-
Notifications
You must be signed in to change notification settings - Fork 1.3k
decouple gitpod-protocol from public-api #19151
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
packages: | ||
- name: lib | ||
type: yarn | ||
srcs: | ||
- src/** | ||
- package.json | ||
- tsconfig.json | ||
deps: | ||
- components/gitpod-protocol:lib | ||
- components/public-api/typescript:lib | ||
config: | ||
packaging: library | ||
commands: | ||
# leeway executes the build and test step in the wrong order, so we need to call a special script that builds before testing | ||
test: ["yarn", "test:leeway"] | ||
yarnLock: ${coreYarnLockBase}/../yarn.lock | ||
tsconfig: tsconfig.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@gitpod/public-api-common", | ||
"version": "0.1.5", | ||
"license": "AGPL-3.0", | ||
"files": [ | ||
"lib" | ||
], | ||
"exports": { | ||
"./lib/*": { | ||
"types": "./lib/*.d.ts", | ||
"import": "./lib/esm/*.js", | ||
"require": "./lib/*.js" | ||
} | ||
}, | ||
"scripts": { | ||
"build": "yarn run build:cjs && yarn run build:esm", | ||
"build:cjs": "tsc", | ||
"build:esm": "tsc --module es2015 --outDir ./lib/esm", | ||
"test": "mocha './**/*.spec.js' --exclude './node_modules/**' --exclude './lib/esm/**' --exit", | ||
"test:leeway": "yarn build && yarn test" | ||
}, | ||
"dependencies": { | ||
"@gitpod/gitpod-protocol": "0.1.5", | ||
"@gitpod/public-api": "0.1.5", | ||
"@connectrpc/connect": "1.1.2", | ||
"@bufbuild/protobuf": "^1.3.3" | ||
}, | ||
"devDependencies": { | ||
"@types/chai-subset": "^1.3.3", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "^16.11.6", | ||
"chai": "^4.3.4", | ||
"mocha": "^10.2.0", | ||
"typescript": "~4.4.2" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Copyright (c) 2023 Gitpod GmbH. All rights reserved. | ||
* Licensed under the GNU Affero General Public License (AGPL). | ||
* See License.AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
import { PlainMessage } from "@bufbuild/protobuf"; | ||
import { ApplicationError, ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error"; | ||
import { | ||
InvalidGitpodYMLError as InvalidGitpodYMLErrorData, | ||
RepositoryNotFoundError as RepositoryNotFoundErrorData, | ||
RepositoryUnauthorizedError as RepositoryUnauthorizedErrorData, | ||
} from "@gitpod/public-api/lib/gitpod/v1/error_pb"; | ||
|
||
export class RepositoryNotFoundError extends ApplicationError { | ||
constructor(readonly info: PlainMessage<RepositoryNotFoundErrorData>) { | ||
// on gRPC we remap to PRECONDITION_FAILED, all error code for backwards compatibility with the dashboard | ||
super(ErrorCodes.NOT_FOUND, "Repository not found.", info); | ||
} | ||
} | ||
export class UnauthorizedRepositoryAccessError extends ApplicationError { | ||
constructor(readonly info: PlainMessage<RepositoryUnauthorizedErrorData>) { | ||
// on gRPC we remap to PRECONDITION_FAILED, all error code for backwards compatibility with the dashboard | ||
super(ErrorCodes.NOT_AUTHENTICATED, "Repository unauthorized.", info); | ||
} | ||
} | ||
export class InvalidGitpodYMLError extends ApplicationError { | ||
constructor(readonly info: PlainMessage<InvalidGitpodYMLErrorData>) { | ||
// on gRPC we remap to PRECONDITION_FAILED, all error code for backwards compatibility with the dashboard | ||
super(ErrorCodes.INVALID_GITPOD_YML, "Invalid gitpod.yml: " + info.violations.join(","), info); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"experimentalDecorators": true, | ||
"outDir": "lib", | ||
"declarationDir": "lib", | ||
"lib": [ | ||
"es6", | ||
"esnext.asynciterable", | ||
"DOM" | ||
], | ||
"strict": true, | ||
"noEmitOnError": false, | ||
"noUnusedLocals": true, | ||
"emitDecoratorMetadata": true, | ||
"strictPropertyInitialization": false, | ||
"downlevelIteration": true, | ||
"module": "CommonJS", | ||
"moduleResolution": "node", | ||
"target": "es6", | ||
"jsx": "react", | ||
"sourceMap": true, | ||
"declaration": true, | ||
"declarationMap": true, | ||
"skipLibCheck": true, | ||
"useUnknownInCatchVariables": false | ||
}, | ||
"include": [ | ||
"src" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,34 +28,16 @@ | |
"scripts": { | ||
"build": "yarn run build:cjs && yarn run build:esm", | ||
"build:cjs": "tsc", | ||
"build:esm": "tsc --module es2015 --outDir ./lib/esm", | ||
"watch": "leeway exec --package .:lib --transitive-dependencies --filter-type yarn --components --parallel -- tsc -w --preserveWatchOutput", | ||
"test": "mocha './**/*.spec.ts' --exclude './node_modules/**' --exit", | ||
"test:brk": "yarn test --inspect-brk" | ||
}, | ||
"mocha": { | ||
"require": [ | ||
"ts-node/register", | ||
"reflect-metadata/Reflect", | ||
"source-map-support/register" | ||
], | ||
"extensions": [ | ||
"ts" | ||
], | ||
"exit": true | ||
"build:esm": "tsc --module es2015 --outDir ./lib/esm" | ||
}, | ||
"dependencies": { | ||
"@connectrpc/connect-node": "1.1.2", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is unrelated, but these dependencies are not strictly required, and not necessary in case of browser for instance There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a feeling we are better to remove it and let a client to decide which version to use in their context. |
||
"@connectrpc/connect": "1.1.2", | ||
"@bufbuild/protobuf": "^1.3.3", | ||
"prom-client": "^14.2.0" | ||
"@bufbuild/protobuf": "^1.3.3" | ||
}, | ||
"devDependencies": { | ||
"@connectrpc/protoc-gen-connect-es": "1.1.2", | ||
"@bufbuild/protoc-gen-es": "1.3.3", | ||
"@testdeck/mocha": "0.1.2", | ||
"@types/chai": "^4.1.2", | ||
"@types/node": "^16.11.0", | ||
"typescript": "~4.4.2" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akosyakov Personally I would love to see a README.md next to this file, which explains the "WHY does this package exist, how it compares to gitpod-protocol, and "which package to choose for what"".
Can be a follow-up 👍