-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decouple gitpod-protocol from public-api (#19151)
to prevent rebuilding of components which dependent on gitpod-protocol, but not public-api on an API change
- Loading branch information
Showing
40 changed files
with
167 additions
and
109 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
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 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
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 |
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": "@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" | ||
} | ||
} |
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
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
32 changes: 32 additions & 0 deletions
32
components/public-api/typescript-common/src/public-api-errors.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
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); | ||
} | ||
} |
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,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" | ||
] | ||
} |
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
Oops, something went wrong.