Skip to content
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

build!: convert to typescript #923

Merged
merged 139 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
7276eca
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
2af5c35
upgrade package.json
summer-ji-eng Mar 23, 2020
7080c54
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
e8206af
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
2f32e34
upgrade package.json
summer-ji-eng Mar 23, 2020
c848fe7
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
93d35f1
update synthtool
summer-ji-eng Mar 24, 2020
7e2f1dc
Merge branch 'summer_convert' of github.com:googleapis/nodejs-pubsub …
summer-ji-eng Mar 24, 2020
a4e8f90
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
9d7e28a
upgrade package.json
summer-ji-eng Mar 23, 2020
ffa02bf
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
f42a1e0
update synthtool
summer-ji-eng Mar 24, 2020
153e188
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
b588e0b
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
9d38a6e
rebase master
summer-ji-eng Mar 24, 2020
bf85031
update synth.metadata
summer-ji-eng Mar 24, 2020
ce7afdd
update synthtool
summer-ji-eng Mar 24, 2020
6d44cfe
timeout system-test, install sample test
summer-ji-eng Mar 24, 2020
6d91c8b
fix subscriberStub
summer-ji-eng Mar 24, 2020
df1138c
fix unit test for subscriberStub
summer-ji-eng Mar 25, 2020
fb8c091
fix topicPath
summer-ji-eng Mar 26, 2020
15369fe
hack synth.py to fix eslint for gts 1.0.0
summer-ji-eng Mar 26, 2020
fa27b00
hack synth.py to fix duplicate http namespace
summer-ji-eng Mar 27, 2020
89342b3
IAM client injection
summer-ji-eng Mar 27, 2020
701dbf3
Merge branch 'master' into summer_convert
summer-ji-eng Mar 27, 2020
870625f
Merge branch 'master' into summer_convert
summer-ji-eng Mar 28, 2020
2ce0c77
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
289ff7b
upgrade package.json
summer-ji-eng Mar 23, 2020
95084e0
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
e266a70
update synthtool
summer-ji-eng Mar 24, 2020
84028a9
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
aec31ce
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
677d82e
rebase master
summer-ji-eng Mar 24, 2020
30cb418
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
be05487
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
ae72f6a
update synthtool
summer-ji-eng Mar 24, 2020
05976a6
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
1671f8c
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
a6980b3
update synthtool
summer-ji-eng Mar 24, 2020
266dfc0
timeout system-test, install sample test
summer-ji-eng Mar 24, 2020
3cf361d
fix subscriberStub
summer-ji-eng Mar 24, 2020
de395f0
fix unit test for subscriberStub
summer-ji-eng Mar 25, 2020
044f3c7
fix topicPath
summer-ji-eng Mar 26, 2020
5b2ebf9
hack synth.py to fix eslint for gts 1.0.0
summer-ji-eng Mar 26, 2020
7518122
hack synth.py to fix duplicate http namespace
summer-ji-eng Mar 27, 2020
3a53b29
IAM client injection
summer-ji-eng Mar 27, 2020
d51def6
resolve conflict
summer-ji-eng Mar 28, 2020
75aaed5
Merge branch 'summer_convert' of github.com:googleapis/nodejs-pubsub …
summer-ji-eng Mar 28, 2020
828bf65
Merge branch 'master' into summer_convert
JustinBeckwith Mar 29, 2020
b27259c
delete smoke test
summer-ji-eng Mar 30, 2020
b393ddc
Merge branch 'summer_convert' of github.com:googleapis/nodejs-pubsub …
summer-ji-eng Mar 30, 2020
3bc88ca
lint fix helper.ts
summer-ji-eng Mar 30, 2020
28e8668
fix stringPull not found
summer-ji-eng Mar 31, 2020
9210fc0
Merge branch 'master' into summer_convert
summer-ji-eng Mar 31, 2020
fac8a82
fix initize
summer-ji-eng Mar 31, 2020
7c08ac0
fix lint for message-stream
summer-ji-eng Mar 31, 2020
1dc4473
fix projectTopicPath not found
summer-ji-eng Mar 31, 2020
7672fd6
revert subscriber_client_config.json
summer-ji-eng Apr 2, 2020
d852b85
Merge branch 'master' into summer_convert
summer-ji-eng Apr 2, 2020
e8050ce
timeout for sample test
summer-ji-eng Apr 2, 2020
e552791
Merge branch 'summer_convert' of github.com:googleapis/nodejs-pubsub …
summer-ji-eng Apr 2, 2020
8738c36
update correct subscriber_client_config.json
summer-ji-eng Apr 3, 2020
3c9d28d
update publisher_client_config
summer-ji-eng Apr 3, 2020
834c884
run synthtool
summer-ji-eng Apr 3, 2020
dacb6df
clean synthotool
summer-ji-eng Apr 3, 2020
e8f13b9
ues original timeout
summer-ji-eng Apr 3, 2020
ba941fd
Revert "run synthtool"
summer-ji-eng Apr 3, 2020
fce0b35
add IAM injection
summer-ji-eng Apr 3, 2020
c5ebfc8
copyright year for helper.ts
summer-ji-eng Apr 3, 2020
a7279ff
fix lint
summer-ji-eng Apr 3, 2020
c3c1323
Merge branch 'master' into summer_convert
summer-ji-eng Apr 6, 2020
1ead50a
address the comments
summer-ji-eng Apr 6, 2020
6195092
Merge branch 'summer_convert' of github.com:googleapis/nodejs-pubsub …
summer-ji-eng Apr 6, 2020
90e0f34
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
8633649
upgrade package.json
summer-ji-eng Mar 23, 2020
7a953cc
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
43fe86a
update synthtool
summer-ji-eng Mar 24, 2020
1843fca
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
132e656
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
11cff46
rebase master
summer-ji-eng Mar 24, 2020
a59cb12
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
eb0b9be
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
2441b03
update synthtool
summer-ji-eng Mar 24, 2020
42bff9e
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
7303555
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
309133f
update synthtool
summer-ji-eng Mar 24, 2020
d0869af
timeout system-test, install sample test
summer-ji-eng Mar 24, 2020
df122db
fix subscriberStub
summer-ji-eng Mar 24, 2020
7ca37e5
fix unit test for subscriberStub
summer-ji-eng Mar 25, 2020
26467cf
fix topicPath
summer-ji-eng Mar 26, 2020
a5d14fc
hack synth.py to fix eslint for gts 1.0.0
summer-ji-eng Mar 26, 2020
a1360f2
hack synth.py to fix duplicate http namespace
summer-ji-eng Mar 27, 2020
2362a3a
IAM client injection
summer-ji-eng Mar 27, 2020
96b7a49
resolve conflict
summer-ji-eng Mar 28, 2020
18df358
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
f357758
upgrade package.json
summer-ji-eng Mar 23, 2020
b51a4e1
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
b15104b
update synthtool
summer-ji-eng Mar 24, 2020
66280a4
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
6ebe457
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
b5606ad
rebase master
summer-ji-eng Mar 24, 2020
507ebb3
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
af0ea07
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
6ca216a
update synthtool
summer-ji-eng Mar 24, 2020
f865604
feat: convert client to typescript
summer-ji-eng Mar 23, 2020
947981d
revert changes on ci.yaml
summer-ji-eng Mar 23, 2020
6af2b9a
timeout system-test, install sample test
summer-ji-eng Mar 24, 2020
9e0624a
fix subscriberStub
summer-ji-eng Mar 24, 2020
1ada358
fix unit test for subscriberStub
summer-ji-eng Mar 25, 2020
e6ceb77
hack synth.py to fix eslint for gts 1.0.0
summer-ji-eng Mar 26, 2020
509336d
hack synth.py to fix duplicate http namespace
summer-ji-eng Mar 27, 2020
fbeb58d
IAM client injection
summer-ji-eng Mar 27, 2020
60c5a24
delete smoke test
summer-ji-eng Mar 30, 2020
f5f6881
lint fix helper.ts
summer-ji-eng Mar 30, 2020
ad14631
fix stringPull not found
summer-ji-eng Mar 31, 2020
b02388a
fix initize
summer-ji-eng Mar 31, 2020
576a131
fix lint for message-stream
summer-ji-eng Mar 31, 2020
69c6ed1
fix projectTopicPath not found
summer-ji-eng Mar 31, 2020
07c9493
revert subscriber_client_config.json
summer-ji-eng Apr 2, 2020
bc1b405
timeout for sample test
summer-ji-eng Apr 2, 2020
8349c38
update correct subscriber_client_config.json
summer-ji-eng Apr 3, 2020
e48295c
update publisher_client_config
summer-ji-eng Apr 3, 2020
5e48955
run synthtool
summer-ji-eng Apr 3, 2020
614f3c4
clean synthotool
summer-ji-eng Apr 3, 2020
0a14591
ues original timeout
summer-ji-eng Apr 3, 2020
e3d12fc
Revert "run synthtool"
summer-ji-eng Apr 3, 2020
74c52d3
add IAM injection
summer-ji-eng Apr 3, 2020
1143170
copyright year for helper.ts
summer-ji-eng Apr 3, 2020
9079230
fix lint
summer-ji-eng Apr 3, 2020
af0230e
address the comments
summer-ji-eng Apr 6, 2020
6135301
merge close feature
summer-ji-eng Apr 7, 2020
9778571
merge conflict
summer-ji-eng Apr 7, 2020
0cfc0a1
synthtool update
summer-ji-eng Apr 7, 2020
49c7d06
Merge branch 'master' into summer_convert
summer-ji-eng Apr 7, 2020
bc476b9
add .gitignore
summer-ji-eng Apr 7, 2020
b4d598e
update synthtool
summer-ji-eng Apr 7, 2020
a167a7a
remove node 8 hack in synth.py, because depends on node 10
summer-ji-eng Apr 7, 2020
03f454f
remove timeout for test
summer-ji-eng Apr 8, 2020
4acc3e9
address the comments
summer-ji-eng Apr 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./node_modules/gts"
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [8, 10, 12, 13]
node: [10, 12, 13]
summer-ji-eng marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
Expand Down
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
**/*.log
**/node_modules
.coverage
coverage
.nyc_output
docs/
out/
build/
system-test/secrets.js
system-test/*key.json
*.lock
.vscode
**/package-lock.json
.DS_Store
google-cloud-logging-winston-*.tgz
google-cloud-logging-bunyan-*.tgz
package-lock.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we do still want .vscode (that's not getting checked in, right?) and **/package-lock.json, because the samples install their own node_modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will put it back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@feywind synthtool remove .vscode and **/package-lock.jsonautomatically

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexander-fenster Does this synthtool change seem right? Maybe we're excluding .vscode and **/package-lock.json elsewhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcoe what do you think? It might make sense to exclude .vscode and nested lockfiles.

__pycache__
7 changes: 5 additions & 2 deletions .jsdoc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019 Google LLC
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **

'use strict';

Expand All @@ -37,7 +40,7 @@ module.exports = {
includePattern: '\\.js$'
},
templates: {
copyright: 'Copyright 2019 Google, LLC.',
copyright: 'Copyright 2020 Google LLC',
includeDate: false,
sourceFiles: false,
systemName: '@google-cloud/pubsub',
Expand Down
5 changes: 5 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
summer-ji-eng marked this conversation as resolved.
Show resolved Hide resolved
"enable-source-maps": true,
"throw-deprecation": true,
"timeout": 10000
}
7 changes: 4 additions & 3 deletions src/v1/doc/google/iam/v1/doc_iam_policy.js → .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Note: this file is purely for documentation. Any contents are not expected
// to be loaded as the JS file.
module.exports = {
...require('gts/.prettierrc.json')
}
33 changes: 33 additions & 0 deletions helperMethods.ts.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* This part will be added into src/v1/key_management_service_client.ts by synth.py.
* KMS service requires IAM client for [setIamPolicy, getIamPolicy, testIamPerssion] methods.
* But we don't support it now in micro-generators for rerouting one service to another and mix them in.
* New feature request link: [https://github.com/googleapis/gapic-generator-typescript/issues/315]
*
* So this is manually written for providing methods to the KMS client.
* IamClient is created for KMS client in the constructor using src/helper.ts.
* [setIamPolicy, getIamPolicy, testIamPerssion] methods are created which is calling the corresponding methods from IamClient in `helper.ts`.
*/

getIamPolicy(
request: protos.google.iam.v1.GetIamPolicyRequest,
options: gax.CallOptions,
callback: protos.google.iam.v1.IAMPolicy.GetIamPolicyCallback
) {
return this._iamClient.getIamPolicy(request, options, callback);
}
setIamPolicy(
request: protos.google.iam.v1.SetIamPolicyRequest,
options: gax.CallOptions,
callback: protos.google.iam.v1.IAMPolicy.SetIamPolicyCallback
) {
return this._iamClient.setIamPolicy(request, options, callback);
}
testIamPermissions(
request: protos.google.iam.v1.TestIamPermissionsRequest,
options: gax.CallOptions,
callback?: protos.google.iam.v1.IAMPolicy.TestIamPermissionsCallback
) {
return this._iamClient.testIamPermissions(request, options, callback);
}
}
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"main": "./build/src/index.js",
"types": "./build/src/index.d.ts",
"files": [
"build/proto",
"build/protos",
"build/src"
],
Expand All @@ -30,19 +29,17 @@
"scripts": {
"presystem-test": "npm run compile",
"system-test": "mocha build/system-test --timeout 600000",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"test": "c8 mocha build/test/*{,/*}.js",
"lint": "eslint '**/*.js' && gts check",
"samples-test": "cd samples/ && npm link ../ && npm install && npm test && cd ../",
"test": "c8 mocha build/test",
"lint": "gts check",
"predocs": "npm run compile",
"docs": "jsdoc -c .jsdoc.js",
"fix": "eslint --fix '**/*.js' && gts fix",
"fix": "gts fix",
"clean": "gts clean",
"compile": "tsc -p . && cp -r src/v1 build/src/ && cp -r protos build/ && cp -r proto build/ && cp smoke-test/*.js build/system-test && cp test/*.js build/test",
"prepare": "npm run compile",
"compile": "tsc -p . && cp -r protos build/",
"compile-protos": "compileProtos src",
"prepare": "npm run compile-protos && npm run compile",
"pretest": "npm run compile",
"proto": "mkdirp proto && npm run proto:pubsub && npm run proto:iam",
"proto:pubsub": "pbjs -t static-module -w commonjs -p protos google/pubsub/v1/pubsub.proto | pbts -o proto/pubsub.d.ts -",
"proto:iam": "pbjs -t static-module -w commonjs -p protos google/iam/v1/iam_policy.proto | pbts -o proto/iam.d.ts -",
"docs-test": "linkinator docs",
"predocs-test": "npm run docs",
"benchwrapper": "node bin/benchwrapper.js"
Expand All @@ -58,7 +55,7 @@
"async-each": "^1.0.1",
"extend": "^3.0.2",
"google-auth-library": "^6.0.0",
"google-gax": "^1.14.2",
"google-gax": "^2.0.0",
alexander-fenster marked this conversation as resolved.
Show resolved Hide resolved
"is-stream-ended": "^0.1.4",
"lodash.snakecase": "^4.1.1",
"p-defer": "^3.0.0",
Expand All @@ -72,6 +69,7 @@
"@types/mocha": "^7.0.0",
"@types/mv": "^2.1.0",
"@types/ncp": "^2.0.1",
"@types/node": "^12.12.30",
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^9.0.0",
"@types/tmp": "^0.1.0",
Expand All @@ -92,12 +90,16 @@
"mocha": "^7.0.0",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"null-loader": "^3.0.0",
"prettier": "^1.18.2",
"proxyquire": "^2.0.0",
"sinon": "^9.0.0",
"source-map-support": "^0.5.9",
"ts-loader": "^6.2.1",
"typescript": "3.6.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use "typescript": "^3.8.3" as we do for other libraries?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussion with @feywind, upgrade typescript ^3.8.3 will happen when pubsub is ready for deprecate Node 8 and upgrade gts@2.0.0.

"uuid": "^7.0.0",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11",
"yargs": "^15.0.0"
}
}