Skip to content

Commit

Permalink
feat: new clients, convert to TypeScript (#61)
Browse files Browse the repository at this point in the history
* feat: convert to TypeScript

* fix: pr feedback

* fix: no console in system tests
  • Loading branch information
alexander-fenster committed Nov 20, 2019
1 parent e277afe commit b7ac867
Show file tree
Hide file tree
Showing 55 changed files with 25,661 additions and 16,098 deletions.
2 changes: 1 addition & 1 deletion packages/google-cloud-datacatalog/.jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
source: {
excludePattern: '(^|\\/|\\\\)[._]',
include: [
'src'
'build/src'
],
includePattern: '\\.js$'
},
Expand Down
25 changes: 17 additions & 8 deletions packages/google-cloud-datacatalog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"version": "1.3.0",
"author": "Google LLC",
"description": "Google Cloud Data Catalog API client for Node.js",
"main": "src/index.js",
"main": "build/src/index.js",
"files": [
"protos",
"src",
"build/src",
"build/protos",
"AUTHORS",
"COPYING"
],
Expand All @@ -28,28 +28,37 @@
"google-gax": "^1.7.5"
},
"devDependencies": {
"@types/mocha": "^5.2.7",
"@types/node": "^10.0.3",
"c8": "^6.0.0",
"chai": "^4.2.0",
"eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-prettier": "^3.0.1",
"gts": "^1.1.0",
"jsdoc": "^3.6.2",
"jsdoc-fresh": "^1.0.1",
"jsdoc-region-tag": "^1.0.2",
"linkinator": "^1.4.0",
"mocha": "^6.1.4",
"prettier": "^1.17.0"
"pack-n-play": "^1.0.0-2",
"prettier": "^1.17.0",
"typescript": "~3.7.0"
},
"scripts": {
"docs": "jsdoc -c .jsdoc.js",
"fix": "eslint . --fix",
"lint": "eslint .",
"test": "c8 mocha test/*.js",
"fix": "gts fix && eslint . --fix",
"lint": "gts check && eslint .",
"test": "c8 mocha build/test/*.js",
"predocs-test": "npm run docs",
"docs-test": "linkinator docs",
"samples-test": "c8 mocha samples/test/*.js",
"system-test": "c8 mocha --timeout=5000 system-test/*.js"
"system-test": "c8 mocha --timeout=5000 build/system-test/*.js",
"compile": "tsc -p . && cp -r protos build/",
"prepare": "npm run compile",
"pretest": "npm run compile",
"posttest": "npm run lint"
},
"license": "Apache-2.0",
"engines": {
Expand Down
4 changes: 4 additions & 0 deletions packages/google-cloud-datacatalog/prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
singleQuote: true,
trailingComma: 'es5',
};
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ import "google/protobuf/field_mask.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1;datacatalog";
option java_multiple_files = true;
option java_package = "com.google.cloud.datacatalog";
option java_package = "com.google.cloud.datacatalog.v1beta1";

// Data Catalog API service allows clients to discover, understand, and manage
// their data.
service DataCatalog {
option (google.api.default_host) = "datacatalog.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform";
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";

// Searches Data Catalog for multiple resources like entries, tags that
// match a query.
Expand Down Expand Up @@ -95,8 +94,7 @@ service DataCatalog {
// deleted. The user should enable the Data Catalog API in the project
// identified by the `name` parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
rpc DeleteEntryGroup(DeleteEntryGroupRequest)
returns (google.protobuf.Empty) {
rpc DeleteEntryGroup(DeleteEntryGroupRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta1/{name=projects/*/locations/*/entryGroups/*}"
};
Expand Down Expand Up @@ -169,8 +167,7 @@ service DataCatalog {
post: "/v1beta1/{parent=projects/*/locations/*}/tagTemplates"
body: "tag_template"
};
option (google.api.method_signature) =
"parent,tag_template_id,tag_template";
option (google.api.method_signature) = "parent,tag_template_id,tag_template";
}

// Gets a tag template.
Expand Down Expand Up @@ -200,8 +197,7 @@ service DataCatalog {
// The user should enable the Data Catalog API in the project identified by
// the `name` parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
rpc DeleteTagTemplate(DeleteTagTemplateRequest)
returns (google.protobuf.Empty) {
rpc DeleteTagTemplate(DeleteTagTemplateRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta1/{name=projects/*/locations/*/tagTemplates/*}"
};
Expand All @@ -213,37 +209,32 @@ service DataCatalog {
// [Data Catalog Resource
// Project](/data-catalog/docs/concepts/resource-project) for more
// information).
rpc CreateTagTemplateField(CreateTagTemplateFieldRequest)
returns (TagTemplateField) {
rpc CreateTagTemplateField(CreateTagTemplateFieldRequest) returns (TagTemplateField) {
option (google.api.http) = {
post: "/v1beta1/{parent=projects/*/locations/*/tagTemplates/*}/fields"
body: "tag_template_field"
};
option (google.api.method_signature) =
"parent,tag_template_field_id,tag_template_field";
option (google.api.method_signature) = "parent,tag_template_field_id,tag_template_field";
}

// Updates a field in a tag template. This method cannot be used to update the
// field type. The user should enable the Data Catalog API in the project
// identified by the `name` parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
rpc UpdateTagTemplateField(UpdateTagTemplateFieldRequest)
returns (TagTemplateField) {
rpc UpdateTagTemplateField(UpdateTagTemplateFieldRequest) returns (TagTemplateField) {
option (google.api.http) = {
patch: "/v1beta1/{name=projects/*/locations/*/tagTemplates/*/fields/*}"
body: "tag_template_field"
};
option (google.api.method_signature) = "name,tag_template_field";
option (google.api.method_signature) =
"name,tag_template_field,update_mask";
option (google.api.method_signature) = "name,tag_template_field,update_mask";
}

// Renames a field in a tag template. The user should enable the Data Catalog
// API in the project identified by the `name` parameter (see [Data Catalog
// Resource Project](/data-catalog/docs/concepts/resource-project) for more
// information).
rpc RenameTagTemplateField(RenameTagTemplateFieldRequest)
returns (TagTemplateField) {
rpc RenameTagTemplateField(RenameTagTemplateFieldRequest) returns (TagTemplateField) {
option (google.api.http) = {
post: "/v1beta1/{name=projects/*/locations/*/tagTemplates/*/fields/*}:rename"
body: "*"
Expand All @@ -255,8 +246,7 @@ service DataCatalog {
// The user should enable the Data Catalog API in the project identified by
// the `name` parameter (see [Data Catalog Resource Project]
// (/data-catalog/docs/concepts/resource-project) for more information).
rpc DeleteTagTemplateField(DeleteTagTemplateFieldRequest)
returns (google.protobuf.Empty) {
rpc DeleteTagTemplateField(DeleteTagTemplateFieldRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1beta1/{name=projects/*/locations/*/tagTemplates/*/fields/*}"
};
Expand Down Expand Up @@ -319,8 +309,7 @@ service DataCatalog {
// templates.
// - `datacatalog.entries.setIamPolicy` to set policies on entries.
// - `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups.
rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest)
returns (google.iam.v1.Policy) {
rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
option (google.api.http) = {
post: "/v1beta1/{resource=projects/*/locations/*/tagTemplates/*}:setIamPolicy"
body: "*"
Expand Down Expand Up @@ -352,8 +341,7 @@ service DataCatalog {
// templates.
// - `datacatalog.entries.getIamPolicy` to get policies on entries.
// - `datacatalog.entryGroups.getIamPolicy` to get policies on entry groups.
rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest)
returns (google.iam.v1.Policy) {
rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
option (google.api.http) = {
post: "/v1beta1/{resource=projects/*/locations/*/tagTemplates/*}:getIamPolicy"
body: "*"
Expand Down Expand Up @@ -382,8 +370,7 @@ service DataCatalog {
//
// A caller is not required to have Google IAM permission to make this
// request.
rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest)
returns (google.iam.v1.TestIamPermissionsResponse) {
rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
option (google.api.http) = {
post: "/v1beta1/{resource=projects/*/locations/*/tagTemplates/*}:testIamPermissions"
body: "*"
Expand Down Expand Up @@ -429,8 +416,7 @@ message SearchCatalogRequest {
// Required. The scope of this search request.
Scope scope = 6 [(google.api.field_behavior) = REQUIRED];

// Required. The query string in search query syntax. The query must be
// non-empty.
// Required. The query string in search query syntax. The query must be non-empty.
//
// Query strings can be simple as "x" or more qualified as:
//
Expand All @@ -448,8 +434,8 @@ message SearchCatalogRequest {
int32 page_size = 2;

// Optional. Pagination token returned in an earlier
// [SearchCatalogResponse.next_page_token][google.cloud.datacatalog.v1beta1.SearchCatalogResponse.next_page_token],
// which indicates that this is a continuation of a prior
// [SearchCatalogResponse.next_page_token][google.cloud.datacatalog.v1beta1.SearchCatalogResponse.next_page_token], which
// indicates that this is a continuation of a prior
// [SearchCatalogRequest][google.cloud.datacatalog.v1beta1.DataCatalog.SearchCatalog]
// call, and that the system should return the next page of data. If empty,
// the first page is returned.
Expand Down Expand Up @@ -495,6 +481,8 @@ message CreateEntryGroupRequest {
];

// Required. The id of the entry group to create.
// The id must begin with a letter or underscore, contain only English
// letters, numbers and underscores, and be at most 64 characters.
string entry_group_id = 3 [(google.api.field_behavior) = REQUIRED];

// The entry group to create. Defaults to an empty entry group.
Expand Down Expand Up @@ -630,7 +618,8 @@ message LookupEntryRequest {
//
// * `cloud_pubsub.project_id.topic_id`
// * ``pubsub.project_id.`topic.id.with.dots` ``
// * `bigquery.project_id.dataset_id.table_id`
// * `bigquery.table.project_id.dataset_id.table_id`
// * `bigquery.dataset.project_id.dataset_id`
// * `datacatalog.project_id.location_id.entry_group_id.entry_id`
//
// `*_id`s shoud satisfy the standard SQL rules for identifiers.
Expand Down Expand Up @@ -661,8 +650,8 @@ message Entry {
// Note that this Entry and its child resources may not actually be stored in
// the location in this name.
string name = 1 [(google.api.resource_reference) = {
type: "datacatalog.googleapis.com/EntryGroup"
}];
type: "datacatalog.googleapis.com/EntryGroup"
}];

// Output only. The resource this metadata entry refers to.
//
Expand Down Expand Up @@ -710,8 +699,7 @@ message Entry {

// Output only. Timestamps about the underlying Google Cloud Platform
// resource, not about this Data Catalog Entry.
SystemTimestamps source_system_timestamps = 7
[(google.api.field_behavior) = OUTPUT_ONLY];
SystemTimestamps source_system_timestamps = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// EntryGroup Metadata.
Expand Down Expand Up @@ -740,10 +728,8 @@ message EntryGroup {
// string.
string description = 3;

// Output only. Timestamps about this EntryGroup. Default value is empty
// timestamps.
SystemTimestamps data_catalog_timestamps = 4
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Timestamps about this EntryGroup. Default value is empty timestamps.
SystemTimestamps data_catalog_timestamps = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Request message for
Expand Down Expand Up @@ -842,16 +828,18 @@ message DeleteTagTemplateRequest {
// Request message for
// [CreateTag][google.cloud.datacatalog.v1beta1.DataCatalog.CreateTag].
message CreateTagRequest {
// Required. The name of the resource to attach this tag to. Tags can be
// attached to Entries. Example:
// Required. The name of the resource to attach this tag to. Tags can be attached to
// Entries. Example:
//
// * projects/{project_id}/locations/{location}/entryGroups/{entry_group_id}/entries/{entry_id}
//
// Note that this Tag and its child resources may not actually be stored in
// the location in this name.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "datacatalog.googleapis.com/Tag" }
(google.api.resource_reference) = {
type: "datacatalog.googleapis.com/Tag"
}
];

// Required. The tag to create.
Expand Down Expand Up @@ -907,8 +895,7 @@ message CreateTagTemplateFieldRequest {
string tag_template_field_id = 2 [(google.api.field_behavior) = REQUIRED];

// Required. The tag template field to create.
TagTemplateField tag_template_field = 3
[(google.api.field_behavior) = REQUIRED];
TagTemplateField tag_template_field = 3 [(google.api.field_behavior) = REQUIRED];
}

// Request message for
Expand All @@ -925,8 +912,7 @@ message UpdateTagTemplateFieldRequest {
];

// Required. The template to update.
TagTemplateField tag_template_field = 2
[(google.api.field_behavior) = REQUIRED];
TagTemplateField tag_template_field = 2 [(google.api.field_behavior) = REQUIRED];

// The field mask specifies the parts of the template to be updated.
// Allowed fields:
Expand Down Expand Up @@ -956,8 +942,7 @@ message RenameTagTemplateFieldRequest {
}
];

// Required. The new ID of this tag template field. For example,
// `my_new_field`.
// Required. The new ID of this tag template field. For example, `my_new_field`.
string new_tag_template_field_id = 2 [(google.api.field_behavior) = REQUIRED];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,39 @@ import "google/cloud/datacatalog/v1beta1/timestamps.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1;datacatalog";
option java_multiple_files = true;
option java_package = "com.google.cloud.datacatalog";
option java_package = "com.google.cloud.datacatalog.v1beta1";

// Describes a Cloud Storage fileset entry.
message GcsFilesetSpec {
// Required. Patterns to identify a set of files in Google Cloud Storage.
// Required. Patterns to identify a set of files in Google Cloud Storage. See [Cloud
// Storage documentation](storage/docs/gsutil/addlhelp/WildcardNames) for
// more information. Note that bucket wildcards are currently not supported.
//
// Examples of valid file_patterns:
//
// * `gs://bucket_name/*`: matches all files in `bucket_name`
// * `gs://bucket_name/dir/*`: matches all files within `bucket_name/dir`
// directory.
// * `gs://bucket_name/dir/**`: matches all files in `bucket_name/dir`
// spanning all subdirectories.
// * `gs://bucket_name/file*`: matches files prefixed by `file` in
// `bucket_name`
// * `gs://bucket_name/a/*/b`: matches all files in `bucket_name` that match
// `a/*/b` pattern, such as `a/c/b`, `a/d/b`
// * `gs://another_bucket/a.txt`: matches `gs://another_bucket/a.txt`
repeated string file_patterns = 1 [(google.api.field_behavior) = REQUIRED];

// Output only. Sample files contained in this fileset, not all files
// contained in this fileset are represented here.
repeated GcsFileSpec sample_gcs_file_specs = 2
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Sample files contained in this fileset, not all files contained in this
// fileset are represented here.
repeated GcsFileSpec sample_gcs_file_specs = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Specifications of a single file in GCS.
// Specifications of a single file in Cloud Storage.
message GcsFileSpec {
// Required. The full file path. Example: `gs://bucket_name/a/b.txt`.
string file_path = 1 [(google.api.field_behavior) = REQUIRED];

// Output only. Timestamps about the GCS file.
SystemTimestamps gcs_timestamps = 2
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Timestamps about the Cloud Storage file.
SystemTimestamps gcs_timestamps = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. The size of the file, in bytes.
int64 size_bytes = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
Expand Down
Loading

0 comments on commit b7ac867

Please sign in to comment.