diff --git a/.gitpod.yml b/.gitpod.yml index 2f0bd0ae8f39fb..91dca3653eb849 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -43,7 +43,8 @@ vscode: extensions: - bajdzis.vscode-database - bradlc.vscode-tailwindcss - - EditorConfig.EditorConfig + - editorconfig.editorconfig + - esbenp.prettier-vscode - golang.go - hashicorp.terraform - ms-azuretools.vscode-docker diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000000000..b4e3136d5b9a88 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +# Add files here to ignore them from prettier formatting + +build/ +dist/ +templates/ + +# YAML is supported, but let's play it safe for now +*.yaml +*.yml \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000000000..6ba9a525b90f18 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "singleQuote": true, + "semi": true, + "trailingComma": "all", + "printWidth": 120, + "tabWidth": 2 +} diff --git a/chart/README.md b/chart/README.md index cc3c0a97fc1c57..38728f0e42f087 100644 --- a/chart/README.md +++ b/chart/README.md @@ -4,9 +4,9 @@ Installing Gitpod Self-Hosted via Helm has been deprecated and will eventually b We have also created guides for the three major cloud providers which use the installer for your reference. -* [Amazon EKS](https://github.com/gitpod-io/gitpod-eks-guide) -* [Google Kubernetes Engine](https://github.com/gitpod-io/gitpod-gke-guide) -* [Azure AKS](https://github.com/gitpod-io/gitpod-microsoft-aks-guide) +- [Amazon EKS](https://github.com/gitpod-io/gitpod-eks-guide) +- [Google Kubernetes Engine](https://github.com/gitpod-io/gitpod-gke-guide) +- [Azure AKS](https://github.com/gitpod-io/gitpod-microsoft-aks-guide) These charts will eventually be archived. @@ -16,13 +16,11 @@ These charts will eventually be archived. This [Helm](https://helm.sh) chart allows you to deploy and operate an instance of Gitpod on your own infrastructure. - ## Prerequisites - Kubernetes 1.13+ - Helm 3+ - ## Get Repo Info ```console @@ -38,7 +36,6 @@ helm dep up _See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._ - ## Install Chart ```console @@ -49,7 +46,6 @@ _See [configuration](#configuration) below._ _See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._ - ## Dependencies By default this chart installs additional, dependent charts: @@ -62,7 +58,6 @@ _See [configuration](#configuration) for options to replace those dependencies._ _See [helm dependency](https://helm.sh/docs/helm/helm_dependency/) for command documentation._ - ## Uninstall Chart ```console @@ -73,7 +68,6 @@ This removes all the Kubernetes components associated with the chart and deletes _See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._ - ## Upgrading Chart ```console @@ -82,51 +76,43 @@ $ helm upgrade --install gitpod . _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._ - ## Recommended Configuration The default installation of this Chart works out-of-the box in the majority of scenarios. The following section introduces the most important options you likely want to review and tune for your particular use case. - ### Ingress, Domain and HTTPS -| Parameter | Description | Default | -|----------------------|------------------------------------------------|---------------------------------------------------------| -| `hostname` | The Hostname your installation is available at | `localhost` | -| `certificatesSecret` | Configures certificates for your domain | `{}` | +| Parameter | Description | Default | +| -------------------- | ---------------------------------------------- | ----------- | +| `hostname` | The Hostname your installation is available at | `localhost` | +| `certificatesSecret` | Configures certificates for your domain | `{}` | Compare [values.yaml](./values.yaml) for details. For more details and a complete example using `hosts` see [here](https://www.gitpod.io/docs/self-hosted/latest/install/configure-ingress/). - ### OAuth See [here](https://www.gitpod.io/docs/self-hosted/latest/install/oauth/) on how to pre-configure OAuth providers. - ### Database The default installation comes with a MySQL that runs inside the same cluster. See [here](https://www.gitpod.io/docs/self-hosted/latest/install/database/) on how to configure a custom database. - ### Storage See [here](https://www.gitpod.io/docs/self-hosted/latest/install/storage/) on how to configure a custom storage provider. - ### Docker Registry See [here](https://www.gitpod.io/docs/self-hosted/latest/install/docker-registry/) on how to configure a custom docker registry. - ## Advanced Configuration Reference - > Note: This is not complete yet and very much work-in-progress. Please [open an issue](https://github.com/gitpod-io/gitpod/issues/new?template=question.md) if you have a particular question! - +> Note: This is not complete yet and very much work-in-progress. Please [open an issue](https://github.com/gitpod-io/gitpod/issues/new?template=question.md) if you have a particular question! ### Node Filesystem Layout diff --git a/chart/dependencies/minio/README.md b/chart/dependencies/minio/README.md index e570e487964a54..ca3639341cf7ed 100644 --- a/chart/dependencies/minio/README.md +++ b/chart/dependencies/minio/README.md @@ -1,7 +1,6 @@ > NOTE: This helm chart is in code freeze i.e we will only update MinIO releases occastionally by bumping up the version. For latest features you are advised to start using our [MinIO operator](https://github.com/minio/operator). -MinIO -===== +# MinIO [MinIO](https://min.io) is a High Performance Object Storage released under Apache License v2.0. It is API compatible with Amazon S3 cloud storage service. Use MinIO to build high performance infrastructure for machine learning, analytics and application data workloads. @@ -9,26 +8,23 @@ MinIO supports [distributed mode](https://docs.minio.io/docs/distributed-minio-q For more detailed documentation please visit [here](https://docs.minio.io/) -Introduction ------------- +## Introduction This chart bootstraps MinIO deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. -Prerequisites -------------- +## Prerequisites - Kubernetes 1.4+ with Beta APIs enabled for default standalone mode. - Kubernetes 1.5+ with Beta APIs enabled to run MinIO in [distributed mode](#distributed-minio). - PV provisioner support in the underlying infrastructure. -Configure MinIO Helm repo --------------------- +## Configure MinIO Helm repo + ```bash $ helm repo add minio https://helm.min.io/ ``` -Installing the Chart --------------------- +## Installing the Chart Install this chart using: @@ -92,8 +88,7 @@ or --set trustedCertsSecret=minio-trusted-certs ``` -Uninstalling the Chart ----------------------- +## Uninstalling the Chart Assuming your release is named as `my-release`, delete it using the command: @@ -109,8 +104,7 @@ $ helm uninstall my-release The command removes all the Kubernetes components associated with the chart and deletes the release. -Upgrading the Chart -------------------- +## Upgrading the Chart You can use Helm to update MinIO version in a live release. Assuming your release is named as `my-release`, get the values using the command: @@ -126,110 +120,109 @@ $ helm upgrade -f old_values.yaml my-release minio/minio Default upgrade strategies are specified in the `values.yaml` file. Update these fields if you'd like to use a different strategy. -Configuration -------------- +## Configuration The following table lists the configurable parameters of the MinIO chart and their default values. -| Parameter | Description | Default | -|:-------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------| -| `nameOverride` | Provide a name in place of `minio` | `""` | -| `fullnameOverride` | Provide a name to substitute for the full names of resources | `""` | -| `image.repository` | Image repository | `minio/minio` | -| `image.tag` | MinIO image tag. Possible values listed [here](https://hub.docker.com/r/minio/minio/tags/). | `RELEASE.2020-11-06T23-17-07Z` | -| `image.pullPolicy` | Image pull policy | `IfNotPresent` | -| `imagePullSecrets` | List of container registry secrets | `[]` | -| `mcImage.repository` | Client image repository | `minio/mc` | -| `mcImage.tag` | mc image tag. Possible values listed [here](https://hub.docker.com/r/minio/mc/tags/). | `RELEASE.2020-10-03T02-54-56Z` | -| `mcImage.pullPolicy` | mc Image pull policy | `IfNotPresent` | -| `ingress.enabled` | Enables Ingress | `false` | -| `ingress.labels ` | Ingress labels | `{}` | -| `ingress.annotations` | Ingress annotations | `{}` | -| `ingress.hosts` | Ingress accepted hostnames | `[]` | -| `ingress.tls` | Ingress TLS configuration | `[]` | -| `trustedCertsSecret` | Kubernetes secret with trusted certificates to be mounted on `{{ .Values.certsPath }}/CAs` | `""` | -| `mode` | MinIO server mode (`standalone` or `distributed`) | `standalone` | -| `extraArgs` | Additional command line arguments to pass to the MinIO server | `[]` | -| `replicas` | Number of nodes (applicable only for MinIO distributed mode). | `4` | -| `zones` | Number of zones (applicable only for MinIO distributed mode). | `1` | -| `drivesPerNode` | Number of drives per node (applicable only for MinIO distributed mode). | `1` | -| `existingSecret` | Name of existing secret with access and secret key. | `""` | -| `accessKey` | Default access key (5 to 20 characters) | random 20 chars | -| `secretKey` | Default secret key (8 to 40 characters) | random 40 chars | -| `certsPath` | Default certs path location | `/etc/minio/certs` | -| `configPathmc` | Default config file location for MinIO client - mc | `/etc/minio/mc` | -| `mountPath` | Default mount location for persistent drive | `/export` | -| `bucketRoot` | Directory from where minio should serve buckets. | Value of `.mountPath` | -| `clusterDomain` | domain name of kubernetes cluster where pod is running. | `cluster.local` | -| `service.type` | Kubernetes service type | `ClusterIP` | -| `service.port` | Kubernetes port where service is exposed | `9000` | -| `service.externalIPs` | service external IP addresses | `nil` | -| `service.annotations` | Service annotations | `{}` | -| `serviceAccount.create` | Toggle creation of new service account | `true` | -| `serviceAccount.name` | Name of service account to create and/or use | `""` | -| `persistence.enabled` | Use persistent volume to store data | `true` | -| `persistence.size` | Size of persistent volume claim | `500Gi` | -| `persistence.existingClaim` | Use an existing PVC to persist data | `nil` | -| `persistence.storageClass` | Storage class name of PVC | `nil` | -| `persistence.accessMode` | ReadWriteOnce or ReadOnly | `ReadWriteOnce` | -| `persistence.subPath` | Mount a sub directory of the persistent volume if set | `""` | -| `resources.requests.memory` | Memory resource requests | Memory: `4Gi` | -| `priorityClassName` | Pod priority settings | `""` | -| `securityContext.enabled` | Enable to run containers as non-root. NOTE: if `persistence.enabled=false` then securityContext will be automatically disabled | `true` | -| `securityContext.runAsUser` | User id of the user for the container | `1000` | -| `securityContext.runAsGroup` | Group id of the user for the container | `1000` | -| `securityContext.fsGroup` | Group id of the persistent volume mount for the container | `1000` | -| `nodeSelector` | Node labels for pod assignment | `{}` | -| `affinity` | Affinity settings for pod assignment | `{}` | -| `tolerations` | Toleration labels for pod assignment | `[]` | -| `additionalLabels` | Additional labels for Deployment in standalone mode or StatefulSet in distributed mode | `[]` | -| `additionalAnnotations` | Additional annotations for Deployment in standalone mode or StatefulSet in distributed mode | `[]` | -| `podAnnotations` | Pod annotations | `{}` | -| `podLabels` | Pod Labels | `{}` | -| `tls.enabled` | Enable TLS for MinIO server | `false` | -| `tls.certSecret` | Kubernetes Secret with `public.crt` and `private.key` files. | `""` | -| `defaultBucket.enabled` | If set to true, a bucket will be created after MinIO install | `false` | -| `defaultBucket.name` | Bucket name | `bucket` | -| `defaultBucket.policy` | Bucket policy | `none` | -| `defaultBucket.purge` | Purge the bucket if already exists | `false` | -| `defaultBucket.versioning` | Enable / Suspend versioning for bucket | `nil` | -| `buckets` | List of buckets to create after MinIO install | `[]` | -| `makeBucketJob.annotations` | Additional annotations for the Kubernetes Batch (make-bucket-job) | `""` | -| `makeBucketJob.podAnnotations` | Additional annotations for the pods of the Kubernetes Batch (make-bucket-job) | `""` | -| `makeBucketJob.securityContext.enabled` | Enable to run Kubernetes Batch (make-bucket-job) containers as non-root. | `false` | -| `makeBucketJob.securityContext.runAsUser` | User id of the user for the container | `1000` | -| `makeBucketJob.securityContext.runAsGroup` | Group id of the user for the container | `1000` | -| `makeBucketJob.securityContext.fsGroup` | Group id of the persistent volume mount for the container | `1000` | -| `makeBucketJob.resources.requests.memory` | Memory resource requests for 'make bucket' job | `128Mi` | -| `updatePrometheusJob.podAnnotations` | Additional annotations for the pods of the Kubernetes Batch (update-prometheus-secret) | `""` | -| `updatePrometheusJob.securityContext.enabled` | Enable to run Kubernetes Batch (update-prometheus-secret) containers as non-root. | `false` | -| `updatePrometheusJob.securityContext.runAsUser` | User id of the user for the container | `1000` | -| `updatePrometheusJob.securityContext.runAsGroup` | Group id of the user for the container | `1000` | -| `updatePrometheusJob.securityContext.fsGroup` | Group id of the persistent volume mount for the container | `1000` | -| `s3gateway.enabled` | Use MinIO as a [s3 gateway](https://github.com/minio/minio/blob/master/docs/gateway/s3.md) | `false` | -| `s3gateway.replicas` | Number of s3 gateway instances to run in parallel | `4` | -| `s3gateway.serviceEndpoint` | Endpoint to the S3 compatible service | `""` | -| `s3gateway.accessKey` | Access key of S3 compatible service | `""` | -| `s3gateway.secretKey` | Secret key of S3 compatible service | `""` | -| `azuregateway.enabled` | Use MinIO as an [azure gateway](https://docs.minio.io/docs/minio-gateway-for-azure) | `false` | -| `azuregateway.replicas` | Number of azure gateway instances to run in parallel | `4` | -| `gcsgateway.enabled` | Use MinIO as a [Google Cloud Storage gateway](https://docs.minio.io/docs/minio-gateway-for-gcs) | `false` | -| `gcsgateway.gcsKeyJson` | credential json file of service account key | `""` | -| `gcsgateway.projectId` | Google cloud project id | `""` | -| `nasgateway.enabled` | Use MinIO as a [NAS gateway](https://docs.MinIO.io/docs/minio-gateway-for-nas) | `false` | -| `nasgateway.replicas` | Number of NAS gateway instances to be run in parallel on a PV | `4` | +| Parameter | Description | Default | +| :----------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------ | +| `nameOverride` | Provide a name in place of `minio` | `""` | +| `fullnameOverride` | Provide a name to substitute for the full names of resources | `""` | +| `image.repository` | Image repository | `minio/minio` | +| `image.tag` | MinIO image tag. Possible values listed [here](https://hub.docker.com/r/minio/minio/tags/). | `RELEASE.2020-11-06T23-17-07Z` | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `imagePullSecrets` | List of container registry secrets | `[]` | +| `mcImage.repository` | Client image repository | `minio/mc` | +| `mcImage.tag` | mc image tag. Possible values listed [here](https://hub.docker.com/r/minio/mc/tags/). | `RELEASE.2020-10-03T02-54-56Z` | +| `mcImage.pullPolicy` | mc Image pull policy | `IfNotPresent` | +| `ingress.enabled` | Enables Ingress | `false` | +| `ingress.labels ` | Ingress labels | `{}` | +| `ingress.annotations` | Ingress annotations | `{}` | +| `ingress.hosts` | Ingress accepted hostnames | `[]` | +| `ingress.tls` | Ingress TLS configuration | `[]` | +| `trustedCertsSecret` | Kubernetes secret with trusted certificates to be mounted on `{{ .Values.certsPath }}/CAs` | `""` | +| `mode` | MinIO server mode (`standalone` or `distributed`) | `standalone` | +| `extraArgs` | Additional command line arguments to pass to the MinIO server | `[]` | +| `replicas` | Number of nodes (applicable only for MinIO distributed mode). | `4` | +| `zones` | Number of zones (applicable only for MinIO distributed mode). | `1` | +| `drivesPerNode` | Number of drives per node (applicable only for MinIO distributed mode). | `1` | +| `existingSecret` | Name of existing secret with access and secret key. | `""` | +| `accessKey` | Default access key (5 to 20 characters) | random 20 chars | +| `secretKey` | Default secret key (8 to 40 characters) | random 40 chars | +| `certsPath` | Default certs path location | `/etc/minio/certs` | +| `configPathmc` | Default config file location for MinIO client - mc | `/etc/minio/mc` | +| `mountPath` | Default mount location for persistent drive | `/export` | +| `bucketRoot` | Directory from where minio should serve buckets. | Value of `.mountPath` | +| `clusterDomain` | domain name of kubernetes cluster where pod is running. | `cluster.local` | +| `service.type` | Kubernetes service type | `ClusterIP` | +| `service.port` | Kubernetes port where service is exposed | `9000` | +| `service.externalIPs` | service external IP addresses | `nil` | +| `service.annotations` | Service annotations | `{}` | +| `serviceAccount.create` | Toggle creation of new service account | `true` | +| `serviceAccount.name` | Name of service account to create and/or use | `""` | +| `persistence.enabled` | Use persistent volume to store data | `true` | +| `persistence.size` | Size of persistent volume claim | `500Gi` | +| `persistence.existingClaim` | Use an existing PVC to persist data | `nil` | +| `persistence.storageClass` | Storage class name of PVC | `nil` | +| `persistence.accessMode` | ReadWriteOnce or ReadOnly | `ReadWriteOnce` | +| `persistence.subPath` | Mount a sub directory of the persistent volume if set | `""` | +| `resources.requests.memory` | Memory resource requests | Memory: `4Gi` | +| `priorityClassName` | Pod priority settings | `""` | +| `securityContext.enabled` | Enable to run containers as non-root. NOTE: if `persistence.enabled=false` then securityContext will be automatically disabled | `true` | +| `securityContext.runAsUser` | User id of the user for the container | `1000` | +| `securityContext.runAsGroup` | Group id of the user for the container | `1000` | +| `securityContext.fsGroup` | Group id of the persistent volume mount for the container | `1000` | +| `nodeSelector` | Node labels for pod assignment | `{}` | +| `affinity` | Affinity settings for pod assignment | `{}` | +| `tolerations` | Toleration labels for pod assignment | `[]` | +| `additionalLabels` | Additional labels for Deployment in standalone mode or StatefulSet in distributed mode | `[]` | +| `additionalAnnotations` | Additional annotations for Deployment in standalone mode or StatefulSet in distributed mode | `[]` | +| `podAnnotations` | Pod annotations | `{}` | +| `podLabels` | Pod Labels | `{}` | +| `tls.enabled` | Enable TLS for MinIO server | `false` | +| `tls.certSecret` | Kubernetes Secret with `public.crt` and `private.key` files. | `""` | +| `defaultBucket.enabled` | If set to true, a bucket will be created after MinIO install | `false` | +| `defaultBucket.name` | Bucket name | `bucket` | +| `defaultBucket.policy` | Bucket policy | `none` | +| `defaultBucket.purge` | Purge the bucket if already exists | `false` | +| `defaultBucket.versioning` | Enable / Suspend versioning for bucket | `nil` | +| `buckets` | List of buckets to create after MinIO install | `[]` | +| `makeBucketJob.annotations` | Additional annotations for the Kubernetes Batch (make-bucket-job) | `""` | +| `makeBucketJob.podAnnotations` | Additional annotations for the pods of the Kubernetes Batch (make-bucket-job) | `""` | +| `makeBucketJob.securityContext.enabled` | Enable to run Kubernetes Batch (make-bucket-job) containers as non-root. | `false` | +| `makeBucketJob.securityContext.runAsUser` | User id of the user for the container | `1000` | +| `makeBucketJob.securityContext.runAsGroup` | Group id of the user for the container | `1000` | +| `makeBucketJob.securityContext.fsGroup` | Group id of the persistent volume mount for the container | `1000` | +| `makeBucketJob.resources.requests.memory` | Memory resource requests for 'make bucket' job | `128Mi` | +| `updatePrometheusJob.podAnnotations` | Additional annotations for the pods of the Kubernetes Batch (update-prometheus-secret) | `""` | +| `updatePrometheusJob.securityContext.enabled` | Enable to run Kubernetes Batch (update-prometheus-secret) containers as non-root. | `false` | +| `updatePrometheusJob.securityContext.runAsUser` | User id of the user for the container | `1000` | +| `updatePrometheusJob.securityContext.runAsGroup` | Group id of the user for the container | `1000` | +| `updatePrometheusJob.securityContext.fsGroup` | Group id of the persistent volume mount for the container | `1000` | +| `s3gateway.enabled` | Use MinIO as a [s3 gateway](https://github.com/minio/minio/blob/master/docs/gateway/s3.md) | `false` | +| `s3gateway.replicas` | Number of s3 gateway instances to run in parallel | `4` | +| `s3gateway.serviceEndpoint` | Endpoint to the S3 compatible service | `""` | +| `s3gateway.accessKey` | Access key of S3 compatible service | `""` | +| `s3gateway.secretKey` | Secret key of S3 compatible service | `""` | +| `azuregateway.enabled` | Use MinIO as an [azure gateway](https://docs.minio.io/docs/minio-gateway-for-azure) | `false` | +| `azuregateway.replicas` | Number of azure gateway instances to run in parallel | `4` | +| `gcsgateway.enabled` | Use MinIO as a [Google Cloud Storage gateway](https://docs.minio.io/docs/minio-gateway-for-gcs) | `false` | +| `gcsgateway.gcsKeyJson` | credential json file of service account key | `""` | +| `gcsgateway.projectId` | Google cloud project id | `""` | +| `nasgateway.enabled` | Use MinIO as a [NAS gateway](https://docs.MinIO.io/docs/minio-gateway-for-nas) | `false` | +| `nasgateway.replicas` | Number of NAS gateway instances to be run in parallel on a PV | `4` | | `environment` | Set MinIO server relevant environment variables in `values.yaml` file. MinIO containers will be passed these variables when they start. | `MINIO_STORAGE_CLASS_STANDARD: EC:4"` | -| `metrics.serviceMonitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` | -| `metrics.serviceMonitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}` | -| `metrics.serviceMonitor.namespace` | Optional namespace in which to create ServiceMonitor | `nil` | -| `metrics.serviceMonitor.interval` | Scrape interval. If not set, the Prometheus default scrape interval is used | `nil` | -| `metrics.serviceMonitor.scrapeTimeout` | Scrape timeout. If not set, the Prometheus default scrape timeout is used | `nil` | -| `metrics.serviceMonitor.relabelConfigs` | Relabel configs that can be used on Endpoints | `{}` | -| `etcd.endpoints` | Endpoints of etcd | `[]` | -| `etcd.pathPrefix` | Prefix for all etcd keys | `""` | -| `etcd.corednsPathPrefix` | Prefix for all CoreDNS etcd keys | `""` | -| `etcd.clientCert` | Certificate used for SSL/TLS connections to etcd [(etcd Security)](https://etcd.io/docs/latest/op-guide/security/) | `""` | -| `etcd.clientCertKey` | Key for the certificate [(etcd Security)](https://etcd.io/docs/latest/op-guide/security/) | `""` | +| `metrics.serviceMonitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` | +| `metrics.serviceMonitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}` | +| `metrics.serviceMonitor.namespace` | Optional namespace in which to create ServiceMonitor | `nil` | +| `metrics.serviceMonitor.interval` | Scrape interval. If not set, the Prometheus default scrape interval is used | `nil` | +| `metrics.serviceMonitor.scrapeTimeout` | Scrape timeout. If not set, the Prometheus default scrape timeout is used | `nil` | +| `metrics.serviceMonitor.relabelConfigs` | Relabel configs that can be used on Endpoints | `{}` | +| `etcd.endpoints` | Endpoints of etcd | `[]` | +| `etcd.pathPrefix` | Prefix for all etcd keys | `""` | +| `etcd.corednsPathPrefix` | Prefix for all CoreDNS etcd keys | `""` | +| `etcd.clientCert` | Certificate used for SSL/TLS connections to etcd [(etcd Security)](https://etcd.io/docs/latest/op-guide/security/) | `""` | +| `etcd.clientCertKey` | Key for the certificate [(etcd Security)](https://etcd.io/docs/latest/op-guide/security/) | `""` | Some of the parameters above map to the env variables defined in the [MinIO DockerHub image](https://hub.docker.com/r/minio/minio/). @@ -249,8 +242,7 @@ $ helm install --name my-release -f values.yaml minio/minio > **Tip**: You can use the default [values.yaml](minio/values.yaml) -Distributed MinIO ------------ +## Distributed MinIO This chart provisions a MinIO server in standalone mode, by default. To provision MinIO server in [distributed mode](https://docs.minio.io/docs/distributed-minio-quickstart-guide), set the `mode` field to `distributed`, @@ -277,8 +269,7 @@ $ helm install --set mode=distributed,replicas=8,zones=2 minio/minio 1. StatefulSets need persistent storage, so the `persistence.enabled` flag is ignored when `mode` is set to `distributed`. 2. When uninstalling a distributed MinIO release, you'll need to manually delete volumes associated with the StatefulSet. -NAS Gateway ------------ +## NAS Gateway ### Prerequisites @@ -301,8 +292,7 @@ $ helm install --set nasgateway.enabled=true,nasgateway.replicas=8 minio/minio This provisions MinIO NAS gateway with 8 instances. -Persistence ------------ +## Persistence This chart provisions a PersistentVolumeClaim and mounts corresponding persistent volume to default location `/export`. You'll need physical storage available in the Kubernetes cluster for this to work. If you'd rather use `emptyDir`, disable PersistentVolumeClaim by: @@ -310,10 +300,9 @@ This chart provisions a PersistentVolumeClaim and mounts corresponding persisten $ helm install --set persistence.enabled=false minio/minio ``` -> *"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."* +> _"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."_ -Existing PersistentVolumeClaim ------------------------------- +## Existing PersistentVolumeClaim If a Persistent Volume Claim already exists, specify it during installation. @@ -325,8 +314,7 @@ If a Persistent Volume Claim already exists, specify it during installation. $ helm install --set persistence.existingClaim=PVC_NAME minio/minio ``` -NetworkPolicy -------------- +## NetworkPolicy To enable network policy for MinIO, install [a networking plugin that implements the Kubernetes @@ -344,18 +332,19 @@ For more precise policy, set `networkPolicy.allowExternal=true`. This will only allow pods with the generated client label to connect to MinIO. This label will be displayed in the output of a successful install. -Existing secret ---------------- +## Existing secret Instead of having this chart create the secret for you, you can supply a preexisting secret, much like an existing PersistentVolumeClaim. First, create the secret: + ```bash $ kubectl create secret generic my-minio-secret --from-literal=accesskey=foobarbaz --from-literal=secretkey=foobarbazqux ``` Then install the chart, specifying that you want to use an existing secret: + ```bash $ helm install --set existingSecret=my-minio-secret minio/minio ``` @@ -363,7 +352,7 @@ $ helm install --set existingSecret=my-minio-secret minio/minio The following fields are expected in the secret: | .data. in Secret | Corresponding variable | Description | -|:---------------------------|:------------------------|:----------------------------------------------------------------------------------| +| :------------------------- | :---------------------- | :-------------------------------------------------------------------------------- | | `accesskey` | `accessKey` | Access key ID. Mandatory. | | `secretkey` | `secretKey` | Secret key. Mandatory. | | `gcs_key.json` | `gcsgateway.gcsKeyJson` | GCS key if you are using the GCS gateway feature. Optional | @@ -374,8 +363,7 @@ The following fields are expected in the secret: All corresponding variables will be ignored in values file. -Configure TLS -------------- +## Configure TLS To enable TLS for MinIO containers, acquire TLS certificates from a CA or create self-signed certificates. While creating / acquiring certificates ensure the corresponding domain names are set as per the standard [DNS naming conventions](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-identity) in a Kubernetes StatefulSet (for a distributed MinIO setup). Then create a secret using @@ -389,8 +377,7 @@ Then install the chart, specifying that you want to use the TLS secret: $ helm install --set tls.enabled=true,tls.certSecret=tls-ssl-minio minio/minio ``` -Pass environment variables to MinIO containers ----------------------------------------------- +## Pass environment variables to MinIO containers To pass environment variables to MinIO containers when deploying via Helm chart, use the below command line format @@ -400,8 +387,7 @@ $ helm install --set environment.MINIO_BROWSER=on,environment.MINIO_DOMAIN=domai You can add as many environment variables as required, using the above format. Just add `environment.=` under `set` flag. -Create buckets after install ---------------------------- +## Create buckets after install Install the chart, specifying the buckets you want to create after install: diff --git a/chart/secrets/encryption-key.json b/chart/secrets/encryption-key.json index 4e35c2a41a6f7c..d286e905bb648a 100644 --- a/chart/secrets/encryption-key.json +++ b/chart/secrets/encryption-key.json @@ -1,8 +1,8 @@ [ - { - "name": "general", - "version": 1, - "primary": true, - "material": "4uGh1q8y2DYryJwrVMHs0kWXJlqvHWWt/KJuNi04edI=" - } -] \ No newline at end of file + { + "name": "general", + "version": 1, + "primary": true, + "material": "4uGh1q8y2DYryJwrVMHs0kWXJlqvHWWt/KJuNi04edI=" + } +] diff --git a/chart/test-semver.js b/chart/test-semver.js index 97d1a6c8a757d9..696fea1160f25f 100644 --- a/chart/test-semver.js +++ b/chart/test-semver.js @@ -5,5 +5,5 @@ const semver = require('semver'); if (!semver.valid(process.argv[2])) { - process.exit(1) -} \ No newline at end of file + process.exit(1); +} diff --git a/components/common-go/nsenter/README.md b/components/common-go/nsenter/README.md index ca396b4e2ca78a..63a6b8b0f1930b 100644 --- a/components/common-go/nsenter/README.md +++ b/components/common-go/nsenter/README.md @@ -10,15 +10,15 @@ Original Source: https://github.com/opencontainers/runc/blob/master/libcontainer ### How does it work? The `nsenter` package registers a special init constructor that is called before -the Go runtime has a chance to boot. This provides us the ability to `setns` on +the Go runtime has a chance to boot. This provides us the ability to `setns` on existing namespaces and avoid the issues that the Go runtime has with multiple -threads. This constructor will be called if this package is registered, +threads. This constructor will be called if this package is registered, imported, in your go application. The `nsenter` package will `import "C"` and it uses [cgo](https://golang.org/cmd/cgo/) package. In cgo, if the import of "C" is immediately preceded by a comment, that comment, called the preamble, is used as a header when compiling the C parts of the package. -So every time we import package `nsenter`, the C code function `nsexec()` would be +So every time we import package `nsenter`, the C code function `nsexec()` would be called. Because `nsexec()` must be run before the Go runtime in order to use the diff --git a/components/content-service-api/typescript/patch-grpc-js.ts b/components/content-service-api/typescript/patch-grpc-js.ts index e6b720cb9e20e2..eda87c5fe79e9d 100644 --- a/components/content-service-api/typescript/patch-grpc-js.ts +++ b/components/content-service-api/typescript/patch-grpc-js.ts @@ -1,34 +1,34 @@ (() => { - const fs = require('fs'); - const path = require('path'); - // const roots = ['client']; // XXX: patch the `lib` instead? + const fs = require('fs'); + const path = require('path'); + // const roots = ['client']; // XXX: patch the `lib` instead? - const replacements = [ - { from: './content-service-api/initializer_pb.js', to: '@gitpod/content-service/lib' }, - { from: './content-service-api/initializer_pb', to: '@gitpod/content-service/lib' }, - { from: './content-service-api/blobs_pb.js', to: '@gitpod/content-service/lib' }, - { from: './content-service-api/blobs_pb', to: '@gitpod/content-service/lib' } - ] + const replacements = [ + { from: './content-service-api/initializer_pb.js', to: '@gitpod/content-service/lib' }, + { from: './content-service-api/initializer_pb', to: '@gitpod/content-service/lib' }, + { from: './content-service-api/blobs_pb.js', to: '@gitpod/content-service/lib' }, + { from: './content-service-api/blobs_pb', to: '@gitpod/content-service/lib' }, + ]; - for (const sub of replacements) { - console.info(`🔧 >>> Patching code. Switching from '${sub.from}' to '${sub.to}'...`); - const cliProtocolPath = path.resolve("."); - for (const fileName of fs.readdirSync(cliProtocolPath)) { - if (fileName.indexOf("patch-grpc-js") !== -1) { - continue; - } + for (const sub of replacements) { + console.info(`🔧 >>> Patching code. Switching from '${sub.from}' to '${sub.to}'...`); + const cliProtocolPath = path.resolve('.'); + for (const fileName of fs.readdirSync(cliProtocolPath)) { + if (fileName.indexOf('patch-grpc-js') !== -1) { + continue; + } - const filePath = path.resolve(cliProtocolPath, fileName); - if (fs.lstatSync(filePath).isDirectory()) { - continue; - } + const filePath = path.resolve(cliProtocolPath, fileName); + if (fs.lstatSync(filePath).isDirectory()) { + continue; + } - let content = fs.readFileSync(filePath, { encoding: 'utf8' }); - if (content.indexOf(sub.from) !== -1) { - console.info(`Updated '${sub.from}' to '${sub.to}' in ${filePath}.`); - fs.writeFileSync(filePath, content.replace(sub.from, sub.to)); - } - } + let content = fs.readFileSync(filePath, { encoding: 'utf8' }); + if (content.indexOf(sub.from) !== -1) { + console.info(`Updated '${sub.from}' to '${sub.to}' in ${filePath}.`); + fs.writeFileSync(filePath, content.replace(sub.from, sub.to)); + } } - console.info('👌 <<< Done. The code has been patched.'); -})(); \ No newline at end of file + } + console.info('👌 <<< Done. The code has been patched.'); +})(); diff --git a/components/content-service-api/typescript/src/blobs_grpc_pb.d.ts b/components/content-service-api/typescript/src/blobs_grpc_pb.d.ts index 6b711a86506dd0..0f0ce4af1f7b31 100644 --- a/components/content-service-api/typescript/src/blobs_grpc_pb.d.ts +++ b/components/content-service-api/typescript/src/blobs_grpc_pb.d.ts @@ -10,72 +10,146 @@ /* tslint:disable */ /* eslint-disable */ -import * as grpc from "@grpc/grpc-js"; -import * as blobs_pb from "./blobs_pb"; +import * as grpc from '@grpc/grpc-js'; +import * as blobs_pb from './blobs_pb'; interface IBlobServiceService extends grpc.ServiceDefinition { - uploadUrl: IBlobServiceService_IUploadUrl; - downloadUrl: IBlobServiceService_IDownloadUrl; - delete: IBlobServiceService_IDelete; + uploadUrl: IBlobServiceService_IUploadUrl; + downloadUrl: IBlobServiceService_IDownloadUrl; + delete: IBlobServiceService_IDelete; } -interface IBlobServiceService_IUploadUrl extends grpc.MethodDefinition { - path: "/contentservice.BlobService/UploadUrl"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IBlobServiceService_IUploadUrl + extends grpc.MethodDefinition { + path: '/contentservice.BlobService/UploadUrl'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } -interface IBlobServiceService_IDownloadUrl extends grpc.MethodDefinition { - path: "/contentservice.BlobService/DownloadUrl"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IBlobServiceService_IDownloadUrl + extends grpc.MethodDefinition { + path: '/contentservice.BlobService/DownloadUrl'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } interface IBlobServiceService_IDelete extends grpc.MethodDefinition { - path: "/contentservice.BlobService/Delete"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; + path: '/contentservice.BlobService/Delete'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } export const BlobServiceService: IBlobServiceService; export interface IBlobServiceServer extends grpc.UntypedServiceImplementation { - uploadUrl: grpc.handleUnaryCall; - downloadUrl: grpc.handleUnaryCall; - delete: grpc.handleUnaryCall; + uploadUrl: grpc.handleUnaryCall; + downloadUrl: grpc.handleUnaryCall; + delete: grpc.handleUnaryCall; } export interface IBlobServiceClient { - uploadUrl(request: blobs_pb.UploadUrlRequest, callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void): grpc.ClientUnaryCall; - uploadUrl(request: blobs_pb.UploadUrlRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void): grpc.ClientUnaryCall; - uploadUrl(request: blobs_pb.UploadUrlRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void): grpc.ClientUnaryCall; - downloadUrl(request: blobs_pb.DownloadUrlRequest, callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void): grpc.ClientUnaryCall; - downloadUrl(request: blobs_pb.DownloadUrlRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void): grpc.ClientUnaryCall; - downloadUrl(request: blobs_pb.DownloadUrlRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void): grpc.ClientUnaryCall; - delete(request: blobs_pb.DeleteRequest, callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void): grpc.ClientUnaryCall; - delete(request: blobs_pb.DeleteRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void): grpc.ClientUnaryCall; - delete(request: blobs_pb.DeleteRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void): grpc.ClientUnaryCall; + uploadUrl( + request: blobs_pb.UploadUrlRequest, + callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void, + ): grpc.ClientUnaryCall; + uploadUrl( + request: blobs_pb.UploadUrlRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void, + ): grpc.ClientUnaryCall; + uploadUrl( + request: blobs_pb.UploadUrlRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void, + ): grpc.ClientUnaryCall; + downloadUrl( + request: blobs_pb.DownloadUrlRequest, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void, + ): grpc.ClientUnaryCall; + downloadUrl( + request: blobs_pb.DownloadUrlRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void, + ): grpc.ClientUnaryCall; + downloadUrl( + request: blobs_pb.DownloadUrlRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void, + ): grpc.ClientUnaryCall; + delete( + request: blobs_pb.DeleteRequest, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void, + ): grpc.ClientUnaryCall; + delete( + request: blobs_pb.DeleteRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void, + ): grpc.ClientUnaryCall; + delete( + request: blobs_pb.DeleteRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void, + ): grpc.ClientUnaryCall; } export class BlobServiceClient extends grpc.Client implements IBlobServiceClient { - constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); - public uploadUrl(request: blobs_pb.UploadUrlRequest, callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void): grpc.ClientUnaryCall; - public uploadUrl(request: blobs_pb.UploadUrlRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void): grpc.ClientUnaryCall; - public uploadUrl(request: blobs_pb.UploadUrlRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void): grpc.ClientUnaryCall; - public downloadUrl(request: blobs_pb.DownloadUrlRequest, callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void): grpc.ClientUnaryCall; - public downloadUrl(request: blobs_pb.DownloadUrlRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void): grpc.ClientUnaryCall; - public downloadUrl(request: blobs_pb.DownloadUrlRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void): grpc.ClientUnaryCall; - public delete(request: blobs_pb.DeleteRequest, callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void): grpc.ClientUnaryCall; - public delete(request: blobs_pb.DeleteRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void): grpc.ClientUnaryCall; - public delete(request: blobs_pb.DeleteRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void): grpc.ClientUnaryCall; + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public uploadUrl( + request: blobs_pb.UploadUrlRequest, + callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void, + ): grpc.ClientUnaryCall; + public uploadUrl( + request: blobs_pb.UploadUrlRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void, + ): grpc.ClientUnaryCall; + public uploadUrl( + request: blobs_pb.UploadUrlRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: blobs_pb.UploadUrlResponse) => void, + ): grpc.ClientUnaryCall; + public downloadUrl( + request: blobs_pb.DownloadUrlRequest, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void, + ): grpc.ClientUnaryCall; + public downloadUrl( + request: blobs_pb.DownloadUrlRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void, + ): grpc.ClientUnaryCall; + public downloadUrl( + request: blobs_pb.DownloadUrlRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DownloadUrlResponse) => void, + ): grpc.ClientUnaryCall; + public delete( + request: blobs_pb.DeleteRequest, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void, + ): grpc.ClientUnaryCall; + public delete( + request: blobs_pb.DeleteRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void, + ): grpc.ClientUnaryCall; + public delete( + request: blobs_pb.DeleteRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: blobs_pb.DeleteResponse) => void, + ): grpc.ClientUnaryCall; } diff --git a/components/content-service-api/typescript/src/blobs_grpc_pb.js b/components/content-service-api/typescript/src/blobs_grpc_pb.js index 186eaf6e99dd28..f90dac420c3fec 100644 --- a/components/content-service-api/typescript/src/blobs_grpc_pb.js +++ b/components/content-service-api/typescript/src/blobs_grpc_pb.js @@ -75,10 +75,9 @@ function deserialize_contentservice_UploadUrlResponse(buffer_arg) { return blobs_pb.UploadUrlResponse.deserializeBinary(new Uint8Array(buffer_arg)); } - -var BlobServiceService = exports.BlobServiceService = { +var BlobServiceService = (exports.BlobServiceService = { // UploadUrl provides a URL to which clients can upload the content via HTTP PUT. -uploadUrl: { + uploadUrl: { path: '/contentservice.BlobService/UploadUrl', requestStream: false, responseStream: false, @@ -90,7 +89,7 @@ uploadUrl: { responseDeserialize: deserialize_contentservice_UploadUrlResponse, }, // DownloadUrl provides a URL from which clients can download the content via HTTP GET. -downloadUrl: { + downloadUrl: { path: '/contentservice.BlobService/DownloadUrl', requestStream: false, responseStream: false, @@ -102,7 +101,7 @@ downloadUrl: { responseDeserialize: deserialize_contentservice_DownloadUrlResponse, }, // Delete deletes the uploaded content. -delete: { + delete: { path: '/contentservice.BlobService/Delete', requestStream: false, responseStream: false, @@ -113,6 +112,6 @@ delete: { responseSerialize: serialize_contentservice_DeleteResponse, responseDeserialize: deserialize_contentservice_DeleteResponse, }, -}; +}); exports.BlobServiceClient = grpc.makeGenericClientConstructor(BlobServiceService); diff --git a/components/content-service-api/typescript/src/blobs_pb.d.ts b/components/content-service-api/typescript/src/blobs_pb.d.ts index 787734b927cc2f..d0bf68a368bf55 100644 --- a/components/content-service-api/typescript/src/blobs_pb.d.ts +++ b/components/content-service-api/typescript/src/blobs_pb.d.ts @@ -10,154 +10,151 @@ /* tslint:disable */ /* eslint-disable */ -import * as jspb from "google-protobuf"; +import * as jspb from 'google-protobuf'; export class UploadUrlRequest extends jspb.Message { - getOwnerId(): string; - setOwnerId(value: string): UploadUrlRequest; - getName(): string; - setName(value: string): UploadUrlRequest; - getContentType(): string; - setContentType(value: string): UploadUrlRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): UploadUrlRequest.AsObject; - static toObject(includeInstance: boolean, msg: UploadUrlRequest): UploadUrlRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: UploadUrlRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): UploadUrlRequest; - static deserializeBinaryFromReader(message: UploadUrlRequest, reader: jspb.BinaryReader): UploadUrlRequest; + getOwnerId(): string; + setOwnerId(value: string): UploadUrlRequest; + getName(): string; + setName(value: string): UploadUrlRequest; + getContentType(): string; + setContentType(value: string): UploadUrlRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): UploadUrlRequest.AsObject; + static toObject(includeInstance: boolean, msg: UploadUrlRequest): UploadUrlRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: UploadUrlRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UploadUrlRequest; + static deserializeBinaryFromReader(message: UploadUrlRequest, reader: jspb.BinaryReader): UploadUrlRequest; } export namespace UploadUrlRequest { - export type AsObject = { - ownerId: string, - name: string, - contentType: string, - } + export type AsObject = { + ownerId: string; + name: string; + contentType: string; + }; } export class UploadUrlResponse extends jspb.Message { - getUrl(): string; - setUrl(value: string): UploadUrlResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): UploadUrlResponse.AsObject; - static toObject(includeInstance: boolean, msg: UploadUrlResponse): UploadUrlResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: UploadUrlResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): UploadUrlResponse; - static deserializeBinaryFromReader(message: UploadUrlResponse, reader: jspb.BinaryReader): UploadUrlResponse; + getUrl(): string; + setUrl(value: string): UploadUrlResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): UploadUrlResponse.AsObject; + static toObject(includeInstance: boolean, msg: UploadUrlResponse): UploadUrlResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: UploadUrlResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): UploadUrlResponse; + static deserializeBinaryFromReader(message: UploadUrlResponse, reader: jspb.BinaryReader): UploadUrlResponse; } export namespace UploadUrlResponse { - export type AsObject = { - url: string, - } + export type AsObject = { + url: string; + }; } export class DownloadUrlRequest extends jspb.Message { - getOwnerId(): string; - setOwnerId(value: string): DownloadUrlRequest; - getName(): string; - setName(value: string): DownloadUrlRequest; - getContentType(): string; - setContentType(value: string): DownloadUrlRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DownloadUrlRequest.AsObject; - static toObject(includeInstance: boolean, msg: DownloadUrlRequest): DownloadUrlRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: DownloadUrlRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DownloadUrlRequest; - static deserializeBinaryFromReader(message: DownloadUrlRequest, reader: jspb.BinaryReader): DownloadUrlRequest; + getOwnerId(): string; + setOwnerId(value: string): DownloadUrlRequest; + getName(): string; + setName(value: string): DownloadUrlRequest; + getContentType(): string; + setContentType(value: string): DownloadUrlRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DownloadUrlRequest.AsObject; + static toObject(includeInstance: boolean, msg: DownloadUrlRequest): DownloadUrlRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: DownloadUrlRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DownloadUrlRequest; + static deserializeBinaryFromReader(message: DownloadUrlRequest, reader: jspb.BinaryReader): DownloadUrlRequest; } export namespace DownloadUrlRequest { - export type AsObject = { - ownerId: string, - name: string, - contentType: string, - } + export type AsObject = { + ownerId: string; + name: string; + contentType: string; + }; } export class DownloadUrlResponse extends jspb.Message { - getUrl(): string; - setUrl(value: string): DownloadUrlResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DownloadUrlResponse.AsObject; - static toObject(includeInstance: boolean, msg: DownloadUrlResponse): DownloadUrlResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: DownloadUrlResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DownloadUrlResponse; - static deserializeBinaryFromReader(message: DownloadUrlResponse, reader: jspb.BinaryReader): DownloadUrlResponse; + getUrl(): string; + setUrl(value: string): DownloadUrlResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DownloadUrlResponse.AsObject; + static toObject(includeInstance: boolean, msg: DownloadUrlResponse): DownloadUrlResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: DownloadUrlResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DownloadUrlResponse; + static deserializeBinaryFromReader(message: DownloadUrlResponse, reader: jspb.BinaryReader): DownloadUrlResponse; } export namespace DownloadUrlResponse { - export type AsObject = { - url: string, - } + export type AsObject = { + url: string; + }; } export class DeleteRequest extends jspb.Message { - getOwnerId(): string; - setOwnerId(value: string): DeleteRequest; - - hasExact(): boolean; - clearExact(): void; - getExact(): string; - setExact(value: string): DeleteRequest; - - hasPrefix(): boolean; - clearPrefix(): void; - getPrefix(): string; - setPrefix(value: string): DeleteRequest; - - getNameCase(): DeleteRequest.NameCase; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DeleteRequest.AsObject; - static toObject(includeInstance: boolean, msg: DeleteRequest): DeleteRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: DeleteRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DeleteRequest; - static deserializeBinaryFromReader(message: DeleteRequest, reader: jspb.BinaryReader): DeleteRequest; + getOwnerId(): string; + setOwnerId(value: string): DeleteRequest; + + hasExact(): boolean; + clearExact(): void; + getExact(): string; + setExact(value: string): DeleteRequest; + + hasPrefix(): boolean; + clearPrefix(): void; + getPrefix(): string; + setPrefix(value: string): DeleteRequest; + + getNameCase(): DeleteRequest.NameCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DeleteRequest.AsObject; + static toObject(includeInstance: boolean, msg: DeleteRequest): DeleteRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: DeleteRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DeleteRequest; + static deserializeBinaryFromReader(message: DeleteRequest, reader: jspb.BinaryReader): DeleteRequest; } export namespace DeleteRequest { - export type AsObject = { - ownerId: string, - exact: string, - prefix: string, - } - - export enum NameCase { - NAME_NOT_SET = 0, - EXACT = 2, - PREFIX = 3, - } - + export type AsObject = { + ownerId: string; + exact: string; + prefix: string; + }; + + export enum NameCase { + NAME_NOT_SET = 0, + EXACT = 2, + PREFIX = 3, + } } export class DeleteResponse extends jspb.Message { - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DeleteResponse.AsObject; - static toObject(includeInstance: boolean, msg: DeleteResponse): DeleteResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: DeleteResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DeleteResponse; - static deserializeBinaryFromReader(message: DeleteResponse, reader: jspb.BinaryReader): DeleteResponse; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DeleteResponse.AsObject; + static toObject(includeInstance: boolean, msg: DeleteResponse): DeleteResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: DeleteResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DeleteResponse; + static deserializeBinaryFromReader(message: DeleteResponse, reader: jspb.BinaryReader): DeleteResponse; } export namespace DeleteResponse { - export type AsObject = { - } + export type AsObject = {}; } diff --git a/components/content-service-api/typescript/src/blobs_pb.js b/components/content-service-api/typescript/src/blobs_pb.js index 720f76c514c5c2..6deddc6528468e 100644 --- a/components/content-service-api/typescript/src/blobs_pb.js +++ b/components/content-service-api/typescript/src/blobs_pb.js @@ -19,13 +19,21 @@ var jspb = require('google-protobuf'); var goog = jspb; -var global = (function() { - if (this) { return this; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - if (typeof self !== 'undefined') { return self; } +var global = function () { + if (this) { + return this; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + if (typeof self !== 'undefined') { + return self; + } return Function('return this')(); -}.call(null)); +}.call(null); goog.exportSymbol('proto.contentservice.DeleteRequest', null, global); goog.exportSymbol('proto.contentservice.DeleteRequest.NameCase', null, global); @@ -44,7 +52,7 @@ goog.exportSymbol('proto.contentservice.UploadUrlResponse', null, global); * @extends {jspb.Message} * @constructor */ -proto.contentservice.UploadUrlRequest = function(opt_data) { +proto.contentservice.UploadUrlRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.UploadUrlRequest, jspb.Message); @@ -65,7 +73,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.UploadUrlResponse = function(opt_data) { +proto.contentservice.UploadUrlResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.UploadUrlResponse, jspb.Message); @@ -86,7 +94,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.DownloadUrlRequest = function(opt_data) { +proto.contentservice.DownloadUrlRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.DownloadUrlRequest, jspb.Message); @@ -107,7 +115,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.DownloadUrlResponse = function(opt_data) { +proto.contentservice.DownloadUrlResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.DownloadUrlResponse, jspb.Message); @@ -128,7 +136,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.DeleteRequest = function(opt_data) { +proto.contentservice.DeleteRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, proto.contentservice.DeleteRequest.oneofGroups_); }; goog.inherits(proto.contentservice.DeleteRequest, jspb.Message); @@ -149,7 +157,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.DeleteResponse = function(opt_data) { +proto.contentservice.DeleteResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.DeleteResponse, jspb.Message); @@ -161,62 +169,58 @@ if (goog.DEBUG && !COMPILED) { proto.contentservice.DeleteResponse.displayName = 'proto.contentservice.DeleteResponse'; } - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.UploadUrlRequest.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.UploadUrlRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.UploadUrlRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.UploadUrlRequest.toObject = function(includeInstance, msg) { - var f, obj = { - ownerId: jspb.Message.getFieldWithDefault(msg, 1, ""), - name: jspb.Message.getFieldWithDefault(msg, 2, ""), - contentType: jspb.Message.getFieldWithDefault(msg, 3, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.UploadUrlRequest.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.UploadUrlRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.UploadUrlRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.UploadUrlRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + ownerId: jspb.Message.getFieldWithDefault(msg, 1, ''), + name: jspb.Message.getFieldWithDefault(msg, 2, ''), + contentType: jspb.Message.getFieldWithDefault(msg, 3, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.UploadUrlRequest} */ -proto.contentservice.UploadUrlRequest.deserializeBinary = function(bytes) { +proto.contentservice.UploadUrlRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.UploadUrlRequest; + var msg = new proto.contentservice.UploadUrlRequest(); return proto.contentservice.UploadUrlRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -224,45 +228,43 @@ proto.contentservice.UploadUrlRequest.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.UploadUrlRequest} */ -proto.contentservice.UploadUrlRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.UploadUrlRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setOwnerId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setContentType(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setOwnerId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setContentType(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.UploadUrlRequest.prototype.serializeBinary = function() { +proto.contentservice.UploadUrlRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.UploadUrlRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -270,141 +272,120 @@ proto.contentservice.UploadUrlRequest.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.UploadUrlRequest.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.UploadUrlRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getOwnerId(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getName(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } f = message.getContentType(); if (f.length > 0) { - writer.writeString( - 3, - f - ); + writer.writeString(3, f); } }; - /** * optional string owner_id = 1; * @return {string} */ -proto.contentservice.UploadUrlRequest.prototype.getOwnerId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.UploadUrlRequest.prototype.getOwnerId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.UploadUrlRequest} returns this */ -proto.contentservice.UploadUrlRequest.prototype.setOwnerId = function(value) { +proto.contentservice.UploadUrlRequest.prototype.setOwnerId = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string name = 2; * @return {string} */ -proto.contentservice.UploadUrlRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.UploadUrlRequest.prototype.getName = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.UploadUrlRequest} returns this */ -proto.contentservice.UploadUrlRequest.prototype.setName = function(value) { +proto.contentservice.UploadUrlRequest.prototype.setName = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - /** * optional string content_type = 3; * @return {string} */ -proto.contentservice.UploadUrlRequest.prototype.getContentType = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.contentservice.UploadUrlRequest.prototype.getContentType = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')); }; - /** * @param {string} value * @return {!proto.contentservice.UploadUrlRequest} returns this */ -proto.contentservice.UploadUrlRequest.prototype.setContentType = function(value) { +proto.contentservice.UploadUrlRequest.prototype.setContentType = function (value) { return jspb.Message.setProto3StringField(this, 3, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.UploadUrlResponse.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.UploadUrlResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.UploadUrlResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.UploadUrlResponse.toObject = function(includeInstance, msg) { - var f, obj = { - url: jspb.Message.getFieldWithDefault(msg, 1, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.UploadUrlResponse.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.UploadUrlResponse.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.UploadUrlResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.UploadUrlResponse.toObject = function (includeInstance, msg) { + var f, + obj = { + url: jspb.Message.getFieldWithDefault(msg, 1, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.UploadUrlResponse} */ -proto.contentservice.UploadUrlResponse.deserializeBinary = function(bytes) { +proto.contentservice.UploadUrlResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.UploadUrlResponse; + var msg = new proto.contentservice.UploadUrlResponse(); return proto.contentservice.UploadUrlResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -412,37 +393,35 @@ proto.contentservice.UploadUrlResponse.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.UploadUrlResponse} */ -proto.contentservice.UploadUrlResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.UploadUrlResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setUrl(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUrl(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.UploadUrlResponse.prototype.serializeBinary = function() { +proto.contentservice.UploadUrlResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.UploadUrlResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -450,93 +429,82 @@ proto.contentservice.UploadUrlResponse.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.UploadUrlResponse.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.UploadUrlResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getUrl(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } }; - /** * optional string url = 1; * @return {string} */ -proto.contentservice.UploadUrlResponse.prototype.getUrl = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.UploadUrlResponse.prototype.getUrl = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.UploadUrlResponse} returns this */ -proto.contentservice.UploadUrlResponse.prototype.setUrl = function(value) { +proto.contentservice.UploadUrlResponse.prototype.setUrl = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.DownloadUrlRequest.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.DownloadUrlRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.DownloadUrlRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.DownloadUrlRequest.toObject = function(includeInstance, msg) { - var f, obj = { - ownerId: jspb.Message.getFieldWithDefault(msg, 1, ""), - name: jspb.Message.getFieldWithDefault(msg, 2, ""), - contentType: jspb.Message.getFieldWithDefault(msg, 3, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.DownloadUrlRequest.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.DownloadUrlRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.DownloadUrlRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.DownloadUrlRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + ownerId: jspb.Message.getFieldWithDefault(msg, 1, ''), + name: jspb.Message.getFieldWithDefault(msg, 2, ''), + contentType: jspb.Message.getFieldWithDefault(msg, 3, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.DownloadUrlRequest} */ -proto.contentservice.DownloadUrlRequest.deserializeBinary = function(bytes) { +proto.contentservice.DownloadUrlRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.DownloadUrlRequest; + var msg = new proto.contentservice.DownloadUrlRequest(); return proto.contentservice.DownloadUrlRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -544,45 +512,43 @@ proto.contentservice.DownloadUrlRequest.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.DownloadUrlRequest} */ -proto.contentservice.DownloadUrlRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.DownloadUrlRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setOwnerId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setContentType(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setOwnerId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setContentType(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.DownloadUrlRequest.prototype.serializeBinary = function() { +proto.contentservice.DownloadUrlRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.DownloadUrlRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -590,141 +556,120 @@ proto.contentservice.DownloadUrlRequest.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.DownloadUrlRequest.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.DownloadUrlRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getOwnerId(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getName(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } f = message.getContentType(); if (f.length > 0) { - writer.writeString( - 3, - f - ); + writer.writeString(3, f); } }; - /** * optional string owner_id = 1; * @return {string} */ -proto.contentservice.DownloadUrlRequest.prototype.getOwnerId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.DownloadUrlRequest.prototype.getOwnerId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.DownloadUrlRequest} returns this */ -proto.contentservice.DownloadUrlRequest.prototype.setOwnerId = function(value) { +proto.contentservice.DownloadUrlRequest.prototype.setOwnerId = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string name = 2; * @return {string} */ -proto.contentservice.DownloadUrlRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.DownloadUrlRequest.prototype.getName = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.DownloadUrlRequest} returns this */ -proto.contentservice.DownloadUrlRequest.prototype.setName = function(value) { +proto.contentservice.DownloadUrlRequest.prototype.setName = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - /** * optional string content_type = 3; * @return {string} */ -proto.contentservice.DownloadUrlRequest.prototype.getContentType = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.contentservice.DownloadUrlRequest.prototype.getContentType = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')); }; - /** * @param {string} value * @return {!proto.contentservice.DownloadUrlRequest} returns this */ -proto.contentservice.DownloadUrlRequest.prototype.setContentType = function(value) { +proto.contentservice.DownloadUrlRequest.prototype.setContentType = function (value) { return jspb.Message.setProto3StringField(this, 3, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.DownloadUrlResponse.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.DownloadUrlResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.DownloadUrlResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.DownloadUrlResponse.toObject = function(includeInstance, msg) { - var f, obj = { - url: jspb.Message.getFieldWithDefault(msg, 1, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.DownloadUrlResponse.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.DownloadUrlResponse.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.DownloadUrlResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.DownloadUrlResponse.toObject = function (includeInstance, msg) { + var f, + obj = { + url: jspb.Message.getFieldWithDefault(msg, 1, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.DownloadUrlResponse} */ -proto.contentservice.DownloadUrlResponse.deserializeBinary = function(bytes) { +proto.contentservice.DownloadUrlResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.DownloadUrlResponse; + var msg = new proto.contentservice.DownloadUrlResponse(); return proto.contentservice.DownloadUrlResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -732,37 +677,35 @@ proto.contentservice.DownloadUrlResponse.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.DownloadUrlResponse} */ -proto.contentservice.DownloadUrlResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.DownloadUrlResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setUrl(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUrl(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.DownloadUrlResponse.prototype.serializeBinary = function() { +proto.contentservice.DownloadUrlResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.DownloadUrlResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -770,37 +713,30 @@ proto.contentservice.DownloadUrlResponse.prototype.serializeBinary = function() * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.DownloadUrlResponse.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.DownloadUrlResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getUrl(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } }; - /** * optional string url = 1; * @return {string} */ -proto.contentservice.DownloadUrlResponse.prototype.getUrl = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.DownloadUrlResponse.prototype.getUrl = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.DownloadUrlResponse} returns this */ -proto.contentservice.DownloadUrlResponse.prototype.setUrl = function(value) { +proto.contentservice.DownloadUrlResponse.prototype.setUrl = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - - /** * Oneof group definitions for this message. Each group defines the field * numbers belonging to that group. When of these fields' value is set, all @@ -809,7 +745,7 @@ proto.contentservice.DownloadUrlResponse.prototype.setUrl = function(value) { * @private {!Array>} * @const */ -proto.contentservice.DeleteRequest.oneofGroups_ = [[2,3]]; +proto.contentservice.DeleteRequest.oneofGroups_ = [[2, 3]]; /** * @enum {number} @@ -817,72 +753,70 @@ proto.contentservice.DeleteRequest.oneofGroups_ = [[2,3]]; proto.contentservice.DeleteRequest.NameCase = { NAME_NOT_SET: 0, EXACT: 2, - PREFIX: 3 + PREFIX: 3, }; /** * @return {proto.contentservice.DeleteRequest.NameCase} */ -proto.contentservice.DeleteRequest.prototype.getNameCase = function() { - return /** @type {proto.contentservice.DeleteRequest.NameCase} */(jspb.Message.computeOneofCase(this, proto.contentservice.DeleteRequest.oneofGroups_[0])); +proto.contentservice.DeleteRequest.prototype.getNameCase = function () { + return /** @type {proto.contentservice.DeleteRequest.NameCase} */ ( + jspb.Message.computeOneofCase(this, proto.contentservice.DeleteRequest.oneofGroups_[0]) + ); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.DeleteRequest.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.DeleteRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.DeleteRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.DeleteRequest.toObject = function(includeInstance, msg) { - var f, obj = { - ownerId: jspb.Message.getFieldWithDefault(msg, 1, ""), - exact: jspb.Message.getFieldWithDefault(msg, 2, ""), - prefix: jspb.Message.getFieldWithDefault(msg, 3, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.DeleteRequest.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.DeleteRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.DeleteRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.DeleteRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + ownerId: jspb.Message.getFieldWithDefault(msg, 1, ''), + exact: jspb.Message.getFieldWithDefault(msg, 2, ''), + prefix: jspb.Message.getFieldWithDefault(msg, 3, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.DeleteRequest} */ -proto.contentservice.DeleteRequest.deserializeBinary = function(bytes) { +proto.contentservice.DeleteRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.DeleteRequest; + var msg = new proto.contentservice.DeleteRequest(); return proto.contentservice.DeleteRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -890,45 +824,43 @@ proto.contentservice.DeleteRequest.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.DeleteRequest} */ -proto.contentservice.DeleteRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.DeleteRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setOwnerId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setExact(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setPrefix(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setOwnerId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setExact(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPrefix(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.DeleteRequest.prototype.serializeBinary = function() { +proto.contentservice.DeleteRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.DeleteRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -936,177 +868,150 @@ proto.contentservice.DeleteRequest.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.DeleteRequest.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.DeleteRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getOwnerId(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = /** @type {string} */ (jspb.Message.getField(message, 2)); if (f != null) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } f = /** @type {string} */ (jspb.Message.getField(message, 3)); if (f != null) { - writer.writeString( - 3, - f - ); + writer.writeString(3, f); } }; - /** * optional string owner_id = 1; * @return {string} */ -proto.contentservice.DeleteRequest.prototype.getOwnerId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.DeleteRequest.prototype.getOwnerId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.DeleteRequest} returns this */ -proto.contentservice.DeleteRequest.prototype.setOwnerId = function(value) { +proto.contentservice.DeleteRequest.prototype.setOwnerId = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string exact = 2; * @return {string} */ -proto.contentservice.DeleteRequest.prototype.getExact = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.DeleteRequest.prototype.getExact = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.DeleteRequest} returns this */ -proto.contentservice.DeleteRequest.prototype.setExact = function(value) { +proto.contentservice.DeleteRequest.prototype.setExact = function (value) { return jspb.Message.setOneofField(this, 2, proto.contentservice.DeleteRequest.oneofGroups_[0], value); }; - /** * Clears the field making it undefined. * @return {!proto.contentservice.DeleteRequest} returns this */ -proto.contentservice.DeleteRequest.prototype.clearExact = function() { +proto.contentservice.DeleteRequest.prototype.clearExact = function () { return jspb.Message.setOneofField(this, 2, proto.contentservice.DeleteRequest.oneofGroups_[0], undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.DeleteRequest.prototype.hasExact = function() { +proto.contentservice.DeleteRequest.prototype.hasExact = function () { return jspb.Message.getField(this, 2) != null; }; - /** * optional string prefix = 3; * @return {string} */ -proto.contentservice.DeleteRequest.prototype.getPrefix = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.contentservice.DeleteRequest.prototype.getPrefix = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')); }; - /** * @param {string} value * @return {!proto.contentservice.DeleteRequest} returns this */ -proto.contentservice.DeleteRequest.prototype.setPrefix = function(value) { +proto.contentservice.DeleteRequest.prototype.setPrefix = function (value) { return jspb.Message.setOneofField(this, 3, proto.contentservice.DeleteRequest.oneofGroups_[0], value); }; - /** * Clears the field making it undefined. * @return {!proto.contentservice.DeleteRequest} returns this */ -proto.contentservice.DeleteRequest.prototype.clearPrefix = function() { +proto.contentservice.DeleteRequest.prototype.clearPrefix = function () { return jspb.Message.setOneofField(this, 3, proto.contentservice.DeleteRequest.oneofGroups_[0], undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.DeleteRequest.prototype.hasPrefix = function() { +proto.contentservice.DeleteRequest.prototype.hasPrefix = function () { return jspb.Message.getField(this, 3) != null; }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.DeleteResponse.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.DeleteResponse.toObject(opt_includeInstance, this); -}; - + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.DeleteResponse.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.DeleteResponse.toObject(opt_includeInstance, this); + }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.DeleteResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.DeleteResponse.toObject = function(includeInstance, msg) { - var f, obj = { + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.DeleteResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.DeleteResponse.toObject = function (includeInstance, msg) { + var f, + obj = {}; + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.DeleteResponse} */ -proto.contentservice.DeleteResponse.deserializeBinary = function(bytes) { +proto.contentservice.DeleteResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.DeleteResponse; + var msg = new proto.contentservice.DeleteResponse(); return proto.contentservice.DeleteResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -1114,33 +1019,31 @@ proto.contentservice.DeleteResponse.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.DeleteResponse} */ -proto.contentservice.DeleteResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.DeleteResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - default: - reader.skipField(); - break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.DeleteResponse.prototype.serializeBinary = function() { +proto.contentservice.DeleteResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.DeleteResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -1148,9 +1051,8 @@ proto.contentservice.DeleteResponse.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.DeleteResponse.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.DeleteResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; }; - goog.object.extend(exports, proto.contentservice); diff --git a/components/content-service-api/typescript/src/client-call-metrics.ts b/components/content-service-api/typescript/src/client-call-metrics.ts index 8011907b518be4..b5773e524302ef 100644 --- a/components/content-service-api/typescript/src/client-call-metrics.ts +++ b/components/content-service-api/typescript/src/client-call-metrics.ts @@ -4,85 +4,90 @@ * See License-AGPL.txt in the project root for license information. */ -import * as grpc from "@grpc/grpc-js"; -import { Status } from "@grpc/grpc-js/build/src/constants"; +import * as grpc from '@grpc/grpc-js'; +import { Status } from '@grpc/grpc-js/build/src/constants'; type GrpcMethodType = 'unary' | 'client_stream' | 'server_stream' | 'bidi_stream'; export interface IGrpcCallMetricsLabels { - service: string, - method: string, - type: GrpcMethodType, + service: string; + method: string; + type: GrpcMethodType; } export interface IGrpcCallMetricsLabelsWithCode extends IGrpcCallMetricsLabels { - code: string + code: string; } -export const IClientCallMetrics = Symbol("IClientCallMetrics"); +export const IClientCallMetrics = Symbol('IClientCallMetrics'); export interface IClientCallMetrics { - handled(labels: IGrpcCallMetricsLabelsWithCode) : void; - received(labels: IGrpcCallMetricsLabels) : void; - sent(labels: IGrpcCallMetricsLabels) : void; - started(labels: IGrpcCallMetricsLabels) : void; + handled(labels: IGrpcCallMetricsLabelsWithCode): void; + received(labels: IGrpcCallMetricsLabels): void; + sent(labels: IGrpcCallMetricsLabels): void; + started(labels: IGrpcCallMetricsLabels): void; } export function getGrpcMethodType(requestStream: boolean, responseStream: boolean): GrpcMethodType { - if (requestStream) { - if (responseStream) { - return 'bidi_stream'; - } else { - return 'client_stream'; - } + if (requestStream) { + if (responseStream) { + return 'bidi_stream'; } else { - if (responseStream) { - return 'server_stream'; - } else { - return 'unary'; - } + return 'client_stream'; + } + } else { + if (responseStream) { + return 'server_stream'; + } else { + return 'unary'; } + } } export function createClientCallMetricsInterceptor(metrics: IClientCallMetrics): grpc.Interceptor { - return (options, nextCall): grpc.InterceptingCall => { - const methodDef = options.method_definition; - const method = methodDef.path.substring(methodDef.path.lastIndexOf('/') + 1); - const service = methodDef.path.substring(1, methodDef.path.length - method.length - 1); - const labels = { - service, - method, - type: getGrpcMethodType(options.method_definition.requestStream, options.method_definition.responseStream) - }; - const requester = new grpc.RequesterBuilder() - .withStart((metadata, listener, next) => { - const newListener = new grpc.ListenerBuilder().withOnReceiveStatus((status, next) => { - try { - metrics.handled({ - ...labels, - code: Status[status.code] - }); - } finally { - next(status); - } - }).withOnReceiveMessage((message, next) => { - try { - metrics.received(labels); - } finally { - next(message); - } - }).build() - try { - metrics.started(labels); - } finally { - next(metadata, newListener); - } - }).withSendMessage((message, next) => { - try { - metrics.sent(labels); - } finally { - next(message); - } - }).build(); - return new grpc.InterceptingCall(nextCall(options), requester); + return (options, nextCall): grpc.InterceptingCall => { + const methodDef = options.method_definition; + const method = methodDef.path.substring(methodDef.path.lastIndexOf('/') + 1); + const service = methodDef.path.substring(1, methodDef.path.length - method.length - 1); + const labels = { + service, + method, + type: getGrpcMethodType(options.method_definition.requestStream, options.method_definition.responseStream), }; + const requester = new grpc.RequesterBuilder() + .withStart((metadata, listener, next) => { + const newListener = new grpc.ListenerBuilder() + .withOnReceiveStatus((status, next) => { + try { + metrics.handled({ + ...labels, + code: Status[status.code], + }); + } finally { + next(status); + } + }) + .withOnReceiveMessage((message, next) => { + try { + metrics.received(labels); + } finally { + next(message); + } + }) + .build(); + try { + metrics.started(labels); + } finally { + next(metadata, newListener); + } + }) + .withSendMessage((message, next) => { + try { + metrics.sent(labels); + } finally { + next(message); + } + }) + .build(); + return new grpc.InterceptingCall(nextCall(options), requester); + }; } diff --git a/components/content-service-api/typescript/src/content_grpc_pb.d.ts b/components/content-service-api/typescript/src/content_grpc_pb.d.ts index 1969316f61ea00..5ee167e1810d44 100644 --- a/components/content-service-api/typescript/src/content_grpc_pb.d.ts +++ b/components/content-service-api/typescript/src/content_grpc_pb.d.ts @@ -10,38 +10,63 @@ /* tslint:disable */ /* eslint-disable */ -import * as grpc from "@grpc/grpc-js"; -import * as content_pb from "./content_pb"; +import * as grpc from '@grpc/grpc-js'; +import * as content_pb from './content_pb'; interface IContentServiceService extends grpc.ServiceDefinition { - deleteUserContent: IContentServiceService_IDeleteUserContent; + deleteUserContent: IContentServiceService_IDeleteUserContent; } -interface IContentServiceService_IDeleteUserContent extends grpc.MethodDefinition { - path: "/contentservice.ContentService/DeleteUserContent"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IContentServiceService_IDeleteUserContent + extends grpc.MethodDefinition { + path: '/contentservice.ContentService/DeleteUserContent'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } export const ContentServiceService: IContentServiceService; export interface IContentServiceServer extends grpc.UntypedServiceImplementation { - deleteUserContent: grpc.handleUnaryCall; + deleteUserContent: grpc.handleUnaryCall; } export interface IContentServiceClient { - deleteUserContent(request: content_pb.DeleteUserContentRequest, callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void): grpc.ClientUnaryCall; - deleteUserContent(request: content_pb.DeleteUserContentRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void): grpc.ClientUnaryCall; - deleteUserContent(request: content_pb.DeleteUserContentRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void): grpc.ClientUnaryCall; + deleteUserContent( + request: content_pb.DeleteUserContentRequest, + callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void, + ): grpc.ClientUnaryCall; + deleteUserContent( + request: content_pb.DeleteUserContentRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void, + ): grpc.ClientUnaryCall; + deleteUserContent( + request: content_pb.DeleteUserContentRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void, + ): grpc.ClientUnaryCall; } export class ContentServiceClient extends grpc.Client implements IContentServiceClient { - constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); - public deleteUserContent(request: content_pb.DeleteUserContentRequest, callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void): grpc.ClientUnaryCall; - public deleteUserContent(request: content_pb.DeleteUserContentRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void): grpc.ClientUnaryCall; - public deleteUserContent(request: content_pb.DeleteUserContentRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void): grpc.ClientUnaryCall; + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public deleteUserContent( + request: content_pb.DeleteUserContentRequest, + callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void, + ): grpc.ClientUnaryCall; + public deleteUserContent( + request: content_pb.DeleteUserContentRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void, + ): grpc.ClientUnaryCall; + public deleteUserContent( + request: content_pb.DeleteUserContentRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: content_pb.DeleteUserContentResponse) => void, + ): grpc.ClientUnaryCall; } diff --git a/components/content-service-api/typescript/src/content_grpc_pb.js b/components/content-service-api/typescript/src/content_grpc_pb.js index 7b0f4761ac6880..a57eee07e8d2c7 100644 --- a/components/content-service-api/typescript/src/content_grpc_pb.js +++ b/components/content-service-api/typescript/src/content_grpc_pb.js @@ -31,10 +31,9 @@ function deserialize_contentservice_DeleteUserContentResponse(buffer_arg) { return content_pb.DeleteUserContentResponse.deserializeBinary(new Uint8Array(buffer_arg)); } - -var ContentServiceService = exports.ContentServiceService = { +var ContentServiceService = (exports.ContentServiceService = { // DeleteUserContent deletes all content associated with a user. -deleteUserContent: { + deleteUserContent: { path: '/contentservice.ContentService/DeleteUserContent', requestStream: false, responseStream: false, @@ -45,6 +44,6 @@ deleteUserContent: { responseSerialize: serialize_contentservice_DeleteUserContentResponse, responseDeserialize: deserialize_contentservice_DeleteUserContentResponse, }, -}; +}); exports.ContentServiceClient = grpc.makeGenericClientConstructor(ContentServiceService); diff --git a/components/content-service-api/typescript/src/content_pb.d.ts b/components/content-service-api/typescript/src/content_pb.d.ts index 4fb0c28486af03..2a2fa9f1ca51d9 100644 --- a/components/content-service-api/typescript/src/content_pb.d.ts +++ b/components/content-service-api/typescript/src/content_pb.d.ts @@ -10,41 +10,45 @@ /* tslint:disable */ /* eslint-disable */ -import * as jspb from "google-protobuf"; +import * as jspb from 'google-protobuf'; export class DeleteUserContentRequest extends jspb.Message { - getOwnerId(): string; - setOwnerId(value: string): DeleteUserContentRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DeleteUserContentRequest.AsObject; - static toObject(includeInstance: boolean, msg: DeleteUserContentRequest): DeleteUserContentRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: DeleteUserContentRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DeleteUserContentRequest; - static deserializeBinaryFromReader(message: DeleteUserContentRequest, reader: jspb.BinaryReader): DeleteUserContentRequest; + getOwnerId(): string; + setOwnerId(value: string): DeleteUserContentRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DeleteUserContentRequest.AsObject; + static toObject(includeInstance: boolean, msg: DeleteUserContentRequest): DeleteUserContentRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: DeleteUserContentRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DeleteUserContentRequest; + static deserializeBinaryFromReader( + message: DeleteUserContentRequest, + reader: jspb.BinaryReader, + ): DeleteUserContentRequest; } export namespace DeleteUserContentRequest { - export type AsObject = { - ownerId: string, - } + export type AsObject = { + ownerId: string; + }; } export class DeleteUserContentResponse extends jspb.Message { - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DeleteUserContentResponse.AsObject; - static toObject(includeInstance: boolean, msg: DeleteUserContentResponse): DeleteUserContentResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: DeleteUserContentResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DeleteUserContentResponse; - static deserializeBinaryFromReader(message: DeleteUserContentResponse, reader: jspb.BinaryReader): DeleteUserContentResponse; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DeleteUserContentResponse.AsObject; + static toObject(includeInstance: boolean, msg: DeleteUserContentResponse): DeleteUserContentResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: DeleteUserContentResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DeleteUserContentResponse; + static deserializeBinaryFromReader( + message: DeleteUserContentResponse, + reader: jspb.BinaryReader, + ): DeleteUserContentResponse; } export namespace DeleteUserContentResponse { - export type AsObject = { - } + export type AsObject = {}; } diff --git a/components/content-service-api/typescript/src/content_pb.js b/components/content-service-api/typescript/src/content_pb.js index 7cb048c5342202..304d3285bd63d2 100644 --- a/components/content-service-api/typescript/src/content_pb.js +++ b/components/content-service-api/typescript/src/content_pb.js @@ -19,13 +19,21 @@ var jspb = require('google-protobuf'); var goog = jspb; -var global = (function() { - if (this) { return this; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - if (typeof self !== 'undefined') { return self; } +var global = function () { + if (this) { + return this; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + if (typeof self !== 'undefined') { + return self; + } return Function('return this')(); -}.call(null)); +}.call(null); goog.exportSymbol('proto.contentservice.DeleteUserContentRequest', null, global); goog.exportSymbol('proto.contentservice.DeleteUserContentResponse', null, global); @@ -39,7 +47,7 @@ goog.exportSymbol('proto.contentservice.DeleteUserContentResponse', null, global * @extends {jspb.Message} * @constructor */ -proto.contentservice.DeleteUserContentRequest = function(opt_data) { +proto.contentservice.DeleteUserContentRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.DeleteUserContentRequest, jspb.Message); @@ -60,7 +68,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.DeleteUserContentResponse = function(opt_data) { +proto.contentservice.DeleteUserContentResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.DeleteUserContentResponse, jspb.Message); @@ -72,60 +80,56 @@ if (goog.DEBUG && !COMPILED) { proto.contentservice.DeleteUserContentResponse.displayName = 'proto.contentservice.DeleteUserContentResponse'; } - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.DeleteUserContentRequest.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.DeleteUserContentRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.DeleteUserContentRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.DeleteUserContentRequest.toObject = function(includeInstance, msg) { - var f, obj = { - ownerId: jspb.Message.getFieldWithDefault(msg, 1, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.DeleteUserContentRequest.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.DeleteUserContentRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.DeleteUserContentRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.DeleteUserContentRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + ownerId: jspb.Message.getFieldWithDefault(msg, 1, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.DeleteUserContentRequest} */ -proto.contentservice.DeleteUserContentRequest.deserializeBinary = function(bytes) { +proto.contentservice.DeleteUserContentRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.DeleteUserContentRequest; + var msg = new proto.contentservice.DeleteUserContentRequest(); return proto.contentservice.DeleteUserContentRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -133,37 +137,35 @@ proto.contentservice.DeleteUserContentRequest.deserializeBinary = function(bytes * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.DeleteUserContentRequest} */ -proto.contentservice.DeleteUserContentRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.DeleteUserContentRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setOwnerId(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setOwnerId(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.DeleteUserContentRequest.prototype.serializeBinary = function() { +proto.contentservice.DeleteUserContentRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.DeleteUserContentRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -171,91 +173,78 @@ proto.contentservice.DeleteUserContentRequest.prototype.serializeBinary = functi * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.DeleteUserContentRequest.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.DeleteUserContentRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getOwnerId(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } }; - /** * optional string owner_id = 1; * @return {string} */ -proto.contentservice.DeleteUserContentRequest.prototype.getOwnerId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.DeleteUserContentRequest.prototype.getOwnerId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.DeleteUserContentRequest} returns this */ -proto.contentservice.DeleteUserContentRequest.prototype.setOwnerId = function(value) { +proto.contentservice.DeleteUserContentRequest.prototype.setOwnerId = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.DeleteUserContentResponse.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.DeleteUserContentResponse.toObject(opt_includeInstance, this); -}; - + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.DeleteUserContentResponse.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.DeleteUserContentResponse.toObject(opt_includeInstance, this); + }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.DeleteUserContentResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.DeleteUserContentResponse.toObject = function(includeInstance, msg) { - var f, obj = { + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.DeleteUserContentResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.DeleteUserContentResponse.toObject = function (includeInstance, msg) { + var f, + obj = {}; + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.DeleteUserContentResponse} */ -proto.contentservice.DeleteUserContentResponse.deserializeBinary = function(bytes) { +proto.contentservice.DeleteUserContentResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.DeleteUserContentResponse; + var msg = new proto.contentservice.DeleteUserContentResponse(); return proto.contentservice.DeleteUserContentResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -263,33 +252,31 @@ proto.contentservice.DeleteUserContentResponse.deserializeBinary = function(byte * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.DeleteUserContentResponse} */ -proto.contentservice.DeleteUserContentResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.DeleteUserContentResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - default: - reader.skipField(); - break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.DeleteUserContentResponse.prototype.serializeBinary = function() { +proto.contentservice.DeleteUserContentResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.DeleteUserContentResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -297,9 +284,8 @@ proto.contentservice.DeleteUserContentResponse.prototype.serializeBinary = funct * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.DeleteUserContentResponse.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.DeleteUserContentResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; }; - goog.object.extend(exports, proto.contentservice); diff --git a/components/content-service-api/typescript/src/headless-log_grpc_pb.d.ts b/components/content-service-api/typescript/src/headless-log_grpc_pb.d.ts index ff7be715953433..d8ce9e5d0013e5 100644 --- a/components/content-service-api/typescript/src/headless-log_grpc_pb.d.ts +++ b/components/content-service-api/typescript/src/headless-log_grpc_pb.d.ts @@ -10,55 +10,105 @@ /* tslint:disable */ /* eslint-disable */ -import * as grpc from "@grpc/grpc-js"; -import * as headless_log_pb from "./headless-log_pb"; +import * as grpc from '@grpc/grpc-js'; +import * as headless_log_pb from './headless-log_pb'; interface IHeadlessLogServiceService extends grpc.ServiceDefinition { - logDownloadURL: IHeadlessLogServiceService_ILogDownloadURL; - listLogs: IHeadlessLogServiceService_IListLogs; + logDownloadURL: IHeadlessLogServiceService_ILogDownloadURL; + listLogs: IHeadlessLogServiceService_IListLogs; } -interface IHeadlessLogServiceService_ILogDownloadURL extends grpc.MethodDefinition { - path: "/contentservice.HeadlessLogService/LogDownloadURL"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IHeadlessLogServiceService_ILogDownloadURL + extends grpc.MethodDefinition { + path: '/contentservice.HeadlessLogService/LogDownloadURL'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } -interface IHeadlessLogServiceService_IListLogs extends grpc.MethodDefinition { - path: "/contentservice.HeadlessLogService/ListLogs"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IHeadlessLogServiceService_IListLogs + extends grpc.MethodDefinition { + path: '/contentservice.HeadlessLogService/ListLogs'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } export const HeadlessLogServiceService: IHeadlessLogServiceService; export interface IHeadlessLogServiceServer extends grpc.UntypedServiceImplementation { - logDownloadURL: grpc.handleUnaryCall; - listLogs: grpc.handleUnaryCall; + logDownloadURL: grpc.handleUnaryCall; + listLogs: grpc.handleUnaryCall; } export interface IHeadlessLogServiceClient { - logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - listLogs(request: headless_log_pb.ListLogsRequest, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; - listLogs(request: headless_log_pb.ListLogsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; - listLogs(request: headless_log_pb.ListLogsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; + logDownloadURL( + request: headless_log_pb.LogDownloadURLRequest, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + logDownloadURL( + request: headless_log_pb.LogDownloadURLRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + logDownloadURL( + request: headless_log_pb.LogDownloadURLRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + listLogs( + request: headless_log_pb.ListLogsRequest, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void, + ): grpc.ClientUnaryCall; + listLogs( + request: headless_log_pb.ListLogsRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void, + ): grpc.ClientUnaryCall; + listLogs( + request: headless_log_pb.ListLogsRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void, + ): grpc.ClientUnaryCall; } export class HeadlessLogServiceClient extends grpc.Client implements IHeadlessLogServiceClient { - constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); - public logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - public logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - public logDownloadURL(request: headless_log_pb.LogDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void): grpc.ClientUnaryCall; - public listLogs(request: headless_log_pb.ListLogsRequest, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; - public listLogs(request: headless_log_pb.ListLogsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; - public listLogs(request: headless_log_pb.ListLogsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void): grpc.ClientUnaryCall; + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public logDownloadURL( + request: headless_log_pb.LogDownloadURLRequest, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + public logDownloadURL( + request: headless_log_pb.LogDownloadURLRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + public logDownloadURL( + request: headless_log_pb.LogDownloadURLRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.LogDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + public listLogs( + request: headless_log_pb.ListLogsRequest, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void, + ): grpc.ClientUnaryCall; + public listLogs( + request: headless_log_pb.ListLogsRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void, + ): grpc.ClientUnaryCall; + public listLogs( + request: headless_log_pb.ListLogsRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: headless_log_pb.ListLogsResponse) => void, + ): grpc.ClientUnaryCall; } diff --git a/components/content-service-api/typescript/src/headless-log_grpc_pb.js b/components/content-service-api/typescript/src/headless-log_grpc_pb.js index 3d3cd7f3a18213..6b41903f5294a0 100644 --- a/components/content-service-api/typescript/src/headless-log_grpc_pb.js +++ b/components/content-service-api/typescript/src/headless-log_grpc_pb.js @@ -53,10 +53,9 @@ function deserialize_contentservice_LogDownloadURLResponse(buffer_arg) { return headless$log_pb.LogDownloadURLResponse.deserializeBinary(new Uint8Array(buffer_arg)); } - -var HeadlessLogServiceService = exports.HeadlessLogServiceService = { +var HeadlessLogServiceService = (exports.HeadlessLogServiceService = { // LogDownloadURL provides a URL from where the content of a workspace can be downloaded from -logDownloadURL: { + logDownloadURL: { path: '/contentservice.HeadlessLogService/LogDownloadURL', requestStream: false, responseStream: false, @@ -68,7 +67,7 @@ logDownloadURL: { responseDeserialize: deserialize_contentservice_LogDownloadURLResponse, }, // ListLogs returns a list of taskIds for the specified workspace instance -listLogs: { + listLogs: { path: '/contentservice.HeadlessLogService/ListLogs', requestStream: false, responseStream: false, @@ -79,6 +78,6 @@ listLogs: { responseSerialize: serialize_contentservice_ListLogsResponse, responseDeserialize: deserialize_contentservice_ListLogsResponse, }, -}; +}); exports.HeadlessLogServiceClient = grpc.makeGenericClientConstructor(HeadlessLogServiceService); diff --git a/components/content-service-api/typescript/src/headless-log_pb.d.ts b/components/content-service-api/typescript/src/headless-log_pb.d.ts index d74fe3dc71fe48..dfc2f9a285c44a 100644 --- a/components/content-service-api/typescript/src/headless-log_pb.d.ts +++ b/components/content-service-api/typescript/src/headless-log_pb.d.ts @@ -10,101 +10,104 @@ /* tslint:disable */ /* eslint-disable */ -import * as jspb from "google-protobuf"; +import * as jspb from 'google-protobuf'; export class LogDownloadURLRequest extends jspb.Message { - getOwnerId(): string; - setOwnerId(value: string): LogDownloadURLRequest; - getWorkspaceId(): string; - setWorkspaceId(value: string): LogDownloadURLRequest; - getInstanceId(): string; - setInstanceId(value: string): LogDownloadURLRequest; - getTaskId(): string; - setTaskId(value: string): LogDownloadURLRequest; + getOwnerId(): string; + setOwnerId(value: string): LogDownloadURLRequest; + getWorkspaceId(): string; + setWorkspaceId(value: string): LogDownloadURLRequest; + getInstanceId(): string; + setInstanceId(value: string): LogDownloadURLRequest; + getTaskId(): string; + setTaskId(value: string): LogDownloadURLRequest; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LogDownloadURLRequest.AsObject; - static toObject(includeInstance: boolean, msg: LogDownloadURLRequest): LogDownloadURLRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LogDownloadURLRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LogDownloadURLRequest; - static deserializeBinaryFromReader(message: LogDownloadURLRequest, reader: jspb.BinaryReader): LogDownloadURLRequest; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): LogDownloadURLRequest.AsObject; + static toObject(includeInstance: boolean, msg: LogDownloadURLRequest): LogDownloadURLRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: LogDownloadURLRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): LogDownloadURLRequest; + static deserializeBinaryFromReader(message: LogDownloadURLRequest, reader: jspb.BinaryReader): LogDownloadURLRequest; } export namespace LogDownloadURLRequest { - export type AsObject = { - ownerId: string, - workspaceId: string, - instanceId: string, - taskId: string, - } + export type AsObject = { + ownerId: string; + workspaceId: string; + instanceId: string; + taskId: string; + }; } export class LogDownloadURLResponse extends jspb.Message { - getUrl(): string; - setUrl(value: string): LogDownloadURLResponse; + getUrl(): string; + setUrl(value: string): LogDownloadURLResponse; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): LogDownloadURLResponse.AsObject; - static toObject(includeInstance: boolean, msg: LogDownloadURLResponse): LogDownloadURLResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: LogDownloadURLResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): LogDownloadURLResponse; - static deserializeBinaryFromReader(message: LogDownloadURLResponse, reader: jspb.BinaryReader): LogDownloadURLResponse; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): LogDownloadURLResponse.AsObject; + static toObject(includeInstance: boolean, msg: LogDownloadURLResponse): LogDownloadURLResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: LogDownloadURLResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): LogDownloadURLResponse; + static deserializeBinaryFromReader( + message: LogDownloadURLResponse, + reader: jspb.BinaryReader, + ): LogDownloadURLResponse; } export namespace LogDownloadURLResponse { - export type AsObject = { - url: string, - } + export type AsObject = { + url: string; + }; } export class ListLogsRequest extends jspb.Message { - getOwnerId(): string; - setOwnerId(value: string): ListLogsRequest; - getWorkspaceId(): string; - setWorkspaceId(value: string): ListLogsRequest; - getInstanceId(): string; - setInstanceId(value: string): ListLogsRequest; + getOwnerId(): string; + setOwnerId(value: string): ListLogsRequest; + getWorkspaceId(): string; + setWorkspaceId(value: string): ListLogsRequest; + getInstanceId(): string; + setInstanceId(value: string): ListLogsRequest; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ListLogsRequest.AsObject; - static toObject(includeInstance: boolean, msg: ListLogsRequest): ListLogsRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ListLogsRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ListLogsRequest; - static deserializeBinaryFromReader(message: ListLogsRequest, reader: jspb.BinaryReader): ListLogsRequest; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListLogsRequest.AsObject; + static toObject(includeInstance: boolean, msg: ListLogsRequest): ListLogsRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: ListLogsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListLogsRequest; + static deserializeBinaryFromReader(message: ListLogsRequest, reader: jspb.BinaryReader): ListLogsRequest; } export namespace ListLogsRequest { - export type AsObject = { - ownerId: string, - workspaceId: string, - instanceId: string, - } + export type AsObject = { + ownerId: string; + workspaceId: string; + instanceId: string; + }; } export class ListLogsResponse extends jspb.Message { - clearTaskIdList(): void; - getTaskIdList(): Array; - setTaskIdList(value: Array): ListLogsResponse; - addTaskId(value: string, index?: number): string; + clearTaskIdList(): void; + getTaskIdList(): Array; + setTaskIdList(value: Array): ListLogsResponse; + addTaskId(value: string, index?: number): string; - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): ListLogsResponse.AsObject; - static toObject(includeInstance: boolean, msg: ListLogsResponse): ListLogsResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: ListLogsResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): ListLogsResponse; - static deserializeBinaryFromReader(message: ListLogsResponse, reader: jspb.BinaryReader): ListLogsResponse; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListLogsResponse.AsObject; + static toObject(includeInstance: boolean, msg: ListLogsResponse): ListLogsResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: ListLogsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListLogsResponse; + static deserializeBinaryFromReader(message: ListLogsResponse, reader: jspb.BinaryReader): ListLogsResponse; } export namespace ListLogsResponse { - export type AsObject = { - taskIdList: Array, - } + export type AsObject = { + taskIdList: Array; + }; } diff --git a/components/content-service-api/typescript/src/headless-log_pb.js b/components/content-service-api/typescript/src/headless-log_pb.js index d4d53ba298b1c3..a73a35020e17a9 100644 --- a/components/content-service-api/typescript/src/headless-log_pb.js +++ b/components/content-service-api/typescript/src/headless-log_pb.js @@ -19,13 +19,21 @@ var jspb = require('google-protobuf'); var goog = jspb; -var global = (function() { - if (this) { return this; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - if (typeof self !== 'undefined') { return self; } +var global = function () { + if (this) { + return this; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + if (typeof self !== 'undefined') { + return self; + } return Function('return this')(); -}.call(null)); +}.call(null); goog.exportSymbol('proto.contentservice.ListLogsRequest', null, global); goog.exportSymbol('proto.contentservice.ListLogsResponse', null, global); @@ -41,7 +49,7 @@ goog.exportSymbol('proto.contentservice.LogDownloadURLResponse', null, global); * @extends {jspb.Message} * @constructor */ -proto.contentservice.LogDownloadURLRequest = function(opt_data) { +proto.contentservice.LogDownloadURLRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.LogDownloadURLRequest, jspb.Message); @@ -62,7 +70,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.LogDownloadURLResponse = function(opt_data) { +proto.contentservice.LogDownloadURLResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.LogDownloadURLResponse, jspb.Message); @@ -83,7 +91,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.ListLogsRequest = function(opt_data) { +proto.contentservice.ListLogsRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.ListLogsRequest, jspb.Message); @@ -104,7 +112,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.ListLogsResponse = function(opt_data) { +proto.contentservice.ListLogsResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.contentservice.ListLogsResponse.repeatedFields_, null); }; goog.inherits(proto.contentservice.ListLogsResponse, jspb.Message); @@ -116,63 +124,59 @@ if (goog.DEBUG && !COMPILED) { proto.contentservice.ListLogsResponse.displayName = 'proto.contentservice.ListLogsResponse'; } - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.LogDownloadURLRequest.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.LogDownloadURLRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.LogDownloadURLRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.LogDownloadURLRequest.toObject = function(includeInstance, msg) { - var f, obj = { - ownerId: jspb.Message.getFieldWithDefault(msg, 1, ""), - workspaceId: jspb.Message.getFieldWithDefault(msg, 2, ""), - instanceId: jspb.Message.getFieldWithDefault(msg, 3, ""), - taskId: jspb.Message.getFieldWithDefault(msg, 4, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.LogDownloadURLRequest.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.LogDownloadURLRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.LogDownloadURLRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.LogDownloadURLRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + ownerId: jspb.Message.getFieldWithDefault(msg, 1, ''), + workspaceId: jspb.Message.getFieldWithDefault(msg, 2, ''), + instanceId: jspb.Message.getFieldWithDefault(msg, 3, ''), + taskId: jspb.Message.getFieldWithDefault(msg, 4, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.LogDownloadURLRequest} */ -proto.contentservice.LogDownloadURLRequest.deserializeBinary = function(bytes) { +proto.contentservice.LogDownloadURLRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.LogDownloadURLRequest; + var msg = new proto.contentservice.LogDownloadURLRequest(); return proto.contentservice.LogDownloadURLRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -180,49 +184,47 @@ proto.contentservice.LogDownloadURLRequest.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.LogDownloadURLRequest} */ -proto.contentservice.LogDownloadURLRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.LogDownloadURLRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setOwnerId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setWorkspaceId(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setInstanceId(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setTaskId(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setOwnerId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setWorkspaceId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setInstanceId(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setTaskId(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.LogDownloadURLRequest.prototype.serializeBinary = function() { +proto.contentservice.LogDownloadURLRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.LogDownloadURLRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -230,166 +232,140 @@ proto.contentservice.LogDownloadURLRequest.prototype.serializeBinary = function( * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.LogDownloadURLRequest.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.LogDownloadURLRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getOwnerId(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getWorkspaceId(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } f = message.getInstanceId(); if (f.length > 0) { - writer.writeString( - 3, - f - ); + writer.writeString(3, f); } f = message.getTaskId(); if (f.length > 0) { - writer.writeString( - 4, - f - ); + writer.writeString(4, f); } }; - /** * optional string owner_id = 1; * @return {string} */ -proto.contentservice.LogDownloadURLRequest.prototype.getOwnerId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.LogDownloadURLRequest.prototype.getOwnerId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.LogDownloadURLRequest} returns this */ -proto.contentservice.LogDownloadURLRequest.prototype.setOwnerId = function(value) { +proto.contentservice.LogDownloadURLRequest.prototype.setOwnerId = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string workspace_id = 2; * @return {string} */ -proto.contentservice.LogDownloadURLRequest.prototype.getWorkspaceId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.LogDownloadURLRequest.prototype.getWorkspaceId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.LogDownloadURLRequest} returns this */ -proto.contentservice.LogDownloadURLRequest.prototype.setWorkspaceId = function(value) { +proto.contentservice.LogDownloadURLRequest.prototype.setWorkspaceId = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - /** * optional string instance_id = 3; * @return {string} */ -proto.contentservice.LogDownloadURLRequest.prototype.getInstanceId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.contentservice.LogDownloadURLRequest.prototype.getInstanceId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')); }; - /** * @param {string} value * @return {!proto.contentservice.LogDownloadURLRequest} returns this */ -proto.contentservice.LogDownloadURLRequest.prototype.setInstanceId = function(value) { +proto.contentservice.LogDownloadURLRequest.prototype.setInstanceId = function (value) { return jspb.Message.setProto3StringField(this, 3, value); }; - /** * optional string task_id = 4; * @return {string} */ -proto.contentservice.LogDownloadURLRequest.prototype.getTaskId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.contentservice.LogDownloadURLRequest.prototype.getTaskId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, '')); }; - /** * @param {string} value * @return {!proto.contentservice.LogDownloadURLRequest} returns this */ -proto.contentservice.LogDownloadURLRequest.prototype.setTaskId = function(value) { +proto.contentservice.LogDownloadURLRequest.prototype.setTaskId = function (value) { return jspb.Message.setProto3StringField(this, 4, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.LogDownloadURLResponse.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.LogDownloadURLResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.LogDownloadURLResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.LogDownloadURLResponse.toObject = function(includeInstance, msg) { - var f, obj = { - url: jspb.Message.getFieldWithDefault(msg, 1, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.LogDownloadURLResponse.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.LogDownloadURLResponse.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.LogDownloadURLResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.LogDownloadURLResponse.toObject = function (includeInstance, msg) { + var f, + obj = { + url: jspb.Message.getFieldWithDefault(msg, 1, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.LogDownloadURLResponse} */ -proto.contentservice.LogDownloadURLResponse.deserializeBinary = function(bytes) { +proto.contentservice.LogDownloadURLResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.LogDownloadURLResponse; + var msg = new proto.contentservice.LogDownloadURLResponse(); return proto.contentservice.LogDownloadURLResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -397,37 +373,35 @@ proto.contentservice.LogDownloadURLResponse.deserializeBinary = function(bytes) * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.LogDownloadURLResponse} */ -proto.contentservice.LogDownloadURLResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.LogDownloadURLResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setUrl(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUrl(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.LogDownloadURLResponse.prototype.serializeBinary = function() { +proto.contentservice.LogDownloadURLResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.LogDownloadURLResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -435,93 +409,82 @@ proto.contentservice.LogDownloadURLResponse.prototype.serializeBinary = function * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.LogDownloadURLResponse.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.LogDownloadURLResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getUrl(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } }; - /** * optional string url = 1; * @return {string} */ -proto.contentservice.LogDownloadURLResponse.prototype.getUrl = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.LogDownloadURLResponse.prototype.getUrl = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.LogDownloadURLResponse} returns this */ -proto.contentservice.LogDownloadURLResponse.prototype.setUrl = function(value) { +proto.contentservice.LogDownloadURLResponse.prototype.setUrl = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.ListLogsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.ListLogsRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.ListLogsRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.ListLogsRequest.toObject = function(includeInstance, msg) { - var f, obj = { - ownerId: jspb.Message.getFieldWithDefault(msg, 1, ""), - workspaceId: jspb.Message.getFieldWithDefault(msg, 2, ""), - instanceId: jspb.Message.getFieldWithDefault(msg, 3, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.ListLogsRequest.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.ListLogsRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.ListLogsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.ListLogsRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + ownerId: jspb.Message.getFieldWithDefault(msg, 1, ''), + workspaceId: jspb.Message.getFieldWithDefault(msg, 2, ''), + instanceId: jspb.Message.getFieldWithDefault(msg, 3, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.ListLogsRequest} */ -proto.contentservice.ListLogsRequest.deserializeBinary = function(bytes) { +proto.contentservice.ListLogsRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.ListLogsRequest; + var msg = new proto.contentservice.ListLogsRequest(); return proto.contentservice.ListLogsRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -529,45 +492,43 @@ proto.contentservice.ListLogsRequest.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.ListLogsRequest} */ -proto.contentservice.ListLogsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.ListLogsRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setOwnerId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setWorkspaceId(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setInstanceId(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setOwnerId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setWorkspaceId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setInstanceId(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.ListLogsRequest.prototype.serializeBinary = function() { +proto.contentservice.ListLogsRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.ListLogsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -575,87 +536,70 @@ proto.contentservice.ListLogsRequest.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.ListLogsRequest.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.ListLogsRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getOwnerId(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getWorkspaceId(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } f = message.getInstanceId(); if (f.length > 0) { - writer.writeString( - 3, - f - ); + writer.writeString(3, f); } }; - /** * optional string owner_id = 1; * @return {string} */ -proto.contentservice.ListLogsRequest.prototype.getOwnerId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.ListLogsRequest.prototype.getOwnerId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.ListLogsRequest} returns this */ -proto.contentservice.ListLogsRequest.prototype.setOwnerId = function(value) { +proto.contentservice.ListLogsRequest.prototype.setOwnerId = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string workspace_id = 2; * @return {string} */ -proto.contentservice.ListLogsRequest.prototype.getWorkspaceId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.ListLogsRequest.prototype.getWorkspaceId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.ListLogsRequest} returns this */ -proto.contentservice.ListLogsRequest.prototype.setWorkspaceId = function(value) { +proto.contentservice.ListLogsRequest.prototype.setWorkspaceId = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - /** * optional string instance_id = 3; * @return {string} */ -proto.contentservice.ListLogsRequest.prototype.getInstanceId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.contentservice.ListLogsRequest.prototype.getInstanceId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')); }; - /** * @param {string} value * @return {!proto.contentservice.ListLogsRequest} returns this */ -proto.contentservice.ListLogsRequest.prototype.setInstanceId = function(value) { +proto.contentservice.ListLogsRequest.prototype.setInstanceId = function (value) { return jspb.Message.setProto3StringField(this, 3, value); }; - - /** * List of repeated fields within this message type. * @private {!Array} @@ -663,60 +607,56 @@ proto.contentservice.ListLogsRequest.prototype.setInstanceId = function(value) { */ proto.contentservice.ListLogsResponse.repeatedFields_ = [1]; - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.ListLogsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.ListLogsResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.ListLogsResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.ListLogsResponse.toObject = function(includeInstance, msg) { - var f, obj = { - taskIdList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.ListLogsResponse.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.ListLogsResponse.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.ListLogsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.ListLogsResponse.toObject = function (includeInstance, msg) { + var f, + obj = { + taskIdList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f, + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.ListLogsResponse} */ -proto.contentservice.ListLogsResponse.deserializeBinary = function(bytes) { +proto.contentservice.ListLogsResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.ListLogsResponse; + var msg = new proto.contentservice.ListLogsResponse(); return proto.contentservice.ListLogsResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -724,37 +664,35 @@ proto.contentservice.ListLogsResponse.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.ListLogsResponse} */ -proto.contentservice.ListLogsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.ListLogsResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.addTaskId(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.addTaskId(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.ListLogsResponse.prototype.serializeBinary = function() { +proto.contentservice.ListLogsResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.ListLogsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -762,53 +700,45 @@ proto.contentservice.ListLogsResponse.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.ListLogsResponse.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.ListLogsResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getTaskIdList(); if (f.length > 0) { - writer.writeRepeatedString( - 1, - f - ); + writer.writeRepeatedString(1, f); } }; - /** * repeated string task_id = 1; * @return {!Array} */ -proto.contentservice.ListLogsResponse.prototype.getTaskIdList = function() { +proto.contentservice.ListLogsResponse.prototype.getTaskIdList = function () { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 1)); }; - /** * @param {!Array} value * @return {!proto.contentservice.ListLogsResponse} returns this */ -proto.contentservice.ListLogsResponse.prototype.setTaskIdList = function(value) { +proto.contentservice.ListLogsResponse.prototype.setTaskIdList = function (value) { return jspb.Message.setField(this, 1, value || []); }; - /** * @param {string} value * @param {number=} opt_index * @return {!proto.contentservice.ListLogsResponse} returns this */ -proto.contentservice.ListLogsResponse.prototype.addTaskId = function(value, opt_index) { +proto.contentservice.ListLogsResponse.prototype.addTaskId = function (value, opt_index) { return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; - /** * Clears the list making it empty but non-null. * @return {!proto.contentservice.ListLogsResponse} returns this */ -proto.contentservice.ListLogsResponse.prototype.clearTaskIdList = function() { +proto.contentservice.ListLogsResponse.prototype.clearTaskIdList = function () { return this.setTaskIdList([]); }; - goog.object.extend(exports, proto.contentservice); diff --git a/components/content-service-api/typescript/src/ideplugin_grpc_pb.d.ts b/components/content-service-api/typescript/src/ideplugin_grpc_pb.d.ts index 085b50ca0dc472..82a31bf3d5412e 100644 --- a/components/content-service-api/typescript/src/ideplugin_grpc_pb.d.ts +++ b/components/content-service-api/typescript/src/ideplugin_grpc_pb.d.ts @@ -10,72 +10,147 @@ /* tslint:disable */ /* eslint-disable */ -import * as grpc from "@grpc/grpc-js"; -import * as ideplugin_pb from "./ideplugin_pb"; +import * as grpc from '@grpc/grpc-js'; +import * as ideplugin_pb from './ideplugin_pb'; interface IIDEPluginServiceService extends grpc.ServiceDefinition { - uploadURL: IIDEPluginServiceService_IUploadURL; - downloadURL: IIDEPluginServiceService_IDownloadURL; - pluginHash: IIDEPluginServiceService_IPluginHash; + uploadURL: IIDEPluginServiceService_IUploadURL; + downloadURL: IIDEPluginServiceService_IDownloadURL; + pluginHash: IIDEPluginServiceService_IPluginHash; } -interface IIDEPluginServiceService_IUploadURL extends grpc.MethodDefinition { - path: "/ideplugin.IDEPluginService/UploadURL"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IIDEPluginServiceService_IUploadURL + extends grpc.MethodDefinition { + path: '/ideplugin.IDEPluginService/UploadURL'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } -interface IIDEPluginServiceService_IDownloadURL extends grpc.MethodDefinition { - path: "/ideplugin.IDEPluginService/DownloadURL"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IIDEPluginServiceService_IDownloadURL + extends grpc.MethodDefinition { + path: '/ideplugin.IDEPluginService/DownloadURL'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } -interface IIDEPluginServiceService_IPluginHash extends grpc.MethodDefinition { - path: "/ideplugin.IDEPluginService/PluginHash"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IIDEPluginServiceService_IPluginHash + extends grpc.MethodDefinition { + path: '/ideplugin.IDEPluginService/PluginHash'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } export const IDEPluginServiceService: IIDEPluginServiceService; export interface IIDEPluginServiceServer extends grpc.UntypedServiceImplementation { - uploadURL: grpc.handleUnaryCall; - downloadURL: grpc.handleUnaryCall; - pluginHash: grpc.handleUnaryCall; + uploadURL: grpc.handleUnaryCall; + downloadURL: grpc.handleUnaryCall; + pluginHash: grpc.handleUnaryCall; } export interface IIDEPluginServiceClient { - uploadURL(request: ideplugin_pb.PluginUploadURLRequest, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void): grpc.ClientUnaryCall; - uploadURL(request: ideplugin_pb.PluginUploadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void): grpc.ClientUnaryCall; - uploadURL(request: ideplugin_pb.PluginUploadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void): grpc.ClientUnaryCall; - downloadURL(request: ideplugin_pb.PluginDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void): grpc.ClientUnaryCall; - downloadURL(request: ideplugin_pb.PluginDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void): grpc.ClientUnaryCall; - downloadURL(request: ideplugin_pb.PluginDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void): grpc.ClientUnaryCall; - pluginHash(request: ideplugin_pb.PluginHashRequest, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void): grpc.ClientUnaryCall; - pluginHash(request: ideplugin_pb.PluginHashRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void): grpc.ClientUnaryCall; - pluginHash(request: ideplugin_pb.PluginHashRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void): grpc.ClientUnaryCall; + uploadURL( + request: ideplugin_pb.PluginUploadURLRequest, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void, + ): grpc.ClientUnaryCall; + uploadURL( + request: ideplugin_pb.PluginUploadURLRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void, + ): grpc.ClientUnaryCall; + uploadURL( + request: ideplugin_pb.PluginUploadURLRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void, + ): grpc.ClientUnaryCall; + downloadURL( + request: ideplugin_pb.PluginDownloadURLRequest, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + downloadURL( + request: ideplugin_pb.PluginDownloadURLRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + downloadURL( + request: ideplugin_pb.PluginDownloadURLRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + pluginHash( + request: ideplugin_pb.PluginHashRequest, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void, + ): grpc.ClientUnaryCall; + pluginHash( + request: ideplugin_pb.PluginHashRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void, + ): grpc.ClientUnaryCall; + pluginHash( + request: ideplugin_pb.PluginHashRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void, + ): grpc.ClientUnaryCall; } export class IDEPluginServiceClient extends grpc.Client implements IIDEPluginServiceClient { - constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); - public uploadURL(request: ideplugin_pb.PluginUploadURLRequest, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void): grpc.ClientUnaryCall; - public uploadURL(request: ideplugin_pb.PluginUploadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void): grpc.ClientUnaryCall; - public uploadURL(request: ideplugin_pb.PluginUploadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void): grpc.ClientUnaryCall; - public downloadURL(request: ideplugin_pb.PluginDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void): grpc.ClientUnaryCall; - public downloadURL(request: ideplugin_pb.PluginDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void): grpc.ClientUnaryCall; - public downloadURL(request: ideplugin_pb.PluginDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void): grpc.ClientUnaryCall; - public pluginHash(request: ideplugin_pb.PluginHashRequest, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void): grpc.ClientUnaryCall; - public pluginHash(request: ideplugin_pb.PluginHashRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void): grpc.ClientUnaryCall; - public pluginHash(request: ideplugin_pb.PluginHashRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void): grpc.ClientUnaryCall; + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public uploadURL( + request: ideplugin_pb.PluginUploadURLRequest, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void, + ): grpc.ClientUnaryCall; + public uploadURL( + request: ideplugin_pb.PluginUploadURLRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void, + ): grpc.ClientUnaryCall; + public uploadURL( + request: ideplugin_pb.PluginUploadURLRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginUploadURLResponse) => void, + ): grpc.ClientUnaryCall; + public downloadURL( + request: ideplugin_pb.PluginDownloadURLRequest, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + public downloadURL( + request: ideplugin_pb.PluginDownloadURLRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + public downloadURL( + request: ideplugin_pb.PluginDownloadURLRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + public pluginHash( + request: ideplugin_pb.PluginHashRequest, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void, + ): grpc.ClientUnaryCall; + public pluginHash( + request: ideplugin_pb.PluginHashRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void, + ): grpc.ClientUnaryCall; + public pluginHash( + request: ideplugin_pb.PluginHashRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: ideplugin_pb.PluginHashResponse) => void, + ): grpc.ClientUnaryCall; } diff --git a/components/content-service-api/typescript/src/ideplugin_grpc_pb.js b/components/content-service-api/typescript/src/ideplugin_grpc_pb.js index 4b90fe02827809..ee0124e55bd8ef 100644 --- a/components/content-service-api/typescript/src/ideplugin_grpc_pb.js +++ b/components/content-service-api/typescript/src/ideplugin_grpc_pb.js @@ -75,10 +75,9 @@ function deserialize_ideplugin_PluginUploadURLResponse(buffer_arg) { return ideplugin_pb.PluginUploadURLResponse.deserializeBinary(new Uint8Array(buffer_arg)); } - -var IDEPluginServiceService = exports.IDEPluginServiceService = { +var IDEPluginServiceService = (exports.IDEPluginServiceService = { // UploadURL provides a URL to which clients can upload the content via HTTP PUT. -uploadURL: { + uploadURL: { path: '/ideplugin.IDEPluginService/UploadURL', requestStream: false, responseStream: false, @@ -90,7 +89,7 @@ uploadURL: { responseDeserialize: deserialize_ideplugin_PluginUploadURLResponse, }, // DownloadURL provides a URL from which clients can download the content via HTTP GET. -downloadURL: { + downloadURL: { path: '/ideplugin.IDEPluginService/DownloadURL', requestStream: false, responseStream: false, @@ -102,7 +101,7 @@ downloadURL: { responseDeserialize: deserialize_ideplugin_PluginDownloadURLResponse, }, // PluginHash provides a hash of the plugin -pluginHash: { + pluginHash: { path: '/ideplugin.IDEPluginService/PluginHash', requestStream: false, responseStream: false, @@ -113,6 +112,6 @@ pluginHash: { responseSerialize: serialize_ideplugin_PluginHashResponse, responseDeserialize: deserialize_ideplugin_PluginHashResponse, }, -}; +}); exports.IDEPluginServiceClient = grpc.makeGenericClientConstructor(IDEPluginServiceService); diff --git a/components/content-service-api/typescript/src/ideplugin_pb.d.ts b/components/content-service-api/typescript/src/ideplugin_pb.d.ts index 69c389d868ca99..f16dd20a8c3617 100644 --- a/components/content-service-api/typescript/src/ideplugin_pb.d.ts +++ b/components/content-service-api/typescript/src/ideplugin_pb.d.ts @@ -10,133 +10,145 @@ /* tslint:disable */ /* eslint-disable */ -import * as jspb from "google-protobuf"; +import * as jspb from 'google-protobuf'; export class PluginUploadURLRequest extends jspb.Message { - getBucket(): string; - setBucket(value: string): PluginUploadURLRequest; - getName(): string; - setName(value: string): PluginUploadURLRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PluginUploadURLRequest.AsObject; - static toObject(includeInstance: boolean, msg: PluginUploadURLRequest): PluginUploadURLRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: PluginUploadURLRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PluginUploadURLRequest; - static deserializeBinaryFromReader(message: PluginUploadURLRequest, reader: jspb.BinaryReader): PluginUploadURLRequest; + getBucket(): string; + setBucket(value: string): PluginUploadURLRequest; + getName(): string; + setName(value: string): PluginUploadURLRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PluginUploadURLRequest.AsObject; + static toObject(includeInstance: boolean, msg: PluginUploadURLRequest): PluginUploadURLRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: PluginUploadURLRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PluginUploadURLRequest; + static deserializeBinaryFromReader( + message: PluginUploadURLRequest, + reader: jspb.BinaryReader, + ): PluginUploadURLRequest; } export namespace PluginUploadURLRequest { - export type AsObject = { - bucket: string, - name: string, - } + export type AsObject = { + bucket: string; + name: string; + }; } export class PluginUploadURLResponse extends jspb.Message { - getUrl(): string; - setUrl(value: string): PluginUploadURLResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PluginUploadURLResponse.AsObject; - static toObject(includeInstance: boolean, msg: PluginUploadURLResponse): PluginUploadURLResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: PluginUploadURLResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PluginUploadURLResponse; - static deserializeBinaryFromReader(message: PluginUploadURLResponse, reader: jspb.BinaryReader): PluginUploadURLResponse; + getUrl(): string; + setUrl(value: string): PluginUploadURLResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PluginUploadURLResponse.AsObject; + static toObject(includeInstance: boolean, msg: PluginUploadURLResponse): PluginUploadURLResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: PluginUploadURLResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PluginUploadURLResponse; + static deserializeBinaryFromReader( + message: PluginUploadURLResponse, + reader: jspb.BinaryReader, + ): PluginUploadURLResponse; } export namespace PluginUploadURLResponse { - export type AsObject = { - url: string, - } + export type AsObject = { + url: string; + }; } export class PluginDownloadURLRequest extends jspb.Message { - getBucket(): string; - setBucket(value: string): PluginDownloadURLRequest; - getName(): string; - setName(value: string): PluginDownloadURLRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PluginDownloadURLRequest.AsObject; - static toObject(includeInstance: boolean, msg: PluginDownloadURLRequest): PluginDownloadURLRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: PluginDownloadURLRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PluginDownloadURLRequest; - static deserializeBinaryFromReader(message: PluginDownloadURLRequest, reader: jspb.BinaryReader): PluginDownloadURLRequest; + getBucket(): string; + setBucket(value: string): PluginDownloadURLRequest; + getName(): string; + setName(value: string): PluginDownloadURLRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PluginDownloadURLRequest.AsObject; + static toObject(includeInstance: boolean, msg: PluginDownloadURLRequest): PluginDownloadURLRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: PluginDownloadURLRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PluginDownloadURLRequest; + static deserializeBinaryFromReader( + message: PluginDownloadURLRequest, + reader: jspb.BinaryReader, + ): PluginDownloadURLRequest; } export namespace PluginDownloadURLRequest { - export type AsObject = { - bucket: string, - name: string, - } + export type AsObject = { + bucket: string; + name: string; + }; } export class PluginDownloadURLResponse extends jspb.Message { - getUrl(): string; - setUrl(value: string): PluginDownloadURLResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PluginDownloadURLResponse.AsObject; - static toObject(includeInstance: boolean, msg: PluginDownloadURLResponse): PluginDownloadURLResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: PluginDownloadURLResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PluginDownloadURLResponse; - static deserializeBinaryFromReader(message: PluginDownloadURLResponse, reader: jspb.BinaryReader): PluginDownloadURLResponse; + getUrl(): string; + setUrl(value: string): PluginDownloadURLResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PluginDownloadURLResponse.AsObject; + static toObject(includeInstance: boolean, msg: PluginDownloadURLResponse): PluginDownloadURLResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: PluginDownloadURLResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PluginDownloadURLResponse; + static deserializeBinaryFromReader( + message: PluginDownloadURLResponse, + reader: jspb.BinaryReader, + ): PluginDownloadURLResponse; } export namespace PluginDownloadURLResponse { - export type AsObject = { - url: string, - } + export type AsObject = { + url: string; + }; } export class PluginHashRequest extends jspb.Message { - getBucket(): string; - setBucket(value: string): PluginHashRequest; - getName(): string; - setName(value: string): PluginHashRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PluginHashRequest.AsObject; - static toObject(includeInstance: boolean, msg: PluginHashRequest): PluginHashRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: PluginHashRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PluginHashRequest; - static deserializeBinaryFromReader(message: PluginHashRequest, reader: jspb.BinaryReader): PluginHashRequest; + getBucket(): string; + setBucket(value: string): PluginHashRequest; + getName(): string; + setName(value: string): PluginHashRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PluginHashRequest.AsObject; + static toObject(includeInstance: boolean, msg: PluginHashRequest): PluginHashRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: PluginHashRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PluginHashRequest; + static deserializeBinaryFromReader(message: PluginHashRequest, reader: jspb.BinaryReader): PluginHashRequest; } export namespace PluginHashRequest { - export type AsObject = { - bucket: string, - name: string, - } + export type AsObject = { + bucket: string; + name: string; + }; } export class PluginHashResponse extends jspb.Message { - getHash(): string; - setHash(value: string): PluginHashResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PluginHashResponse.AsObject; - static toObject(includeInstance: boolean, msg: PluginHashResponse): PluginHashResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: PluginHashResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PluginHashResponse; - static deserializeBinaryFromReader(message: PluginHashResponse, reader: jspb.BinaryReader): PluginHashResponse; + getHash(): string; + setHash(value: string): PluginHashResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PluginHashResponse.AsObject; + static toObject(includeInstance: boolean, msg: PluginHashResponse): PluginHashResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: PluginHashResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PluginHashResponse; + static deserializeBinaryFromReader(message: PluginHashResponse, reader: jspb.BinaryReader): PluginHashResponse; } export namespace PluginHashResponse { - export type AsObject = { - hash: string, - } + export type AsObject = { + hash: string; + }; } diff --git a/components/content-service-api/typescript/src/ideplugin_pb.js b/components/content-service-api/typescript/src/ideplugin_pb.js index c8a322bba6382c..087b03cb0821bb 100644 --- a/components/content-service-api/typescript/src/ideplugin_pb.js +++ b/components/content-service-api/typescript/src/ideplugin_pb.js @@ -19,13 +19,21 @@ var jspb = require('google-protobuf'); var goog = jspb; -var global = (function() { - if (this) { return this; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - if (typeof self !== 'undefined') { return self; } +var global = function () { + if (this) { + return this; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + if (typeof self !== 'undefined') { + return self; + } return Function('return this')(); -}.call(null)); +}.call(null); goog.exportSymbol('proto.ideplugin.PluginDownloadURLRequest', null, global); goog.exportSymbol('proto.ideplugin.PluginDownloadURLResponse', null, global); @@ -43,7 +51,7 @@ goog.exportSymbol('proto.ideplugin.PluginUploadURLResponse', null, global); * @extends {jspb.Message} * @constructor */ -proto.ideplugin.PluginUploadURLRequest = function(opt_data) { +proto.ideplugin.PluginUploadURLRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.ideplugin.PluginUploadURLRequest, jspb.Message); @@ -64,7 +72,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.ideplugin.PluginUploadURLResponse = function(opt_data) { +proto.ideplugin.PluginUploadURLResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.ideplugin.PluginUploadURLResponse, jspb.Message); @@ -85,7 +93,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.ideplugin.PluginDownloadURLRequest = function(opt_data) { +proto.ideplugin.PluginDownloadURLRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.ideplugin.PluginDownloadURLRequest, jspb.Message); @@ -106,7 +114,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.ideplugin.PluginDownloadURLResponse = function(opt_data) { +proto.ideplugin.PluginDownloadURLResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.ideplugin.PluginDownloadURLResponse, jspb.Message); @@ -127,7 +135,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.ideplugin.PluginHashRequest = function(opt_data) { +proto.ideplugin.PluginHashRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.ideplugin.PluginHashRequest, jspb.Message); @@ -148,7 +156,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.ideplugin.PluginHashResponse = function(opt_data) { +proto.ideplugin.PluginHashResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.ideplugin.PluginHashResponse, jspb.Message); @@ -160,61 +168,57 @@ if (goog.DEBUG && !COMPILED) { proto.ideplugin.PluginHashResponse.displayName = 'proto.ideplugin.PluginHashResponse'; } - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.ideplugin.PluginUploadURLRequest.prototype.toObject = function(opt_includeInstance) { - return proto.ideplugin.PluginUploadURLRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.ideplugin.PluginUploadURLRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.ideplugin.PluginUploadURLRequest.toObject = function(includeInstance, msg) { - var f, obj = { - bucket: jspb.Message.getFieldWithDefault(msg, 1, ""), - name: jspb.Message.getFieldWithDefault(msg, 2, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.ideplugin.PluginUploadURLRequest.prototype.toObject = function (opt_includeInstance) { + return proto.ideplugin.PluginUploadURLRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.ideplugin.PluginUploadURLRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.ideplugin.PluginUploadURLRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + bucket: jspb.Message.getFieldWithDefault(msg, 1, ''), + name: jspb.Message.getFieldWithDefault(msg, 2, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.ideplugin.PluginUploadURLRequest} */ -proto.ideplugin.PluginUploadURLRequest.deserializeBinary = function(bytes) { +proto.ideplugin.PluginUploadURLRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.ideplugin.PluginUploadURLRequest; + var msg = new proto.ideplugin.PluginUploadURLRequest(); return proto.ideplugin.PluginUploadURLRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -222,41 +226,39 @@ proto.ideplugin.PluginUploadURLRequest.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.ideplugin.PluginUploadURLRequest} */ -proto.ideplugin.PluginUploadURLRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.ideplugin.PluginUploadURLRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setBucket(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setBucket(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.ideplugin.PluginUploadURLRequest.prototype.serializeBinary = function() { +proto.ideplugin.PluginUploadURLRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.ideplugin.PluginUploadURLRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -264,116 +266,100 @@ proto.ideplugin.PluginUploadURLRequest.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.ideplugin.PluginUploadURLRequest.serializeBinaryToWriter = function(message, writer) { +proto.ideplugin.PluginUploadURLRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getBucket(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getName(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } }; - /** * optional string bucket = 1; * @return {string} */ -proto.ideplugin.PluginUploadURLRequest.prototype.getBucket = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.ideplugin.PluginUploadURLRequest.prototype.getBucket = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.ideplugin.PluginUploadURLRequest} returns this */ -proto.ideplugin.PluginUploadURLRequest.prototype.setBucket = function(value) { +proto.ideplugin.PluginUploadURLRequest.prototype.setBucket = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string name = 2; * @return {string} */ -proto.ideplugin.PluginUploadURLRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.ideplugin.PluginUploadURLRequest.prototype.getName = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.ideplugin.PluginUploadURLRequest} returns this */ -proto.ideplugin.PluginUploadURLRequest.prototype.setName = function(value) { +proto.ideplugin.PluginUploadURLRequest.prototype.setName = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.ideplugin.PluginUploadURLResponse.prototype.toObject = function(opt_includeInstance) { - return proto.ideplugin.PluginUploadURLResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.ideplugin.PluginUploadURLResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.ideplugin.PluginUploadURLResponse.toObject = function(includeInstance, msg) { - var f, obj = { - url: jspb.Message.getFieldWithDefault(msg, 1, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.ideplugin.PluginUploadURLResponse.prototype.toObject = function (opt_includeInstance) { + return proto.ideplugin.PluginUploadURLResponse.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.ideplugin.PluginUploadURLResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.ideplugin.PluginUploadURLResponse.toObject = function (includeInstance, msg) { + var f, + obj = { + url: jspb.Message.getFieldWithDefault(msg, 1, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.ideplugin.PluginUploadURLResponse} */ -proto.ideplugin.PluginUploadURLResponse.deserializeBinary = function(bytes) { +proto.ideplugin.PluginUploadURLResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.ideplugin.PluginUploadURLResponse; + var msg = new proto.ideplugin.PluginUploadURLResponse(); return proto.ideplugin.PluginUploadURLResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -381,37 +367,35 @@ proto.ideplugin.PluginUploadURLResponse.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.ideplugin.PluginUploadURLResponse} */ -proto.ideplugin.PluginUploadURLResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.ideplugin.PluginUploadURLResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setUrl(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUrl(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.ideplugin.PluginUploadURLResponse.prototype.serializeBinary = function() { +proto.ideplugin.PluginUploadURLResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.ideplugin.PluginUploadURLResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -419,92 +403,81 @@ proto.ideplugin.PluginUploadURLResponse.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.ideplugin.PluginUploadURLResponse.serializeBinaryToWriter = function(message, writer) { +proto.ideplugin.PluginUploadURLResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getUrl(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } }; - /** * optional string url = 1; * @return {string} */ -proto.ideplugin.PluginUploadURLResponse.prototype.getUrl = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.ideplugin.PluginUploadURLResponse.prototype.getUrl = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.ideplugin.PluginUploadURLResponse} returns this */ -proto.ideplugin.PluginUploadURLResponse.prototype.setUrl = function(value) { +proto.ideplugin.PluginUploadURLResponse.prototype.setUrl = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.ideplugin.PluginDownloadURLRequest.prototype.toObject = function(opt_includeInstance) { - return proto.ideplugin.PluginDownloadURLRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.ideplugin.PluginDownloadURLRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.ideplugin.PluginDownloadURLRequest.toObject = function(includeInstance, msg) { - var f, obj = { - bucket: jspb.Message.getFieldWithDefault(msg, 1, ""), - name: jspb.Message.getFieldWithDefault(msg, 2, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.ideplugin.PluginDownloadURLRequest.prototype.toObject = function (opt_includeInstance) { + return proto.ideplugin.PluginDownloadURLRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.ideplugin.PluginDownloadURLRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.ideplugin.PluginDownloadURLRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + bucket: jspb.Message.getFieldWithDefault(msg, 1, ''), + name: jspb.Message.getFieldWithDefault(msg, 2, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.ideplugin.PluginDownloadURLRequest} */ -proto.ideplugin.PluginDownloadURLRequest.deserializeBinary = function(bytes) { +proto.ideplugin.PluginDownloadURLRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.ideplugin.PluginDownloadURLRequest; + var msg = new proto.ideplugin.PluginDownloadURLRequest(); return proto.ideplugin.PluginDownloadURLRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -512,41 +485,39 @@ proto.ideplugin.PluginDownloadURLRequest.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.ideplugin.PluginDownloadURLRequest} */ -proto.ideplugin.PluginDownloadURLRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.ideplugin.PluginDownloadURLRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setBucket(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setBucket(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.ideplugin.PluginDownloadURLRequest.prototype.serializeBinary = function() { +proto.ideplugin.PluginDownloadURLRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.ideplugin.PluginDownloadURLRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -554,116 +525,100 @@ proto.ideplugin.PluginDownloadURLRequest.prototype.serializeBinary = function() * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.ideplugin.PluginDownloadURLRequest.serializeBinaryToWriter = function(message, writer) { +proto.ideplugin.PluginDownloadURLRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getBucket(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getName(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } }; - /** * optional string bucket = 1; * @return {string} */ -proto.ideplugin.PluginDownloadURLRequest.prototype.getBucket = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.ideplugin.PluginDownloadURLRequest.prototype.getBucket = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.ideplugin.PluginDownloadURLRequest} returns this */ -proto.ideplugin.PluginDownloadURLRequest.prototype.setBucket = function(value) { +proto.ideplugin.PluginDownloadURLRequest.prototype.setBucket = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string name = 2; * @return {string} */ -proto.ideplugin.PluginDownloadURLRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.ideplugin.PluginDownloadURLRequest.prototype.getName = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.ideplugin.PluginDownloadURLRequest} returns this */ -proto.ideplugin.PluginDownloadURLRequest.prototype.setName = function(value) { +proto.ideplugin.PluginDownloadURLRequest.prototype.setName = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.ideplugin.PluginDownloadURLResponse.prototype.toObject = function(opt_includeInstance) { - return proto.ideplugin.PluginDownloadURLResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.ideplugin.PluginDownloadURLResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.ideplugin.PluginDownloadURLResponse.toObject = function(includeInstance, msg) { - var f, obj = { - url: jspb.Message.getFieldWithDefault(msg, 1, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.ideplugin.PluginDownloadURLResponse.prototype.toObject = function (opt_includeInstance) { + return proto.ideplugin.PluginDownloadURLResponse.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.ideplugin.PluginDownloadURLResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.ideplugin.PluginDownloadURLResponse.toObject = function (includeInstance, msg) { + var f, + obj = { + url: jspb.Message.getFieldWithDefault(msg, 1, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.ideplugin.PluginDownloadURLResponse} */ -proto.ideplugin.PluginDownloadURLResponse.deserializeBinary = function(bytes) { +proto.ideplugin.PluginDownloadURLResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.ideplugin.PluginDownloadURLResponse; + var msg = new proto.ideplugin.PluginDownloadURLResponse(); return proto.ideplugin.PluginDownloadURLResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -671,37 +626,35 @@ proto.ideplugin.PluginDownloadURLResponse.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.ideplugin.PluginDownloadURLResponse} */ -proto.ideplugin.PluginDownloadURLResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.ideplugin.PluginDownloadURLResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setUrl(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUrl(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.ideplugin.PluginDownloadURLResponse.prototype.serializeBinary = function() { +proto.ideplugin.PluginDownloadURLResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.ideplugin.PluginDownloadURLResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -709,92 +662,81 @@ proto.ideplugin.PluginDownloadURLResponse.prototype.serializeBinary = function() * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.ideplugin.PluginDownloadURLResponse.serializeBinaryToWriter = function(message, writer) { +proto.ideplugin.PluginDownloadURLResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getUrl(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } }; - /** * optional string url = 1; * @return {string} */ -proto.ideplugin.PluginDownloadURLResponse.prototype.getUrl = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.ideplugin.PluginDownloadURLResponse.prototype.getUrl = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.ideplugin.PluginDownloadURLResponse} returns this */ -proto.ideplugin.PluginDownloadURLResponse.prototype.setUrl = function(value) { +proto.ideplugin.PluginDownloadURLResponse.prototype.setUrl = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.ideplugin.PluginHashRequest.prototype.toObject = function(opt_includeInstance) { - return proto.ideplugin.PluginHashRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.ideplugin.PluginHashRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.ideplugin.PluginHashRequest.toObject = function(includeInstance, msg) { - var f, obj = { - bucket: jspb.Message.getFieldWithDefault(msg, 1, ""), - name: jspb.Message.getFieldWithDefault(msg, 2, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.ideplugin.PluginHashRequest.prototype.toObject = function (opt_includeInstance) { + return proto.ideplugin.PluginHashRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.ideplugin.PluginHashRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.ideplugin.PluginHashRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + bucket: jspb.Message.getFieldWithDefault(msg, 1, ''), + name: jspb.Message.getFieldWithDefault(msg, 2, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.ideplugin.PluginHashRequest} */ -proto.ideplugin.PluginHashRequest.deserializeBinary = function(bytes) { +proto.ideplugin.PluginHashRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.ideplugin.PluginHashRequest; + var msg = new proto.ideplugin.PluginHashRequest(); return proto.ideplugin.PluginHashRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -802,41 +744,39 @@ proto.ideplugin.PluginHashRequest.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.ideplugin.PluginHashRequest} */ -proto.ideplugin.PluginHashRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.ideplugin.PluginHashRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setBucket(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setName(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setBucket(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.ideplugin.PluginHashRequest.prototype.serializeBinary = function() { +proto.ideplugin.PluginHashRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.ideplugin.PluginHashRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -844,116 +784,100 @@ proto.ideplugin.PluginHashRequest.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.ideplugin.PluginHashRequest.serializeBinaryToWriter = function(message, writer) { +proto.ideplugin.PluginHashRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getBucket(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getName(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } }; - /** * optional string bucket = 1; * @return {string} */ -proto.ideplugin.PluginHashRequest.prototype.getBucket = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.ideplugin.PluginHashRequest.prototype.getBucket = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.ideplugin.PluginHashRequest} returns this */ -proto.ideplugin.PluginHashRequest.prototype.setBucket = function(value) { +proto.ideplugin.PluginHashRequest.prototype.setBucket = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string name = 2; * @return {string} */ -proto.ideplugin.PluginHashRequest.prototype.getName = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.ideplugin.PluginHashRequest.prototype.getName = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.ideplugin.PluginHashRequest} returns this */ -proto.ideplugin.PluginHashRequest.prototype.setName = function(value) { +proto.ideplugin.PluginHashRequest.prototype.setName = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.ideplugin.PluginHashResponse.prototype.toObject = function(opt_includeInstance) { - return proto.ideplugin.PluginHashResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.ideplugin.PluginHashResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.ideplugin.PluginHashResponse.toObject = function(includeInstance, msg) { - var f, obj = { - hash: jspb.Message.getFieldWithDefault(msg, 1, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.ideplugin.PluginHashResponse.prototype.toObject = function (opt_includeInstance) { + return proto.ideplugin.PluginHashResponse.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.ideplugin.PluginHashResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.ideplugin.PluginHashResponse.toObject = function (includeInstance, msg) { + var f, + obj = { + hash: jspb.Message.getFieldWithDefault(msg, 1, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.ideplugin.PluginHashResponse} */ -proto.ideplugin.PluginHashResponse.deserializeBinary = function(bytes) { +proto.ideplugin.PluginHashResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.ideplugin.PluginHashResponse; + var msg = new proto.ideplugin.PluginHashResponse(); return proto.ideplugin.PluginHashResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -961,37 +885,35 @@ proto.ideplugin.PluginHashResponse.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.ideplugin.PluginHashResponse} */ -proto.ideplugin.PluginHashResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.ideplugin.PluginHashResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setHash(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setHash(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.ideplugin.PluginHashResponse.prototype.serializeBinary = function() { +proto.ideplugin.PluginHashResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.ideplugin.PluginHashResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -999,34 +921,28 @@ proto.ideplugin.PluginHashResponse.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.ideplugin.PluginHashResponse.serializeBinaryToWriter = function(message, writer) { +proto.ideplugin.PluginHashResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getHash(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } }; - /** * optional string hash = 1; * @return {string} */ -proto.ideplugin.PluginHashResponse.prototype.getHash = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.ideplugin.PluginHashResponse.prototype.getHash = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.ideplugin.PluginHashResponse} returns this */ -proto.ideplugin.PluginHashResponse.prototype.setHash = function(value) { +proto.ideplugin.PluginHashResponse.prototype.setHash = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - goog.object.extend(exports, proto.ideplugin); diff --git a/components/content-service-api/typescript/src/index.ts b/components/content-service-api/typescript/src/index.ts index 8b300e839b7089..ea7b21fc3e8416 100644 --- a/components/content-service-api/typescript/src/index.ts +++ b/components/content-service-api/typescript/src/index.ts @@ -4,4 +4,4 @@ * See License-AGPL.txt in the project root for license information. */ -export * from './initializer_pb'; \ No newline at end of file +export * from './initializer_pb'; diff --git a/components/content-service-api/typescript/src/initializer_grpc_pb.js b/components/content-service-api/typescript/src/initializer_grpc_pb.js index e15fa3a43f1773..aaa00195cb19a0 100644 --- a/components/content-service-api/typescript/src/initializer_grpc_pb.js +++ b/components/content-service-api/typescript/src/initializer_grpc_pb.js @@ -4,4 +4,4 @@ * See License-AGPL.txt in the project root for license information. */ -// GENERATED CODE -- NO SERVICES IN PROTO \ No newline at end of file +// GENERATED CODE -- NO SERVICES IN PROTO diff --git a/components/content-service-api/typescript/src/initializer_pb.d.ts b/components/content-service-api/typescript/src/initializer_pb.d.ts index 9d8c6df4fa075f..ce4ea42a5860b5 100644 --- a/components/content-service-api/typescript/src/initializer_pb.d.ts +++ b/components/content-service-api/typescript/src/initializer_pb.d.ts @@ -10,367 +10,359 @@ /* tslint:disable */ /* eslint-disable */ -import * as jspb from "google-protobuf"; +import * as jspb from 'google-protobuf'; export class WorkspaceInitializer extends jspb.Message { - - hasEmpty(): boolean; - clearEmpty(): void; - getEmpty(): EmptyInitializer | undefined; - setEmpty(value?: EmptyInitializer): WorkspaceInitializer; - - hasGit(): boolean; - clearGit(): void; - getGit(): GitInitializer | undefined; - setGit(value?: GitInitializer): WorkspaceInitializer; - - hasSnapshot(): boolean; - clearSnapshot(): void; - getSnapshot(): SnapshotInitializer | undefined; - setSnapshot(value?: SnapshotInitializer): WorkspaceInitializer; - - hasPrebuild(): boolean; - clearPrebuild(): void; - getPrebuild(): PrebuildInitializer | undefined; - setPrebuild(value?: PrebuildInitializer): WorkspaceInitializer; - - hasComposite(): boolean; - clearComposite(): void; - getComposite(): CompositeInitializer | undefined; - setComposite(value?: CompositeInitializer): WorkspaceInitializer; - - hasDownload(): boolean; - clearDownload(): void; - getDownload(): FileDownloadInitializer | undefined; - setDownload(value?: FileDownloadInitializer): WorkspaceInitializer; - - hasBackup(): boolean; - clearBackup(): void; - getBackup(): FromBackupInitializer | undefined; - setBackup(value?: FromBackupInitializer): WorkspaceInitializer; - - getSpecCase(): WorkspaceInitializer.SpecCase; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): WorkspaceInitializer.AsObject; - static toObject(includeInstance: boolean, msg: WorkspaceInitializer): WorkspaceInitializer.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: WorkspaceInitializer, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): WorkspaceInitializer; - static deserializeBinaryFromReader(message: WorkspaceInitializer, reader: jspb.BinaryReader): WorkspaceInitializer; + hasEmpty(): boolean; + clearEmpty(): void; + getEmpty(): EmptyInitializer | undefined; + setEmpty(value?: EmptyInitializer): WorkspaceInitializer; + + hasGit(): boolean; + clearGit(): void; + getGit(): GitInitializer | undefined; + setGit(value?: GitInitializer): WorkspaceInitializer; + + hasSnapshot(): boolean; + clearSnapshot(): void; + getSnapshot(): SnapshotInitializer | undefined; + setSnapshot(value?: SnapshotInitializer): WorkspaceInitializer; + + hasPrebuild(): boolean; + clearPrebuild(): void; + getPrebuild(): PrebuildInitializer | undefined; + setPrebuild(value?: PrebuildInitializer): WorkspaceInitializer; + + hasComposite(): boolean; + clearComposite(): void; + getComposite(): CompositeInitializer | undefined; + setComposite(value?: CompositeInitializer): WorkspaceInitializer; + + hasDownload(): boolean; + clearDownload(): void; + getDownload(): FileDownloadInitializer | undefined; + setDownload(value?: FileDownloadInitializer): WorkspaceInitializer; + + hasBackup(): boolean; + clearBackup(): void; + getBackup(): FromBackupInitializer | undefined; + setBackup(value?: FromBackupInitializer): WorkspaceInitializer; + + getSpecCase(): WorkspaceInitializer.SpecCase; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WorkspaceInitializer.AsObject; + static toObject(includeInstance: boolean, msg: WorkspaceInitializer): WorkspaceInitializer.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: WorkspaceInitializer, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WorkspaceInitializer; + static deserializeBinaryFromReader(message: WorkspaceInitializer, reader: jspb.BinaryReader): WorkspaceInitializer; } export namespace WorkspaceInitializer { - export type AsObject = { - empty?: EmptyInitializer.AsObject, - git?: GitInitializer.AsObject, - snapshot?: SnapshotInitializer.AsObject, - prebuild?: PrebuildInitializer.AsObject, - composite?: CompositeInitializer.AsObject, - download?: FileDownloadInitializer.AsObject, - backup?: FromBackupInitializer.AsObject, - } - - export enum SpecCase { - SPEC_NOT_SET = 0, - EMPTY = 1, - GIT = 2, - SNAPSHOT = 3, - PREBUILD = 4, - COMPOSITE = 5, - DOWNLOAD = 6, - BACKUP = 7, - } - + export type AsObject = { + empty?: EmptyInitializer.AsObject; + git?: GitInitializer.AsObject; + snapshot?: SnapshotInitializer.AsObject; + prebuild?: PrebuildInitializer.AsObject; + composite?: CompositeInitializer.AsObject; + download?: FileDownloadInitializer.AsObject; + backup?: FromBackupInitializer.AsObject; + }; + + export enum SpecCase { + SPEC_NOT_SET = 0, + EMPTY = 1, + GIT = 2, + SNAPSHOT = 3, + PREBUILD = 4, + COMPOSITE = 5, + DOWNLOAD = 6, + BACKUP = 7, + } } export class CompositeInitializer extends jspb.Message { - clearInitializerList(): void; - getInitializerList(): Array; - setInitializerList(value: Array): CompositeInitializer; - addInitializer(value?: WorkspaceInitializer, index?: number): WorkspaceInitializer; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): CompositeInitializer.AsObject; - static toObject(includeInstance: boolean, msg: CompositeInitializer): CompositeInitializer.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: CompositeInitializer, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): CompositeInitializer; - static deserializeBinaryFromReader(message: CompositeInitializer, reader: jspb.BinaryReader): CompositeInitializer; + clearInitializerList(): void; + getInitializerList(): Array; + setInitializerList(value: Array): CompositeInitializer; + addInitializer(value?: WorkspaceInitializer, index?: number): WorkspaceInitializer; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): CompositeInitializer.AsObject; + static toObject(includeInstance: boolean, msg: CompositeInitializer): CompositeInitializer.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: CompositeInitializer, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): CompositeInitializer; + static deserializeBinaryFromReader(message: CompositeInitializer, reader: jspb.BinaryReader): CompositeInitializer; } export namespace CompositeInitializer { - export type AsObject = { - initializerList: Array, - } + export type AsObject = { + initializerList: Array; + }; } export class FileDownloadInitializer extends jspb.Message { - clearFilesList(): void; - getFilesList(): Array; - setFilesList(value: Array): FileDownloadInitializer; - addFiles(value?: FileDownloadInitializer.FileInfo, index?: number): FileDownloadInitializer.FileInfo; - getTargetLocation(): string; - setTargetLocation(value: string): FileDownloadInitializer; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): FileDownloadInitializer.AsObject; - static toObject(includeInstance: boolean, msg: FileDownloadInitializer): FileDownloadInitializer.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: FileDownloadInitializer, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): FileDownloadInitializer; - static deserializeBinaryFromReader(message: FileDownloadInitializer, reader: jspb.BinaryReader): FileDownloadInitializer; + clearFilesList(): void; + getFilesList(): Array; + setFilesList(value: Array): FileDownloadInitializer; + addFiles(value?: FileDownloadInitializer.FileInfo, index?: number): FileDownloadInitializer.FileInfo; + getTargetLocation(): string; + setTargetLocation(value: string): FileDownloadInitializer; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FileDownloadInitializer.AsObject; + static toObject(includeInstance: boolean, msg: FileDownloadInitializer): FileDownloadInitializer.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: FileDownloadInitializer, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FileDownloadInitializer; + static deserializeBinaryFromReader( + message: FileDownloadInitializer, + reader: jspb.BinaryReader, + ): FileDownloadInitializer; } export namespace FileDownloadInitializer { - export type AsObject = { - filesList: Array, - targetLocation: string, - } - - - export class FileInfo extends jspb.Message { - getUrl(): string; - setUrl(value: string): FileInfo; - getFilePath(): string; - setFilePath(value: string): FileInfo; - getDigest(): string; - setDigest(value: string): FileInfo; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): FileInfo.AsObject; - static toObject(includeInstance: boolean, msg: FileInfo): FileInfo.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: FileInfo, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): FileInfo; - static deserializeBinaryFromReader(message: FileInfo, reader: jspb.BinaryReader): FileInfo; - } - - export namespace FileInfo { - export type AsObject = { - url: string, - filePath: string, - digest: string, - } - } + export type AsObject = { + filesList: Array; + targetLocation: string; + }; + + export class FileInfo extends jspb.Message { + getUrl(): string; + setUrl(value: string): FileInfo; + getFilePath(): string; + setFilePath(value: string): FileInfo; + getDigest(): string; + setDigest(value: string): FileInfo; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FileInfo.AsObject; + static toObject(includeInstance: boolean, msg: FileInfo): FileInfo.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: FileInfo, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FileInfo; + static deserializeBinaryFromReader(message: FileInfo, reader: jspb.BinaryReader): FileInfo; + } + + export namespace FileInfo { + export type AsObject = { + url: string; + filePath: string; + digest: string; + }; + } } export class EmptyInitializer extends jspb.Message { - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): EmptyInitializer.AsObject; - static toObject(includeInstance: boolean, msg: EmptyInitializer): EmptyInitializer.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: EmptyInitializer, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): EmptyInitializer; - static deserializeBinaryFromReader(message: EmptyInitializer, reader: jspb.BinaryReader): EmptyInitializer; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): EmptyInitializer.AsObject; + static toObject(includeInstance: boolean, msg: EmptyInitializer): EmptyInitializer.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: EmptyInitializer, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): EmptyInitializer; + static deserializeBinaryFromReader(message: EmptyInitializer, reader: jspb.BinaryReader): EmptyInitializer; } export namespace EmptyInitializer { - export type AsObject = { - } + export type AsObject = {}; } export class GitInitializer extends jspb.Message { - getRemoteUri(): string; - setRemoteUri(value: string): GitInitializer; - getUpstreamRemoteUri(): string; - setUpstreamRemoteUri(value: string): GitInitializer; - getTargetMode(): CloneTargetMode; - setTargetMode(value: CloneTargetMode): GitInitializer; - getCloneTaget(): string; - setCloneTaget(value: string): GitInitializer; - getCheckoutLocation(): string; - setCheckoutLocation(value: string): GitInitializer; - - hasConfig(): boolean; - clearConfig(): void; - getConfig(): GitConfig | undefined; - setConfig(value?: GitConfig): GitInitializer; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GitInitializer.AsObject; - static toObject(includeInstance: boolean, msg: GitInitializer): GitInitializer.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GitInitializer, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GitInitializer; - static deserializeBinaryFromReader(message: GitInitializer, reader: jspb.BinaryReader): GitInitializer; + getRemoteUri(): string; + setRemoteUri(value: string): GitInitializer; + getUpstreamRemoteUri(): string; + setUpstreamRemoteUri(value: string): GitInitializer; + getTargetMode(): CloneTargetMode; + setTargetMode(value: CloneTargetMode): GitInitializer; + getCloneTaget(): string; + setCloneTaget(value: string): GitInitializer; + getCheckoutLocation(): string; + setCheckoutLocation(value: string): GitInitializer; + + hasConfig(): boolean; + clearConfig(): void; + getConfig(): GitConfig | undefined; + setConfig(value?: GitConfig): GitInitializer; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GitInitializer.AsObject; + static toObject(includeInstance: boolean, msg: GitInitializer): GitInitializer.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: GitInitializer, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GitInitializer; + static deserializeBinaryFromReader(message: GitInitializer, reader: jspb.BinaryReader): GitInitializer; } export namespace GitInitializer { - export type AsObject = { - remoteUri: string, - upstreamRemoteUri: string, - targetMode: CloneTargetMode, - cloneTaget: string, - checkoutLocation: string, - config?: GitConfig.AsObject, - } + export type AsObject = { + remoteUri: string; + upstreamRemoteUri: string; + targetMode: CloneTargetMode; + cloneTaget: string; + checkoutLocation: string; + config?: GitConfig.AsObject; + }; } export class GitConfig extends jspb.Message { - - getCustomConfigMap(): jspb.Map; - clearCustomConfigMap(): void; - getAuthentication(): GitAuthMethod; - setAuthentication(value: GitAuthMethod): GitConfig; - getAuthUser(): string; - setAuthUser(value: string): GitConfig; - getAuthPassword(): string; - setAuthPassword(value: string): GitConfig; - getAuthOts(): string; - setAuthOts(value: string): GitConfig; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GitConfig.AsObject; - static toObject(includeInstance: boolean, msg: GitConfig): GitConfig.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GitConfig, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GitConfig; - static deserializeBinaryFromReader(message: GitConfig, reader: jspb.BinaryReader): GitConfig; + getCustomConfigMap(): jspb.Map; + clearCustomConfigMap(): void; + getAuthentication(): GitAuthMethod; + setAuthentication(value: GitAuthMethod): GitConfig; + getAuthUser(): string; + setAuthUser(value: string): GitConfig; + getAuthPassword(): string; + setAuthPassword(value: string): GitConfig; + getAuthOts(): string; + setAuthOts(value: string): GitConfig; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GitConfig.AsObject; + static toObject(includeInstance: boolean, msg: GitConfig): GitConfig.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: GitConfig, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GitConfig; + static deserializeBinaryFromReader(message: GitConfig, reader: jspb.BinaryReader): GitConfig; } export namespace GitConfig { - export type AsObject = { - - customConfigMap: Array<[string, string]>, - authentication: GitAuthMethod, - authUser: string, - authPassword: string, - authOts: string, - } + export type AsObject = { + customConfigMap: Array<[string, string]>; + authentication: GitAuthMethod; + authUser: string; + authPassword: string; + authOts: string; + }; } export class SnapshotInitializer extends jspb.Message { - getSnapshot(): string; - setSnapshot(value: string): SnapshotInitializer; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): SnapshotInitializer.AsObject; - static toObject(includeInstance: boolean, msg: SnapshotInitializer): SnapshotInitializer.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: SnapshotInitializer, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): SnapshotInitializer; - static deserializeBinaryFromReader(message: SnapshotInitializer, reader: jspb.BinaryReader): SnapshotInitializer; + getSnapshot(): string; + setSnapshot(value: string): SnapshotInitializer; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): SnapshotInitializer.AsObject; + static toObject(includeInstance: boolean, msg: SnapshotInitializer): SnapshotInitializer.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: SnapshotInitializer, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): SnapshotInitializer; + static deserializeBinaryFromReader(message: SnapshotInitializer, reader: jspb.BinaryReader): SnapshotInitializer; } export namespace SnapshotInitializer { - export type AsObject = { - snapshot: string, - } + export type AsObject = { + snapshot: string; + }; } export class PrebuildInitializer extends jspb.Message { - - hasPrebuild(): boolean; - clearPrebuild(): void; - getPrebuild(): SnapshotInitializer | undefined; - setPrebuild(value?: SnapshotInitializer): PrebuildInitializer; - - hasGit(): boolean; - clearGit(): void; - getGit(): GitInitializer | undefined; - setGit(value?: GitInitializer): PrebuildInitializer; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): PrebuildInitializer.AsObject; - static toObject(includeInstance: boolean, msg: PrebuildInitializer): PrebuildInitializer.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: PrebuildInitializer, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): PrebuildInitializer; - static deserializeBinaryFromReader(message: PrebuildInitializer, reader: jspb.BinaryReader): PrebuildInitializer; + hasPrebuild(): boolean; + clearPrebuild(): void; + getPrebuild(): SnapshotInitializer | undefined; + setPrebuild(value?: SnapshotInitializer): PrebuildInitializer; + + hasGit(): boolean; + clearGit(): void; + getGit(): GitInitializer | undefined; + setGit(value?: GitInitializer): PrebuildInitializer; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): PrebuildInitializer.AsObject; + static toObject(includeInstance: boolean, msg: PrebuildInitializer): PrebuildInitializer.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: PrebuildInitializer, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): PrebuildInitializer; + static deserializeBinaryFromReader(message: PrebuildInitializer, reader: jspb.BinaryReader): PrebuildInitializer; } export namespace PrebuildInitializer { - export type AsObject = { - prebuild?: SnapshotInitializer.AsObject, - git?: GitInitializer.AsObject, - } + export type AsObject = { + prebuild?: SnapshotInitializer.AsObject; + git?: GitInitializer.AsObject; + }; } export class FromBackupInitializer extends jspb.Message { - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): FromBackupInitializer.AsObject; - static toObject(includeInstance: boolean, msg: FromBackupInitializer): FromBackupInitializer.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: FromBackupInitializer, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): FromBackupInitializer; - static deserializeBinaryFromReader(message: FromBackupInitializer, reader: jspb.BinaryReader): FromBackupInitializer; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): FromBackupInitializer.AsObject; + static toObject(includeInstance: boolean, msg: FromBackupInitializer): FromBackupInitializer.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: FromBackupInitializer, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): FromBackupInitializer; + static deserializeBinaryFromReader(message: FromBackupInitializer, reader: jspb.BinaryReader): FromBackupInitializer; } export namespace FromBackupInitializer { - export type AsObject = { - } + export type AsObject = {}; } export class GitStatus extends jspb.Message { - getBranch(): string; - setBranch(value: string): GitStatus; - getLatestCommit(): string; - setLatestCommit(value: string): GitStatus; - clearUncommitedFilesList(): void; - getUncommitedFilesList(): Array; - setUncommitedFilesList(value: Array): GitStatus; - addUncommitedFiles(value: string, index?: number): string; - getTotalUncommitedFiles(): number; - setTotalUncommitedFiles(value: number): GitStatus; - clearUntrackedFilesList(): void; - getUntrackedFilesList(): Array; - setUntrackedFilesList(value: Array): GitStatus; - addUntrackedFiles(value: string, index?: number): string; - getTotalUntrackedFiles(): number; - setTotalUntrackedFiles(value: number): GitStatus; - clearUnpushedCommitsList(): void; - getUnpushedCommitsList(): Array; - setUnpushedCommitsList(value: Array): GitStatus; - addUnpushedCommits(value: string, index?: number): string; - getTotalUnpushedCommits(): number; - setTotalUnpushedCommits(value: number): GitStatus; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): GitStatus.AsObject; - static toObject(includeInstance: boolean, msg: GitStatus): GitStatus.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: GitStatus, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): GitStatus; - static deserializeBinaryFromReader(message: GitStatus, reader: jspb.BinaryReader): GitStatus; + getBranch(): string; + setBranch(value: string): GitStatus; + getLatestCommit(): string; + setLatestCommit(value: string): GitStatus; + clearUncommitedFilesList(): void; + getUncommitedFilesList(): Array; + setUncommitedFilesList(value: Array): GitStatus; + addUncommitedFiles(value: string, index?: number): string; + getTotalUncommitedFiles(): number; + setTotalUncommitedFiles(value: number): GitStatus; + clearUntrackedFilesList(): void; + getUntrackedFilesList(): Array; + setUntrackedFilesList(value: Array): GitStatus; + addUntrackedFiles(value: string, index?: number): string; + getTotalUntrackedFiles(): number; + setTotalUntrackedFiles(value: number): GitStatus; + clearUnpushedCommitsList(): void; + getUnpushedCommitsList(): Array; + setUnpushedCommitsList(value: Array): GitStatus; + addUnpushedCommits(value: string, index?: number): string; + getTotalUnpushedCommits(): number; + setTotalUnpushedCommits(value: number): GitStatus; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GitStatus.AsObject; + static toObject(includeInstance: boolean, msg: GitStatus): GitStatus.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: GitStatus, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GitStatus; + static deserializeBinaryFromReader(message: GitStatus, reader: jspb.BinaryReader): GitStatus; } export namespace GitStatus { - export type AsObject = { - branch: string, - latestCommit: string, - uncommitedFilesList: Array, - totalUncommitedFiles: number, - untrackedFilesList: Array, - totalUntrackedFiles: number, - unpushedCommitsList: Array, - totalUnpushedCommits: number, - } + export type AsObject = { + branch: string; + latestCommit: string; + uncommitedFilesList: Array; + totalUncommitedFiles: number; + untrackedFilesList: Array; + totalUntrackedFiles: number; + unpushedCommitsList: Array; + totalUnpushedCommits: number; + }; } export enum CloneTargetMode { - REMOTE_HEAD = 0, - REMOTE_COMMIT = 1, - REMOTE_BRANCH = 2, - LOCAL_BRANCH = 3, + REMOTE_HEAD = 0, + REMOTE_COMMIT = 1, + REMOTE_BRANCH = 2, + LOCAL_BRANCH = 3, } export enum GitAuthMethod { - NO_AUTH = 0, - BASIC_AUTH = 1, - BASIC_AUTH_OTS = 2, + NO_AUTH = 0, + BASIC_AUTH = 1, + BASIC_AUTH_OTS = 2, } diff --git a/components/content-service-api/typescript/src/initializer_pb.js b/components/content-service-api/typescript/src/initializer_pb.js index 8a00062cdd444d..e56033b0d4613b 100644 --- a/components/content-service-api/typescript/src/initializer_pb.js +++ b/components/content-service-api/typescript/src/initializer_pb.js @@ -19,13 +19,21 @@ var jspb = require('google-protobuf'); var goog = jspb; -var global = (function() { - if (this) { return this; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - if (typeof self !== 'undefined') { return self; } +var global = function () { + if (this) { + return this; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + if (typeof self !== 'undefined') { + return self; + } return Function('return this')(); -}.call(null)); +}.call(null); goog.exportSymbol('proto.contentservice.CloneTargetMode', null, global); goog.exportSymbol('proto.contentservice.CompositeInitializer', null, global); @@ -51,7 +59,7 @@ goog.exportSymbol('proto.contentservice.WorkspaceInitializer.SpecCase', null, gl * @extends {jspb.Message} * @constructor */ -proto.contentservice.WorkspaceInitializer = function(opt_data) { +proto.contentservice.WorkspaceInitializer = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, proto.contentservice.WorkspaceInitializer.oneofGroups_); }; goog.inherits(proto.contentservice.WorkspaceInitializer, jspb.Message); @@ -72,7 +80,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.CompositeInitializer = function(opt_data) { +proto.contentservice.CompositeInitializer = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.contentservice.CompositeInitializer.repeatedFields_, null); }; goog.inherits(proto.contentservice.CompositeInitializer, jspb.Message); @@ -93,7 +101,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.FileDownloadInitializer = function(opt_data) { +proto.contentservice.FileDownloadInitializer = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.contentservice.FileDownloadInitializer.repeatedFields_, null); }; goog.inherits(proto.contentservice.FileDownloadInitializer, jspb.Message); @@ -114,7 +122,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.FileDownloadInitializer.FileInfo = function(opt_data) { +proto.contentservice.FileDownloadInitializer.FileInfo = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.FileDownloadInitializer.FileInfo, jspb.Message); @@ -123,7 +131,8 @@ if (goog.DEBUG && !COMPILED) { * @public * @override */ - proto.contentservice.FileDownloadInitializer.FileInfo.displayName = 'proto.contentservice.FileDownloadInitializer.FileInfo'; + proto.contentservice.FileDownloadInitializer.FileInfo.displayName = + 'proto.contentservice.FileDownloadInitializer.FileInfo'; } /** * Generated by JsPbCodeGenerator. @@ -135,7 +144,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.EmptyInitializer = function(opt_data) { +proto.contentservice.EmptyInitializer = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.EmptyInitializer, jspb.Message); @@ -156,7 +165,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.GitInitializer = function(opt_data) { +proto.contentservice.GitInitializer = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.GitInitializer, jspb.Message); @@ -177,7 +186,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.GitConfig = function(opt_data) { +proto.contentservice.GitConfig = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.GitConfig, jspb.Message); @@ -198,7 +207,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.SnapshotInitializer = function(opt_data) { +proto.contentservice.SnapshotInitializer = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.SnapshotInitializer, jspb.Message); @@ -219,7 +228,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.PrebuildInitializer = function(opt_data) { +proto.contentservice.PrebuildInitializer = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.PrebuildInitializer, jspb.Message); @@ -240,7 +249,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.FromBackupInitializer = function(opt_data) { +proto.contentservice.FromBackupInitializer = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.FromBackupInitializer, jspb.Message); @@ -261,7 +270,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.GitStatus = function(opt_data) { +proto.contentservice.GitStatus = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.contentservice.GitStatus.repeatedFields_, null); }; goog.inherits(proto.contentservice.GitStatus, jspb.Message); @@ -281,7 +290,7 @@ if (goog.DEBUG && !COMPILED) { * @private {!Array>} * @const */ -proto.contentservice.WorkspaceInitializer.oneofGroups_ = [[1,2,3,4,5,6,7]]; +proto.contentservice.WorkspaceInitializer.oneofGroups_ = [[1, 2, 3, 4, 5, 6, 7]]; /** * @enum {number} @@ -294,76 +303,74 @@ proto.contentservice.WorkspaceInitializer.SpecCase = { PREBUILD: 4, COMPOSITE: 5, DOWNLOAD: 6, - BACKUP: 7 + BACKUP: 7, }; /** * @return {proto.contentservice.WorkspaceInitializer.SpecCase} */ -proto.contentservice.WorkspaceInitializer.prototype.getSpecCase = function() { - return /** @type {proto.contentservice.WorkspaceInitializer.SpecCase} */(jspb.Message.computeOneofCase(this, proto.contentservice.WorkspaceInitializer.oneofGroups_[0])); +proto.contentservice.WorkspaceInitializer.prototype.getSpecCase = function () { + return /** @type {proto.contentservice.WorkspaceInitializer.SpecCase} */ ( + jspb.Message.computeOneofCase(this, proto.contentservice.WorkspaceInitializer.oneofGroups_[0]) + ); }; - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.WorkspaceInitializer.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.WorkspaceInitializer.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.WorkspaceInitializer} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.WorkspaceInitializer.toObject = function(includeInstance, msg) { - var f, obj = { - empty: (f = msg.getEmpty()) && proto.contentservice.EmptyInitializer.toObject(includeInstance, f), - git: (f = msg.getGit()) && proto.contentservice.GitInitializer.toObject(includeInstance, f), - snapshot: (f = msg.getSnapshot()) && proto.contentservice.SnapshotInitializer.toObject(includeInstance, f), - prebuild: (f = msg.getPrebuild()) && proto.contentservice.PrebuildInitializer.toObject(includeInstance, f), - composite: (f = msg.getComposite()) && proto.contentservice.CompositeInitializer.toObject(includeInstance, f), - download: (f = msg.getDownload()) && proto.contentservice.FileDownloadInitializer.toObject(includeInstance, f), - backup: (f = msg.getBackup()) && proto.contentservice.FromBackupInitializer.toObject(includeInstance, f) + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.WorkspaceInitializer.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.WorkspaceInitializer.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.WorkspaceInitializer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.WorkspaceInitializer.toObject = function (includeInstance, msg) { + var f, + obj = { + empty: (f = msg.getEmpty()) && proto.contentservice.EmptyInitializer.toObject(includeInstance, f), + git: (f = msg.getGit()) && proto.contentservice.GitInitializer.toObject(includeInstance, f), + snapshot: (f = msg.getSnapshot()) && proto.contentservice.SnapshotInitializer.toObject(includeInstance, f), + prebuild: (f = msg.getPrebuild()) && proto.contentservice.PrebuildInitializer.toObject(includeInstance, f), + composite: (f = msg.getComposite()) && proto.contentservice.CompositeInitializer.toObject(includeInstance, f), + download: (f = msg.getDownload()) && proto.contentservice.FileDownloadInitializer.toObject(includeInstance, f), + backup: (f = msg.getBackup()) && proto.contentservice.FromBackupInitializer.toObject(includeInstance, f), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.WorkspaceInitializer} */ -proto.contentservice.WorkspaceInitializer.deserializeBinary = function(bytes) { +proto.contentservice.WorkspaceInitializer.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.WorkspaceInitializer; + var msg = new proto.contentservice.WorkspaceInitializer(); return proto.contentservice.WorkspaceInitializer.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -371,68 +378,66 @@ proto.contentservice.WorkspaceInitializer.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.WorkspaceInitializer} */ -proto.contentservice.WorkspaceInitializer.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.WorkspaceInitializer.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = new proto.contentservice.EmptyInitializer; - reader.readMessage(value,proto.contentservice.EmptyInitializer.deserializeBinaryFromReader); - msg.setEmpty(value); - break; - case 2: - var value = new proto.contentservice.GitInitializer; - reader.readMessage(value,proto.contentservice.GitInitializer.deserializeBinaryFromReader); - msg.setGit(value); - break; - case 3: - var value = new proto.contentservice.SnapshotInitializer; - reader.readMessage(value,proto.contentservice.SnapshotInitializer.deserializeBinaryFromReader); - msg.setSnapshot(value); - break; - case 4: - var value = new proto.contentservice.PrebuildInitializer; - reader.readMessage(value,proto.contentservice.PrebuildInitializer.deserializeBinaryFromReader); - msg.setPrebuild(value); - break; - case 5: - var value = new proto.contentservice.CompositeInitializer; - reader.readMessage(value,proto.contentservice.CompositeInitializer.deserializeBinaryFromReader); - msg.setComposite(value); - break; - case 6: - var value = new proto.contentservice.FileDownloadInitializer; - reader.readMessage(value,proto.contentservice.FileDownloadInitializer.deserializeBinaryFromReader); - msg.setDownload(value); - break; - case 7: - var value = new proto.contentservice.FromBackupInitializer; - reader.readMessage(value,proto.contentservice.FromBackupInitializer.deserializeBinaryFromReader); - msg.setBackup(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = new proto.contentservice.EmptyInitializer(); + reader.readMessage(value, proto.contentservice.EmptyInitializer.deserializeBinaryFromReader); + msg.setEmpty(value); + break; + case 2: + var value = new proto.contentservice.GitInitializer(); + reader.readMessage(value, proto.contentservice.GitInitializer.deserializeBinaryFromReader); + msg.setGit(value); + break; + case 3: + var value = new proto.contentservice.SnapshotInitializer(); + reader.readMessage(value, proto.contentservice.SnapshotInitializer.deserializeBinaryFromReader); + msg.setSnapshot(value); + break; + case 4: + var value = new proto.contentservice.PrebuildInitializer(); + reader.readMessage(value, proto.contentservice.PrebuildInitializer.deserializeBinaryFromReader); + msg.setPrebuild(value); + break; + case 5: + var value = new proto.contentservice.CompositeInitializer(); + reader.readMessage(value, proto.contentservice.CompositeInitializer.deserializeBinaryFromReader); + msg.setComposite(value); + break; + case 6: + var value = new proto.contentservice.FileDownloadInitializer(); + reader.readMessage(value, proto.contentservice.FileDownloadInitializer.deserializeBinaryFromReader); + msg.setDownload(value); + break; + case 7: + var value = new proto.contentservice.FromBackupInitializer(); + reader.readMessage(value, proto.contentservice.FromBackupInitializer.deserializeBinaryFromReader); + msg.setBackup(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.WorkspaceInitializer.prototype.serializeBinary = function() { +proto.contentservice.WorkspaceInitializer.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.WorkspaceInitializer.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -440,327 +445,276 @@ proto.contentservice.WorkspaceInitializer.prototype.serializeBinary = function() * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.WorkspaceInitializer.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.WorkspaceInitializer.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getEmpty(); if (f != null) { - writer.writeMessage( - 1, - f, - proto.contentservice.EmptyInitializer.serializeBinaryToWriter - ); + writer.writeMessage(1, f, proto.contentservice.EmptyInitializer.serializeBinaryToWriter); } f = message.getGit(); if (f != null) { - writer.writeMessage( - 2, - f, - proto.contentservice.GitInitializer.serializeBinaryToWriter - ); + writer.writeMessage(2, f, proto.contentservice.GitInitializer.serializeBinaryToWriter); } f = message.getSnapshot(); if (f != null) { - writer.writeMessage( - 3, - f, - proto.contentservice.SnapshotInitializer.serializeBinaryToWriter - ); + writer.writeMessage(3, f, proto.contentservice.SnapshotInitializer.serializeBinaryToWriter); } f = message.getPrebuild(); if (f != null) { - writer.writeMessage( - 4, - f, - proto.contentservice.PrebuildInitializer.serializeBinaryToWriter - ); + writer.writeMessage(4, f, proto.contentservice.PrebuildInitializer.serializeBinaryToWriter); } f = message.getComposite(); if (f != null) { - writer.writeMessage( - 5, - f, - proto.contentservice.CompositeInitializer.serializeBinaryToWriter - ); + writer.writeMessage(5, f, proto.contentservice.CompositeInitializer.serializeBinaryToWriter); } f = message.getDownload(); if (f != null) { - writer.writeMessage( - 6, - f, - proto.contentservice.FileDownloadInitializer.serializeBinaryToWriter - ); + writer.writeMessage(6, f, proto.contentservice.FileDownloadInitializer.serializeBinaryToWriter); } f = message.getBackup(); if (f != null) { - writer.writeMessage( - 7, - f, - proto.contentservice.FromBackupInitializer.serializeBinaryToWriter - ); + writer.writeMessage(7, f, proto.contentservice.FromBackupInitializer.serializeBinaryToWriter); } }; - /** * optional EmptyInitializer empty = 1; * @return {?proto.contentservice.EmptyInitializer} */ -proto.contentservice.WorkspaceInitializer.prototype.getEmpty = function() { +proto.contentservice.WorkspaceInitializer.prototype.getEmpty = function () { return /** @type{?proto.contentservice.EmptyInitializer} */ ( - jspb.Message.getWrapperField(this, proto.contentservice.EmptyInitializer, 1)); + jspb.Message.getWrapperField(this, proto.contentservice.EmptyInitializer, 1) + ); }; - /** * @param {?proto.contentservice.EmptyInitializer|undefined} value * @return {!proto.contentservice.WorkspaceInitializer} returns this -*/ -proto.contentservice.WorkspaceInitializer.prototype.setEmpty = function(value) { + */ +proto.contentservice.WorkspaceInitializer.prototype.setEmpty = function (value) { return jspb.Message.setOneofWrapperField(this, 1, proto.contentservice.WorkspaceInitializer.oneofGroups_[0], value); }; - /** * Clears the message field making it undefined. * @return {!proto.contentservice.WorkspaceInitializer} returns this */ -proto.contentservice.WorkspaceInitializer.prototype.clearEmpty = function() { +proto.contentservice.WorkspaceInitializer.prototype.clearEmpty = function () { return this.setEmpty(undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.WorkspaceInitializer.prototype.hasEmpty = function() { +proto.contentservice.WorkspaceInitializer.prototype.hasEmpty = function () { return jspb.Message.getField(this, 1) != null; }; - /** * optional GitInitializer git = 2; * @return {?proto.contentservice.GitInitializer} */ -proto.contentservice.WorkspaceInitializer.prototype.getGit = function() { +proto.contentservice.WorkspaceInitializer.prototype.getGit = function () { return /** @type{?proto.contentservice.GitInitializer} */ ( - jspb.Message.getWrapperField(this, proto.contentservice.GitInitializer, 2)); + jspb.Message.getWrapperField(this, proto.contentservice.GitInitializer, 2) + ); }; - /** * @param {?proto.contentservice.GitInitializer|undefined} value * @return {!proto.contentservice.WorkspaceInitializer} returns this -*/ -proto.contentservice.WorkspaceInitializer.prototype.setGit = function(value) { + */ +proto.contentservice.WorkspaceInitializer.prototype.setGit = function (value) { return jspb.Message.setOneofWrapperField(this, 2, proto.contentservice.WorkspaceInitializer.oneofGroups_[0], value); }; - /** * Clears the message field making it undefined. * @return {!proto.contentservice.WorkspaceInitializer} returns this */ -proto.contentservice.WorkspaceInitializer.prototype.clearGit = function() { +proto.contentservice.WorkspaceInitializer.prototype.clearGit = function () { return this.setGit(undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.WorkspaceInitializer.prototype.hasGit = function() { +proto.contentservice.WorkspaceInitializer.prototype.hasGit = function () { return jspb.Message.getField(this, 2) != null; }; - /** * optional SnapshotInitializer snapshot = 3; * @return {?proto.contentservice.SnapshotInitializer} */ -proto.contentservice.WorkspaceInitializer.prototype.getSnapshot = function() { +proto.contentservice.WorkspaceInitializer.prototype.getSnapshot = function () { return /** @type{?proto.contentservice.SnapshotInitializer} */ ( - jspb.Message.getWrapperField(this, proto.contentservice.SnapshotInitializer, 3)); + jspb.Message.getWrapperField(this, proto.contentservice.SnapshotInitializer, 3) + ); }; - /** * @param {?proto.contentservice.SnapshotInitializer|undefined} value * @return {!proto.contentservice.WorkspaceInitializer} returns this -*/ -proto.contentservice.WorkspaceInitializer.prototype.setSnapshot = function(value) { + */ +proto.contentservice.WorkspaceInitializer.prototype.setSnapshot = function (value) { return jspb.Message.setOneofWrapperField(this, 3, proto.contentservice.WorkspaceInitializer.oneofGroups_[0], value); }; - /** * Clears the message field making it undefined. * @return {!proto.contentservice.WorkspaceInitializer} returns this */ -proto.contentservice.WorkspaceInitializer.prototype.clearSnapshot = function() { +proto.contentservice.WorkspaceInitializer.prototype.clearSnapshot = function () { return this.setSnapshot(undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.WorkspaceInitializer.prototype.hasSnapshot = function() { +proto.contentservice.WorkspaceInitializer.prototype.hasSnapshot = function () { return jspb.Message.getField(this, 3) != null; }; - /** * optional PrebuildInitializer prebuild = 4; * @return {?proto.contentservice.PrebuildInitializer} */ -proto.contentservice.WorkspaceInitializer.prototype.getPrebuild = function() { +proto.contentservice.WorkspaceInitializer.prototype.getPrebuild = function () { return /** @type{?proto.contentservice.PrebuildInitializer} */ ( - jspb.Message.getWrapperField(this, proto.contentservice.PrebuildInitializer, 4)); + jspb.Message.getWrapperField(this, proto.contentservice.PrebuildInitializer, 4) + ); }; - /** * @param {?proto.contentservice.PrebuildInitializer|undefined} value * @return {!proto.contentservice.WorkspaceInitializer} returns this -*/ -proto.contentservice.WorkspaceInitializer.prototype.setPrebuild = function(value) { + */ +proto.contentservice.WorkspaceInitializer.prototype.setPrebuild = function (value) { return jspb.Message.setOneofWrapperField(this, 4, proto.contentservice.WorkspaceInitializer.oneofGroups_[0], value); }; - /** * Clears the message field making it undefined. * @return {!proto.contentservice.WorkspaceInitializer} returns this */ -proto.contentservice.WorkspaceInitializer.prototype.clearPrebuild = function() { +proto.contentservice.WorkspaceInitializer.prototype.clearPrebuild = function () { return this.setPrebuild(undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.WorkspaceInitializer.prototype.hasPrebuild = function() { +proto.contentservice.WorkspaceInitializer.prototype.hasPrebuild = function () { return jspb.Message.getField(this, 4) != null; }; - /** * optional CompositeInitializer composite = 5; * @return {?proto.contentservice.CompositeInitializer} */ -proto.contentservice.WorkspaceInitializer.prototype.getComposite = function() { +proto.contentservice.WorkspaceInitializer.prototype.getComposite = function () { return /** @type{?proto.contentservice.CompositeInitializer} */ ( - jspb.Message.getWrapperField(this, proto.contentservice.CompositeInitializer, 5)); + jspb.Message.getWrapperField(this, proto.contentservice.CompositeInitializer, 5) + ); }; - /** * @param {?proto.contentservice.CompositeInitializer|undefined} value * @return {!proto.contentservice.WorkspaceInitializer} returns this -*/ -proto.contentservice.WorkspaceInitializer.prototype.setComposite = function(value) { + */ +proto.contentservice.WorkspaceInitializer.prototype.setComposite = function (value) { return jspb.Message.setOneofWrapperField(this, 5, proto.contentservice.WorkspaceInitializer.oneofGroups_[0], value); }; - /** * Clears the message field making it undefined. * @return {!proto.contentservice.WorkspaceInitializer} returns this */ -proto.contentservice.WorkspaceInitializer.prototype.clearComposite = function() { +proto.contentservice.WorkspaceInitializer.prototype.clearComposite = function () { return this.setComposite(undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.WorkspaceInitializer.prototype.hasComposite = function() { +proto.contentservice.WorkspaceInitializer.prototype.hasComposite = function () { return jspb.Message.getField(this, 5) != null; }; - /** * optional FileDownloadInitializer download = 6; * @return {?proto.contentservice.FileDownloadInitializer} */ -proto.contentservice.WorkspaceInitializer.prototype.getDownload = function() { +proto.contentservice.WorkspaceInitializer.prototype.getDownload = function () { return /** @type{?proto.contentservice.FileDownloadInitializer} */ ( - jspb.Message.getWrapperField(this, proto.contentservice.FileDownloadInitializer, 6)); + jspb.Message.getWrapperField(this, proto.contentservice.FileDownloadInitializer, 6) + ); }; - /** * @param {?proto.contentservice.FileDownloadInitializer|undefined} value * @return {!proto.contentservice.WorkspaceInitializer} returns this -*/ -proto.contentservice.WorkspaceInitializer.prototype.setDownload = function(value) { + */ +proto.contentservice.WorkspaceInitializer.prototype.setDownload = function (value) { return jspb.Message.setOneofWrapperField(this, 6, proto.contentservice.WorkspaceInitializer.oneofGroups_[0], value); }; - /** * Clears the message field making it undefined. * @return {!proto.contentservice.WorkspaceInitializer} returns this */ -proto.contentservice.WorkspaceInitializer.prototype.clearDownload = function() { +proto.contentservice.WorkspaceInitializer.prototype.clearDownload = function () { return this.setDownload(undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.WorkspaceInitializer.prototype.hasDownload = function() { +proto.contentservice.WorkspaceInitializer.prototype.hasDownload = function () { return jspb.Message.getField(this, 6) != null; }; - /** * optional FromBackupInitializer backup = 7; * @return {?proto.contentservice.FromBackupInitializer} */ -proto.contentservice.WorkspaceInitializer.prototype.getBackup = function() { +proto.contentservice.WorkspaceInitializer.prototype.getBackup = function () { return /** @type{?proto.contentservice.FromBackupInitializer} */ ( - jspb.Message.getWrapperField(this, proto.contentservice.FromBackupInitializer, 7)); + jspb.Message.getWrapperField(this, proto.contentservice.FromBackupInitializer, 7) + ); }; - /** * @param {?proto.contentservice.FromBackupInitializer|undefined} value * @return {!proto.contentservice.WorkspaceInitializer} returns this -*/ -proto.contentservice.WorkspaceInitializer.prototype.setBackup = function(value) { + */ +proto.contentservice.WorkspaceInitializer.prototype.setBackup = function (value) { return jspb.Message.setOneofWrapperField(this, 7, proto.contentservice.WorkspaceInitializer.oneofGroups_[0], value); }; - /** * Clears the message field making it undefined. * @return {!proto.contentservice.WorkspaceInitializer} returns this */ -proto.contentservice.WorkspaceInitializer.prototype.clearBackup = function() { +proto.contentservice.WorkspaceInitializer.prototype.clearBackup = function () { return this.setBackup(undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.WorkspaceInitializer.prototype.hasBackup = function() { +proto.contentservice.WorkspaceInitializer.prototype.hasBackup = function () { return jspb.Message.getField(this, 7) != null; }; - - /** * List of repeated fields within this message type. * @private {!Array} @@ -768,61 +722,60 @@ proto.contentservice.WorkspaceInitializer.prototype.hasBackup = function() { */ proto.contentservice.CompositeInitializer.repeatedFields_ = [1]; - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.CompositeInitializer.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.CompositeInitializer.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.CompositeInitializer} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.CompositeInitializer.toObject = function(includeInstance, msg) { - var f, obj = { - initializerList: jspb.Message.toObjectList(msg.getInitializerList(), - proto.contentservice.WorkspaceInitializer.toObject, includeInstance) + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.CompositeInitializer.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.CompositeInitializer.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.CompositeInitializer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.CompositeInitializer.toObject = function (includeInstance, msg) { + var f, + obj = { + initializerList: jspb.Message.toObjectList( + msg.getInitializerList(), + proto.contentservice.WorkspaceInitializer.toObject, + includeInstance, + ), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.CompositeInitializer} */ -proto.contentservice.CompositeInitializer.deserializeBinary = function(bytes) { +proto.contentservice.CompositeInitializer.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.CompositeInitializer; + var msg = new proto.contentservice.CompositeInitializer(); return proto.contentservice.CompositeInitializer.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -830,38 +783,36 @@ proto.contentservice.CompositeInitializer.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.CompositeInitializer} */ -proto.contentservice.CompositeInitializer.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.CompositeInitializer.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = new proto.contentservice.WorkspaceInitializer; - reader.readMessage(value,proto.contentservice.WorkspaceInitializer.deserializeBinaryFromReader); - msg.addInitializer(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = new proto.contentservice.WorkspaceInitializer(); + reader.readMessage(value, proto.contentservice.WorkspaceInitializer.deserializeBinaryFromReader); + msg.addInitializer(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.CompositeInitializer.prototype.serializeBinary = function() { +proto.contentservice.CompositeInitializer.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.CompositeInitializer.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -869,58 +820,55 @@ proto.contentservice.CompositeInitializer.prototype.serializeBinary = function() * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.CompositeInitializer.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.CompositeInitializer.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getInitializerList(); if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.contentservice.WorkspaceInitializer.serializeBinaryToWriter - ); + writer.writeRepeatedMessage(1, f, proto.contentservice.WorkspaceInitializer.serializeBinaryToWriter); } }; - /** * repeated WorkspaceInitializer initializer = 1; * @return {!Array} */ -proto.contentservice.CompositeInitializer.prototype.getInitializerList = function() { +proto.contentservice.CompositeInitializer.prototype.getInitializerList = function () { return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.contentservice.WorkspaceInitializer, 1)); + jspb.Message.getRepeatedWrapperField(this, proto.contentservice.WorkspaceInitializer, 1) + ); }; - /** * @param {!Array} value * @return {!proto.contentservice.CompositeInitializer} returns this -*/ -proto.contentservice.CompositeInitializer.prototype.setInitializerList = function(value) { + */ +proto.contentservice.CompositeInitializer.prototype.setInitializerList = function (value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; - /** * @param {!proto.contentservice.WorkspaceInitializer=} opt_value * @param {number=} opt_index * @return {!proto.contentservice.WorkspaceInitializer} */ -proto.contentservice.CompositeInitializer.prototype.addInitializer = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.contentservice.WorkspaceInitializer, opt_index); +proto.contentservice.CompositeInitializer.prototype.addInitializer = function (opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField( + this, + 1, + opt_value, + proto.contentservice.WorkspaceInitializer, + opt_index, + ); }; - /** * Clears the list making it empty but non-null. * @return {!proto.contentservice.CompositeInitializer} returns this */ -proto.contentservice.CompositeInitializer.prototype.clearInitializerList = function() { +proto.contentservice.CompositeInitializer.prototype.clearInitializerList = function () { return this.setInitializerList([]); }; - - /** * List of repeated fields within this message type. * @private {!Array} @@ -928,62 +876,61 @@ proto.contentservice.CompositeInitializer.prototype.clearInitializerList = funct */ proto.contentservice.FileDownloadInitializer.repeatedFields_ = [1]; - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.FileDownloadInitializer.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.FileDownloadInitializer.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.FileDownloadInitializer} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.FileDownloadInitializer.toObject = function(includeInstance, msg) { - var f, obj = { - filesList: jspb.Message.toObjectList(msg.getFilesList(), - proto.contentservice.FileDownloadInitializer.FileInfo.toObject, includeInstance), - targetLocation: jspb.Message.getFieldWithDefault(msg, 2, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.FileDownloadInitializer.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.FileDownloadInitializer.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.FileDownloadInitializer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.FileDownloadInitializer.toObject = function (includeInstance, msg) { + var f, + obj = { + filesList: jspb.Message.toObjectList( + msg.getFilesList(), + proto.contentservice.FileDownloadInitializer.FileInfo.toObject, + includeInstance, + ), + targetLocation: jspb.Message.getFieldWithDefault(msg, 2, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.FileDownloadInitializer} */ -proto.contentservice.FileDownloadInitializer.deserializeBinary = function(bytes) { +proto.contentservice.FileDownloadInitializer.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.FileDownloadInitializer; + var msg = new proto.contentservice.FileDownloadInitializer(); return proto.contentservice.FileDownloadInitializer.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -991,42 +938,40 @@ proto.contentservice.FileDownloadInitializer.deserializeBinary = function(bytes) * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.FileDownloadInitializer} */ -proto.contentservice.FileDownloadInitializer.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.FileDownloadInitializer.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = new proto.contentservice.FileDownloadInitializer.FileInfo; - reader.readMessage(value,proto.contentservice.FileDownloadInitializer.FileInfo.deserializeBinaryFromReader); - msg.addFiles(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setTargetLocation(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = new proto.contentservice.FileDownloadInitializer.FileInfo(); + reader.readMessage(value, proto.contentservice.FileDownloadInitializer.FileInfo.deserializeBinaryFromReader); + msg.addFiles(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setTargetLocation(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.FileDownloadInitializer.prototype.serializeBinary = function() { +proto.contentservice.FileDownloadInitializer.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.FileDownloadInitializer.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -1034,83 +979,70 @@ proto.contentservice.FileDownloadInitializer.prototype.serializeBinary = functio * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.FileDownloadInitializer.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.FileDownloadInitializer.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getFilesList(); if (f.length > 0) { - writer.writeRepeatedMessage( - 1, - f, - proto.contentservice.FileDownloadInitializer.FileInfo.serializeBinaryToWriter - ); + writer.writeRepeatedMessage(1, f, proto.contentservice.FileDownloadInitializer.FileInfo.serializeBinaryToWriter); } f = message.getTargetLocation(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.FileDownloadInitializer.FileInfo.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.FileDownloadInitializer.FileInfo.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.FileDownloadInitializer.FileInfo} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.FileDownloadInitializer.FileInfo.toObject = function(includeInstance, msg) { - var f, obj = { - url: jspb.Message.getFieldWithDefault(msg, 1, ""), - filePath: jspb.Message.getFieldWithDefault(msg, 2, ""), - digest: jspb.Message.getFieldWithDefault(msg, 3, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.FileDownloadInitializer.FileInfo.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.FileDownloadInitializer.FileInfo.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.FileDownloadInitializer.FileInfo} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.FileDownloadInitializer.FileInfo.toObject = function (includeInstance, msg) { + var f, + obj = { + url: jspb.Message.getFieldWithDefault(msg, 1, ''), + filePath: jspb.Message.getFieldWithDefault(msg, 2, ''), + digest: jspb.Message.getFieldWithDefault(msg, 3, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.FileDownloadInitializer.FileInfo} */ -proto.contentservice.FileDownloadInitializer.FileInfo.deserializeBinary = function(bytes) { +proto.contentservice.FileDownloadInitializer.FileInfo.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.FileDownloadInitializer.FileInfo; + var msg = new proto.contentservice.FileDownloadInitializer.FileInfo(); return proto.contentservice.FileDownloadInitializer.FileInfo.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -1118,45 +1050,43 @@ proto.contentservice.FileDownloadInitializer.FileInfo.deserializeBinary = functi * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.FileDownloadInitializer.FileInfo} */ -proto.contentservice.FileDownloadInitializer.FileInfo.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.FileDownloadInitializer.FileInfo.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setUrl(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setFilePath(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setDigest(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUrl(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setFilePath(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setDigest(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.FileDownloadInitializer.FileInfo.prototype.serializeBinary = function() { +proto.contentservice.FileDownloadInitializer.FileInfo.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.FileDownloadInitializer.FileInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -1164,197 +1094,175 @@ proto.contentservice.FileDownloadInitializer.FileInfo.prototype.serializeBinary * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.FileDownloadInitializer.FileInfo.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.FileDownloadInitializer.FileInfo.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getUrl(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getFilePath(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } f = message.getDigest(); if (f.length > 0) { - writer.writeString( - 3, - f - ); + writer.writeString(3, f); } }; - /** * optional string url = 1; * @return {string} */ -proto.contentservice.FileDownloadInitializer.FileInfo.prototype.getUrl = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.FileDownloadInitializer.FileInfo.prototype.getUrl = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.FileDownloadInitializer.FileInfo} returns this */ -proto.contentservice.FileDownloadInitializer.FileInfo.prototype.setUrl = function(value) { +proto.contentservice.FileDownloadInitializer.FileInfo.prototype.setUrl = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string file_path = 2; * @return {string} */ -proto.contentservice.FileDownloadInitializer.FileInfo.prototype.getFilePath = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.FileDownloadInitializer.FileInfo.prototype.getFilePath = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.FileDownloadInitializer.FileInfo} returns this */ -proto.contentservice.FileDownloadInitializer.FileInfo.prototype.setFilePath = function(value) { +proto.contentservice.FileDownloadInitializer.FileInfo.prototype.setFilePath = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - /** * optional string digest = 3; * @return {string} */ -proto.contentservice.FileDownloadInitializer.FileInfo.prototype.getDigest = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.contentservice.FileDownloadInitializer.FileInfo.prototype.getDigest = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')); }; - /** * @param {string} value * @return {!proto.contentservice.FileDownloadInitializer.FileInfo} returns this */ -proto.contentservice.FileDownloadInitializer.FileInfo.prototype.setDigest = function(value) { +proto.contentservice.FileDownloadInitializer.FileInfo.prototype.setDigest = function (value) { return jspb.Message.setProto3StringField(this, 3, value); }; - /** * repeated FileInfo files = 1; * @return {!Array} */ -proto.contentservice.FileDownloadInitializer.prototype.getFilesList = function() { +proto.contentservice.FileDownloadInitializer.prototype.getFilesList = function () { return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.contentservice.FileDownloadInitializer.FileInfo, 1)); + jspb.Message.getRepeatedWrapperField(this, proto.contentservice.FileDownloadInitializer.FileInfo, 1) + ); }; - /** * @param {!Array} value * @return {!proto.contentservice.FileDownloadInitializer} returns this -*/ -proto.contentservice.FileDownloadInitializer.prototype.setFilesList = function(value) { + */ +proto.contentservice.FileDownloadInitializer.prototype.setFilesList = function (value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; - /** * @param {!proto.contentservice.FileDownloadInitializer.FileInfo=} opt_value * @param {number=} opt_index * @return {!proto.contentservice.FileDownloadInitializer.FileInfo} */ -proto.contentservice.FileDownloadInitializer.prototype.addFiles = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.contentservice.FileDownloadInitializer.FileInfo, opt_index); +proto.contentservice.FileDownloadInitializer.prototype.addFiles = function (opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField( + this, + 1, + opt_value, + proto.contentservice.FileDownloadInitializer.FileInfo, + opt_index, + ); }; - /** * Clears the list making it empty but non-null. * @return {!proto.contentservice.FileDownloadInitializer} returns this */ -proto.contentservice.FileDownloadInitializer.prototype.clearFilesList = function() { +proto.contentservice.FileDownloadInitializer.prototype.clearFilesList = function () { return this.setFilesList([]); }; - /** * optional string target_location = 2; * @return {string} */ -proto.contentservice.FileDownloadInitializer.prototype.getTargetLocation = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.FileDownloadInitializer.prototype.getTargetLocation = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.FileDownloadInitializer} returns this */ -proto.contentservice.FileDownloadInitializer.prototype.setTargetLocation = function(value) { +proto.contentservice.FileDownloadInitializer.prototype.setTargetLocation = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.EmptyInitializer.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.EmptyInitializer.toObject(opt_includeInstance, this); -}; - + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.EmptyInitializer.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.EmptyInitializer.toObject(opt_includeInstance, this); + }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.EmptyInitializer} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.EmptyInitializer.toObject = function(includeInstance, msg) { - var f, obj = { + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.EmptyInitializer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.EmptyInitializer.toObject = function (includeInstance, msg) { + var f, + obj = {}; + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.EmptyInitializer} */ -proto.contentservice.EmptyInitializer.deserializeBinary = function(bytes) { +proto.contentservice.EmptyInitializer.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.EmptyInitializer; + var msg = new proto.contentservice.EmptyInitializer(); return proto.contentservice.EmptyInitializer.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -1362,33 +1270,31 @@ proto.contentservice.EmptyInitializer.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.EmptyInitializer} */ -proto.contentservice.EmptyInitializer.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.EmptyInitializer.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - default: - reader.skipField(); - break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.EmptyInitializer.prototype.serializeBinary = function() { +proto.contentservice.EmptyInitializer.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.EmptyInitializer.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -1396,71 +1302,65 @@ proto.contentservice.EmptyInitializer.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.EmptyInitializer.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.EmptyInitializer.serializeBinaryToWriter = function (message, writer) { var f = undefined; }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.GitInitializer.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.GitInitializer.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.GitInitializer} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.GitInitializer.toObject = function(includeInstance, msg) { - var f, obj = { - remoteUri: jspb.Message.getFieldWithDefault(msg, 1, ""), - upstreamRemoteUri: jspb.Message.getFieldWithDefault(msg, 2, ""), - targetMode: jspb.Message.getFieldWithDefault(msg, 3, 0), - cloneTaget: jspb.Message.getFieldWithDefault(msg, 4, ""), - checkoutLocation: jspb.Message.getFieldWithDefault(msg, 5, ""), - config: (f = msg.getConfig()) && proto.contentservice.GitConfig.toObject(includeInstance, f) + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.GitInitializer.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.GitInitializer.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.GitInitializer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.GitInitializer.toObject = function (includeInstance, msg) { + var f, + obj = { + remoteUri: jspb.Message.getFieldWithDefault(msg, 1, ''), + upstreamRemoteUri: jspb.Message.getFieldWithDefault(msg, 2, ''), + targetMode: jspb.Message.getFieldWithDefault(msg, 3, 0), + cloneTaget: jspb.Message.getFieldWithDefault(msg, 4, ''), + checkoutLocation: jspb.Message.getFieldWithDefault(msg, 5, ''), + config: (f = msg.getConfig()) && proto.contentservice.GitConfig.toObject(includeInstance, f), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.GitInitializer} */ -proto.contentservice.GitInitializer.deserializeBinary = function(bytes) { +proto.contentservice.GitInitializer.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.GitInitializer; + var msg = new proto.contentservice.GitInitializer(); return proto.contentservice.GitInitializer.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -1468,58 +1368,56 @@ proto.contentservice.GitInitializer.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.GitInitializer} */ -proto.contentservice.GitInitializer.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.GitInitializer.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setRemoteUri(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setUpstreamRemoteUri(value); - break; - case 3: - var value = /** @type {!proto.contentservice.CloneTargetMode} */ (reader.readEnum()); - msg.setTargetMode(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setCloneTaget(value); - break; - case 5: - var value = /** @type {string} */ (reader.readString()); - msg.setCheckoutLocation(value); - break; - case 6: - var value = new proto.contentservice.GitConfig; - reader.readMessage(value,proto.contentservice.GitConfig.deserializeBinaryFromReader); - msg.setConfig(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setRemoteUri(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setUpstreamRemoteUri(value); + break; + case 3: + var value = /** @type {!proto.contentservice.CloneTargetMode} */ (reader.readEnum()); + msg.setTargetMode(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setCloneTaget(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setCheckoutLocation(value); + break; + case 6: + var value = new proto.contentservice.GitConfig(); + reader.readMessage(value, proto.contentservice.GitConfig.deserializeBinaryFromReader); + msg.setConfig(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.GitInitializer.prototype.serializeBinary = function() { +proto.contentservice.GitInitializer.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.GitInitializer.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -1527,240 +1425,202 @@ proto.contentservice.GitInitializer.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.GitInitializer.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.GitInitializer.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getRemoteUri(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getUpstreamRemoteUri(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } f = message.getTargetMode(); if (f !== 0.0) { - writer.writeEnum( - 3, - f - ); + writer.writeEnum(3, f); } f = message.getCloneTaget(); if (f.length > 0) { - writer.writeString( - 4, - f - ); + writer.writeString(4, f); } f = message.getCheckoutLocation(); if (f.length > 0) { - writer.writeString( - 5, - f - ); + writer.writeString(5, f); } f = message.getConfig(); if (f != null) { - writer.writeMessage( - 6, - f, - proto.contentservice.GitConfig.serializeBinaryToWriter - ); + writer.writeMessage(6, f, proto.contentservice.GitConfig.serializeBinaryToWriter); } }; - /** * optional string remote_uri = 1; * @return {string} */ -proto.contentservice.GitInitializer.prototype.getRemoteUri = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.GitInitializer.prototype.getRemoteUri = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.GitInitializer} returns this */ -proto.contentservice.GitInitializer.prototype.setRemoteUri = function(value) { +proto.contentservice.GitInitializer.prototype.setRemoteUri = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string upstream_Remote_uri = 2; * @return {string} */ -proto.contentservice.GitInitializer.prototype.getUpstreamRemoteUri = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.GitInitializer.prototype.getUpstreamRemoteUri = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.GitInitializer} returns this */ -proto.contentservice.GitInitializer.prototype.setUpstreamRemoteUri = function(value) { +proto.contentservice.GitInitializer.prototype.setUpstreamRemoteUri = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - /** * optional CloneTargetMode target_mode = 3; * @return {!proto.contentservice.CloneTargetMode} */ -proto.contentservice.GitInitializer.prototype.getTargetMode = function() { +proto.contentservice.GitInitializer.prototype.getTargetMode = function () { return /** @type {!proto.contentservice.CloneTargetMode} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; - /** * @param {!proto.contentservice.CloneTargetMode} value * @return {!proto.contentservice.GitInitializer} returns this */ -proto.contentservice.GitInitializer.prototype.setTargetMode = function(value) { +proto.contentservice.GitInitializer.prototype.setTargetMode = function (value) { return jspb.Message.setProto3EnumField(this, 3, value); }; - /** * optional string clone_taget = 4; * @return {string} */ -proto.contentservice.GitInitializer.prototype.getCloneTaget = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.contentservice.GitInitializer.prototype.getCloneTaget = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, '')); }; - /** * @param {string} value * @return {!proto.contentservice.GitInitializer} returns this */ -proto.contentservice.GitInitializer.prototype.setCloneTaget = function(value) { +proto.contentservice.GitInitializer.prototype.setCloneTaget = function (value) { return jspb.Message.setProto3StringField(this, 4, value); }; - /** * optional string checkout_location = 5; * @return {string} */ -proto.contentservice.GitInitializer.prototype.getCheckoutLocation = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +proto.contentservice.GitInitializer.prototype.getCheckoutLocation = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, '')); }; - /** * @param {string} value * @return {!proto.contentservice.GitInitializer} returns this */ -proto.contentservice.GitInitializer.prototype.setCheckoutLocation = function(value) { +proto.contentservice.GitInitializer.prototype.setCheckoutLocation = function (value) { return jspb.Message.setProto3StringField(this, 5, value); }; - /** * optional GitConfig config = 6; * @return {?proto.contentservice.GitConfig} */ -proto.contentservice.GitInitializer.prototype.getConfig = function() { +proto.contentservice.GitInitializer.prototype.getConfig = function () { return /** @type{?proto.contentservice.GitConfig} */ ( - jspb.Message.getWrapperField(this, proto.contentservice.GitConfig, 6)); + jspb.Message.getWrapperField(this, proto.contentservice.GitConfig, 6) + ); }; - /** * @param {?proto.contentservice.GitConfig|undefined} value * @return {!proto.contentservice.GitInitializer} returns this -*/ -proto.contentservice.GitInitializer.prototype.setConfig = function(value) { + */ +proto.contentservice.GitInitializer.prototype.setConfig = function (value) { return jspb.Message.setWrapperField(this, 6, value); }; - /** * Clears the message field making it undefined. * @return {!proto.contentservice.GitInitializer} returns this */ -proto.contentservice.GitInitializer.prototype.clearConfig = function() { +proto.contentservice.GitInitializer.prototype.clearConfig = function () { return this.setConfig(undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.GitInitializer.prototype.hasConfig = function() { +proto.contentservice.GitInitializer.prototype.hasConfig = function () { return jspb.Message.getField(this, 6) != null; }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.GitConfig.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.GitConfig.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.GitConfig} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.GitConfig.toObject = function(includeInstance, msg) { - var f, obj = { - customConfigMap: (f = msg.getCustomConfigMap()) ? f.toObject(includeInstance, undefined) : [], - authentication: jspb.Message.getFieldWithDefault(msg, 2, 0), - authUser: jspb.Message.getFieldWithDefault(msg, 3, ""), - authPassword: jspb.Message.getFieldWithDefault(msg, 4, ""), - authOts: jspb.Message.getFieldWithDefault(msg, 5, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.GitConfig.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.GitConfig.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.GitConfig} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.GitConfig.toObject = function (includeInstance, msg) { + var f, + obj = { + customConfigMap: (f = msg.getCustomConfigMap()) ? f.toObject(includeInstance, undefined) : [], + authentication: jspb.Message.getFieldWithDefault(msg, 2, 0), + authUser: jspb.Message.getFieldWithDefault(msg, 3, ''), + authPassword: jspb.Message.getFieldWithDefault(msg, 4, ''), + authOts: jspb.Message.getFieldWithDefault(msg, 5, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.GitConfig} */ -proto.contentservice.GitConfig.deserializeBinary = function(bytes) { +proto.contentservice.GitConfig.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.GitConfig; + var msg = new proto.contentservice.GitConfig(); return proto.contentservice.GitConfig.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -1768,55 +1628,61 @@ proto.contentservice.GitConfig.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.GitConfig} */ -proto.contentservice.GitConfig.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.GitConfig.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = msg.getCustomConfigMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); - }); - break; - case 2: - var value = /** @type {!proto.contentservice.GitAuthMethod} */ (reader.readEnum()); - msg.setAuthentication(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setAuthUser(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setAuthPassword(value); - break; - case 5: - var value = /** @type {string} */ (reader.readString()); - msg.setAuthOts(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = msg.getCustomConfigMap(); + reader.readMessage(value, function (message, reader) { + jspb.Map.deserializeBinary( + message, + reader, + jspb.BinaryReader.prototype.readString, + jspb.BinaryReader.prototype.readString, + null, + '', + '', + ); + }); + break; + case 2: + var value = /** @type {!proto.contentservice.GitAuthMethod} */ (reader.readEnum()); + msg.setAuthentication(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setAuthUser(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setAuthPassword(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setAuthOts(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.GitConfig.prototype.serializeBinary = function() { +proto.contentservice.GitConfig.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.GitConfig.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -1824,7 +1690,7 @@ proto.contentservice.GitConfig.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.GitConfig.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.GitConfig.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getCustomConfigMap(true); if (f && f.getLength() > 0) { @@ -1832,184 +1698,155 @@ proto.contentservice.GitConfig.serializeBinaryToWriter = function(message, write } f = message.getAuthentication(); if (f !== 0.0) { - writer.writeEnum( - 2, - f - ); + writer.writeEnum(2, f); } f = message.getAuthUser(); if (f.length > 0) { - writer.writeString( - 3, - f - ); + writer.writeString(3, f); } f = message.getAuthPassword(); if (f.length > 0) { - writer.writeString( - 4, - f - ); + writer.writeString(4, f); } f = message.getAuthOts(); if (f.length > 0) { - writer.writeString( - 5, - f - ); + writer.writeString(5, f); } }; - /** * map custom_config = 1; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.contentservice.GitConfig.prototype.getCustomConfigMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - null)); +proto.contentservice.GitConfig.prototype.getCustomConfigMap = function (opt_noLazyCreate) { + return /** @type {!jspb.Map} */ (jspb.Message.getMapField(this, 1, opt_noLazyCreate, null)); }; - /** * Clears values from the map. The map will be non-null. * @return {!proto.contentservice.GitConfig} returns this */ -proto.contentservice.GitConfig.prototype.clearCustomConfigMap = function() { +proto.contentservice.GitConfig.prototype.clearCustomConfigMap = function () { this.getCustomConfigMap().clear(); - return this;}; - + return this; +}; /** * optional GitAuthMethod authentication = 2; * @return {!proto.contentservice.GitAuthMethod} */ -proto.contentservice.GitConfig.prototype.getAuthentication = function() { +proto.contentservice.GitConfig.prototype.getAuthentication = function () { return /** @type {!proto.contentservice.GitAuthMethod} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; - /** * @param {!proto.contentservice.GitAuthMethod} value * @return {!proto.contentservice.GitConfig} returns this */ -proto.contentservice.GitConfig.prototype.setAuthentication = function(value) { +proto.contentservice.GitConfig.prototype.setAuthentication = function (value) { return jspb.Message.setProto3EnumField(this, 2, value); }; - /** * optional string auth_user = 3; * @return {string} */ -proto.contentservice.GitConfig.prototype.getAuthUser = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.contentservice.GitConfig.prototype.getAuthUser = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')); }; - /** * @param {string} value * @return {!proto.contentservice.GitConfig} returns this */ -proto.contentservice.GitConfig.prototype.setAuthUser = function(value) { +proto.contentservice.GitConfig.prototype.setAuthUser = function (value) { return jspb.Message.setProto3StringField(this, 3, value); }; - /** * optional string auth_password = 4; * @return {string} */ -proto.contentservice.GitConfig.prototype.getAuthPassword = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +proto.contentservice.GitConfig.prototype.getAuthPassword = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, '')); }; - /** * @param {string} value * @return {!proto.contentservice.GitConfig} returns this */ -proto.contentservice.GitConfig.prototype.setAuthPassword = function(value) { +proto.contentservice.GitConfig.prototype.setAuthPassword = function (value) { return jspb.Message.setProto3StringField(this, 4, value); }; - /** * optional string auth_ots = 5; * @return {string} */ -proto.contentservice.GitConfig.prototype.getAuthOts = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +proto.contentservice.GitConfig.prototype.getAuthOts = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, '')); }; - /** * @param {string} value * @return {!proto.contentservice.GitConfig} returns this */ -proto.contentservice.GitConfig.prototype.setAuthOts = function(value) { +proto.contentservice.GitConfig.prototype.setAuthOts = function (value) { return jspb.Message.setProto3StringField(this, 5, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.SnapshotInitializer.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.SnapshotInitializer.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.SnapshotInitializer} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.SnapshotInitializer.toObject = function(includeInstance, msg) { - var f, obj = { - snapshot: jspb.Message.getFieldWithDefault(msg, 1, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.SnapshotInitializer.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.SnapshotInitializer.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.SnapshotInitializer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.SnapshotInitializer.toObject = function (includeInstance, msg) { + var f, + obj = { + snapshot: jspb.Message.getFieldWithDefault(msg, 1, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.SnapshotInitializer} */ -proto.contentservice.SnapshotInitializer.deserializeBinary = function(bytes) { +proto.contentservice.SnapshotInitializer.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.SnapshotInitializer; + var msg = new proto.contentservice.SnapshotInitializer(); return proto.contentservice.SnapshotInitializer.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -2017,37 +1854,35 @@ proto.contentservice.SnapshotInitializer.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.SnapshotInitializer} */ -proto.contentservice.SnapshotInitializer.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.SnapshotInitializer.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setSnapshot(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setSnapshot(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.SnapshotInitializer.prototype.serializeBinary = function() { +proto.contentservice.SnapshotInitializer.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.SnapshotInitializer.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -2055,92 +1890,81 @@ proto.contentservice.SnapshotInitializer.prototype.serializeBinary = function() * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.SnapshotInitializer.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.SnapshotInitializer.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getSnapshot(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } }; - /** * optional string snapshot = 1; * @return {string} */ -proto.contentservice.SnapshotInitializer.prototype.getSnapshot = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.SnapshotInitializer.prototype.getSnapshot = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.SnapshotInitializer} returns this */ -proto.contentservice.SnapshotInitializer.prototype.setSnapshot = function(value) { +proto.contentservice.SnapshotInitializer.prototype.setSnapshot = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.PrebuildInitializer.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.PrebuildInitializer.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.PrebuildInitializer} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.PrebuildInitializer.toObject = function(includeInstance, msg) { - var f, obj = { - prebuild: (f = msg.getPrebuild()) && proto.contentservice.SnapshotInitializer.toObject(includeInstance, f), - git: (f = msg.getGit()) && proto.contentservice.GitInitializer.toObject(includeInstance, f) + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.PrebuildInitializer.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.PrebuildInitializer.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.PrebuildInitializer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.PrebuildInitializer.toObject = function (includeInstance, msg) { + var f, + obj = { + prebuild: (f = msg.getPrebuild()) && proto.contentservice.SnapshotInitializer.toObject(includeInstance, f), + git: (f = msg.getGit()) && proto.contentservice.GitInitializer.toObject(includeInstance, f), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.PrebuildInitializer} */ -proto.contentservice.PrebuildInitializer.deserializeBinary = function(bytes) { +proto.contentservice.PrebuildInitializer.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.PrebuildInitializer; + var msg = new proto.contentservice.PrebuildInitializer(); return proto.contentservice.PrebuildInitializer.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -2148,43 +1972,41 @@ proto.contentservice.PrebuildInitializer.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.PrebuildInitializer} */ -proto.contentservice.PrebuildInitializer.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.PrebuildInitializer.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = new proto.contentservice.SnapshotInitializer; - reader.readMessage(value,proto.contentservice.SnapshotInitializer.deserializeBinaryFromReader); - msg.setPrebuild(value); - break; - case 2: - var value = new proto.contentservice.GitInitializer; - reader.readMessage(value,proto.contentservice.GitInitializer.deserializeBinaryFromReader); - msg.setGit(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = new proto.contentservice.SnapshotInitializer(); + reader.readMessage(value, proto.contentservice.SnapshotInitializer.deserializeBinaryFromReader); + msg.setPrebuild(value); + break; + case 2: + var value = new proto.contentservice.GitInitializer(); + reader.readMessage(value, proto.contentservice.GitInitializer.deserializeBinaryFromReader); + msg.setGit(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.PrebuildInitializer.prototype.serializeBinary = function() { +proto.contentservice.PrebuildInitializer.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.PrebuildInitializer.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -2192,156 +2014,134 @@ proto.contentservice.PrebuildInitializer.prototype.serializeBinary = function() * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.PrebuildInitializer.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.PrebuildInitializer.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getPrebuild(); if (f != null) { - writer.writeMessage( - 1, - f, - proto.contentservice.SnapshotInitializer.serializeBinaryToWriter - ); + writer.writeMessage(1, f, proto.contentservice.SnapshotInitializer.serializeBinaryToWriter); } f = message.getGit(); if (f != null) { - writer.writeMessage( - 2, - f, - proto.contentservice.GitInitializer.serializeBinaryToWriter - ); + writer.writeMessage(2, f, proto.contentservice.GitInitializer.serializeBinaryToWriter); } }; - /** * optional SnapshotInitializer prebuild = 1; * @return {?proto.contentservice.SnapshotInitializer} */ -proto.contentservice.PrebuildInitializer.prototype.getPrebuild = function() { +proto.contentservice.PrebuildInitializer.prototype.getPrebuild = function () { return /** @type{?proto.contentservice.SnapshotInitializer} */ ( - jspb.Message.getWrapperField(this, proto.contentservice.SnapshotInitializer, 1)); + jspb.Message.getWrapperField(this, proto.contentservice.SnapshotInitializer, 1) + ); }; - /** * @param {?proto.contentservice.SnapshotInitializer|undefined} value * @return {!proto.contentservice.PrebuildInitializer} returns this -*/ -proto.contentservice.PrebuildInitializer.prototype.setPrebuild = function(value) { + */ +proto.contentservice.PrebuildInitializer.prototype.setPrebuild = function (value) { return jspb.Message.setWrapperField(this, 1, value); }; - /** * Clears the message field making it undefined. * @return {!proto.contentservice.PrebuildInitializer} returns this */ -proto.contentservice.PrebuildInitializer.prototype.clearPrebuild = function() { +proto.contentservice.PrebuildInitializer.prototype.clearPrebuild = function () { return this.setPrebuild(undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.PrebuildInitializer.prototype.hasPrebuild = function() { +proto.contentservice.PrebuildInitializer.prototype.hasPrebuild = function () { return jspb.Message.getField(this, 1) != null; }; - /** * optional GitInitializer git = 2; * @return {?proto.contentservice.GitInitializer} */ -proto.contentservice.PrebuildInitializer.prototype.getGit = function() { +proto.contentservice.PrebuildInitializer.prototype.getGit = function () { return /** @type{?proto.contentservice.GitInitializer} */ ( - jspb.Message.getWrapperField(this, proto.contentservice.GitInitializer, 2)); + jspb.Message.getWrapperField(this, proto.contentservice.GitInitializer, 2) + ); }; - /** * @param {?proto.contentservice.GitInitializer|undefined} value * @return {!proto.contentservice.PrebuildInitializer} returns this -*/ -proto.contentservice.PrebuildInitializer.prototype.setGit = function(value) { + */ +proto.contentservice.PrebuildInitializer.prototype.setGit = function (value) { return jspb.Message.setWrapperField(this, 2, value); }; - /** * Clears the message field making it undefined. * @return {!proto.contentservice.PrebuildInitializer} returns this */ -proto.contentservice.PrebuildInitializer.prototype.clearGit = function() { +proto.contentservice.PrebuildInitializer.prototype.clearGit = function () { return this.setGit(undefined); }; - /** * Returns whether this field is set. * @return {boolean} */ -proto.contentservice.PrebuildInitializer.prototype.hasGit = function() { +proto.contentservice.PrebuildInitializer.prototype.hasGit = function () { return jspb.Message.getField(this, 2) != null; }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.FromBackupInitializer.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.FromBackupInitializer.toObject(opt_includeInstance, this); -}; - + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.FromBackupInitializer.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.FromBackupInitializer.toObject(opt_includeInstance, this); + }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.FromBackupInitializer} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.FromBackupInitializer.toObject = function(includeInstance, msg) { - var f, obj = { + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.FromBackupInitializer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.FromBackupInitializer.toObject = function (includeInstance, msg) { + var f, + obj = {}; + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.FromBackupInitializer} */ -proto.contentservice.FromBackupInitializer.deserializeBinary = function(bytes) { +proto.contentservice.FromBackupInitializer.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.FromBackupInitializer; + var msg = new proto.contentservice.FromBackupInitializer(); return proto.contentservice.FromBackupInitializer.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -2349,33 +2149,31 @@ proto.contentservice.FromBackupInitializer.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.FromBackupInitializer} */ -proto.contentservice.FromBackupInitializer.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.FromBackupInitializer.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - default: - reader.skipField(); - break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.FromBackupInitializer.prototype.serializeBinary = function() { +proto.contentservice.FromBackupInitializer.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.FromBackupInitializer.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -2383,80 +2181,74 @@ proto.contentservice.FromBackupInitializer.prototype.serializeBinary = function( * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.FromBackupInitializer.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.FromBackupInitializer.serializeBinaryToWriter = function (message, writer) { var f = undefined; }; - - /** * List of repeated fields within this message type. * @private {!Array} * @const */ -proto.contentservice.GitStatus.repeatedFields_ = [3,4,5]; - - +proto.contentservice.GitStatus.repeatedFields_ = [3, 4, 5]; if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.GitStatus.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.GitStatus.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.GitStatus} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.GitStatus.toObject = function(includeInstance, msg) { - var f, obj = { - branch: jspb.Message.getFieldWithDefault(msg, 1, ""), - latestCommit: jspb.Message.getFieldWithDefault(msg, 2, ""), - uncommitedFilesList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f, - totalUncommitedFiles: jspb.Message.getFieldWithDefault(msg, 6, 0), - untrackedFilesList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f, - totalUntrackedFiles: jspb.Message.getFieldWithDefault(msg, 7, 0), - unpushedCommitsList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f, - totalUnpushedCommits: jspb.Message.getFieldWithDefault(msg, 8, 0) + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.GitStatus.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.GitStatus.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.GitStatus} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.GitStatus.toObject = function (includeInstance, msg) { + var f, + obj = { + branch: jspb.Message.getFieldWithDefault(msg, 1, ''), + latestCommit: jspb.Message.getFieldWithDefault(msg, 2, ''), + uncommitedFilesList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f, + totalUncommitedFiles: jspb.Message.getFieldWithDefault(msg, 6, 0), + untrackedFilesList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f, + totalUntrackedFiles: jspb.Message.getFieldWithDefault(msg, 7, 0), + unpushedCommitsList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f, + totalUnpushedCommits: jspb.Message.getFieldWithDefault(msg, 8, 0), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.GitStatus} */ -proto.contentservice.GitStatus.deserializeBinary = function(bytes) { +proto.contentservice.GitStatus.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.GitStatus; + var msg = new proto.contentservice.GitStatus(); return proto.contentservice.GitStatus.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -2464,65 +2256,63 @@ proto.contentservice.GitStatus.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.GitStatus} */ -proto.contentservice.GitStatus.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.GitStatus.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setBranch(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setLatestCommit(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.addUncommitedFiles(value); - break; - case 6: - var value = /** @type {number} */ (reader.readInt64()); - msg.setTotalUncommitedFiles(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.addUntrackedFiles(value); - break; - case 7: - var value = /** @type {number} */ (reader.readInt64()); - msg.setTotalUntrackedFiles(value); - break; - case 5: - var value = /** @type {string} */ (reader.readString()); - msg.addUnpushedCommits(value); - break; - case 8: - var value = /** @type {number} */ (reader.readInt64()); - msg.setTotalUnpushedCommits(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setBranch(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setLatestCommit(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.addUncommitedFiles(value); + break; + case 6: + var value = /** @type {number} */ (reader.readInt64()); + msg.setTotalUncommitedFiles(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.addUntrackedFiles(value); + break; + case 7: + var value = /** @type {number} */ (reader.readInt64()); + msg.setTotalUntrackedFiles(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.addUnpushedCommits(value); + break; + case 8: + var value = /** @type {number} */ (reader.readInt64()); + msg.setTotalUnpushedCommits(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.GitStatus.prototype.serializeBinary = function() { +proto.contentservice.GitStatus.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.GitStatus.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -2530,268 +2320,221 @@ proto.contentservice.GitStatus.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.GitStatus.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.GitStatus.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getBranch(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getLatestCommit(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } f = message.getUncommitedFilesList(); if (f.length > 0) { - writer.writeRepeatedString( - 3, - f - ); + writer.writeRepeatedString(3, f); } f = message.getTotalUncommitedFiles(); if (f !== 0) { - writer.writeInt64( - 6, - f - ); + writer.writeInt64(6, f); } f = message.getUntrackedFilesList(); if (f.length > 0) { - writer.writeRepeatedString( - 4, - f - ); + writer.writeRepeatedString(4, f); } f = message.getTotalUntrackedFiles(); if (f !== 0) { - writer.writeInt64( - 7, - f - ); + writer.writeInt64(7, f); } f = message.getUnpushedCommitsList(); if (f.length > 0) { - writer.writeRepeatedString( - 5, - f - ); + writer.writeRepeatedString(5, f); } f = message.getTotalUnpushedCommits(); if (f !== 0) { - writer.writeInt64( - 8, - f - ); + writer.writeInt64(8, f); } }; - /** * optional string branch = 1; * @return {string} */ -proto.contentservice.GitStatus.prototype.getBranch = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.GitStatus.prototype.getBranch = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.setBranch = function(value) { +proto.contentservice.GitStatus.prototype.setBranch = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string latest_commit = 2; * @return {string} */ -proto.contentservice.GitStatus.prototype.getLatestCommit = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.GitStatus.prototype.getLatestCommit = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.setLatestCommit = function(value) { +proto.contentservice.GitStatus.prototype.setLatestCommit = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - /** * repeated string uncommited_files = 3; * @return {!Array} */ -proto.contentservice.GitStatus.prototype.getUncommitedFilesList = function() { +proto.contentservice.GitStatus.prototype.getUncommitedFilesList = function () { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 3)); }; - /** * @param {!Array} value * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.setUncommitedFilesList = function(value) { +proto.contentservice.GitStatus.prototype.setUncommitedFilesList = function (value) { return jspb.Message.setField(this, 3, value || []); }; - /** * @param {string} value * @param {number=} opt_index * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.addUncommitedFiles = function(value, opt_index) { +proto.contentservice.GitStatus.prototype.addUncommitedFiles = function (value, opt_index) { return jspb.Message.addToRepeatedField(this, 3, value, opt_index); }; - /** * Clears the list making it empty but non-null. * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.clearUncommitedFilesList = function() { +proto.contentservice.GitStatus.prototype.clearUncommitedFilesList = function () { return this.setUncommitedFilesList([]); }; - /** * optional int64 total_uncommited_files = 6; * @return {number} */ -proto.contentservice.GitStatus.prototype.getTotalUncommitedFiles = function() { +proto.contentservice.GitStatus.prototype.getTotalUncommitedFiles = function () { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; - /** * @param {number} value * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.setTotalUncommitedFiles = function(value) { +proto.contentservice.GitStatus.prototype.setTotalUncommitedFiles = function (value) { return jspb.Message.setProto3IntField(this, 6, value); }; - /** * repeated string untracked_files = 4; * @return {!Array} */ -proto.contentservice.GitStatus.prototype.getUntrackedFilesList = function() { +proto.contentservice.GitStatus.prototype.getUntrackedFilesList = function () { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 4)); }; - /** * @param {!Array} value * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.setUntrackedFilesList = function(value) { +proto.contentservice.GitStatus.prototype.setUntrackedFilesList = function (value) { return jspb.Message.setField(this, 4, value || []); }; - /** * @param {string} value * @param {number=} opt_index * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.addUntrackedFiles = function(value, opt_index) { +proto.contentservice.GitStatus.prototype.addUntrackedFiles = function (value, opt_index) { return jspb.Message.addToRepeatedField(this, 4, value, opt_index); }; - /** * Clears the list making it empty but non-null. * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.clearUntrackedFilesList = function() { +proto.contentservice.GitStatus.prototype.clearUntrackedFilesList = function () { return this.setUntrackedFilesList([]); }; - /** * optional int64 total_untracked_files = 7; * @return {number} */ -proto.contentservice.GitStatus.prototype.getTotalUntrackedFiles = function() { +proto.contentservice.GitStatus.prototype.getTotalUntrackedFiles = function () { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); }; - /** * @param {number} value * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.setTotalUntrackedFiles = function(value) { +proto.contentservice.GitStatus.prototype.setTotalUntrackedFiles = function (value) { return jspb.Message.setProto3IntField(this, 7, value); }; - /** * repeated string unpushed_commits = 5; * @return {!Array} */ -proto.contentservice.GitStatus.prototype.getUnpushedCommitsList = function() { +proto.contentservice.GitStatus.prototype.getUnpushedCommitsList = function () { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); }; - /** * @param {!Array} value * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.setUnpushedCommitsList = function(value) { +proto.contentservice.GitStatus.prototype.setUnpushedCommitsList = function (value) { return jspb.Message.setField(this, 5, value || []); }; - /** * @param {string} value * @param {number=} opt_index * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.addUnpushedCommits = function(value, opt_index) { +proto.contentservice.GitStatus.prototype.addUnpushedCommits = function (value, opt_index) { return jspb.Message.addToRepeatedField(this, 5, value, opt_index); }; - /** * Clears the list making it empty but non-null. * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.clearUnpushedCommitsList = function() { +proto.contentservice.GitStatus.prototype.clearUnpushedCommitsList = function () { return this.setUnpushedCommitsList([]); }; - /** * optional int64 total_unpushed_commits = 8; * @return {number} */ -proto.contentservice.GitStatus.prototype.getTotalUnpushedCommits = function() { +proto.contentservice.GitStatus.prototype.getTotalUnpushedCommits = function () { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); }; - /** * @param {number} value * @return {!proto.contentservice.GitStatus} returns this */ -proto.contentservice.GitStatus.prototype.setTotalUnpushedCommits = function(value) { +proto.contentservice.GitStatus.prototype.setTotalUnpushedCommits = function (value) { return jspb.Message.setProto3IntField(this, 8, value); }; - /** * @enum {number} */ @@ -2799,7 +2542,7 @@ proto.contentservice.CloneTargetMode = { REMOTE_HEAD: 0, REMOTE_COMMIT: 1, REMOTE_BRANCH: 2, - LOCAL_BRANCH: 3 + LOCAL_BRANCH: 3, }; /** @@ -2808,7 +2551,7 @@ proto.contentservice.CloneTargetMode = { proto.contentservice.GitAuthMethod = { NO_AUTH: 0, BASIC_AUTH: 1, - BASIC_AUTH_OTS: 2 + BASIC_AUTH_OTS: 2, }; goog.object.extend(exports, proto.contentservice); diff --git a/components/content-service-api/typescript/src/sugar.ts b/components/content-service-api/typescript/src/sugar.ts index 9b24f9a58f7c54..73a8f3e604655c 100644 --- a/components/content-service-api/typescript/src/sugar.ts +++ b/components/content-service-api/typescript/src/sugar.ts @@ -4,37 +4,40 @@ * See License-AGPL.txt in the project root for license information. */ -import { inject, injectable, interfaces, optional } from "inversify"; -import * as grpc from "@grpc/grpc-js"; -import { createClientCallMetricsInterceptor, IClientCallMetrics } from "./client-call-metrics"; -import { IDEPluginServiceClient } from "./ideplugin_grpc_pb"; -import { ContentServiceClient } from "./content_grpc_pb"; -import { BlobServiceClient } from "./blobs_grpc_pb"; -import { WorkspaceServiceClient } from "./workspace_grpc_pb"; -import { HeadlessLogServiceClient } from "./headless-log_grpc_pb"; - -export const ContentServiceClientConfig = Symbol("ContentServiceClientConfig"); -export const ContentServiceClientCallMetrics = Symbol("ContentServiceClientCallMetrics"); - -export const contentServiceBinder = (config: (ctx: interfaces.Context) => ContentServiceClientConfig, clientCallMetrics?: IClientCallMetrics): interfaces.ContainerModuleCallBack => { - return (bind, unbind, isBound, rebind) => { - bind(ContentServiceClientConfig).toDynamicValue(config).inSingletonScope(); - if (clientCallMetrics) { - bind(ContentServiceClientCallMetrics).toConstantValue(clientCallMetrics); - } - - bind(CachingContentServiceClientProvider).toSelf().inSingletonScope(); - bind(CachingBlobServiceClientProvider).toSelf().inSingletonScope(); - bind(CachingWorkspaceServiceClientProvider).toSelf().inSingletonScope(); - bind(CachingIDEPluginClientProvider).toSelf().inSingletonScope(); - bind(CachingHeadlessLogServiceClientProvider).toSelf().inSingletonScope(); - }; +import { inject, injectable, interfaces, optional } from 'inversify'; +import * as grpc from '@grpc/grpc-js'; +import { createClientCallMetricsInterceptor, IClientCallMetrics } from './client-call-metrics'; +import { IDEPluginServiceClient } from './ideplugin_grpc_pb'; +import { ContentServiceClient } from './content_grpc_pb'; +import { BlobServiceClient } from './blobs_grpc_pb'; +import { WorkspaceServiceClient } from './workspace_grpc_pb'; +import { HeadlessLogServiceClient } from './headless-log_grpc_pb'; + +export const ContentServiceClientConfig = Symbol('ContentServiceClientConfig'); +export const ContentServiceClientCallMetrics = Symbol('ContentServiceClientCallMetrics'); + +export const contentServiceBinder = ( + config: (ctx: interfaces.Context) => ContentServiceClientConfig, + clientCallMetrics?: IClientCallMetrics, +): interfaces.ContainerModuleCallBack => { + return (bind, unbind, isBound, rebind) => { + bind(ContentServiceClientConfig).toDynamicValue(config).inSingletonScope(); + if (clientCallMetrics) { + bind(ContentServiceClientCallMetrics).toConstantValue(clientCallMetrics); + } + + bind(CachingContentServiceClientProvider).toSelf().inSingletonScope(); + bind(CachingBlobServiceClientProvider).toSelf().inSingletonScope(); + bind(CachingWorkspaceServiceClientProvider).toSelf().inSingletonScope(); + bind(CachingIDEPluginClientProvider).toSelf().inSingletonScope(); + bind(CachingHeadlessLogServiceClientProvider).toSelf().inSingletonScope(); + }; }; export interface ContentServiceClientConfig { - address: string; - credentials: grpc.ChannelCredentials; - options?: Partial; + address: string; + credentials: grpc.ChannelCredentials; + options?: Partial; } type Client = T & grpc.Client; @@ -43,105 +46,106 @@ type Client = T & grpc.Client; * ContentServiceClientProvider caches content service client */ export interface ContentServiceClientProvider { - getDefault(): Client; + getDefault(): Client; } @injectable() abstract class CachingClientProvider implements ContentServiceClientProvider { - @inject(ContentServiceClientConfig) protected readonly clientConfig: ContentServiceClientConfig; + @inject(ContentServiceClientConfig) protected readonly clientConfig: ContentServiceClientConfig; - @inject(ContentServiceClientCallMetrics) @optional() - protected readonly clientCallMetrics: IClientCallMetrics; + @inject(ContentServiceClientCallMetrics) + @optional() + protected readonly clientCallMetrics: IClientCallMetrics; - protected readonly interceptors: grpc.Interceptor[] = []; + protected readonly interceptors: grpc.Interceptor[] = []; - // gRPC connections can be used concurrently, even across services. - // Thus it makes sense to cache them rather than create a new connection for each request. - protected client: Client | undefined; + // gRPC connections can be used concurrently, even across services. + // Thus it makes sense to cache them rather than create a new connection for each request. + protected client: Client | undefined; - constructor( - protected readonly createClient: (config: ContentServiceClientConfig) => Client, - ) { - if (this.clientCallMetrics) { - this.interceptors.push(createClientCallMetricsInterceptor(this.clientCallMetrics)); - } + constructor(protected readonly createClient: (config: ContentServiceClientConfig) => Client) { + if (this.clientCallMetrics) { + this.interceptors.push(createClientCallMetricsInterceptor(this.clientCallMetrics)); } + } - getDefault(): Client { - let client = this.client; - if (!client) { - client = this.createClient(this.getConfig()); - } else if (!isConnectionAlive(client)) { - client.close(); + getDefault(): Client { + let client = this.client; + if (!client) { + client = this.createClient(this.getConfig()); + } else if (!isConnectionAlive(client)) { + client.close(); - client = this.createClient(this.getConfig()); - } - - this.client = client; - return client; + client = this.createClient(this.getConfig()); } - protected getConfig(): ContentServiceClientConfig { - const config = this.clientConfig; - if (this.interceptors) { - return { - ...config, - options: { - ...(config.options || {}), - interceptors: [...(config.options?.interceptors || []), ...this.interceptors], - } - } - } - return config; + this.client = client; + return client; + } + + protected getConfig(): ContentServiceClientConfig { + const config = this.clientConfig; + if (this.interceptors) { + return { + ...config, + options: { + ...(config.options || {}), + interceptors: [...(config.options?.interceptors || []), ...this.interceptors], + }, + }; } + return config; + } } @injectable() export class CachingContentServiceClientProvider extends CachingClientProvider { - constructor() { - super((config) => { - return new ContentServiceClient(config.address, config.credentials, config.options); - }) - } + constructor() { + super((config) => { + return new ContentServiceClient(config.address, config.credentials, config.options); + }); + } } @injectable() export class CachingBlobServiceClientProvider extends CachingClientProvider { - constructor() { - super((config) => { - return new BlobServiceClient(config.address, config.credentials, config.options); - }) - } + constructor() { + super((config) => { + return new BlobServiceClient(config.address, config.credentials, config.options); + }); + } } @injectable() export class CachingWorkspaceServiceClientProvider extends CachingClientProvider { - constructor() { - super((config) => { - return new WorkspaceServiceClient(config.address, config.credentials, config.options); - }) - } + constructor() { + super((config) => { + return new WorkspaceServiceClient(config.address, config.credentials, config.options); + }); + } } @injectable() export class CachingIDEPluginClientProvider extends CachingClientProvider { - constructor() { - super((config) => { - return new IDEPluginServiceClient(config.address, config.credentials, config.options); - }) - } + constructor() { + super((config) => { + return new IDEPluginServiceClient(config.address, config.credentials, config.options); + }); + } } @injectable() export class CachingHeadlessLogServiceClientProvider extends CachingClientProvider { - constructor() { - super((config) => { - return new HeadlessLogServiceClient(config.address, config.credentials, config.options); - }) - } + constructor() { + super((config) => { + return new HeadlessLogServiceClient(config.address, config.credentials, config.options); + }); + } } function isConnectionAlive(client: grpc.Client) { - const cs = client.getChannel().getConnectivityState(false); - return cs == grpc.connectivityState.CONNECTING || cs == grpc.connectivityState.IDLE || cs == grpc.connectivityState.READY; + const cs = client.getChannel().getConnectivityState(false); + return ( + cs == grpc.connectivityState.CONNECTING || cs == grpc.connectivityState.IDLE || cs == grpc.connectivityState.READY + ); } diff --git a/components/content-service-api/typescript/src/workspace_grpc_pb.d.ts b/components/content-service-api/typescript/src/workspace_grpc_pb.d.ts index e7809c822b94df..8e930ce80af3a6 100644 --- a/components/content-service-api/typescript/src/workspace_grpc_pb.d.ts +++ b/components/content-service-api/typescript/src/workspace_grpc_pb.d.ts @@ -10,72 +10,156 @@ /* tslint:disable */ /* eslint-disable */ -import * as grpc from "@grpc/grpc-js"; -import * as workspace_pb from "./workspace_pb"; +import * as grpc from '@grpc/grpc-js'; +import * as workspace_pb from './workspace_pb'; interface IWorkspaceServiceService extends grpc.ServiceDefinition { - workspaceDownloadURL: IWorkspaceServiceService_IWorkspaceDownloadURL; - deleteWorkspace: IWorkspaceServiceService_IDeleteWorkspace; - workspaceSnapshotExists: IWorkspaceServiceService_IWorkspaceSnapshotExists; + workspaceDownloadURL: IWorkspaceServiceService_IWorkspaceDownloadURL; + deleteWorkspace: IWorkspaceServiceService_IDeleteWorkspace; + workspaceSnapshotExists: IWorkspaceServiceService_IWorkspaceSnapshotExists; } -interface IWorkspaceServiceService_IWorkspaceDownloadURL extends grpc.MethodDefinition { - path: "/contentservice.WorkspaceService/WorkspaceDownloadURL"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IWorkspaceServiceService_IWorkspaceDownloadURL + extends grpc.MethodDefinition { + path: '/contentservice.WorkspaceService/WorkspaceDownloadURL'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } -interface IWorkspaceServiceService_IDeleteWorkspace extends grpc.MethodDefinition { - path: "/contentservice.WorkspaceService/DeleteWorkspace"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IWorkspaceServiceService_IDeleteWorkspace + extends grpc.MethodDefinition { + path: '/contentservice.WorkspaceService/DeleteWorkspace'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } -interface IWorkspaceServiceService_IWorkspaceSnapshotExists extends grpc.MethodDefinition { - path: "/contentservice.WorkspaceService/WorkspaceSnapshotExists"; - requestStream: false; - responseStream: false; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; +interface IWorkspaceServiceService_IWorkspaceSnapshotExists + extends grpc.MethodDefinition< + workspace_pb.WorkspaceSnapshotExistsRequest, + workspace_pb.WorkspaceSnapshotExistsResponse + > { + path: '/contentservice.WorkspaceService/WorkspaceSnapshotExists'; + requestStream: false; + responseStream: false; + requestSerialize: grpc.serialize; + requestDeserialize: grpc.deserialize; + responseSerialize: grpc.serialize; + responseDeserialize: grpc.deserialize; } export const WorkspaceServiceService: IWorkspaceServiceService; export interface IWorkspaceServiceServer extends grpc.UntypedServiceImplementation { - workspaceDownloadURL: grpc.handleUnaryCall; - deleteWorkspace: grpc.handleUnaryCall; - workspaceSnapshotExists: grpc.handleUnaryCall; + workspaceDownloadURL: grpc.handleUnaryCall< + workspace_pb.WorkspaceDownloadURLRequest, + workspace_pb.WorkspaceDownloadURLResponse + >; + deleteWorkspace: grpc.handleUnaryCall; + workspaceSnapshotExists: grpc.handleUnaryCall< + workspace_pb.WorkspaceSnapshotExistsRequest, + workspace_pb.WorkspaceSnapshotExistsResponse + >; } export interface IWorkspaceServiceClient { - workspaceDownloadURL(request: workspace_pb.WorkspaceDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void): grpc.ClientUnaryCall; - workspaceDownloadURL(request: workspace_pb.WorkspaceDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void): grpc.ClientUnaryCall; - workspaceDownloadURL(request: workspace_pb.WorkspaceDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void): grpc.ClientUnaryCall; - deleteWorkspace(request: workspace_pb.DeleteWorkspaceRequest, callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void): grpc.ClientUnaryCall; - deleteWorkspace(request: workspace_pb.DeleteWorkspaceRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void): grpc.ClientUnaryCall; - deleteWorkspace(request: workspace_pb.DeleteWorkspaceRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void): grpc.ClientUnaryCall; - workspaceSnapshotExists(request: workspace_pb.WorkspaceSnapshotExistsRequest, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void): grpc.ClientUnaryCall; - workspaceSnapshotExists(request: workspace_pb.WorkspaceSnapshotExistsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void): grpc.ClientUnaryCall; - workspaceSnapshotExists(request: workspace_pb.WorkspaceSnapshotExistsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void): grpc.ClientUnaryCall; + workspaceDownloadURL( + request: workspace_pb.WorkspaceDownloadURLRequest, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + workspaceDownloadURL( + request: workspace_pb.WorkspaceDownloadURLRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + workspaceDownloadURL( + request: workspace_pb.WorkspaceDownloadURLRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + deleteWorkspace( + request: workspace_pb.DeleteWorkspaceRequest, + callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void, + ): grpc.ClientUnaryCall; + deleteWorkspace( + request: workspace_pb.DeleteWorkspaceRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void, + ): grpc.ClientUnaryCall; + deleteWorkspace( + request: workspace_pb.DeleteWorkspaceRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void, + ): grpc.ClientUnaryCall; + workspaceSnapshotExists( + request: workspace_pb.WorkspaceSnapshotExistsRequest, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void, + ): grpc.ClientUnaryCall; + workspaceSnapshotExists( + request: workspace_pb.WorkspaceSnapshotExistsRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void, + ): grpc.ClientUnaryCall; + workspaceSnapshotExists( + request: workspace_pb.WorkspaceSnapshotExistsRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void, + ): grpc.ClientUnaryCall; } export class WorkspaceServiceClient extends grpc.Client implements IWorkspaceServiceClient { - constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); - public workspaceDownloadURL(request: workspace_pb.WorkspaceDownloadURLRequest, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void): grpc.ClientUnaryCall; - public workspaceDownloadURL(request: workspace_pb.WorkspaceDownloadURLRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void): grpc.ClientUnaryCall; - public workspaceDownloadURL(request: workspace_pb.WorkspaceDownloadURLRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void): grpc.ClientUnaryCall; - public deleteWorkspace(request: workspace_pb.DeleteWorkspaceRequest, callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void): grpc.ClientUnaryCall; - public deleteWorkspace(request: workspace_pb.DeleteWorkspaceRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void): grpc.ClientUnaryCall; - public deleteWorkspace(request: workspace_pb.DeleteWorkspaceRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void): grpc.ClientUnaryCall; - public workspaceSnapshotExists(request: workspace_pb.WorkspaceSnapshotExistsRequest, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void): grpc.ClientUnaryCall; - public workspaceSnapshotExists(request: workspace_pb.WorkspaceSnapshotExistsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void): grpc.ClientUnaryCall; - public workspaceSnapshotExists(request: workspace_pb.WorkspaceSnapshotExistsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void): grpc.ClientUnaryCall; + constructor(address: string, credentials: grpc.ChannelCredentials, options?: Partial); + public workspaceDownloadURL( + request: workspace_pb.WorkspaceDownloadURLRequest, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + public workspaceDownloadURL( + request: workspace_pb.WorkspaceDownloadURLRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + public workspaceDownloadURL( + request: workspace_pb.WorkspaceDownloadURLRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceDownloadURLResponse) => void, + ): grpc.ClientUnaryCall; + public deleteWorkspace( + request: workspace_pb.DeleteWorkspaceRequest, + callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void, + ): grpc.ClientUnaryCall; + public deleteWorkspace( + request: workspace_pb.DeleteWorkspaceRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void, + ): grpc.ClientUnaryCall; + public deleteWorkspace( + request: workspace_pb.DeleteWorkspaceRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: workspace_pb.DeleteWorkspaceResponse) => void, + ): grpc.ClientUnaryCall; + public workspaceSnapshotExists( + request: workspace_pb.WorkspaceSnapshotExistsRequest, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void, + ): grpc.ClientUnaryCall; + public workspaceSnapshotExists( + request: workspace_pb.WorkspaceSnapshotExistsRequest, + metadata: grpc.Metadata, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void, + ): grpc.ClientUnaryCall; + public workspaceSnapshotExists( + request: workspace_pb.WorkspaceSnapshotExistsRequest, + metadata: grpc.Metadata, + options: Partial, + callback: (error: grpc.ServiceError | null, response: workspace_pb.WorkspaceSnapshotExistsResponse) => void, + ): grpc.ClientUnaryCall; } diff --git a/components/content-service-api/typescript/src/workspace_grpc_pb.js b/components/content-service-api/typescript/src/workspace_grpc_pb.js index 7cd1698e94f127..1f9d9cd3b3d899 100644 --- a/components/content-service-api/typescript/src/workspace_grpc_pb.js +++ b/components/content-service-api/typescript/src/workspace_grpc_pb.js @@ -75,10 +75,9 @@ function deserialize_contentservice_WorkspaceSnapshotExistsResponse(buffer_arg) return workspace_pb.WorkspaceSnapshotExistsResponse.deserializeBinary(new Uint8Array(buffer_arg)); } - -var WorkspaceServiceService = exports.WorkspaceServiceService = { +var WorkspaceServiceService = (exports.WorkspaceServiceService = { // WorkspaceDownloadURL provides a URL from where the content of a workspace can be downloaded from -workspaceDownloadURL: { + workspaceDownloadURL: { path: '/contentservice.WorkspaceService/WorkspaceDownloadURL', requestStream: false, responseStream: false, @@ -90,7 +89,7 @@ workspaceDownloadURL: { responseDeserialize: deserialize_contentservice_WorkspaceDownloadURLResponse, }, // DeleteWorkspace deletes the content of a single workspace -deleteWorkspace: { + deleteWorkspace: { path: '/contentservice.WorkspaceService/DeleteWorkspace', requestStream: false, responseStream: false, @@ -102,7 +101,7 @@ deleteWorkspace: { responseDeserialize: deserialize_contentservice_DeleteWorkspaceResponse, }, // WorkspaceSnapshotExists checks whether the snapshot exists or not -workspaceSnapshotExists: { + workspaceSnapshotExists: { path: '/contentservice.WorkspaceService/WorkspaceSnapshotExists', requestStream: false, responseStream: false, @@ -113,6 +112,6 @@ workspaceSnapshotExists: { responseSerialize: serialize_contentservice_WorkspaceSnapshotExistsResponse, responseDeserialize: deserialize_contentservice_WorkspaceSnapshotExistsResponse, }, -}; +}); exports.WorkspaceServiceClient = grpc.makeGenericClientConstructor(WorkspaceServiceService); diff --git a/components/content-service-api/typescript/src/workspace_pb.d.ts b/components/content-service-api/typescript/src/workspace_pb.d.ts index 3bf3816e1ffcc2..f98fbeae7edf7a 100644 --- a/components/content-service-api/typescript/src/workspace_pb.d.ts +++ b/components/content-service-api/typescript/src/workspace_pb.d.ts @@ -10,136 +10,158 @@ /* tslint:disable */ /* eslint-disable */ -import * as jspb from "google-protobuf"; +import * as jspb from 'google-protobuf'; export class WorkspaceDownloadURLRequest extends jspb.Message { - getOwnerId(): string; - setOwnerId(value: string): WorkspaceDownloadURLRequest; - getWorkspaceId(): string; - setWorkspaceId(value: string): WorkspaceDownloadURLRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): WorkspaceDownloadURLRequest.AsObject; - static toObject(includeInstance: boolean, msg: WorkspaceDownloadURLRequest): WorkspaceDownloadURLRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: WorkspaceDownloadURLRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): WorkspaceDownloadURLRequest; - static deserializeBinaryFromReader(message: WorkspaceDownloadURLRequest, reader: jspb.BinaryReader): WorkspaceDownloadURLRequest; + getOwnerId(): string; + setOwnerId(value: string): WorkspaceDownloadURLRequest; + getWorkspaceId(): string; + setWorkspaceId(value: string): WorkspaceDownloadURLRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WorkspaceDownloadURLRequest.AsObject; + static toObject(includeInstance: boolean, msg: WorkspaceDownloadURLRequest): WorkspaceDownloadURLRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: WorkspaceDownloadURLRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WorkspaceDownloadURLRequest; + static deserializeBinaryFromReader( + message: WorkspaceDownloadURLRequest, + reader: jspb.BinaryReader, + ): WorkspaceDownloadURLRequest; } export namespace WorkspaceDownloadURLRequest { - export type AsObject = { - ownerId: string, - workspaceId: string, - } + export type AsObject = { + ownerId: string; + workspaceId: string; + }; } export class WorkspaceDownloadURLResponse extends jspb.Message { - getUrl(): string; - setUrl(value: string): WorkspaceDownloadURLResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): WorkspaceDownloadURLResponse.AsObject; - static toObject(includeInstance: boolean, msg: WorkspaceDownloadURLResponse): WorkspaceDownloadURLResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: WorkspaceDownloadURLResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): WorkspaceDownloadURLResponse; - static deserializeBinaryFromReader(message: WorkspaceDownloadURLResponse, reader: jspb.BinaryReader): WorkspaceDownloadURLResponse; + getUrl(): string; + setUrl(value: string): WorkspaceDownloadURLResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WorkspaceDownloadURLResponse.AsObject; + static toObject(includeInstance: boolean, msg: WorkspaceDownloadURLResponse): WorkspaceDownloadURLResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: WorkspaceDownloadURLResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WorkspaceDownloadURLResponse; + static deserializeBinaryFromReader( + message: WorkspaceDownloadURLResponse, + reader: jspb.BinaryReader, + ): WorkspaceDownloadURLResponse; } export namespace WorkspaceDownloadURLResponse { - export type AsObject = { - url: string, - } + export type AsObject = { + url: string; + }; } export class DeleteWorkspaceRequest extends jspb.Message { - getOwnerId(): string; - setOwnerId(value: string): DeleteWorkspaceRequest; - getWorkspaceId(): string; - setWorkspaceId(value: string): DeleteWorkspaceRequest; - getIncludeSnapshots(): boolean; - setIncludeSnapshots(value: boolean): DeleteWorkspaceRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DeleteWorkspaceRequest.AsObject; - static toObject(includeInstance: boolean, msg: DeleteWorkspaceRequest): DeleteWorkspaceRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: DeleteWorkspaceRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DeleteWorkspaceRequest; - static deserializeBinaryFromReader(message: DeleteWorkspaceRequest, reader: jspb.BinaryReader): DeleteWorkspaceRequest; + getOwnerId(): string; + setOwnerId(value: string): DeleteWorkspaceRequest; + getWorkspaceId(): string; + setWorkspaceId(value: string): DeleteWorkspaceRequest; + getIncludeSnapshots(): boolean; + setIncludeSnapshots(value: boolean): DeleteWorkspaceRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DeleteWorkspaceRequest.AsObject; + static toObject(includeInstance: boolean, msg: DeleteWorkspaceRequest): DeleteWorkspaceRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: DeleteWorkspaceRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DeleteWorkspaceRequest; + static deserializeBinaryFromReader( + message: DeleteWorkspaceRequest, + reader: jspb.BinaryReader, + ): DeleteWorkspaceRequest; } export namespace DeleteWorkspaceRequest { - export type AsObject = { - ownerId: string, - workspaceId: string, - includeSnapshots: boolean, - } + export type AsObject = { + ownerId: string; + workspaceId: string; + includeSnapshots: boolean; + }; } export class DeleteWorkspaceResponse extends jspb.Message { - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): DeleteWorkspaceResponse.AsObject; - static toObject(includeInstance: boolean, msg: DeleteWorkspaceResponse): DeleteWorkspaceResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: DeleteWorkspaceResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): DeleteWorkspaceResponse; - static deserializeBinaryFromReader(message: DeleteWorkspaceResponse, reader: jspb.BinaryReader): DeleteWorkspaceResponse; + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): DeleteWorkspaceResponse.AsObject; + static toObject(includeInstance: boolean, msg: DeleteWorkspaceResponse): DeleteWorkspaceResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: DeleteWorkspaceResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): DeleteWorkspaceResponse; + static deserializeBinaryFromReader( + message: DeleteWorkspaceResponse, + reader: jspb.BinaryReader, + ): DeleteWorkspaceResponse; } export namespace DeleteWorkspaceResponse { - export type AsObject = { - } + export type AsObject = {}; } export class WorkspaceSnapshotExistsRequest extends jspb.Message { - getOwnerId(): string; - setOwnerId(value: string): WorkspaceSnapshotExistsRequest; - getWorkspaceId(): string; - setWorkspaceId(value: string): WorkspaceSnapshotExistsRequest; - getFilename(): string; - setFilename(value: string): WorkspaceSnapshotExistsRequest; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): WorkspaceSnapshotExistsRequest.AsObject; - static toObject(includeInstance: boolean, msg: WorkspaceSnapshotExistsRequest): WorkspaceSnapshotExistsRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: WorkspaceSnapshotExistsRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): WorkspaceSnapshotExistsRequest; - static deserializeBinaryFromReader(message: WorkspaceSnapshotExistsRequest, reader: jspb.BinaryReader): WorkspaceSnapshotExistsRequest; + getOwnerId(): string; + setOwnerId(value: string): WorkspaceSnapshotExistsRequest; + getWorkspaceId(): string; + setWorkspaceId(value: string): WorkspaceSnapshotExistsRequest; + getFilename(): string; + setFilename(value: string): WorkspaceSnapshotExistsRequest; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WorkspaceSnapshotExistsRequest.AsObject; + static toObject( + includeInstance: boolean, + msg: WorkspaceSnapshotExistsRequest, + ): WorkspaceSnapshotExistsRequest.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: WorkspaceSnapshotExistsRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WorkspaceSnapshotExistsRequest; + static deserializeBinaryFromReader( + message: WorkspaceSnapshotExistsRequest, + reader: jspb.BinaryReader, + ): WorkspaceSnapshotExistsRequest; } export namespace WorkspaceSnapshotExistsRequest { - export type AsObject = { - ownerId: string, - workspaceId: string, - filename: string, - } + export type AsObject = { + ownerId: string; + workspaceId: string; + filename: string; + }; } export class WorkspaceSnapshotExistsResponse extends jspb.Message { - getExists(): boolean; - setExists(value: boolean): WorkspaceSnapshotExistsResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): WorkspaceSnapshotExistsResponse.AsObject; - static toObject(includeInstance: boolean, msg: WorkspaceSnapshotExistsResponse): WorkspaceSnapshotExistsResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: WorkspaceSnapshotExistsResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): WorkspaceSnapshotExistsResponse; - static deserializeBinaryFromReader(message: WorkspaceSnapshotExistsResponse, reader: jspb.BinaryReader): WorkspaceSnapshotExistsResponse; + getExists(): boolean; + setExists(value: boolean): WorkspaceSnapshotExistsResponse; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): WorkspaceSnapshotExistsResponse.AsObject; + static toObject( + includeInstance: boolean, + msg: WorkspaceSnapshotExistsResponse, + ): WorkspaceSnapshotExistsResponse.AsObject; + static extensions: { [key: number]: jspb.ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: jspb.ExtensionFieldBinaryInfo }; + static serializeBinaryToWriter(message: WorkspaceSnapshotExistsResponse, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): WorkspaceSnapshotExistsResponse; + static deserializeBinaryFromReader( + message: WorkspaceSnapshotExistsResponse, + reader: jspb.BinaryReader, + ): WorkspaceSnapshotExistsResponse; } export namespace WorkspaceSnapshotExistsResponse { - export type AsObject = { - exists: boolean, - } + export type AsObject = { + exists: boolean; + }; } diff --git a/components/content-service-api/typescript/src/workspace_pb.js b/components/content-service-api/typescript/src/workspace_pb.js index cc954dfd5b9df8..19be115394db83 100644 --- a/components/content-service-api/typescript/src/workspace_pb.js +++ b/components/content-service-api/typescript/src/workspace_pb.js @@ -19,13 +19,21 @@ var jspb = require('google-protobuf'); var goog = jspb; -var global = (function() { - if (this) { return this; } - if (typeof window !== 'undefined') { return window; } - if (typeof global !== 'undefined') { return global; } - if (typeof self !== 'undefined') { return self; } +var global = function () { + if (this) { + return this; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + if (typeof self !== 'undefined') { + return self; + } return Function('return this')(); -}.call(null)); +}.call(null); goog.exportSymbol('proto.contentservice.DeleteWorkspaceRequest', null, global); goog.exportSymbol('proto.contentservice.DeleteWorkspaceResponse', null, global); @@ -43,7 +51,7 @@ goog.exportSymbol('proto.contentservice.WorkspaceSnapshotExistsResponse', null, * @extends {jspb.Message} * @constructor */ -proto.contentservice.WorkspaceDownloadURLRequest = function(opt_data) { +proto.contentservice.WorkspaceDownloadURLRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.WorkspaceDownloadURLRequest, jspb.Message); @@ -64,7 +72,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.WorkspaceDownloadURLResponse = function(opt_data) { +proto.contentservice.WorkspaceDownloadURLResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.WorkspaceDownloadURLResponse, jspb.Message); @@ -85,7 +93,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.DeleteWorkspaceRequest = function(opt_data) { +proto.contentservice.DeleteWorkspaceRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.DeleteWorkspaceRequest, jspb.Message); @@ -106,7 +114,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.DeleteWorkspaceResponse = function(opt_data) { +proto.contentservice.DeleteWorkspaceResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.DeleteWorkspaceResponse, jspb.Message); @@ -127,7 +135,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.WorkspaceSnapshotExistsRequest = function(opt_data) { +proto.contentservice.WorkspaceSnapshotExistsRequest = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.WorkspaceSnapshotExistsRequest, jspb.Message); @@ -136,7 +144,8 @@ if (goog.DEBUG && !COMPILED) { * @public * @override */ - proto.contentservice.WorkspaceSnapshotExistsRequest.displayName = 'proto.contentservice.WorkspaceSnapshotExistsRequest'; + proto.contentservice.WorkspaceSnapshotExistsRequest.displayName = + 'proto.contentservice.WorkspaceSnapshotExistsRequest'; } /** * Generated by JsPbCodeGenerator. @@ -148,7 +157,7 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.contentservice.WorkspaceSnapshotExistsResponse = function(opt_data) { +proto.contentservice.WorkspaceSnapshotExistsResponse = function (opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.contentservice.WorkspaceSnapshotExistsResponse, jspb.Message); @@ -157,64 +166,61 @@ if (goog.DEBUG && !COMPILED) { * @public * @override */ - proto.contentservice.WorkspaceSnapshotExistsResponse.displayName = 'proto.contentservice.WorkspaceSnapshotExistsResponse'; + proto.contentservice.WorkspaceSnapshotExistsResponse.displayName = + 'proto.contentservice.WorkspaceSnapshotExistsResponse'; } - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.WorkspaceDownloadURLRequest.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.WorkspaceDownloadURLRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.WorkspaceDownloadURLRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.WorkspaceDownloadURLRequest.toObject = function(includeInstance, msg) { - var f, obj = { - ownerId: jspb.Message.getFieldWithDefault(msg, 1, ""), - workspaceId: jspb.Message.getFieldWithDefault(msg, 2, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.WorkspaceDownloadURLRequest.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.WorkspaceDownloadURLRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.WorkspaceDownloadURLRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.WorkspaceDownloadURLRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + ownerId: jspb.Message.getFieldWithDefault(msg, 1, ''), + workspaceId: jspb.Message.getFieldWithDefault(msg, 2, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.WorkspaceDownloadURLRequest} */ -proto.contentservice.WorkspaceDownloadURLRequest.deserializeBinary = function(bytes) { +proto.contentservice.WorkspaceDownloadURLRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.WorkspaceDownloadURLRequest; + var msg = new proto.contentservice.WorkspaceDownloadURLRequest(); return proto.contentservice.WorkspaceDownloadURLRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -222,41 +228,39 @@ proto.contentservice.WorkspaceDownloadURLRequest.deserializeBinary = function(by * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.WorkspaceDownloadURLRequest} */ -proto.contentservice.WorkspaceDownloadURLRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.WorkspaceDownloadURLRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setOwnerId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setWorkspaceId(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setOwnerId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setWorkspaceId(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.WorkspaceDownloadURLRequest.prototype.serializeBinary = function() { +proto.contentservice.WorkspaceDownloadURLRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.WorkspaceDownloadURLRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -264,116 +268,100 @@ proto.contentservice.WorkspaceDownloadURLRequest.prototype.serializeBinary = fun * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.WorkspaceDownloadURLRequest.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.WorkspaceDownloadURLRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getOwnerId(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getWorkspaceId(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } }; - /** * optional string owner_id = 1; * @return {string} */ -proto.contentservice.WorkspaceDownloadURLRequest.prototype.getOwnerId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.WorkspaceDownloadURLRequest.prototype.getOwnerId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.WorkspaceDownloadURLRequest} returns this */ -proto.contentservice.WorkspaceDownloadURLRequest.prototype.setOwnerId = function(value) { +proto.contentservice.WorkspaceDownloadURLRequest.prototype.setOwnerId = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string workspace_id = 2; * @return {string} */ -proto.contentservice.WorkspaceDownloadURLRequest.prototype.getWorkspaceId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.WorkspaceDownloadURLRequest.prototype.getWorkspaceId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.WorkspaceDownloadURLRequest} returns this */ -proto.contentservice.WorkspaceDownloadURLRequest.prototype.setWorkspaceId = function(value) { +proto.contentservice.WorkspaceDownloadURLRequest.prototype.setWorkspaceId = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.WorkspaceDownloadURLResponse.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.WorkspaceDownloadURLResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.WorkspaceDownloadURLResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.WorkspaceDownloadURLResponse.toObject = function(includeInstance, msg) { - var f, obj = { - url: jspb.Message.getFieldWithDefault(msg, 1, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.WorkspaceDownloadURLResponse.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.WorkspaceDownloadURLResponse.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.WorkspaceDownloadURLResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.WorkspaceDownloadURLResponse.toObject = function (includeInstance, msg) { + var f, + obj = { + url: jspb.Message.getFieldWithDefault(msg, 1, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.WorkspaceDownloadURLResponse} */ -proto.contentservice.WorkspaceDownloadURLResponse.deserializeBinary = function(bytes) { +proto.contentservice.WorkspaceDownloadURLResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.WorkspaceDownloadURLResponse; + var msg = new proto.contentservice.WorkspaceDownloadURLResponse(); return proto.contentservice.WorkspaceDownloadURLResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -381,37 +369,35 @@ proto.contentservice.WorkspaceDownloadURLResponse.deserializeBinary = function(b * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.WorkspaceDownloadURLResponse} */ -proto.contentservice.WorkspaceDownloadURLResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.WorkspaceDownloadURLResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setUrl(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUrl(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.WorkspaceDownloadURLResponse.prototype.serializeBinary = function() { +proto.contentservice.WorkspaceDownloadURLResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.WorkspaceDownloadURLResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -419,93 +405,82 @@ proto.contentservice.WorkspaceDownloadURLResponse.prototype.serializeBinary = fu * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.WorkspaceDownloadURLResponse.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.WorkspaceDownloadURLResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getUrl(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } }; - /** * optional string url = 1; * @return {string} */ -proto.contentservice.WorkspaceDownloadURLResponse.prototype.getUrl = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.WorkspaceDownloadURLResponse.prototype.getUrl = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.WorkspaceDownloadURLResponse} returns this */ -proto.contentservice.WorkspaceDownloadURLResponse.prototype.setUrl = function(value) { +proto.contentservice.WorkspaceDownloadURLResponse.prototype.setUrl = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.DeleteWorkspaceRequest.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.DeleteWorkspaceRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.DeleteWorkspaceRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.DeleteWorkspaceRequest.toObject = function(includeInstance, msg) { - var f, obj = { - ownerId: jspb.Message.getFieldWithDefault(msg, 1, ""), - workspaceId: jspb.Message.getFieldWithDefault(msg, 2, ""), - includeSnapshots: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.DeleteWorkspaceRequest.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.DeleteWorkspaceRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.DeleteWorkspaceRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.DeleteWorkspaceRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + ownerId: jspb.Message.getFieldWithDefault(msg, 1, ''), + workspaceId: jspb.Message.getFieldWithDefault(msg, 2, ''), + includeSnapshots: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.DeleteWorkspaceRequest} */ -proto.contentservice.DeleteWorkspaceRequest.deserializeBinary = function(bytes) { +proto.contentservice.DeleteWorkspaceRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.DeleteWorkspaceRequest; + var msg = new proto.contentservice.DeleteWorkspaceRequest(); return proto.contentservice.DeleteWorkspaceRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -513,45 +488,43 @@ proto.contentservice.DeleteWorkspaceRequest.deserializeBinary = function(bytes) * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.DeleteWorkspaceRequest} */ -proto.contentservice.DeleteWorkspaceRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.DeleteWorkspaceRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setOwnerId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setWorkspaceId(value); - break; - case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setIncludeSnapshots(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setOwnerId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setWorkspaceId(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setIncludeSnapshots(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.DeleteWorkspaceRequest.prototype.serializeBinary = function() { +proto.contentservice.DeleteWorkspaceRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.DeleteWorkspaceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -559,141 +532,118 @@ proto.contentservice.DeleteWorkspaceRequest.prototype.serializeBinary = function * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.DeleteWorkspaceRequest.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.DeleteWorkspaceRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getOwnerId(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getWorkspaceId(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } f = message.getIncludeSnapshots(); if (f) { - writer.writeBool( - 3, - f - ); + writer.writeBool(3, f); } }; - /** * optional string owner_id = 1; * @return {string} */ -proto.contentservice.DeleteWorkspaceRequest.prototype.getOwnerId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.DeleteWorkspaceRequest.prototype.getOwnerId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.DeleteWorkspaceRequest} returns this */ -proto.contentservice.DeleteWorkspaceRequest.prototype.setOwnerId = function(value) { +proto.contentservice.DeleteWorkspaceRequest.prototype.setOwnerId = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string workspace_id = 2; * @return {string} */ -proto.contentservice.DeleteWorkspaceRequest.prototype.getWorkspaceId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.DeleteWorkspaceRequest.prototype.getWorkspaceId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.DeleteWorkspaceRequest} returns this */ -proto.contentservice.DeleteWorkspaceRequest.prototype.setWorkspaceId = function(value) { +proto.contentservice.DeleteWorkspaceRequest.prototype.setWorkspaceId = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - /** * optional bool include_snapshots = 3; * @return {boolean} */ -proto.contentservice.DeleteWorkspaceRequest.prototype.getIncludeSnapshots = function() { +proto.contentservice.DeleteWorkspaceRequest.prototype.getIncludeSnapshots = function () { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; - /** * @param {boolean} value * @return {!proto.contentservice.DeleteWorkspaceRequest} returns this */ -proto.contentservice.DeleteWorkspaceRequest.prototype.setIncludeSnapshots = function(value) { +proto.contentservice.DeleteWorkspaceRequest.prototype.setIncludeSnapshots = function (value) { return jspb.Message.setProto3BooleanField(this, 3, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.DeleteWorkspaceResponse.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.DeleteWorkspaceResponse.toObject(opt_includeInstance, this); -}; - + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.DeleteWorkspaceResponse.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.DeleteWorkspaceResponse.toObject(opt_includeInstance, this); + }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.DeleteWorkspaceResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.DeleteWorkspaceResponse.toObject = function(includeInstance, msg) { - var f, obj = { + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.DeleteWorkspaceResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.DeleteWorkspaceResponse.toObject = function (includeInstance, msg) { + var f, + obj = {}; + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.DeleteWorkspaceResponse} */ -proto.contentservice.DeleteWorkspaceResponse.deserializeBinary = function(bytes) { +proto.contentservice.DeleteWorkspaceResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.DeleteWorkspaceResponse; + var msg = new proto.contentservice.DeleteWorkspaceResponse(); return proto.contentservice.DeleteWorkspaceResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -701,33 +651,31 @@ proto.contentservice.DeleteWorkspaceResponse.deserializeBinary = function(bytes) * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.DeleteWorkspaceResponse} */ -proto.contentservice.DeleteWorkspaceResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.DeleteWorkspaceResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - default: - reader.skipField(); - break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.DeleteWorkspaceResponse.prototype.serializeBinary = function() { +proto.contentservice.DeleteWorkspaceResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.DeleteWorkspaceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -735,68 +683,62 @@ proto.contentservice.DeleteWorkspaceResponse.prototype.serializeBinary = functio * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.DeleteWorkspaceResponse.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.DeleteWorkspaceResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.WorkspaceSnapshotExistsRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.WorkspaceSnapshotExistsRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.WorkspaceSnapshotExistsRequest.toObject = function(includeInstance, msg) { - var f, obj = { - ownerId: jspb.Message.getFieldWithDefault(msg, 1, ""), - workspaceId: jspb.Message.getFieldWithDefault(msg, 2, ""), - filename: jspb.Message.getFieldWithDefault(msg, 3, "") + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.WorkspaceSnapshotExistsRequest.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.WorkspaceSnapshotExistsRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.WorkspaceSnapshotExistsRequest.toObject = function (includeInstance, msg) { + var f, + obj = { + ownerId: jspb.Message.getFieldWithDefault(msg, 1, ''), + workspaceId: jspb.Message.getFieldWithDefault(msg, 2, ''), + filename: jspb.Message.getFieldWithDefault(msg, 3, ''), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.WorkspaceSnapshotExistsRequest} */ -proto.contentservice.WorkspaceSnapshotExistsRequest.deserializeBinary = function(bytes) { +proto.contentservice.WorkspaceSnapshotExistsRequest.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.WorkspaceSnapshotExistsRequest; + var msg = new proto.contentservice.WorkspaceSnapshotExistsRequest(); return proto.contentservice.WorkspaceSnapshotExistsRequest.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -804,45 +746,43 @@ proto.contentservice.WorkspaceSnapshotExistsRequest.deserializeBinary = function * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.WorkspaceSnapshotExistsRequest} */ -proto.contentservice.WorkspaceSnapshotExistsRequest.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.WorkspaceSnapshotExistsRequest.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setOwnerId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setWorkspaceId(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setFilename(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setOwnerId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setWorkspaceId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setFilename(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.serializeBinary = function() { +proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.WorkspaceSnapshotExistsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -850,141 +790,120 @@ proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.serializeBinary = * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.WorkspaceSnapshotExistsRequest.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.WorkspaceSnapshotExistsRequest.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getOwnerId(); if (f.length > 0) { - writer.writeString( - 1, - f - ); + writer.writeString(1, f); } f = message.getWorkspaceId(); if (f.length > 0) { - writer.writeString( - 2, - f - ); + writer.writeString(2, f); } f = message.getFilename(); if (f.length > 0) { - writer.writeString( - 3, - f - ); + writer.writeString(3, f); } }; - /** * optional string owner_id = 1; * @return {string} */ -proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.getOwnerId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.getOwnerId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, '')); }; - /** * @param {string} value * @return {!proto.contentservice.WorkspaceSnapshotExistsRequest} returns this */ -proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.setOwnerId = function(value) { +proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.setOwnerId = function (value) { return jspb.Message.setProto3StringField(this, 1, value); }; - /** * optional string workspace_id = 2; * @return {string} */ -proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.getWorkspaceId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.getWorkspaceId = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, '')); }; - /** * @param {string} value * @return {!proto.contentservice.WorkspaceSnapshotExistsRequest} returns this */ -proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.setWorkspaceId = function(value) { +proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.setWorkspaceId = function (value) { return jspb.Message.setProto3StringField(this, 2, value); }; - /** * optional string filename = 3; * @return {string} */ -proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.getFilename = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.getFilename = function () { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, '')); }; - /** * @param {string} value * @return {!proto.contentservice.WorkspaceSnapshotExistsRequest} returns this */ -proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.setFilename = function(value) { +proto.contentservice.WorkspaceSnapshotExistsRequest.prototype.setFilename = function (value) { return jspb.Message.setProto3StringField(this, 3, value); }; - - - - if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.contentservice.WorkspaceSnapshotExistsResponse.prototype.toObject = function(opt_includeInstance) { - return proto.contentservice.WorkspaceSnapshotExistsResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.contentservice.WorkspaceSnapshotExistsResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.contentservice.WorkspaceSnapshotExistsResponse.toObject = function(includeInstance, msg) { - var f, obj = { - exists: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + /** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ + proto.contentservice.WorkspaceSnapshotExistsResponse.prototype.toObject = function (opt_includeInstance) { + return proto.contentservice.WorkspaceSnapshotExistsResponse.toObject(opt_includeInstance, this); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; + /** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.contentservice.WorkspaceSnapshotExistsResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + proto.contentservice.WorkspaceSnapshotExistsResponse.toObject = function (includeInstance, msg) { + var f, + obj = { + exists: jspb.Message.getBooleanFieldWithDefault(msg, 1, false), + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; + }; } - /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.contentservice.WorkspaceSnapshotExistsResponse} */ -proto.contentservice.WorkspaceSnapshotExistsResponse.deserializeBinary = function(bytes) { +proto.contentservice.WorkspaceSnapshotExistsResponse.deserializeBinary = function (bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.contentservice.WorkspaceSnapshotExistsResponse; + var msg = new proto.contentservice.WorkspaceSnapshotExistsResponse(); return proto.contentservice.WorkspaceSnapshotExistsResponse.deserializeBinaryFromReader(msg, reader); }; - /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. @@ -992,37 +911,35 @@ proto.contentservice.WorkspaceSnapshotExistsResponse.deserializeBinary = functio * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.contentservice.WorkspaceSnapshotExistsResponse} */ -proto.contentservice.WorkspaceSnapshotExistsResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.contentservice.WorkspaceSnapshotExistsResponse.deserializeBinaryFromReader = function (msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { - case 1: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setExists(value); - break; - default: - reader.skipField(); - break; + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setExists(value); + break; + default: + reader.skipField(); + break; } } return msg; }; - /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.contentservice.WorkspaceSnapshotExistsResponse.prototype.serializeBinary = function() { +proto.contentservice.WorkspaceSnapshotExistsResponse.prototype.serializeBinary = function () { var writer = new jspb.BinaryWriter(); proto.contentservice.WorkspaceSnapshotExistsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; - /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. @@ -1030,34 +947,28 @@ proto.contentservice.WorkspaceSnapshotExistsResponse.prototype.serializeBinary = * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.contentservice.WorkspaceSnapshotExistsResponse.serializeBinaryToWriter = function(message, writer) { +proto.contentservice.WorkspaceSnapshotExistsResponse.serializeBinaryToWriter = function (message, writer) { var f = undefined; f = message.getExists(); if (f) { - writer.writeBool( - 1, - f - ); + writer.writeBool(1, f); } }; - /** * optional bool exists = 1; * @return {boolean} */ -proto.contentservice.WorkspaceSnapshotExistsResponse.prototype.getExists = function() { +proto.contentservice.WorkspaceSnapshotExistsResponse.prototype.getExists = function () { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); }; - /** * @param {boolean} value * @return {!proto.contentservice.WorkspaceSnapshotExistsResponse} returns this */ -proto.contentservice.WorkspaceSnapshotExistsResponse.prototype.setExists = function(value) { +proto.contentservice.WorkspaceSnapshotExistsResponse.prototype.setExists = function (value) { return jspb.Message.setProto3BooleanField(this, 1, value); }; - goog.object.extend(exports, proto.contentservice); diff --git a/components/content-service-api/typescript/tsconfig.json b/components/content-service-api/typescript/tsconfig.json index aceb1f2656b4b9..74828b0718c45d 100644 --- a/components/content-service-api/typescript/tsconfig.json +++ b/components/content-service-api/typescript/tsconfig.json @@ -1,29 +1,24 @@ { - "compilerOptions": { - "rootDir": "src", - "experimentalDecorators": true, - "outDir": "lib", - "lib": [ - "es6", - "esnext.asynciterable" - ], - "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" - ] -} \ No newline at end of file + "compilerOptions": { + "rootDir": "src", + "experimentalDecorators": true, + "outDir": "lib", + "lib": ["es6", "esnext.asynciterable"], + "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"] +} diff --git a/components/content-service/pkg/layer/fixtures/full_workspace_backup.json b/components/content-service/pkg/layer/fixtures/full_workspace_backup.json index 76e62dcb62909b..d14be359e7f01f 100644 --- a/components/content-service/pkg/layer/fixtures/full_workspace_backup.json +++ b/components/content-service/pkg/layer/fixtures/full_workspace_backup.json @@ -31,4 +31,4 @@ } ] } -} \ No newline at end of file +} diff --git a/components/content-service/pkg/layer/fixtures/git_initializer.json b/components/content-service/pkg/layer/fixtures/git_initializer.json index 5183f18cefb591..f748af13e0e354 100644 --- a/components/content-service/pkg/layer/fixtures/git_initializer.json +++ b/components/content-service/pkg/layer/fixtures/git_initializer.json @@ -13,4 +13,4 @@ "type": "application/vnd.gitpod.wsfull.v1", "layers": null } -} \ No newline at end of file +} diff --git a/components/content-service/pkg/layer/fixtures/legacy_backup.json b/components/content-service/pkg/layer/fixtures/legacy_backup.json index 3603561f87787d..0e61a18b3073a2 100644 --- a/components/content-service/pkg/layer/fixtures/legacy_backup.json +++ b/components/content-service/pkg/layer/fixtures/legacy_backup.json @@ -13,4 +13,4 @@ "type": "application/vnd.gitpod.wsfull.v1", "layers": null } -} \ No newline at end of file +} diff --git a/components/dashboard/.eslintrc.js b/components/dashboard/.eslintrc.js index 8b0658d9306c4c..929a799ca77e15 100644 --- a/components/dashboard/.eslintrc.js +++ b/components/dashboard/.eslintrc.js @@ -5,9 +5,9 @@ */ module.exports = { - root: true, - extends: ['react-app'], - rules: { - "import/no-anonymous-default-export": "off", - } -} + root: true, + extends: ['react-app', 'prettier'], + rules: { + 'import/no-anonymous-default-export': 'off', + }, +}; diff --git a/components/dashboard/README.md b/components/dashboard/README.md index af11a7e1973139..3f87727b268b5e 100644 --- a/components/dashboard/README.md +++ b/components/dashboard/README.md @@ -20,13 +20,13 @@ The `App.tsx` is the entry point for the SPA and it uses React-Router to registe Pages are loaded lazily using `React.lazy` so that not everything needs to be loaded up-front but only when needed: ```ts -const Notifications = React.lazy(() => import("./account/Notifications")); -const Profile = React.lazy(() => import("./account/Profile")); -const Subscriptions = React.lazy(() => import("./account/Subscriptions")); -const DefaultIDE = React.lazy(() => import("./settings/DefaultIDE")); -const EnvVars = React.lazy(() => import("./settings/EnvVars")); -const FeaturePreview = React.lazy(() => import("./settings/FeaturePreview")); -const GitIntegration = React.lazy(() => import("./settings/GitIntegration")); +const Notifications = React.lazy(() => import('./account/Notifications')); +const Profile = React.lazy(() => import('./account/Profile')); +const Subscriptions = React.lazy(() => import('./account/Subscriptions')); +const DefaultIDE = React.lazy(() => import('./settings/DefaultIDE')); +const EnvVars = React.lazy(() => import('./settings/EnvVars')); +const FeaturePreview = React.lazy(() => import('./settings/FeaturePreview')); +const GitIntegration = React.lazy(() => import('./settings/GitIntegration')); ``` Global state is passed through `React.Context`. @@ -98,4 +98,4 @@ When the dashboard app is up and running, open another terminal and launch Cypre yarn test:integration:run ``` -You should see Cypress running in the terminal. \ No newline at end of file +You should see Cypress running in the terminal. diff --git a/components/dashboard/craco.config.js b/components/dashboard/craco.config.js index 435ef4fc8911a5..bc4d666e768436 100644 --- a/components/dashboard/craco.config.js +++ b/components/dashboard/craco.config.js @@ -7,7 +7,7 @@ module.exports = { style: { postcss: { - plugins: [require("tailwindcss"), require("autoprefixer")], + plugins: [require('tailwindcss'), require('autoprefixer')], }, }, }; diff --git a/components/dashboard/cypress/fixtures/profile.json b/components/dashboard/cypress/fixtures/profile.json index b6c355ca5c5b9a..a95e88f9cb7049 100644 --- a/components/dashboard/cypress/fixtures/profile.json +++ b/components/dashboard/cypress/fixtures/profile.json @@ -2,4 +2,4 @@ "id": 8739, "name": "Jane", "email": "jane@example.com" -} \ No newline at end of file +} diff --git a/components/dashboard/cypress/fixtures/users.json b/components/dashboard/cypress/fixtures/users.json index 79b699aa772428..82a0056b3b1e8c 100644 --- a/components/dashboard/cypress/fixtures/users.json +++ b/components/dashboard/cypress/fixtures/users.json @@ -229,4 +229,4 @@ "bs": "target end-to-end models" } } -] \ No newline at end of file +] diff --git a/components/dashboard/cypress/integration/app.spec.ts b/components/dashboard/cypress/integration/app.spec.ts index c277560560bd5f..bb98295e2bde1e 100644 --- a/components/dashboard/cypress/integration/app.spec.ts +++ b/components/dashboard/cypress/integration/app.spec.ts @@ -5,18 +5,29 @@ import { workspacesPathMain } from '../../src/workspaces/workspaces.routes'; describe('The app', () => { before(() => { cy.visit('/'); - }) + }); it('should load and start from the Workspaces page', () => { - cy.location("pathname").should("eq", workspacesPathMain); + cy.location('pathname').should('eq', workspacesPathMain); cy.findByRole('heading', { name: /Workspaces/i, level: 1 }).should('exist'); cy.findAllByRole('navigation').last().as('sections').findAllByRole('link').should('have.length', 3); - cy.get("@sections").findByText(/Workspaces/i).as('workspacesTab').should('exist'); - cy.get('@sections').findByText(/Projects/i).as('projectsTab').should('exist'); - cy.get("@sections").findByText(/Settings/i).as('settingsTab').should('exist'); + cy.get('@sections') + .findByText(/Workspaces/i) + .as('workspacesTab') + .should('exist'); + + cy.get('@sections') + .findByText(/Projects/i) + .as('projectsTab') + .should('exist'); + + cy.get('@sections') + .findByText(/Settings/i) + .as('settingsTab') + .should('exist'); cy.get('@projectsTab').click(); cy.location('pathname').should('eq', projectsPathMain); @@ -29,8 +40,8 @@ describe('The app', () => { // TODO complete checks about the general layout of the app. // The "Workspaces" page will have its own spec file. - }) -}) + }); +}); // This empty export is due to `"isolatedModules": true` in the main `tsconfig.json` 🤷🏻 -export {} \ No newline at end of file +export {}; diff --git a/components/dashboard/cypress/plugins/index.js b/components/dashboard/cypress/plugins/index.js index 59b2bab6e4e605..8229063adc1fda 100644 --- a/components/dashboard/cypress/plugins/index.js +++ b/components/dashboard/cypress/plugins/index.js @@ -19,4 +19,4 @@ module.exports = (on, config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config -} +}; diff --git a/components/dashboard/cypress/support/commands.js b/components/dashboard/cypress/support/commands.js index 81f1958040b24f..e89f2b3925f75a 100644 --- a/components/dashboard/cypress/support/commands.js +++ b/components/dashboard/cypress/support/commands.js @@ -24,4 +24,4 @@ // -- This will overwrite an existing command -- // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) -import "@testing-library/cypress/add-commands"; +import '@testing-library/cypress/add-commands'; diff --git a/components/dashboard/cypress/support/index.js b/components/dashboard/cypress/support/index.js index d68db96df2697e..37a498fb5bf395 100644 --- a/components/dashboard/cypress/support/index.js +++ b/components/dashboard/cypress/support/index.js @@ -14,7 +14,7 @@ // *********************************************************** // Import commands.js using ES2015 syntax: -import './commands' +import './commands'; // Alternatively you can use CommonJS syntax: // require('./commands') diff --git a/components/dashboard/cypress/tsconfig.json b/components/dashboard/cypress/tsconfig.json index 1cd8d86180de00..190e8643e3aefc 100644 --- a/components/dashboard/cypress/tsconfig.json +++ b/components/dashboard/cypress/tsconfig.json @@ -1,16 +1,10 @@ { - "extends": "../tsconfig.json", - "compilerOptions": { - "noEmit": true, - // be explicit about types included - // to avoid clashing with Jest types - "types": [ - "cypress", - "@testing-library/cypress" - ] - }, - "include": [ - "../node_modules/cypress", - "./**/*.ts" - ] -} \ No newline at end of file + "extends": "../tsconfig.json", + "compilerOptions": { + "noEmit": true, + // be explicit about types included + // to avoid clashing with Jest types + "types": ["cypress", "@testing-library/cypress"] + }, + "include": ["../node_modules/cypress", "./**/*.ts"] +} diff --git a/components/dashboard/package.json b/components/dashboard/package.json index b6a3b3f7d041e8..222c14768c0161 100644 --- a/components/dashboard/package.json +++ b/components/dashboard/package.json @@ -37,6 +37,7 @@ "classnames": "^2.3.1", "cypress": "^9.2.1", "eslint": "^7.24.0", + "eslint-config-prettier": "^8.3.0", "eslint-config-react-app": "^6.0.0", "postcss": "^7.0.36", "react-scripts": "^4.0.3", diff --git a/components/dashboard/postcss.config.js b/components/dashboard/postcss.config.js index 03dd67a4644cab..f89a862dcc8bae 100644 --- a/components/dashboard/postcss.config.js +++ b/components/dashboard/postcss.config.js @@ -5,8 +5,8 @@ */ module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {} - } -} \ No newline at end of file + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/components/dashboard/public/complete-auth/index.html b/components/dashboard/public/complete-auth/index.html index c2478233670782..86269408fc2ed3 100644 --- a/components/dashboard/public/complete-auth/index.html +++ b/components/dashboard/public/complete-auth/index.html @@ -6,24 +6,25 @@ --> - - + + Done - - - If this tab is not closed automatically, feel free to close it and proceed. - - \ No newline at end of file + + + If this tab is not closed automatically, feel free to close it and proceed. + + + diff --git a/components/dashboard/public/index.html b/components/dashboard/public/index.html index 4e35091e609647..500fbcf7e8a4c0 100644 --- a/components/dashboard/public/index.html +++ b/components/dashboard/public/index.html @@ -11,10 +11,7 @@ - + Dashboard — Gitpod diff --git a/components/dashboard/public/tos/index.html b/components/dashboard/public/tos/index.html index fcc3b5c957e81c..b961b7e7d158b5 100644 --- a/components/dashboard/public/tos/index.html +++ b/components/dashboard/public/tos/index.html @@ -6,20 +6,18 @@ --> - - + + Terms of Service - - - -
-
- - - -
+ + + +
+
+ + + +
- - \ No newline at end of file + + diff --git a/components/dashboard/src/Analytics.tsx b/components/dashboard/src/Analytics.tsx index 11831cafcaa0f7..771688827cbfed 100644 --- a/components/dashboard/src/Analytics.tsx +++ b/components/dashboard/src/Analytics.tsx @@ -4,56 +4,48 @@ * See License-AGPL.txt in the project root for license information. */ -import { getGitpodService } from "./service/service"; -import { log } from "@gitpod/gitpod-protocol/lib/util/logging"; -import Cookies from "js-cookie"; -import { v4 } from "uuid"; -import { Experiment } from "./experiments"; - - -export type Event = "invite_url_requested" | "organisation_authorised"; -type InternalEvent = Event | "path_changed" | "dashboard_clicked"; - -export type EventProperties = - TrackOrgAuthorised - | TrackInviteUrlRequested -; -type InternalEventProperties = TrackUIExperiments & ( - EventProperties - | TrackDashboardClick - | TrackPathChanged -); +import { getGitpodService } from './service/service'; +import { log } from '@gitpod/gitpod-protocol/lib/util/logging'; +import Cookies from 'js-cookie'; +import { v4 } from 'uuid'; +import { Experiment } from './experiments'; + +export type Event = 'invite_url_requested' | 'organisation_authorised'; +type InternalEvent = Event | 'path_changed' | 'dashboard_clicked'; + +export type EventProperties = TrackOrgAuthorised | TrackInviteUrlRequested; +type InternalEventProperties = TrackUIExperiments & (EventProperties | TrackDashboardClick | TrackPathChanged); export interface TrackOrgAuthorised { - installation_id: string, - setup_action: string | undefined, + installation_id: string; + setup_action: string | undefined; } export interface TrackInviteUrlRequested { - invite_url: string, + invite_url: string; } interface TrackDashboardClick { - dnt?: boolean, - path: string, - button_type?: string, - label?: string, - destination?: string, -}; + dnt?: boolean; + path: string; + button_type?: string; + label?: string; + destination?: string; +} interface TrackPathChanged { - prev: string, - path: string, + prev: string; + path: string; } interface TrackUIExperiments { - ui_experiments?: {}, + ui_experiments?: {}; } //call this to track all events outside of button and anchor clicks export const trackEvent = (event: Event, properties: EventProperties) => { trackEventInternal(event, properties); -} +}; const trackEventInternal = (event: InternalEvent, properties: InternalEventProperties, userKnown?: boolean) => { properties.ui_experiments = Experiment.get(); @@ -66,7 +58,10 @@ const trackEventInternal = (event: InternalEvent, properties: InternalEventPrope }); }; -export const trackButtonOrAnchor = (target: HTMLAnchorElement | HTMLButtonElement | HTMLDivElement, userKnown: boolean) => { +export const trackButtonOrAnchor = ( + target: HTMLAnchorElement | HTMLButtonElement | HTMLDivElement, + userKnown: boolean, +) => { //read manually passed analytics props from 'data-analytics' attribute of event target let passedProps: TrackDashboardClick | undefined; if (target.dataset.analytics) { @@ -78,20 +73,19 @@ export const trackButtonOrAnchor = (target: HTMLAnchorElement | HTMLButtonElemen } catch (error) { log.debug(error); } - } let trackingMsg: TrackDashboardClick = { path: window.location.pathname, - label: target.textContent || undefined + label: target.textContent || undefined, }; if (target instanceof HTMLButtonElement || target instanceof HTMLDivElement) { //parse button data - if (target.classList.contains("secondary")) { - trackingMsg.button_type = "secondary"; + if (target.classList.contains('secondary')) { + trackingMsg.button_type = 'secondary'; } else { - trackingMsg.button_type = "primary"; //primary button is the default if secondary is not specified + trackingMsg.button_type = 'primary'; //primary button is the default if secondary is not specified } //retrieve href if parent is an anchor element if (target.parentElement instanceof HTMLAnchorElement) { @@ -110,29 +104,28 @@ export const trackButtonOrAnchor = (target: HTMLAnchorElement | HTMLButtonElemen return; } const ancestorProps: TrackDashboardClick | undefined = getAncestorProps(curr.parentElement); - const currProps = JSON.parse(curr.dataset.analytics || "{}") as TrackDashboardClick; - return {...ancestorProps, ...currProps}; - } + const currProps = JSON.parse(curr.dataset.analytics || '{}') as TrackDashboardClick; + return { ...ancestorProps, ...currProps }; + }; const ancestorProps = getAncestorProps(target); //props that were passed directly to the event target take precedence over those passed to ancestor elements, which take precedence over those implicitly determined. - trackingMsg = {...trackingMsg, ...ancestorProps, ...passedProps}; + trackingMsg = { ...trackingMsg, ...ancestorProps, ...passedProps }; - trackEventInternal("dashboard_clicked", trackingMsg, userKnown); -} + trackEventInternal('dashboard_clicked', trackingMsg, userKnown); +}; //call this when the path changes. Complete page call is unnecessary for SPA after initial call export const trackPathChange = (props: TrackPathChanged) => { - trackEventInternal("path_changed", props); -} - + trackEventInternal('path_changed', props); +}; type TrackLocationProperties = TrackUIExperiments & { - referrer: string, - path: string, - host: string, - url: string, + referrer: string; + path: string; + host: string; + url: string; }; export const trackLocation = async (userKnown: boolean) => { @@ -147,18 +140,17 @@ export const trackLocation = async (userKnown: boolean) => { getGitpodService().server.trackLocation({ //if the user is authenticated, let server determine the id. else, pass anonymousId explicitly. anonymousId: userKnown ? undefined : getAnonymousId(), - properties: props + properties: props, }); -} +}; const getAnonymousId = (): string => { let anonymousId = Cookies.get('ajs_anonymous_id'); if (anonymousId) { return anonymousId.replace(/^"(.+(?="$))"$/, '$1'); //strip enclosing double quotes before returning - } - else { + } else { anonymousId = v4(); - Cookies.set('ajs_anonymous_id', anonymousId, {domain: '.'+window.location.hostname, expires: 365}); - }; + Cookies.set('ajs_anonymous_id', anonymousId, { domain: '.' + window.location.hostname, expires: 365 }); + } return anonymousId; -} \ No newline at end of file +}; diff --git a/components/dashboard/src/App.test.ts b/components/dashboard/src/App.test.ts index 6e0cc914ef389c..cda958a8a836ad 100644 --- a/components/dashboard/src/App.test.ts +++ b/components/dashboard/src/App.test.ts @@ -4,15 +4,15 @@ * See License-AGPL.txt in the project root for license information. */ -import { getURLHash } from './App' +import { getURLHash } from './App'; test('urlHash', () => { - global.window = Object.create(window); - Object.defineProperty(window, 'location', { - value: { - hash: '#https://example.org/user/repo' - } - }); + global.window = Object.create(window); + Object.defineProperty(window, 'location', { + value: { + hash: '#https://example.org/user/repo', + }, + }); - expect(getURLHash()).toBe('https://example.org/user/repo'); -}); \ No newline at end of file + expect(getURLHash()).toBe('https://example.org/user/repo'); +}); diff --git a/components/dashboard/src/App.tsx b/components/dashboard/src/App.tsx index c49cab5dc3b0f6..d838cb2a8eb7d4 100644 --- a/components/dashboard/src/App.tsx +++ b/components/dashboard/src/App.tsx @@ -6,7 +6,7 @@ import React, { Suspense, useContext, useEffect, useState } from 'react'; import Menu from './Menu'; -import { Redirect, Route, Switch } from "react-router"; +import { Redirect, Route, Switch } from 'react-router'; import { Login } from './Login'; import { UserContext } from './user-context'; @@ -22,8 +22,24 @@ import { User } from '@gitpod/gitpod-protocol'; import * as GitpodCookie from '@gitpod/gitpod-protocol/lib/util/gitpod-cookie'; import { Experiment } from './experiments'; import { workspacesPathMain } from './workspaces/workspaces.routes'; -import { settingsPathAccount, settingsPathIntegrations, settingsPathMain, settingsPathNotifications, settingsPathPlans, settingsPathPreferences, settingsPathTeams, settingsPathTeamsJoin, settingsPathTeamsNew, settingsPathVariables } from './settings/settings.routes'; -import { projectsPathInstallGitHubApp, projectsPathMain, projectsPathMainWithParams, projectsPathNew } from './projects/projects.routes'; +import { + settingsPathAccount, + settingsPathIntegrations, + settingsPathMain, + settingsPathNotifications, + settingsPathPlans, + settingsPathPreferences, + settingsPathTeams, + settingsPathTeamsJoin, + settingsPathTeamsNew, + settingsPathVariables, +} from './settings/settings.routes'; +import { + projectsPathInstallGitHubApp, + projectsPathMain, + projectsPathMainWithParams, + projectsPathNew, +} from './projects/projects.routes'; const Setup = React.lazy(() => import(/* webpackPrefetch: true */ './Setup')); const Workspaces = React.lazy(() => import(/* webpackPrefetch: true */ './workspaces/Workspaces')); @@ -55,355 +71,392 @@ const WorkspacesSearch = React.lazy(() => import(/* webpackPrefetch: true */ './ const OAuthClientApproval = React.lazy(() => import(/* webpackPrefetch: true */ './OauthClientApproval')); function Loading() { - return <> - ; + return <>; } function isGitpodIo() { - return window.location.hostname === 'gitpod.io' || window.location.hostname === 'gitpod-staging.com' || window.location.hostname.endsWith('gitpod-dev.com') || window.location.hostname.endsWith('gitpod-io-dev.com') + return ( + window.location.hostname === 'gitpod.io' || + window.location.hostname === 'gitpod-staging.com' || + window.location.hostname.endsWith('gitpod-dev.com') || + window.location.hostname.endsWith('gitpod-io-dev.com') + ); } function isWebsiteSlug(pathName: string) { - const slugs = [ - 'about', - 'blog', - 'careers', - 'changelog', - 'chat', - 'code-of-conduct', - 'contact', - 'docs', - 'features', - 'for', - 'gitpod-vs-github-codespaces', - 'imprint', - 'media-kit', - 'memes', - 'pricing', - 'privacy', - 'security', - 'screencasts', - 'self-hosted', - 'support', - 'terms', - 'values' - ] - return slugs.some(slug => pathName.startsWith('/' + slug + '/') || pathName === ('/' + slug)); + const slugs = [ + 'about', + 'blog', + 'careers', + 'changelog', + 'chat', + 'code-of-conduct', + 'contact', + 'docs', + 'features', + 'for', + 'gitpod-vs-github-codespaces', + 'imprint', + 'media-kit', + 'memes', + 'pricing', + 'privacy', + 'security', + 'screencasts', + 'self-hosted', + 'support', + 'terms', + 'values', + ]; + return slugs.some((slug) => pathName.startsWith('/' + slug + '/') || pathName === '/' + slug); } export function getURLHash() { - return window.location.hash.replace(/^[#/]+/, ''); + return window.location.hash.replace(/^[#/]+/, ''); } function App() { - const { user, setUser } = useContext(UserContext); - const { teams, setTeams } = useContext(TeamsContext); - const { setIsDark } = useContext(ThemeContext); + const { user, setUser } = useContext(UserContext); + const { teams, setTeams } = useContext(TeamsContext); + const { setIsDark } = useContext(ThemeContext); - const [ loading, setLoading ] = useState(true); - const [ isWhatsNewShown, setWhatsNewShown ] = useState(false); - const [ isSetupRequired, setSetupRequired ] = useState(false); - const history = useHistory(); + const [loading, setLoading] = useState(true); + const [isWhatsNewShown, setWhatsNewShown] = useState(false); + const [isSetupRequired, setSetupRequired] = useState(false); + const history = useHistory(); - useEffect(() => { - (async () => { - var user: User | undefined; - try { - const teamsPromise = getGitpodService().server.getTeams(); + useEffect(() => { + (async () => { + var user: User | undefined; + try { + const teamsPromise = getGitpodService().server.getTeams(); - user = await getGitpodService().server.getLoggedInUser(); - setUser(user); + user = await getGitpodService().server.getLoggedInUser(); + setUser(user); - const teams = await teamsPromise; + const teams = await teamsPromise; - { - // if a team was selected previously and we call the root URL (e.g. "gitpod.io"), - // let's continue with the team page - const hash = getURLHash(); - const isRoot = window.location.pathname === '/' && hash === ''; - if (isRoot) { - try { - const teamSlug = localStorage.getItem('team-selection'); - if (teams.some(t => t.slug === teamSlug)) { - history.push(`/t/${teamSlug}`); - } - } catch { - } - } - } - setTeams(teams); - } catch (error) { - console.error(error); - if (error && "code" in error) { - if (error.code === ErrorCodes.SETUP_REQUIRED) { - setSetupRequired(true); - } - } - } finally { - trackLocation(!!user); - } - setLoading(false); - (window as any)._gp.path = window.location.pathname; //store current path to have access to previous when path changes - })(); - }, []); - - useEffect(() => { - const updateTheme = () => { - const isDark = localStorage.theme === 'dark' || (localStorage.theme !== 'light' && window.matchMedia("(prefers-color-scheme: dark)").matches); - setIsDark(isDark); - } - updateTheme(); - const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)"); - if (mediaQuery instanceof EventTarget) { - mediaQuery.addEventListener('change', updateTheme); - } else { - // backward compatibility for Safari < 14 - (mediaQuery as MediaQueryList).addListener(updateTheme); - } - window.addEventListener('storage', updateTheme); - return function cleanup() { - if (mediaQuery instanceof EventTarget) { - mediaQuery.removeEventListener('change', updateTheme); - } else { - // backward compatibility for Safari < 14 - (mediaQuery as MediaQueryList).removeListener(updateTheme); - } - window.removeEventListener('storage', updateTheme); - } - }, []); - - // listen and notify Segment of client-side path updates - useEffect(() => { - if (isGitpodIo()) { - // Choose which experiments to run for this session/user - Experiment.set(Experiment.seed(true)); + { + // if a team was selected previously and we call the root URL (e.g. "gitpod.io"), + // let's continue with the team page + const hash = getURLHash(); + const isRoot = window.location.pathname === '/' && hash === ''; + if (isRoot) { + try { + const teamSlug = localStorage.getItem('team-selection'); + if (teams.some((t) => t.slug === teamSlug)) { + history.push(`/t/${teamSlug}`); + } + } catch {} + } } - }) - - useEffect(() => { - return history.listen((location: any) => { - const path = window.location.pathname; - trackPathChange({ - prev: (window as any)._gp.path, - path: path - }); - (window as any)._gp.path = path; - }) - }, [history]) - - useEffect(() => { - const handleButtonOrAnchorTracking = (props: MouseEvent) => { - var curr = props.target as HTMLElement; - //check if current target or any ancestor up to document is button or anchor - while (!(curr instanceof Document)) { - if (curr instanceof HTMLButtonElement || curr instanceof HTMLAnchorElement || (curr instanceof HTMLDivElement && curr.onclick)) { - trackButtonOrAnchor(curr, !!user); - break; //finding first ancestor is sufficient - } - curr = curr.parentNode as HTMLElement; - } + setTeams(teams); + } catch (error) { + console.error(error); + if (error && 'code' in error) { + if (error.code === ErrorCodes.SETUP_REQUIRED) { + setSetupRequired(true); + } } - window.addEventListener("click", handleButtonOrAnchorTracking, true); - return () => window.removeEventListener("click", handleButtonOrAnchorTracking, true); - }, []); + } finally { + trackLocation(!!user); + } + setLoading(false); + (window as any)._gp.path = window.location.pathname; //store current path to have access to previous when path changes + })(); + }, []); - // redirect to website for any website slugs - if (isGitpodIo() && isWebsiteSlug(window.location.pathname)) { - window.location.host = 'www.gitpod.io'; - return
; + useEffect(() => { + const updateTheme = () => { + const isDark = + localStorage.theme === 'dark' || + (localStorage.theme !== 'light' && window.matchMedia('(prefers-color-scheme: dark)').matches); + setIsDark(isDark); + }; + updateTheme(); + const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); + if (mediaQuery instanceof EventTarget) { + mediaQuery.addEventListener('change', updateTheme); + } else { + // backward compatibility for Safari < 14 + (mediaQuery as MediaQueryList).addListener(updateTheme); } + window.addEventListener('storage', updateTheme); + return function cleanup() { + if (mediaQuery instanceof EventTarget) { + mediaQuery.removeEventListener('change', updateTheme); + } else { + // backward compatibility for Safari < 14 + (mediaQuery as MediaQueryList).removeListener(updateTheme); + } + window.removeEventListener('storage', updateTheme); + }; + }, []); - if (isGitpodIo() && window.location.pathname === '/' && window.location.hash === '' && !loading && !user) { - if (!GitpodCookie.isPresent(document.cookie)) { - window.location.href = `https://www.gitpod.io`; - return
; - } else { - // explicitly render the Login page when the session is out-of-sync with the Gitpod cookie - return (); - } + // listen and notify Segment of client-side path updates + useEffect(() => { + if (isGitpodIo()) { + // Choose which experiments to run for this session/user + Experiment.set(Experiment.seed(true)); } + }); - if (loading) { - return (); - } - if (isSetupRequired) { - return (}> - - ); - } - if (!user) { - return (); - } - if (window.location.pathname.startsWith('/blocked')) { - return
- Gitpod's logo -

Your account has been blocked.

-

Please contact support if you think this is an error. See also terms of service.

- -
; - } - const shouldWhatsNewShown = shouldSeeWhatsNew(user) - if (shouldWhatsNewShown !== isWhatsNewShown) { - setWhatsNewShown(shouldWhatsNewShown); - } - if (window.location.pathname.startsWith('/oauth-approval')) { - return ( - }> - - - ); - } + useEffect(() => { + return history.listen((location: any) => { + const path = window.location.pathname; + trackPathChange({ + prev: (window as any)._gp.path, + path: path, + }); + (window as any)._gp.path = path; + }); + }, [history]); - window.addEventListener("hashchange", () => { - // Refresh on hash change if the path is '/' (new context URL) - if (window.location.pathname === '/') { - window.location.reload(); + useEffect(() => { + const handleButtonOrAnchorTracking = (props: MouseEvent) => { + var curr = props.target as HTMLElement; + //check if current target or any ancestor up to document is button or anchor + while (!(curr instanceof Document)) { + if ( + curr instanceof HTMLButtonElement || + curr instanceof HTMLAnchorElement || + (curr instanceof HTMLDivElement && curr.onclick) + ) { + trackButtonOrAnchor(curr, !!user); + break; //finding first ancestor is sufficient } - }, false); + curr = curr.parentNode as HTMLElement; + } + }; + window.addEventListener('click', handleButtonOrAnchorTracking, true); + return () => window.removeEventListener('click', handleButtonOrAnchorTracking, true); + }, []); - let toRender: React.ReactElement = -
- - - - - - - - - - - - - + // redirect to website for any website slugs + if (isGitpodIo() && isWebsiteSlug(window.location.pathname)) { + window.location.host = 'www.gitpod.io'; + return
; + } - - + if (isGitpodIo() && window.location.pathname === '/' && window.location.hash === '' && !loading && !user) { + if (!GitpodCookie.isPresent(document.cookie)) { + window.location.href = `https://www.gitpod.io`; + return
; + } else { + // explicitly render the Login page when the session is out-of-sync with the Gitpod cookie + return ; + } + } - - - - - - - - - - - - - - - - -
-

Oh, no! Something went wrong!

-

{decodeURIComponent(getURLHash())}

-
-
- - - { - const { resourceOrPrebuild } = props.match.params; - if (resourceOrPrebuild === "settings") { - return ; - } - if (resourceOrPrebuild === "configure") { - return ; - } - if (resourceOrPrebuild === "variables") { - return ; - } - if (resourceOrPrebuild === "prebuilds") { - return ; - } - return resourceOrPrebuild ? : ; - }} /> - - - - - - - {(teams || []).map(team => - - - - - { - const { maybeProject, resourceOrPrebuild } = props.match.params; - if (maybeProject === "projects") { - return ; - } - if (maybeProject === "workspaces") { - return ; - } - if (maybeProject === "members") { - return ; - } - if (maybeProject === "settings") { - return ; - } - if (resourceOrPrebuild === "settings") { - return ; - } - if (resourceOrPrebuild === "configure") { - return ; - } - if (resourceOrPrebuild === "variables") { - return ; - } - if (resourceOrPrebuild === "prebuilds") { - return ; - } - return resourceOrPrebuild ? : ; - }} /> - )} - { + if (loading) { + return ; + } + if (isSetupRequired) { + return ( + }> + + + ); + } + if (!user) { + return ; + } + if (window.location.pathname.startsWith('/blocked')) { + return ( +
+ Gitpod's logo +

Your account has been blocked.

+

+ Please contact support if you think this is an error. See also{' '} + + terms of service + + . +

+ + + +
+ ); + } + const shouldWhatsNewShown = shouldSeeWhatsNew(user); + if (shouldWhatsNewShown !== isWhatsNewShown) { + setWhatsNewShown(shouldWhatsNewShown); + } + if (window.location.pathname.startsWith('/oauth-approval')) { + return ( + }> + + + ); + } - return isGitpodIo() ? - // delegate to our website to handle the request - (window.location.host = 'www.gitpod.io') : -
-

404

-

Page not found.

-
; - }}> -
-
-
-
; + window.addEventListener( + 'hashchange', + () => { + // Refresh on hash change if the path is '/' (new context URL) + if (window.location.pathname === '/') { + window.location.reload(); + } + }, + false, + ); - const hash = getURLHash(); - if (/^(https:\/\/)?github\.dev\//i.test(hash)) { - window.location.hash = hash.replace(/^(https:\/\/)?github\.dev\//i, 'https://github.com/') - return
- } else if (/^([^\/]+?=[^\/]*?|prebuild)\/(https:\/\/)?github\.dev\//i.test(hash)) { - window.location.hash = hash.replace(/^([^\/]+?=[^\/]*?|prebuild)\/(https:\/\/)?github\.dev\//i, '$1/https://github.com/') - return
- } - const isCreation = window.location.pathname === '/' && hash !== ''; - const isWsStart = /\/start\/?/.test(window.location.pathname) && hash !== ''; - if (isWhatsNewShown) { - toRender = setWhatsNewShown(false)} />; - } else if (isCreation) { - toRender = ; - } else if (isWsStart) { - toRender = ; - } else if (/^(github|gitlab)\.com\/.+?/i.test(window.location.pathname)) { - let url = new URL(window.location.href) - url.hash = url.pathname - url.pathname = '/' - window.location.replace(url) - return
- } + let toRender: React.ReactElement = ( + +
+ + + + + + + + + + + + + - return ( - }> - {toRender} - + + + + + + + + + + + + + + + + + + + +
+

Oh, no! Something went wrong!

+

{decodeURIComponent(getURLHash())}

+
+
+ + + { + const { resourceOrPrebuild } = props.match.params; + if (resourceOrPrebuild === 'settings') { + return ; + } + if (resourceOrPrebuild === 'configure') { + return ; + } + if (resourceOrPrebuild === 'variables') { + return ; + } + if (resourceOrPrebuild === 'prebuilds') { + return ; + } + return resourceOrPrebuild ? : ; + }} + /> + + + + + + + {(teams || []).map((team) => ( + + + + + { + const { maybeProject, resourceOrPrebuild } = props.match.params; + if (maybeProject === 'projects') { + return ; + } + if (maybeProject === 'workspaces') { + return ; + } + if (maybeProject === 'members') { + return ; + } + if (maybeProject === 'settings') { + return ; + } + if (resourceOrPrebuild === 'settings') { + return ; + } + if (resourceOrPrebuild === 'configure') { + return ; + } + if (resourceOrPrebuild === 'variables') { + return ; + } + if (resourceOrPrebuild === 'prebuilds') { + return ; + } + return resourceOrPrebuild ? : ; + }} + /> + + ))} + { + return isGitpodIo() ? ( + // delegate to our website to handle the request + (window.location.host = 'www.gitpod.io') + ) : ( +
+

404

+

Page not found.

+
+ ); + }} + >
+
+
+
+ ); + + const hash = getURLHash(); + if (/^(https:\/\/)?github\.dev\//i.test(hash)) { + window.location.hash = hash.replace(/^(https:\/\/)?github\.dev\//i, 'https://github.com/'); + return
; + } else if (/^([^\/]+?=[^\/]*?|prebuild)\/(https:\/\/)?github\.dev\//i.test(hash)) { + window.location.hash = hash.replace( + /^([^\/]+?=[^\/]*?|prebuild)\/(https:\/\/)?github\.dev\//i, + '$1/https://github.com/', ); + return
; + } + const isCreation = window.location.pathname === '/' && hash !== ''; + const isWsStart = /\/start\/?/.test(window.location.pathname) && hash !== ''; + if (isWhatsNewShown) { + toRender = setWhatsNewShown(false)} />; + } else if (isCreation) { + toRender = ; + } else if (isWsStart) { + toRender = ; + } else if (/^(github|gitlab)\.com\/.+?/i.test(window.location.pathname)) { + let url = new URL(window.location.href); + url.hash = url.pathname; + url.pathname = '/'; + window.location.replace(url); + return
; + } + + return }>{toRender}; } export default App; diff --git a/components/dashboard/src/FromReferrer.tsx b/components/dashboard/src/FromReferrer.tsx index 740d13fc67605c..be38bf1bec76d7 100644 --- a/components/dashboard/src/FromReferrer.tsx +++ b/components/dashboard/src/FromReferrer.tsx @@ -4,35 +4,43 @@ * See License-AGPL.txt in the project root for license information. */ -import { Link } from "react-router-dom"; +import { Link } from 'react-router-dom'; export default function FromReferrer() { - const contextUrl = document.referrer; + const contextUrl = document.referrer; - if (contextUrl && contextUrl !== '' && new URL(contextUrl).pathname !== '/') { - // Redirect to gitpod.io/# to get the same experience as with direct call - const url = new URL(window.location.toString()); - url.pathname = "/"; - url.hash = contextUrl; - window.location.href = url.toString(); - return
; - } + if (contextUrl && contextUrl !== '' && new URL(contextUrl).pathname !== '/') { + // Redirect to gitpod.io/# to get the same experience as with direct call + const url = new URL(window.location.toString()); + url.pathname = '/'; + url.hash = contextUrl; + window.location.href = url.toString(); + return
; + } - return
-
-
-

No Referrer Found

-
-

- It looks like you are trying to open a workspace, but the referrer URL is empty or has an incomplete path. - This happens when the Git hoster or browser doesn't send the referrer header. -
Please prefix the repository URL with

https://{window.location.host}/#
in order to start a workspace. Learn more -

-
- - - -
+ return ( +
+
+
+

No Referrer Found

+
+

+ It looks like you are trying to open a workspace, but the referrer URL is empty or has an incomplete path. + This happens when the Git hoster or browser doesn't send the referrer header. +
Please prefix the repository URL with

https://{window.location.host}/#
in order to start + a workspace.{' '} + + Learn more + +

+
+ + + + +
-
; +
+
+ ); } diff --git a/components/dashboard/src/Login.tsx b/components/dashboard/src/Login.tsx index 9a637bcde22603..6a1cc04150d828 100644 --- a/components/dashboard/src/Login.tsx +++ b/components/dashboard/src/Login.tsx @@ -4,216 +4,251 @@ * See License-AGPL.txt in the project root for license information. */ -import { AuthProviderInfo } from "@gitpod/gitpod-protocol"; +import { AuthProviderInfo } from '@gitpod/gitpod-protocol'; import * as GitpodCookie from '@gitpod/gitpod-protocol/lib/util/gitpod-cookie'; -import { useContext, useEffect, useState } from "react"; -import { UserContext } from "./user-context"; -import { TeamsContext } from "./teams/teams-context"; -import { getGitpodService } from "./service/service"; -import { iconForAuthProvider, openAuthorizeWindow, simplifyProviderName, getSafeURLRedirect } from "./provider-utils"; +import { useContext, useEffect, useState } from 'react'; +import { UserContext } from './user-context'; +import { TeamsContext } from './teams/teams-context'; +import { getGitpodService } from './service/service'; +import { iconForAuthProvider, openAuthorizeWindow, simplifyProviderName, getSafeURLRedirect } from './provider-utils'; import gitpod from './images/gitpod.svg'; import gitpodDark from './images/gitpod-dark.svg'; import gitpodIcon from './icons/gitpod.svg'; -import automate from "./images/welcome/automate.svg"; -import code from "./images/welcome/code.svg"; -import collaborate from "./images/welcome/collaborate.svg"; -import customize from "./images/welcome/customize.svg"; -import fresh from "./images/welcome/fresh.svg"; -import prebuild from "./images/welcome/prebuild.svg"; -import exclamation from "./images/exclamation.svg"; -import { getURLHash } from "./App"; - - -function Item(props: { icon: string, iconSize?: string, text: string }) { - const iconSize = props.iconSize || 28; - return
- -
{props.text}
-
; +import automate from './images/welcome/automate.svg'; +import code from './images/welcome/code.svg'; +import collaborate from './images/welcome/collaborate.svg'; +import customize from './images/welcome/customize.svg'; +import fresh from './images/welcome/fresh.svg'; +import prebuild from './images/welcome/prebuild.svg'; +import exclamation from './images/exclamation.svg'; +import { getURLHash } from './App'; + +function Item(props: { icon: string; iconSize?: string; text: string }) { + const iconSize = props.iconSize || 28; + return ( +
+ +
{props.text}
+
+ ); } export function markLoggedIn() { - document.cookie = GitpodCookie.generateCookie(window.location.hostname); + document.cookie = GitpodCookie.generateCookie(window.location.hostname); } export function hasLoggedInBefore() { - return GitpodCookie.isPresent(document.cookie); + return GitpodCookie.isPresent(document.cookie); } export function hasVisitedMarketingWebsiteBefore() { - return document.cookie.match("gitpod-marketing-website-visited=true"); + return document.cookie.match('gitpod-marketing-website-visited=true'); } export function Login() { - const { setUser } = useContext(UserContext); - const { setTeams } = useContext(TeamsContext); - - const urlHash = getURLHash(); - let hostFromContext: string | undefined; - let repoPathname: string | undefined; - - try { - if (urlHash.length > 0) { - const url = new URL(urlHash); - hostFromContext = url.host; - repoPathname = url.pathname; - } - } catch (error) { - // Hash is not a valid URL + const { setUser } = useContext(UserContext); + const { setTeams } = useContext(TeamsContext); + + const urlHash = getURLHash(); + let hostFromContext: string | undefined; + let repoPathname: string | undefined; + + try { + if (urlHash.length > 0) { + const url = new URL(urlHash); + hostFromContext = url.host; + repoPathname = url.pathname; } - - const [authProviders, setAuthProviders] = useState([]); - const [errorMessage, setErrorMessage] = useState(undefined); - const [providerFromContext, setProviderFromContext] = useState(); - - const showWelcome = !hasLoggedInBefore() && !hasVisitedMarketingWebsiteBefore() && !urlHash.startsWith("https://"); - - useEffect(() => { - (async () => { - setAuthProviders(await getGitpodService().server.getAuthProviders()); - })(); - }, []) - - useEffect(() => { - if (hostFromContext && authProviders) { - const providerFromContext = authProviders.find(provider => provider.host === hostFromContext); - setProviderFromContext(providerFromContext); - } - }, [authProviders]); - - const authorizeSuccessful = async (payload?: string) => { - updateUser().catch(console.error); - - // Check for a valid returnTo in payload - const safeReturnTo = getSafeURLRedirect(payload); - if (safeReturnTo) { - // ... and if it is, redirect to it - window.location.replace(safeReturnTo); - } + } catch (error) { + // Hash is not a valid URL + } + + const [authProviders, setAuthProviders] = useState([]); + const [errorMessage, setErrorMessage] = useState(undefined); + const [providerFromContext, setProviderFromContext] = useState(); + + const showWelcome = !hasLoggedInBefore() && !hasVisitedMarketingWebsiteBefore() && !urlHash.startsWith('https://'); + + useEffect(() => { + (async () => { + setAuthProviders(await getGitpodService().server.getAuthProviders()); + })(); + }, []); + + useEffect(() => { + if (hostFromContext && authProviders) { + const providerFromContext = authProviders.find((provider) => provider.host === hostFromContext); + setProviderFromContext(providerFromContext); } + }, [authProviders]); - const updateUser = async () => { - await getGitpodService().reconnect(); - const [user, teams] = await Promise.all([ - getGitpodService().server.getLoggedInUser(), - getGitpodService().server.getTeams(), - ]); - setUser(user); - setTeams(teams); - markLoggedIn(); - } + const authorizeSuccessful = async (payload?: string) => { + updateUser().catch(console.error); - const openLogin = async (host: string) => { - setErrorMessage(undefined); - - try { - await openAuthorizeWindow({ - login: true, - host, - onSuccess: authorizeSuccessful, - onError: (payload) => { - let errorMessage: string; - if (typeof payload === "string") { - errorMessage = payload; - } else { - errorMessage = payload.description ? payload.description : `Error: ${payload.error}`; - if (payload.error === "email_taken") { - errorMessage = `Email address already used in another account. Please log in with ${(payload as any).host}.`; - } - } - setErrorMessage(errorMessage); - } - }); - } catch (error) { - console.log(error) - } + // Check for a valid returnTo in payload + const safeReturnTo = getSafeURLRedirect(payload); + if (safeReturnTo) { + // ... and if it is, redirect to it + window.location.replace(safeReturnTo); } + }; + + const updateUser = async () => { + await getGitpodService().reconnect(); + const [user, teams] = await Promise.all([ + getGitpodService().server.getLoggedInUser(), + getGitpodService().server.getTeams(), + ]); + setUser(user); + setTeams(teams); + markLoggedIn(); + }; + + const openLogin = async (host: string) => { + setErrorMessage(undefined); - return (
- {showWelcome ?
-
-
-
- Gitpod light theme logo - Gitpod dark theme logo -
-
-

Welcome to Gitpod

-
- Spin up fresh, automated dev environments for each task in the cloud, in seconds. -
-
-
- - - -
-
- - - -
+ try { + await openAuthorizeWindow({ + login: true, + host, + onSuccess: authorizeSuccessful, + onError: (payload) => { + let errorMessage: string; + if (typeof payload === 'string') { + errorMessage = payload; + } else { + errorMessage = payload.description ? payload.description : `Error: ${payload.error}`; + if (payload.error === 'email_taken') { + errorMessage = `Email address already used in another account. Please log in with ${ + (payload as any).host + }.`; + } + } + setErrorMessage(errorMessage); + }, + }); + } catch (error) { + console.log(error); + } + }; + + return ( +
+ {showWelcome ? ( +
+
+
+
+ Gitpod light theme logo + Gitpod dark theme logo +
+
+

Welcome to Gitpod

+
+ Spin up fresh, automated dev environments for each task in the cloud, in seconds.
+
+
+ + + +
+
+ + + +
-
: null} -
-
-
-
-
- Gitpod's logo - Gitpod dark theme logo -
- -
- {providerFromContext - ? <> -

Open a cloud-based developer environment

-

for the repository {repoPathname?.slice(1)}

- - : <> -

Log in{showWelcome ? '' : ' to Gitpod'}

-

ALWAYS READY-TO-CODE

- } -
- - -
- {providerFromContext - ? - - : - authProviders.map(ap => - ) - } -
- - {errorMessage && ( -
-
- -
-
-

{errorMessage}

-
-
- )} - -
-
-
- - By signing in, you agree to our terms of service. +
+
+ ) : null} +
+
+
+
+
+ Gitpod's logo + Gitpod dark theme logo +
+ +
+ {providerFromContext ? ( + <> +

+ Open a cloud-based developer environment +

+

for the repository {repoPathname?.slice(1)}

+ + ) : ( + <> +

Log in{showWelcome ? '' : ' to Gitpod'}

+

ALWAYS READY-TO-CODE

+ + )} +
+ +
+ {providerFromContext ? ( + + ) : ( + authProviders.map((ap) => ( + + )) + )} +
+ + {errorMessage && ( +
+
+ +
+
+

{errorMessage}

+
+ )}
- +
+
+ + By signing in, you agree to our{' '} + + terms of service + + . + +
-
); +
+
+ ); } diff --git a/components/dashboard/src/Menu.tsx b/components/dashboard/src/Menu.tsx index e9661a1f483c44..929fcc10fd7a0d 100644 --- a/components/dashboard/src/Menu.tsx +++ b/components/dashboard/src/Menu.tsx @@ -4,299 +4,365 @@ * See License-AGPL.txt in the project root for license information. */ -import { User, TeamMemberInfo, Project } from "@gitpod/gitpod-protocol"; -import { useContext, useEffect, useState } from "react"; -import { Link } from "react-router-dom"; -import { useLocation, useRouteMatch } from "react-router"; -import { Location } from "history"; +import { User, TeamMemberInfo, Project } from '@gitpod/gitpod-protocol'; +import { useContext, useEffect, useState } from 'react'; +import { Link } from 'react-router-dom'; +import { useLocation, useRouteMatch } from 'react-router'; +import { Location } from 'history'; import gitpodIcon from './icons/gitpod.svg'; -import CaretDown from "./icons/CaretDown.svg"; -import CaretUpDown from "./icons/CaretUpDown.svg"; -import { getGitpodService, gitpodHostUrl } from "./service/service"; -import { UserContext } from "./user-context"; -import { TeamsContext, getCurrentTeam } from "./teams/teams-context"; +import CaretDown from './icons/CaretDown.svg'; +import CaretUpDown from './icons/CaretUpDown.svg'; +import { getGitpodService, gitpodHostUrl } from './service/service'; +import { UserContext } from './user-context'; +import { TeamsContext, getCurrentTeam } from './teams/teams-context'; import settingsMenu from './settings/settings-menu'; import { adminMenu } from './admin/admin-menu'; -import ContextMenu from "./components/ContextMenu"; -import Separator from "./components/Separator"; -import PillMenuItem from "./components/PillMenuItem"; -import TabMenuItem from "./components/TabMenuItem"; -import { getTeamSettingsMenu } from "./teams/TeamSettings"; -import { getProjectSettingsMenu } from "./projects/ProjectSettings"; -import { ProjectContext } from "./projects/project-context"; +import ContextMenu from './components/ContextMenu'; +import Separator from './components/Separator'; +import PillMenuItem from './components/PillMenuItem'; +import TabMenuItem from './components/TabMenuItem'; +import { getTeamSettingsMenu } from './teams/TeamSettings'; +import { getProjectSettingsMenu } from './projects/ProjectSettings'; +import { ProjectContext } from './projects/project-context'; interface Entry { - title: string, - link: string, - alternatives?: string[] + title: string; + link: string; + alternatives?: string[]; } export default function Menu() { - const { user } = useContext(UserContext); - const { teams } = useContext(TeamsContext); - const location = useLocation(); - const team = getCurrentTeam(location, teams); - const { project, setProject } = useContext(ProjectContext); + const { user } = useContext(UserContext); + const { teams } = useContext(TeamsContext); + const location = useLocation(); + const team = getCurrentTeam(location, teams); + const { project, setProject } = useContext(ProjectContext); - const match = useRouteMatch<{ segment1?: string, segment2?: string, segment3?: string }>("/(t/)?:segment1/:segment2?/:segment3?"); - const projectSlug = (() => { - const resource = match?.params?.segment2; - if (resource && !["projects", "members", "users", "workspaces", "settings"].includes(resource)) { - return resource; - } - })(); - const prebuildId = (() => { - const resource = projectSlug && match?.params?.segment3; - if (resource !== "workspaces" && resource !== "prebuilds" && resource !== "settings" && resource !== "configure" && resource !== "variables") { - return resource; - } - })(); - - function isSelected(entry: Entry, location: Location) { - const all = [entry.link, ...(entry.alternatives||[])].map(l => l.toLowerCase()); - const path = location.pathname.toLowerCase(); - return all.some(n => n === path || n+'/' === path); + const match = useRouteMatch<{ segment1?: string; segment2?: string; segment3?: string }>( + '/(t/)?:segment1/:segment2?/:segment3?', + ); + const projectSlug = (() => { + const resource = match?.params?.segment2; + if (resource && !['projects', 'members', 'users', 'workspaces', 'settings'].includes(resource)) { + return resource; } - - const userFullName = user?.fullName || user?.name || '...'; - - { - // updating last team selection - try { - localStorage.setItem('team-selection', team ? team.slug : ""); - } catch { - } + })(); + const prebuildId = (() => { + const resource = projectSlug && match?.params?.segment3; + if ( + resource !== 'workspaces' && + resource !== 'prebuilds' && + resource !== 'settings' && + resource !== 'configure' && + resource !== 'variables' + ) { + return resource; } + })(); - // Hide most of the top menu when in a full-page form. - const isMinimalUI = ['/new', '/teams/new'].includes(location.pathname); + function isSelected(entry: Entry, location: Location) { + const all = [entry.link, ...(entry.alternatives || [])].map((l) => l.toLowerCase()); + const path = location.pathname.toLowerCase(); + return all.some((n) => n === path || n + '/' === path); + } - const [ teamMembers, setTeamMembers ] = useState>({}); - useEffect(() => { - if (!teams) { - return; - } - (async () => { - const members: Record = {}; - await Promise.all(teams.map(async (team) => { - try { - members[team.id] = await getGitpodService().server.getTeamMembers(team.id); - } catch (error) { - console.error('Could not get members of team', team, error); - } - })); - setTeamMembers(members); - })(); - }, [ teams ]); + const userFullName = user?.fullName || user?.name || '...'; - useEffect(() => { - if (!teams || !projectSlug) { - return; - } - (async () => { - const projects = (!!team - ? await getGitpodService().server.getTeamProjects(team.id) - : await getGitpodService().server.getUserProjects()); + { + // updating last team selection + try { + localStorage.setItem('team-selection', team ? team.slug : ''); + } catch {} + } - // Find project matching with slug, otherwise with name - const project = projectSlug && projects.find(p => p.slug ? p.slug === projectSlug : p.name === projectSlug); - if (!project) { - return; - } - setProject(project); - })(); - }, [projectSlug, setProject, team, teams]); + // Hide most of the top menu when in a full-page form. + const isMinimalUI = ['/new', '/teams/new'].includes(location.pathname); - const teamOrUserSlug = !!team ? '/t/' + team.slug : '/projects'; - const leftMenu: Entry[] = (() => { - // Project menu - if (projectSlug) { - return [ - { - title: 'Branches', - link: `${teamOrUserSlug}/${projectSlug}`, - }, - { - title: 'Prebuilds', - link: `${teamOrUserSlug}/${projectSlug}/prebuilds`, - }, - { - title: 'Settings', - link: `${teamOrUserSlug}/${projectSlug}/settings`, - alternatives: getProjectSettingsMenu({ slug: projectSlug } as Project, team).flatMap(e => e.link), - }, - ]; - } - // Team menu - if (team) { - const currentUserInTeam = (teamMembers[team.id] || []).find(m => m.userId === user?.id); + const [teamMembers, setTeamMembers] = useState>({}); + useEffect(() => { + if (!teams) { + return; + } + (async () => { + const members: Record = {}; + await Promise.all( + teams.map(async (team) => { + try { + members[team.id] = await getGitpodService().server.getTeamMembers(team.id); + } catch (error) { + console.error('Could not get members of team', team, error); + } + }), + ); + setTeamMembers(members); + })(); + }, [teams]); - const teamSettingsList = [ - { - title: 'Projects', - link: `/t/${team.slug}/projects`, - alternatives: ([] as string[]) - }, - { - title: 'Members', - link: `/t/${team.slug}/members` - } - ]; - if (currentUserInTeam?.role === "owner") { - teamSettingsList.push({ - title: 'Settings', - link: `/t/${team.slug}/settings`, - alternatives: getTeamSettingsMenu(team).flatMap(e => e.link), - }) - } + useEffect(() => { + if (!teams || !projectSlug) { + return; + } + (async () => { + const projects = !!team + ? await getGitpodService().server.getTeamProjects(team.id) + : await getGitpodService().server.getUserProjects(); - return teamSettingsList; - } - // User menu - return [ - { - title: 'Workspaces', - link: '/workspaces', - alternatives: ['/'] - }, - { - title: 'Projects', - link: '/projects' - }, - { - title: 'Settings', - link: '/settings', - alternatives: settingsMenu.flatMap(e => e.link) - } - ]; + // Find project matching with slug, otherwise with name + const project = projectSlug && projects.find((p) => (p.slug ? p.slug === projectSlug : p.name === projectSlug)); + if (!project) { + return; + } + setProject(project); })(); - const rightMenu: Entry[] = [ - ...(user?.rolesOrPermissions?.includes('admin') ? [{ - title: 'Admin', - link: '/admin', - alternatives: adminMenu.flatMap(e => e.link) - }] : []), + }, [projectSlug, setProject, team, teams]); + + const teamOrUserSlug = !!team ? '/t/' + team.slug : '/projects'; + const leftMenu: Entry[] = (() => { + // Project menu + if (projectSlug) { + return [ + { + title: 'Branches', + link: `${teamOrUserSlug}/${projectSlug}`, + }, + { + title: 'Prebuilds', + link: `${teamOrUserSlug}/${projectSlug}/prebuilds`, + }, + { + title: 'Settings', + link: `${teamOrUserSlug}/${projectSlug}/settings`, + alternatives: getProjectSettingsMenu({ slug: projectSlug } as Project, team).flatMap((e) => e.link), + }, + ]; + } + // Team menu + if (team) { + const currentUserInTeam = (teamMembers[team.id] || []).find((m) => m.userId === user?.id); + + const teamSettingsList = [ { - title: 'Docs', - link: 'https://www.gitpod.io/docs/', + title: 'Projects', + link: `/t/${team.slug}/projects`, + alternatives: [] as string[], }, { - title: 'Help', - link: 'https://www.gitpod.io/support', - } + title: 'Members', + link: `/t/${team.slug}/members`, + }, + ]; + if (currentUserInTeam?.role === 'owner') { + teamSettingsList.push({ + title: 'Settings', + link: `/t/${team.slug}/settings`, + alternatives: getTeamSettingsMenu(team).flatMap((e) => e.link), + }); + } + + return teamSettingsList; + } + // User menu + return [ + { + title: 'Workspaces', + link: '/workspaces', + alternatives: ['/'], + }, + { + title: 'Projects', + link: '/projects', + }, + { + title: 'Settings', + link: '/settings', + alternatives: settingsMenu.flatMap((e) => e.link), + }, ]; + })(); + const rightMenu: Entry[] = [ + ...(user?.rolesOrPermissions?.includes('admin') + ? [ + { + title: 'Admin', + link: '/admin', + alternatives: adminMenu.flatMap((e) => e.link), + }, + ] + : []), + { + title: 'Docs', + link: 'https://www.gitpod.io/docs/', + }, + { + title: 'Help', + link: 'https://www.gitpod.io/support', + }, + ]; - const renderTeamMenu = () => { - return ( -
- { projectSlug &&
- - {team?.name || userFullName} - -
} -
- - {userFullName} - Personal Account -
, - active: !team, - separator: true, - link: '/', - }, - ...(teams || []).map(t => ({ - title: t.name, - customContent:
- {t.name} - {!!teamMembers[t.id] - ? `${teamMembers[t.id].length} member${teamMembers[t.id].length === 1 ? '' : 's'}` - : '...' - } -
, - active: team && team.id === t.id, - separator: true, - link: `/t/${t.slug}`, - })).sort((a, b) => a.title.toLowerCase() > b.title.toLowerCase() ? 1 : -1), - { - title: 'Create a new team', - customContent:
- New Team - -
, - link: '/teams/new', - } - ]}> -
- { !projectSlug && {team?.name || userFullName}} - -
- -
- { projectSlug && ( -
- - {project?.name} - -
- )} - { prebuildId && ( -
- - {prebuildId} + const renderTeamMenu = () => { + return ( +
+ {projectSlug && ( +
+ + + {team?.name || userFullName} + + +
+ )} +
+ + {userFullName} + Personal Account +
+ ), + active: !team, + separator: true, + link: '/', + }, + ...(teams || []) + .map((t) => ({ + title: t.name, + customContent: ( +
+ {t.name} + + {!!teamMembers[t.id] + ? `${teamMembers[t.id].length} member${teamMembers[t.id].length === 1 ? '' : 's'}` + : '...'} +
- )} + ), + active: team && team.id === t.id, + separator: true, + link: `/t/${t.slug}`, + })) + .sort((a, b) => (a.title.toLowerCase() > b.title.toLowerCase() ? 1 : -1)), + { + title: 'Create a new team', + customContent: ( +
+ New Team + + + +
+ ), + link: '/teams/new', + }, + ]} + > +
+ {!projectSlug && ( + + {team?.name || userFullName} + + )} +
- ) - } + +
+ {projectSlug && ( +
+ + {project?.name} + +
+ )} + {prebuildId && ( +
+ + {prebuildId} +
+ )} +
+ ); + }; - return <> -
-
-
- - Gitpod's logo - - {!isMinimalUI &&
- {renderTeamMenu()} -
} -
- + return ( + <> +
+
+
+ + Gitpod's logo + + {!isMinimalUI &&
{renderTeamMenu()}
} +
+
- - ; -} \ No newline at end of file +
+
+ {!isMinimalUI && !prebuildId && ( + + )} + + + + ); +} diff --git a/components/dashboard/src/OauthClientApproval.tsx b/components/dashboard/src/OauthClientApproval.tsx index 55841299ae51f6..d9b249438bc4f7 100644 --- a/components/dashboard/src/OauthClientApproval.tsx +++ b/components/dashboard/src/OauthClientApproval.tsx @@ -5,44 +5,51 @@ */ import gitpodIcon from './icons/gitpod.svg'; -import { getSafeURLRedirect } from "./provider-utils"; +import { getSafeURLRedirect } from './provider-utils'; export default function OAuthClientApproval() { - const params = new URLSearchParams(window.location.search); - const clientName = params.get("clientName") || ""; - let redirectToParam = params.get("redirectTo") || undefined; - if (redirectToParam) { - redirectToParam = decodeURIComponent(redirectToParam); - } - const redirectTo = getSafeURLRedirect(redirectToParam) || "/"; - const updateClientApproval = async (isApproved: boolean) => { - if (redirectTo === "/") { - window.location.replace(redirectTo); - } - window.location.replace(`${redirectTo}&approved=${isApproved ? 'yes' : 'no'}`); + const params = new URLSearchParams(window.location.search); + const clientName = params.get('clientName') || ''; + let redirectToParam = params.get('redirectTo') || undefined; + if (redirectToParam) { + redirectToParam = decodeURIComponent(redirectToParam); + } + const redirectTo = getSafeURLRedirect(redirectToParam) || '/'; + const updateClientApproval = async (isApproved: boolean) => { + if (redirectTo === '/') { + window.location.replace(redirectTo); } + window.location.replace(`${redirectTo}&approved=${isApproved ? 'yes' : 'no'}`); + }; - return (
-
-
-
-
-
- Gitpod's logo -
-
-

Authorize {clientName}

-

You are about to authorize {clientName} to access your Gitpod account including data for all workspaces.

-
-
- - -
-
-
+ return ( +
+
+
+
+
+
+ Gitpod's logo +
+
+

Authorize {clientName}

+

+ You are about to authorize {clientName} to access your Gitpod account including data for all + workspaces. +

+
+
+ + +
+
-
); -} \ No newline at end of file +
+
+ ); +} diff --git a/components/dashboard/src/Setup.tsx b/components/dashboard/src/Setup.tsx index 7f2804e0ec83d8..6e851c3def7a6a 100644 --- a/components/dashboard/src/Setup.tsx +++ b/components/dashboard/src/Setup.tsx @@ -4,58 +4,73 @@ * See License-AGPL.txt in the project root for license information. */ -import { useEffect, useState } from "react"; -import Modal from "./components/Modal"; -import { getGitpodService, gitpodHostUrl } from "./service/service"; -import { GitIntegrationModal } from "./settings/Integrations"; +import { useEffect, useState } from 'react'; +import Modal from './components/Modal'; +import { getGitpodService, gitpodHostUrl } from './service/service'; +import { GitIntegrationModal } from './settings/Integrations'; export default function Setup() { + const [showModal, setShowModal] = useState(false); - const [showModal, setShowModal] = useState(false); - - useEffect(() => { - (async () => { - const dynamicAuthProviders = await getGitpodService().server.getOwnAuthProviders(); - const previous = dynamicAuthProviders.filter(ap => ap.ownerId === "no-user")[0]; - if (previous) { - await getGitpodService().server.deleteOwnAuthProvider({ id: previous.id }); - } - })(); - }, []); - - const acceptAndContinue = () => { - setShowModal(true); - } - - const onAuthorize = (payload?: string) => { - // run without await, so the integrated closing of new tab isn't blocked - (async () => { - window.location.href = gitpodHostUrl.asDashboard().toString(); - })(); - } - - const headerText = "Configure a Git integration with a GitLab or GitHub instance." - - return
- {!showModal && ( - { }} closeable={false}> -

Welcome to Gitpod 🎉

-
-

To start using Gitpod, you will need to set up a Git integration.

- -
- - By using Gitpod, you agree to our terms. - -
-
-
- -
-
- )} - {showModal && ( - - )} -
; + useEffect(() => { + (async () => { + const dynamicAuthProviders = await getGitpodService().server.getOwnAuthProviders(); + const previous = dynamicAuthProviders.filter((ap) => ap.ownerId === 'no-user')[0]; + if (previous) { + await getGitpodService().server.deleteOwnAuthProvider({ id: previous.id }); + } + })(); + }, []); + + const acceptAndContinue = () => { + setShowModal(true); + }; + + const onAuthorize = (payload?: string) => { + // run without await, so the integrated closing of new tab isn't blocked + (async () => { + window.location.href = gitpodHostUrl.asDashboard().toString(); + })(); + }; + + const headerText = 'Configure a Git integration with a GitLab or GitHub instance.'; + + return ( +
+ {!showModal && ( + {}} closeable={false}> +

Welcome to Gitpod 🎉

+
+

+ To start using Gitpod, you will need to set up a Git integration. +

+ +
+ + By using Gitpod, you agree to our{' '} + + terms + + . + +
+
+
+ +
+
+ )} + {showModal && ( + + )} +
+ ); } diff --git a/components/dashboard/src/admin/UserDetail.tsx b/components/dashboard/src/admin/UserDetail.tsx index e3a9d2969d25a6..4c15b8a4f7719f 100644 --- a/components/dashboard/src/admin/UserDetail.tsx +++ b/components/dashboard/src/admin/UserDetail.tsx @@ -4,269 +4,357 @@ * See License-AGPL.txt in the project root for license information. */ -import { NamedWorkspaceFeatureFlag, Permissions, RoleOrPermission, Roles, User, WorkspaceFeatureFlags } from "@gitpod/gitpod-protocol" -import { AccountStatement, Subscription } from "@gitpod/gitpod-protocol/lib/accounting-protocol"; -import { Plans } from "@gitpod/gitpod-protocol/lib/plans"; -import moment from "moment"; -import { ReactChild, useEffect, useRef, useState } from "react"; -import CheckBox from "../components/CheckBox"; -import Modal from "../components/Modal"; -import { PageWithSubMenu } from "../components/PageWithSubMenu" -import { getGitpodService } from "../service/service"; -import { adminMenu } from "./admin-menu" -import { WorkspaceSearch } from "./WorkspacesSearch"; - +import { + NamedWorkspaceFeatureFlag, + Permissions, + RoleOrPermission, + Roles, + User, + WorkspaceFeatureFlags, +} from '@gitpod/gitpod-protocol'; +import { AccountStatement, Subscription } from '@gitpod/gitpod-protocol/lib/accounting-protocol'; +import { Plans } from '@gitpod/gitpod-protocol/lib/plans'; +import moment from 'moment'; +import { ReactChild, useEffect, useRef, useState } from 'react'; +import CheckBox from '../components/CheckBox'; +import Modal from '../components/Modal'; +import { PageWithSubMenu } from '../components/PageWithSubMenu'; +import { getGitpodService } from '../service/service'; +import { adminMenu } from './admin-menu'; +import { WorkspaceSearch } from './WorkspacesSearch'; export default function UserDetail(p: { user: User }) { - const [activity, setActivity] = useState(false); - const [user, setUser] = useState(p.user); - const [accountStatement, setAccountStatement] = useState(); - const [isStudent, setIsStudent] = useState(); - const [editFeatureFlags, setEditFeatureFlags] = useState(false); - const [editRoles, setEditRoles] = useState(false); - const userRef = useRef(user); + const [activity, setActivity] = useState(false); + const [user, setUser] = useState(p.user); + const [accountStatement, setAccountStatement] = useState(); + const [isStudent, setIsStudent] = useState(); + const [editFeatureFlags, setEditFeatureFlags] = useState(false); + const [editRoles, setEditRoles] = useState(false); + const userRef = useRef(user); - const isProfessionalOpenSource = accountStatement && accountStatement.subscriptions.some(s => s.planId === Plans.FREE_OPEN_SOURCE.chargebeeId) + const isProfessionalOpenSource = + accountStatement && accountStatement.subscriptions.some((s) => s.planId === Plans.FREE_OPEN_SOURCE.chargebeeId); - useEffect(() => { - setUser(p.user); - getGitpodService().server.adminGetAccountStatement(p.user.id).then( - as => - setAccountStatement(as) - ).catch(e => { - console.error(e); - }); - getGitpodService().server.adminIsStudent(p.user.id).then( - isStud => setIsStudent(isStud) - ); - }, [p.user]); + useEffect(() => { + setUser(p.user); + getGitpodService() + .server.adminGetAccountStatement(p.user.id) + .then((as) => setAccountStatement(as)) + .catch((e) => { + console.error(e); + }); + getGitpodService() + .server.adminIsStudent(p.user.id) + .then((isStud) => setIsStudent(isStud)); + }, [p.user]); - const email = User.getPrimaryEmail(p.user); - const emailDomain = email.split('@')[ email.split('@').length - 1]; + const email = User.getPrimaryEmail(p.user); + const emailDomain = email.split('@')[email.split('@').length - 1]; - const updateUser: UpdateUserFunction = async fun => { - setActivity(true); - try { - setUser(await fun(userRef.current)); - } finally { - setActivity(false); - } - }; + const updateUser: UpdateUserFunction = async (fun) => { + setActivity(true); + try { + setUser(await fun(userRef.current)); + } finally { + setActivity(false); + } + }; - const addStudentDomain = async () => { - await updateUser(async u => { - await getGitpodService().server.adminAddStudentEmailDomain(u.id, emailDomain); - await getGitpodService().server.adminIsStudent(u.id).then( - isStud => setIsStudent(isStud) - ); - return u; - }); - }; + const addStudentDomain = async () => { + await updateUser(async (u) => { + await getGitpodService().server.adminAddStudentEmailDomain(u.id, emailDomain); + await getGitpodService() + .server.adminIsStudent(u.id) + .then((isStud) => setIsStudent(isStud)); + return u; + }); + }; - const toggleBlockUser = async () => { - await updateUser(async u => { - u.blocked = !u.blocked; - await getGitpodService().server.adminBlockUser({ - blocked: u.blocked, - id: u.id - }); - return u; - }); - } + const toggleBlockUser = async () => { + await updateUser(async (u) => { + u.blocked = !u.blocked; + await getGitpodService().server.adminBlockUser({ + blocked: u.blocked, + id: u.id, + }); + return u; + }); + }; - const deleteUser = async () => { - await updateUser(async u => { - u.markedDeleted = !u.markedDeleted; - await getGitpodService().server.adminDeleteUser(u.id); - return u; - }); - } + const deleteUser = async () => { + await updateUser(async (u) => { + u.markedDeleted = !u.markedDeleted; + await getGitpodService().server.adminDeleteUser(u.id); + return u; + }); + }; - const flags = getFlags(user, updateUser); - const rop = getRopEntries(user, updateUser); + const flags = getFlags(user, updateUser); + const rop = getRopEntries(user, updateUser); - const downloadAccountStatement = async () => { - if (!accountStatement) { - return; - } - try { - const blob = new Blob([JSON.stringify(accountStatement)], { type: 'application/json' }); - const fileDownloadUrl = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = fileDownloadUrl; - link.setAttribute('download', 'AccountStatement.json'); - document.body.appendChild(link); - link.click(); - } catch (error) { - console.error(`Error downloading account statement `, error); - } + const downloadAccountStatement = async () => { + if (!accountStatement) { + return; + } + try { + const blob = new Blob([JSON.stringify(accountStatement)], { type: 'application/json' }); + const fileDownloadUrl = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = fileDownloadUrl; + link.setAttribute('download', 'AccountStatement.json'); + document.body.appendChild(link); + link.click(); + } catch (error) { + console.error(`Error downloading account statement `, error); } + }; - return <> - + return ( + <> + +
+
-
-

{user.fullName}

{user.blocked ?
-

{user.identities.map(i => i.primaryEmail).filter(e => !!e).join(', ')}

-
- - +

{user.fullName}

+ {user.blocked ?
-
-
- {user.fullName} -
-
-
- {moment(user.creationDate).format('MMM D, YYYY')} - downloadAccountStatement() - }, { - label: 'Grant 20 Extra Hours', - onClick: async () => { - await getGitpodService().server.adminGrantExtraHours(user.id, 20); - setAccountStatement(await getGitpodService().server.adminGetAccountStatement(user.id)); - } - }] - } - >{accountStatement?.remainingHours ? accountStatement?.remainingHours.toString() : '---'} - { - await getGitpodService().server.adminSetProfessionalOpenSource(user.id, !isProfessionalOpenSource); - setAccountStatement(await getGitpodService().server.adminGetAccountStatement(user.id)); - } - }]} - >{accountStatement?.subscriptions ? accountStatement.subscriptions.filter(s => Subscription.isActive(s, new Date().toISOString())).map(s => Plans.getById(s.planId)?.name).join(', ') : '---'} -
-
- { - setEditFeatureFlags(true); - } - }]} - >{user.featureFlags?.permanentWSFeatureFlags?.join(', ') || '---'} - { - setEditRoles(true); - } - }]} - >{user.rolesOrPermissions?.join(', ') || '---'} - {isStudent === undefined ? '---' : (isStudent ? 'Enabled' : 'Disabled')} -
-
-
- - - setEditFeatureFlags(false)} title="Edit Feature Flags" buttons={[ - - ]}> -

Edit feature access by adding or removing feature flags for this user.

-
- { - flags.map(e => ) +

+ {user.identities + .map((i) => i.primaryEmail) + .filter((e) => !!e) + .join(', ')} +

+
+ + +
+
+
+ {user.fullName} +
+
+
+ {moment(user.creationDate).format('MMM D, YYYY')} + downloadAccountStatement(), + }, + { + label: 'Grant 20 Extra Hours', + onClick: async () => { + await getGitpodService().server.adminGrantExtraHours(user.id, 20); + setAccountStatement(await getGitpodService().server.adminGetAccountStatement(user.id)); + }, + }, + ] + } + > + {accountStatement?.remainingHours ? accountStatement?.remainingHours.toString() : '---'} + + { + await getGitpodService().server.adminSetProfessionalOpenSource( + user.id, + !isProfessionalOpenSource, + ); + setAccountStatement(await getGitpodService().server.adminGetAccountStatement(user.id)); + }, + }, + ] } + > + {accountStatement?.subscriptions + ? accountStatement.subscriptions + .filter((s) => Subscription.isActive(s, new Date().toISOString())) + .map((s) => Plans.getById(s.planId)?.name) + .join(', ') + : '---'} +
- - setEditRoles(false)} title="Edit Roles" buttons={[ - - ]}> -

Edit user permissions by adding or removing roles for this user.

-
- { - rop.map(e => ) +
+ { + setEditFeatureFlags(true); + }, + }, + ]} + > + {user.featureFlags?.permanentWSFeatureFlags?.join(', ') || '---'} + + { + setEditRoles(true); + }, + }, + ]} + > + {user.rolesOrPermissions?.join(', ') || '---'} + + + {isStudent === undefined ? '---' : isStudent ? 'Enabled' : 'Disabled'} +
- - ; +
+
+ + + setEditFeatureFlags(false)} + title="Edit Feature Flags" + buttons={[ + , + ]} + > +

Edit feature access by adding or removing feature flags for this user.

+
+ {flags.map((e) => ( + + ))} +
+
+ setEditRoles(false)} + title="Edit Roles" + buttons={[ + , + ]} + > +

Edit user permissions by adding or removing roles for this user.

+
+ {rop.map((e) => ( + + ))} +
+
+ + ); } -function Label(p: { text: string, color: string }) { - return
{p.text}
; +function Label(p: { text: string; color: string }) { + return ( +
+ {p.text} +
+ ); } -export function Property(p: { name: string, children: string | ReactChild, actions?: { label: string, onClick: () => void }[] }) { - return
-
- {p.name} -
-
- {p.children} +export function Property(p: { + name: string; + children: string | ReactChild; + actions?: { label: string; onClick: () => void }[]; +}) { + return ( +
+
{p.name}
+
{p.children}
+ {(p.actions || []).map((a) => ( +
+ {a.label || ''}
- {(p.actions || []).map(a => -
- {a.label || ''} -
- )} -
; + ))} +
+ ); } interface Entry { - title: string, - checked: boolean, - onClick: () => void + title: string; + checked: boolean; + onClick: () => void; } type UpdateUserFunction = (fun: (u: User) => Promise) => Promise; function getFlags(user: User, updateUser: UpdateUserFunction): Entry[] { - return Object.entries(WorkspaceFeatureFlags).map(e => e[0] as NamedWorkspaceFeatureFlag).map(name => { - const checked = !!user.featureFlags?.permanentWSFeatureFlags?.includes(name); - return { - title: name, - checked, - onClick: async () => { - await updateUser(async u => { - return await getGitpodService().server.adminModifyPermanentWorkspaceFeatureFlag({ - id: user.id, - changes: [ - { - featureFlag: name, - add: !checked - } - ] - }); - }) - } - }; + return Object.entries(WorkspaceFeatureFlags) + .map((e) => e[0] as NamedWorkspaceFeatureFlag) + .map((name) => { + const checked = !!user.featureFlags?.permanentWSFeatureFlags?.includes(name); + return { + title: name, + checked, + onClick: async () => { + await updateUser(async (u) => { + return await getGitpodService().server.adminModifyPermanentWorkspaceFeatureFlag({ + id: user.id, + changes: [ + { + featureFlag: name, + add: !checked, + }, + ], + }); + }); + }, + }; }); } function getRopEntries(user: User, updateUser: UpdateUserFunction): Entry[] { - const createRopEntry = (name: RoleOrPermission, role?: boolean) => { - const checked = user.rolesOrPermissions?.includes(name)!!; - return { - title: (role ? 'Role: ' : 'Permission: ') + name, - checked, - onClick: async () => { - await updateUser(async u => { - return await getGitpodService().server.adminModifyRoleOrPermission({ - id: user.id, - rpp: [{ - r: name, - add: !checked - }] - }); - }) - } - }; + const createRopEntry = (name: RoleOrPermission, role?: boolean) => { + const checked = user.rolesOrPermissions?.includes(name)!!; + return { + title: (role ? 'Role: ' : 'Permission: ') + name, + checked, + onClick: async () => { + await updateUser(async (u) => { + return await getGitpodService().server.adminModifyRoleOrPermission({ + id: user.id, + rpp: [ + { + r: name, + add: !checked, + }, + ], + }); + }); + }, }; - return [ - ...Object.entries(Permissions).map(e => createRopEntry(e[0] as RoleOrPermission)), - ...Object.entries(Roles).map(e => createRopEntry(e[0] as RoleOrPermission, true)) - ]; -}; + }; + return [ + ...Object.entries(Permissions).map((e) => createRopEntry(e[0] as RoleOrPermission)), + ...Object.entries(Roles).map((e) => createRopEntry(e[0] as RoleOrPermission, true)), + ]; +} diff --git a/components/dashboard/src/admin/UserSearch.tsx b/components/dashboard/src/admin/UserSearch.tsx index 6158f34c98309b..4f4c7934a12b2f 100644 --- a/components/dashboard/src/admin/UserSearch.tsx +++ b/components/dashboard/src/admin/UserSearch.tsx @@ -4,112 +4,145 @@ * See License-AGPL.txt in the project root for license information. */ -import { AdminGetListResult, User } from "@gitpod/gitpod-protocol"; -import { log } from "@gitpod/gitpod-protocol/lib/util/logging"; -import moment from "moment"; -import { useContext, useEffect, useState } from "react"; -import { useLocation } from "react-router"; -import { Link, Redirect } from "react-router-dom"; -import { PageWithSubMenu } from "../components/PageWithSubMenu"; -import { getGitpodService } from "../service/service"; -import { UserContext } from "../user-context"; -import { adminMenu } from "./admin-menu"; -import UserDetail from "./UserDetail"; +import { AdminGetListResult, User } from '@gitpod/gitpod-protocol'; +import { log } from '@gitpod/gitpod-protocol/lib/util/logging'; +import moment from 'moment'; +import { useContext, useEffect, useState } from 'react'; +import { useLocation } from 'react-router'; +import { Link, Redirect } from 'react-router-dom'; +import { PageWithSubMenu } from '../components/PageWithSubMenu'; +import { getGitpodService } from '../service/service'; +import { UserContext } from '../user-context'; +import { adminMenu } from './admin-menu'; +import UserDetail from './UserDetail'; export default function UserSearch() { - const location = useLocation(); - const { user } = useContext(UserContext); - const [searchResult, setSearchResult] = useState>({ rows: [], total: 0 }); - const [searchTerm, setSearchTerm] = useState(''); - const [searching, setSearching] = useState(false); - const [currentUser, setCurrentUserState] = useState(undefined); + const location = useLocation(); + const { user } = useContext(UserContext); + const [searchResult, setSearchResult] = useState>({ rows: [], total: 0 }); + const [searchTerm, setSearchTerm] = useState(''); + const [searching, setSearching] = useState(false); + const [currentUser, setCurrentUserState] = useState(undefined); - useEffect(() => { - const userId = location.pathname.split('/')[3]; - if (userId) { - let user = searchResult.rows.find(u => u.id === userId); - if (user) { - setCurrentUserState(user); - } else { - getGitpodService().server.adminGetUser(userId).then( - user => setCurrentUserState(user) - ).catch(e => console.error(e)); - } - } else { - setCurrentUserState(undefined); - } - }, [location]); - - if (!user || !user?.rolesOrPermissions?.includes('admin')) { - return + useEffect(() => { + const userId = location.pathname.split('/')[3]; + if (userId) { + let user = searchResult.rows.find((u) => u.id === userId); + if (user) { + setCurrentUserState(user); + } else { + getGitpodService() + .server.adminGetUser(userId) + .then((user) => setCurrentUserState(user)) + .catch((e) => console.error(e)); + } + } else { + setCurrentUserState(undefined); } + }, [location]); - if (currentUser) { - return ; - } + if (!user || !user?.rolesOrPermissions?.includes('admin')) { + return ; + } - const search = async () => { - setSearching(true); - try { - const result = await getGitpodService().server.adminGetUsers({ - searchTerm, - limit: 50, - orderBy: 'creationDate', - offset: 0, - orderDir: "desc" - }); - setSearchResult(result); - } finally { - setSearching(false); - } + if (currentUser) { + return ; + } + + const search = async () => { + setSearching(true); + try { + const result = await getGitpodService().server.adminGetUsers({ + searchTerm, + limit: 50, + orderBy: 'creationDate', + offset: 0, + orderDir: 'desc', + }); + setSearchResult(result); + } finally { + setSearching(false); } - return -
-
-
-
- - - -
- ke.key === 'Enter' && search() } onChange={(v) => { setSearchTerm(v.target.value) }} /> -
- + }; + return ( + +
+
+
+
+ + +
+ ke.key === 'Enter' && search()} + onChange={(v) => { + setSearchTerm(v.target.value); + }} + /> +
+
-
-
-
-
Name
-
Created
-
- {searchResult.rows.filter(u => u.identities.length > 0).map(u => )} +
+
+
+
+
Name
+
Created
+ {searchResult.rows + .filter((u) => u.identities.length > 0) + .map((u) => ( + + ))} +
+ ); } function UserEntry(p: { user: User }) { - if (!p) { - return <>; - } - let email = '---'; - try { - email = User.getPrimaryEmail(p.user); - } catch (e) { - log.error(e); - } - return -
-
- {p.user.fullName -
-
-
{p.user.fullName}
-
{email}
-
-
-
{moment(p.user.creationDate).fromNow()}
-
+ if (!p) { + return <>; + } + let email = '---'; + try { + email = User.getPrimaryEmail(p.user); + } catch (e) { + log.error(e); + } + return ( + +
+
+ {p.user.fullName
- ; -} \ No newline at end of file +
+
+ {p.user.fullName} +
+
+ {email} +
+
+
+
{moment(p.user.creationDate).fromNow()}
+
+
+ + ); +} diff --git a/components/dashboard/src/admin/WorkspaceDetail.tsx b/components/dashboard/src/admin/WorkspaceDetail.tsx index 9557372866e983..15fb647d3fc93e 100644 --- a/components/dashboard/src/admin/WorkspaceDetail.tsx +++ b/components/dashboard/src/admin/WorkspaceDetail.tsx @@ -4,96 +4,142 @@ * See License-AGPL.txt in the project root for license information. */ -import { User, WorkspaceAndInstance, ContextURL } from "@gitpod/gitpod-protocol"; +import { User, WorkspaceAndInstance, ContextURL } from '@gitpod/gitpod-protocol'; import { GitpodHostUrl } from '@gitpod/gitpod-protocol/lib/util/gitpod-host-url'; -import moment from "moment"; -import { useEffect, useState } from "react"; -import { Link } from "react-router-dom"; -import { getGitpodService } from "../service/service"; -import { getProject, WorkspaceStatusIndicator } from "../workspaces/WorkspaceEntry"; -import { getAdminLinks } from "./gcp-info"; -import { Property } from "./UserDetail"; +import moment from 'moment'; +import { useEffect, useState } from 'react'; +import { Link } from 'react-router-dom'; +import { getGitpodService } from '../service/service'; +import { getProject, WorkspaceStatusIndicator } from '../workspaces/WorkspaceEntry'; +import { getAdminLinks } from './gcp-info'; +import { Property } from './UserDetail'; export default function WorkspaceDetail(props: { workspace: WorkspaceAndInstance }) { - const [workspace, setWorkspace] = useState(props.workspace); - const [activity, setActivity] = useState(false); - const [user, setUser] = useState(); - useEffect(() => { - getGitpodService().server.adminGetUser(props.workspace.ownerId).then(setUser); - }, [props.workspace]); + const [workspace, setWorkspace] = useState(props.workspace); + const [activity, setActivity] = useState(false); + const [user, setUser] = useState(); + useEffect(() => { + getGitpodService().server.adminGetUser(props.workspace.ownerId).then(setUser); + }, [props.workspace]); - const stopWorkspace = async () => { - try { - setActivity(true); - await getGitpodService().server.adminForceStopWorkspace(workspace.workspaceId); - // let's reload in a sec - setTimeout(reload, 2000); - } finally { - setActivity(false); - } + const stopWorkspace = async () => { + try { + setActivity(true); + await getGitpodService().server.adminForceStopWorkspace(workspace.workspaceId); + // let's reload in a sec + setTimeout(reload, 2000); + } finally { + setActivity(false); } + }; - const reload = async () => { - try { - setActivity(true); - const ws = await getGitpodService().server.adminGetWorkspace(workspace.workspaceId); - setWorkspace(ws); - } finally { - setActivity(false); - } + const reload = async () => { + try { + setActivity(true); + const ws = await getGitpodService().server.adminGetWorkspace(workspace.workspaceId); + setWorkspace(ws); + } finally { + setActivity(false); } + }; - const adminLinks = getAdminLinks(workspace); - const adminLink = (i: number) => {adminLinks[i]?.title || ''}; - return <> -
-
-

{workspace.workspaceId}

-

{getProject(WorkspaceAndInstance.toWorkspace(workspace))}

-
- - + const adminLinks = getAdminLinks(workspace); + const adminLink = (i: number) => ( + + + {adminLinks[i]?.title || ''} + + + ); + return ( + <> +
+
+
+

{workspace.workspaceId}

+ + + +
+

{getProject(WorkspaceAndInstance.toWorkspace(workspace))}

-
-
-
- {moment(workspace.workspaceCreationTime).format('MMM D, YYYY')} - {moment(workspace.instanceCreationTime).fromNow()} - {workspace.context.title} -
-
- {user?.name || props.workspace.ownerId} - {workspace.shareable ? 'Enabled' : 'Disabled'} - { + window.location.href = new GitpodHostUrl(window.location.href) + .with({ + pathname: `/workspace-download/get/${workspace.workspaceId}`, + }) + .toString(); + }} + > + Download Workspace + + +
+
+
+
+ {moment(workspace.workspaceCreationTime).format('MMM D, YYYY')} + {moment(workspace.instanceCreationTime).fromNow()} + + + {workspace.context.title} + + +
+
+ + + {user?.name || props.workspace.ownerId} + + + {workspace.shareable ? 'Enabled' : 'Disabled'} + { - await getGitpodService().server.adminRestoreSoftDeletedWorkspace(workspace.workspaceId); - await reload(); - } - }] : undefined}>{workspace.softDeleted ? `'${workspace.softDeleted}' ${moment(workspace.softDeletedTime).fromNow()}` : 'No'} -
-
- -
{workspace.instanceId}
-
- {workspace.region} - {workspace.stoppedTime ? moment(workspace.stoppedTime).fromNow() : '---'} -
-
- { - [0,1,2].map(adminLink) - } -
-
- { - [3,4,5].map(adminLink) - } -
-
+ await getGitpodService().server.adminRestoreSoftDeletedWorkspace(workspace.workspaceId); + await reload(); + }, + }, + ] + : undefined + } + > + {workspace.softDeleted + ? `'${workspace.softDeleted}' ${moment(workspace.softDeletedTime).fromNow()}` + : 'No'} + +
+
+ +
{workspace.instanceId}
+
+ {workspace.region} + + {workspace.stoppedTime ? moment(workspace.stoppedTime).fromNow() : '---'} + +
+
{[0, 1, 2].map(adminLink)}
+
{[3, 4, 5].map(adminLink)}
- ; +
+ + ); } diff --git a/components/dashboard/src/admin/WorkspacesSearch.tsx b/components/dashboard/src/admin/WorkspacesSearch.tsx index ebf4ba734287a2..c83d7906b80994 100644 --- a/components/dashboard/src/admin/WorkspacesSearch.tsx +++ b/components/dashboard/src/admin/WorkspacesSearch.tsx @@ -4,140 +4,182 @@ * See License-AGPL.txt in the project root for license information. */ -import { AdminGetListResult, AdminGetWorkspacesQuery, User, WorkspaceAndInstance } from "@gitpod/gitpod-protocol"; -import { matchesInstanceIdOrLegacyWorkspaceIdExactly, matchesNewWorkspaceIdExactly } from "@gitpod/gitpod-protocol/lib/util/parse-workspace-id"; -import moment from "moment"; -import { useContext, useEffect, useState } from "react"; -import { useLocation } from "react-router"; -import { Link, Redirect } from "react-router-dom"; -import { PageWithSubMenu } from "../components/PageWithSubMenu"; -import { getGitpodService } from "../service/service"; -import { UserContext } from "../user-context"; -import { getProject, WorkspaceStatusIndicator } from "../workspaces/WorkspaceEntry"; -import { adminMenu } from "./admin-menu"; -import WorkspaceDetail from "./WorkspaceDetail"; +import { AdminGetListResult, AdminGetWorkspacesQuery, User, WorkspaceAndInstance } from '@gitpod/gitpod-protocol'; +import { + matchesInstanceIdOrLegacyWorkspaceIdExactly, + matchesNewWorkspaceIdExactly, +} from '@gitpod/gitpod-protocol/lib/util/parse-workspace-id'; +import moment from 'moment'; +import { useContext, useEffect, useState } from 'react'; +import { useLocation } from 'react-router'; +import { Link, Redirect } from 'react-router-dom'; +import { PageWithSubMenu } from '../components/PageWithSubMenu'; +import { getGitpodService } from '../service/service'; +import { UserContext } from '../user-context'; +import { getProject, WorkspaceStatusIndicator } from '../workspaces/WorkspaceEntry'; +import { adminMenu } from './admin-menu'; +import WorkspaceDetail from './WorkspaceDetail'; interface Props { - user?: User + user?: User; } export default function WorkspaceSearchPage() { - return - - ; + return ( + + + + ); } export function WorkspaceSearch(props: Props) { - const location = useLocation(); - const { user } = useContext(UserContext); - const [searchResult, setSearchResult] = useState>({ rows: [], total: 0 }); - const [queryTerm, setQueryTerm] = useState(''); - const [searching, setSearching] = useState(false); - const [currentWorkspace, setCurrentWorkspaceState] = useState(undefined); + const location = useLocation(); + const { user } = useContext(UserContext); + const [searchResult, setSearchResult] = useState>({ rows: [], total: 0 }); + const [queryTerm, setQueryTerm] = useState(''); + const [searching, setSearching] = useState(false); + const [currentWorkspace, setCurrentWorkspaceState] = useState(undefined); - useEffect(() => { - const workspaceId = location.pathname.split('/')[3]; - if (workspaceId) { - let user = searchResult.rows.find(ws => ws.workspaceId === workspaceId); - if (user) { - setCurrentWorkspaceState(user); - } else { - getGitpodService().server.adminGetWorkspace(workspaceId).then( - ws => setCurrentWorkspaceState(ws) - ).catch(e => console.error(e)); - } - } else { - setCurrentWorkspaceState(undefined); - } - }, [location]); - - useEffect(() => { - if (props.user) { - search(); - } - }, [props.user]); - - if (!user || !user?.rolesOrPermissions?.includes('admin')) { - return + useEffect(() => { + const workspaceId = location.pathname.split('/')[3]; + if (workspaceId) { + let user = searchResult.rows.find((ws) => ws.workspaceId === workspaceId); + if (user) { + setCurrentWorkspaceState(user); + } else { + getGitpodService() + .server.adminGetWorkspace(workspaceId) + .then((ws) => setCurrentWorkspaceState(ws)) + .catch((e) => console.error(e)); + } + } else { + setCurrentWorkspaceState(undefined); } + }, [location]); - if (currentWorkspace) { - return ; + useEffect(() => { + if (props.user) { + search(); } + }, [props.user]); + + if (!user || !user?.rolesOrPermissions?.includes('admin')) { + return ; + } - const search = async () => { - setSearching(true); - try { - let searchTerm: string | undefined = queryTerm; - const query: AdminGetWorkspacesQuery = { - ownerId: props?.user?.id, - }; - if (matchesInstanceIdOrLegacyWorkspaceIdExactly(searchTerm)) { - query.instanceIdOrWorkspaceId = searchTerm; - } else if (matchesNewWorkspaceIdExactly(searchTerm)) { - query.workspaceId = searchTerm; - } - if (query.workspaceId || query.instanceId || query.instanceIdOrWorkspaceId) { - searchTerm = undefined; - } + if (currentWorkspace) { + return ; + } - // const searchTerm = searchTerm; - const result = await getGitpodService().server.adminGetWorkspaces({ - limit: 100, - orderBy: 'instanceCreationTime', - offset: 0, - orderDir: "desc", - ...query, - searchTerm, - }); - setSearchResult(result); - } finally { - setSearching(false); - } + const search = async () => { + setSearching(true); + try { + let searchTerm: string | undefined = queryTerm; + const query: AdminGetWorkspacesQuery = { + ownerId: props?.user?.id, + }; + if (matchesInstanceIdOrLegacyWorkspaceIdExactly(searchTerm)) { + query.instanceIdOrWorkspaceId = searchTerm; + } else if (matchesNewWorkspaceIdExactly(searchTerm)) { + query.workspaceId = searchTerm; + } + if (query.workspaceId || query.instanceId || query.instanceIdOrWorkspaceId) { + searchTerm = undefined; + } + + // const searchTerm = searchTerm; + const result = await getGitpodService().server.adminGetWorkspaces({ + limit: 100, + orderBy: 'instanceCreationTime', + offset: 0, + orderDir: 'desc', + ...query, + searchTerm, + }); + setSearchResult(result); + } finally { + setSearching(false); } - return <> -
-
-
-
- - - -
- ke.key === 'Enter' && search() } onChange={(v) => { setQueryTerm(v.target.value) }} /> -
- + }; + return ( + <> +
+
+
+
+ + +
+ ke.key === 'Enter' && search()} + onChange={(v) => { + setQueryTerm(v.target.value); + }} + /> +
+
-
-
-
-
Name
-
Context
-
Last Started
-
- {searchResult.rows.map(ws => )} +
+
+
+
+
Name
+
Context
+
Last Started
+ {searchResult.rows.map((ws) => ( + + ))} +
+ ); } function WorkspaceEntry(p: { ws: WorkspaceAndInstance }) { - return -
-
- -
-
-
{p.ws.workspaceId}
-
{getProject(WorkspaceAndInstance.toWorkspace(p.ws))}
-
-
-
{p.ws.description}
-
{p.ws.contextURL}
-
-
-
{moment(p.ws.instanceCreationTime || p.ws.workspaceCreationTime).fromNow()}
-
+ return ( + +
+
+ +
+
+
+ {p.ws.workspaceId} +
+
+ {getProject(WorkspaceAndInstance.toWorkspace(p.ws))} +
+
+
+
{p.ws.description}
+
{p.ws.contextURL}
+
+
+
+ {moment(p.ws.instanceCreationTime || p.ws.workspaceCreationTime).fromNow()} +
- ; +
+ + ); } diff --git a/components/dashboard/src/admin/admin-menu.ts b/components/dashboard/src/admin/admin-menu.ts index c6d4f6f2ccf00f..5807f2e7852c89 100644 --- a/components/dashboard/src/admin/admin-menu.ts +++ b/components/dashboard/src/admin/admin-menu.ts @@ -4,10 +4,13 @@ * See License-AGPL.txt in the project root for license information. */ -export const adminMenu = [{ +export const adminMenu = [ + { title: 'Users', - link: ['/admin/users', '/admin'] -}, { + link: ['/admin/users', '/admin'], + }, + { title: 'Workspaces', - link: ['/admin/workspaces'] -},]; \ No newline at end of file + link: ['/admin/workspaces'], + }, +]; diff --git a/components/dashboard/src/admin/gcp-info.ts b/components/dashboard/src/admin/gcp-info.ts index 85209a53bd5bfe..0f3022367737b0 100644 --- a/components/dashboard/src/admin/gcp-info.ts +++ b/components/dashboard/src/admin/gcp-info.ts @@ -4,131 +4,128 @@ * See License-AGPL.txt in the project root for license information. */ -import { WorkspaceAndInstance } from "@gitpod/gitpod-protocol"; -import { log } from "@gitpod/gitpod-protocol/lib/util/logging"; +import { WorkspaceAndInstance } from '@gitpod/gitpod-protocol'; +import { log } from '@gitpod/gitpod-protocol/lib/util/logging'; export interface Link { - readonly name: string; - readonly title: string; - readonly url: string; + readonly name: string; + readonly title: string; + readonly url: string; } export function getAdminLinks(workspace: WorkspaceAndInstance): Link[] { - let gcpInfo; - try { - gcpInfo = deriveGcpInfo(workspace.ideUrl, workspace.region); - } catch (e) { - log.error(e); - } - if (gcpInfo === undefined) { - return []; - } - const { baseDomain, gcp } = gcpInfo; + let gcpInfo; + try { + gcpInfo = deriveGcpInfo(workspace.ideUrl, workspace.region); + } catch (e) { + log.error(e); + } + if (gcpInfo === undefined) { + return []; + } + const { baseDomain, gcp } = gcpInfo; - return internalGetAdminLinks(gcp, baseDomain, workspace.status.podName, workspace.status.nodeName); + return internalGetAdminLinks(gcp, baseDomain, workspace.status.podName, workspace.status.nodeName); } -function internalGetAdminLinks(gcpInfo: GcpInfo, - baseDomain: string, - podName?: string, - nodeName?: string): Link[] { - const {clusterName, namespace, projectName, region} = gcpInfo; - return [ - { - name: "GKE Pod", - title: `${podName}`, - url: `https://console.cloud.google.com/kubernetes/pod/${region}/${clusterName}/${namespace}/${podName}/details?project=${projectName}` - }, - { - name: `GKE Node`, - title: `${nodeName}`, - url: `https://console.cloud.google.com/kubernetes/node/${region}/${clusterName}/${nodeName}/summary?project=${projectName}` - }, - { - name: `Workspace Pod Logs`, - title: `See Logs`, - url: `https://console.cloud.google.com/logs/query;query=resource.type%3D%22k8s_container%22%0Aresource.labels.project_id%3D%22${projectName}%22%0Aresource.labels.location%3D%22${region}%22%0Aresource.labels.cluster_name%3D%22${clusterName}%22%0Aresource.labels.namespace_name%3D%22${namespace}%22%0Aresource.labels.pod_name%3D%22${podName}%22?project=${projectName}` - }, - { - name: `Grafana Workspace`, - title: `Pod Metrics`, - url: `https://monitoring.${baseDomain}/d/admin-workspace/admin-workspace?var-workspace=${podName}` - }, - { - name: `Grafana Node`, - title: `Node Metrics`, - url: `https://monitoring.${baseDomain}/d/admin-node/admin-node?var-node=${nodeName}` - }, - ]; +function internalGetAdminLinks(gcpInfo: GcpInfo, baseDomain: string, podName?: string, nodeName?: string): Link[] { + const { clusterName, namespace, projectName, region } = gcpInfo; + return [ + { + name: 'GKE Pod', + title: `${podName}`, + url: `https://console.cloud.google.com/kubernetes/pod/${region}/${clusterName}/${namespace}/${podName}/details?project=${projectName}`, + }, + { + name: `GKE Node`, + title: `${nodeName}`, + url: `https://console.cloud.google.com/kubernetes/node/${region}/${clusterName}/${nodeName}/summary?project=${projectName}`, + }, + { + name: `Workspace Pod Logs`, + title: `See Logs`, + url: `https://console.cloud.google.com/logs/query;query=resource.type%3D%22k8s_container%22%0Aresource.labels.project_id%3D%22${projectName}%22%0Aresource.labels.location%3D%22${region}%22%0Aresource.labels.cluster_name%3D%22${clusterName}%22%0Aresource.labels.namespace_name%3D%22${namespace}%22%0Aresource.labels.pod_name%3D%22${podName}%22?project=${projectName}`, + }, + { + name: `Grafana Workspace`, + title: `Pod Metrics`, + url: `https://monitoring.${baseDomain}/d/admin-workspace/admin-workspace?var-workspace=${podName}`, + }, + { + name: `Grafana Node`, + title: `Node Metrics`, + url: `https://monitoring.${baseDomain}/d/admin-node/admin-node?var-node=${nodeName}`, + }, + ]; } -function deriveGcpInfo(ideUrlStr: string, region: string): { gcp: GcpInfo, baseDomain: string } | undefined { - const ideUrl = new URL(ideUrlStr); - const hostnameParts = ideUrl.hostname.split(".") - const baseDomain = hostnameParts.slice(hostnameParts.length - 2).join("."); - const namespace = hostnameParts[hostnameParts.length - 4]; +function deriveGcpInfo(ideUrlStr: string, region: string): { gcp: GcpInfo; baseDomain: string } | undefined { + const ideUrl = new URL(ideUrlStr); + const hostnameParts = ideUrl.hostname.split('.'); + const baseDomain = hostnameParts.slice(hostnameParts.length - 2).join('.'); + const namespace = hostnameParts[hostnameParts.length - 4]; - const gcp = getGcpInfo(baseDomain, region, namespace); - if (!gcp) { - return undefined; - } - return { - gcp, - baseDomain, - } + const gcp = getGcpInfo(baseDomain, region, namespace); + if (!gcp) { + return undefined; + } + return { + gcp, + baseDomain, + }; } function getGcpInfo(baseDomain: string, regionShort: string, namespace?: string): GcpInfo | undefined { - if (baseDomain === "gitpod.io") { - if (regionShort === "eu03") { - return { - clusterName: "prod--gitpod-io--europe-west1--03", - namespace: 'default', - region: "europe-west1", - projectName: "gitpod-191109", - }; - } - if (regionShort === "us03") { - return { - clusterName: "prod--gitpod-io--us-west1--03", - namespace: 'default', - region: "us-west1", - projectName: "gitpod-191109", - }; - } + if (baseDomain === 'gitpod.io') { + if (regionShort === 'eu03') { + return { + clusterName: 'prod--gitpod-io--europe-west1--03', + namespace: 'default', + region: 'europe-west1', + projectName: 'gitpod-191109', + }; } - if (baseDomain === "gitpod-staging.com") { - if (regionShort === "eu02") { - return { - clusterName: "staging--gitpod-io--eu-west1--02", - namespace: 'default', - region: "europe-west1", - projectName: "gitpod-staging", - }; - } - if (regionShort === "us02") { - return { - clusterName: "staging--gitpod-io--us-west1--02", - namespace: 'default', - region: "us-west1", - projectName: "gitpod-staging", - }; - } + if (regionShort === 'us03') { + return { + clusterName: 'prod--gitpod-io--us-west1--03', + namespace: 'default', + region: 'us-west1', + projectName: 'gitpod-191109', + }; } - if (baseDomain === "gitpod-dev.com") { - return { - clusterName: "dev", - namespace: 'staging-' + namespace, - region: "europe-west1-b", - projectName: "gitpod-core-dev", - }; + } + if (baseDomain === 'gitpod-staging.com') { + if (regionShort === 'eu02') { + return { + clusterName: 'staging--gitpod-io--eu-west1--02', + namespace: 'default', + region: 'europe-west1', + projectName: 'gitpod-staging', + }; } - return undefined; + if (regionShort === 'us02') { + return { + clusterName: 'staging--gitpod-io--us-west1--02', + namespace: 'default', + region: 'us-west1', + projectName: 'gitpod-staging', + }; + } + } + if (baseDomain === 'gitpod-dev.com') { + return { + clusterName: 'dev', + namespace: 'staging-' + namespace, + region: 'europe-west1-b', + projectName: 'gitpod-core-dev', + }; + } + return undefined; } interface GcpInfo { - readonly clusterName: string; - readonly region: string; - readonly projectName: string; - readonly namespace: string; -} \ No newline at end of file + readonly clusterName: string; + readonly region: string; + readonly projectName: string; + readonly namespace: string; +} diff --git a/components/dashboard/src/chargebee/chargebee-client.ts b/components/dashboard/src/chargebee/chargebee-client.ts index 355d74a8b3e27d..da48fb476f6101 100644 --- a/components/dashboard/src/chargebee/chargebee-client.ts +++ b/components/dashboard/src/chargebee/chargebee-client.ts @@ -10,81 +10,89 @@ import { GitpodServer } from '@gitpod/gitpod-protocol'; import { getGitpodService } from '../service/service'; class ChargebeeClientProvider { - protected static client: chargebee.Client; + protected static client: chargebee.Client; - static async get() { - if (!this.client) { - await new Promise((resolve) => { - var scriptTag = document.createElement('script'); - scriptTag.src = "https://js.chargebee.com/v2/chargebee.js"; - scriptTag.async = true; - scriptTag.addEventListener("load", () => { - resolve(); - }); - document.head.appendChild(scriptTag); - }) - const site = await getGitpodService().server.getChargebeeSiteId(); - this.client = (((window as any).Chargebee) as chargebee.Client).init({ - site - }); - } - return this.client; + static async get() { + if (!this.client) { + await new Promise((resolve) => { + var scriptTag = document.createElement('script'); + scriptTag.src = 'https://js.chargebee.com/v2/chargebee.js'; + scriptTag.async = true; + scriptTag.addEventListener('load', () => { + resolve(); + }); + document.head.appendChild(scriptTag); + }); + const site = await getGitpodService().server.getChargebeeSiteId(); + this.client = ((window as any).Chargebee as chargebee.Client).init({ + site, + }); } + return this.client; + } } export interface OpenPortalParams { - loaded?: () => void; - close?: () => void; - visit?: (sectionName: string) => void; + loaded?: () => void; + close?: () => void; + visit?: (sectionName: string) => void; } // https://www.chargebee.com/checkout-portal-docs/api.html export class ChargebeeClient { - constructor(protected readonly client: chargebee.Client) {} + constructor(protected readonly client: chargebee.Client) {} - static async getOrCreate(): Promise { - const create = async () => { - const chargebeeClient = await ChargebeeClientProvider.get(); - const client = new ChargebeeClient(chargebeeClient); - client.createPortalSession(); - return client; - }; + static async getOrCreate(): Promise { + const create = async () => { + const chargebeeClient = await ChargebeeClientProvider.get(); + const client = new ChargebeeClient(chargebeeClient); + client.createPortalSession(); + return client; + }; - const w = window as any; - const _gp = w._gp || (w._gp = {}); - const chargebeeClient = _gp.chargebeeClient || (_gp.chargebeeClient = await create()); - return chargebeeClient; - } + const w = window as any; + const _gp = w._gp || (w._gp = {}); + const chargebeeClient = _gp.chargebeeClient || (_gp.chargebeeClient = await create()); + return chargebeeClient; + } - checkout(hostedPage: (paymentServer: GitpodServer) => Promise<{}>, params: Omit = { success: noOp }) { - const paymentServer = getGitpodService().server; - this.client.openCheckout({ - ...params, - async hostedPage(): Promise { - return hostedPage(paymentServer); - } - }); - } + checkout( + hostedPage: (paymentServer: GitpodServer) => Promise<{}>, + params: Omit = { success: noOp }, + ) { + const paymentServer = getGitpodService().server; + this.client.openCheckout({ + ...params, + async hostedPage(): Promise { + return hostedPage(paymentServer); + }, + }); + } - checkoutExisting(hostedPage: (paymentServer: GitpodServer) => Promise<{}>, params: Omit = { success: noOp }) { - const paymentServer = getGitpodService().server; - this.client.openCheckout({ - ...params, - async hostedPage(): Promise { - return hostedPage(paymentServer); - } - }); - } + checkoutExisting( + hostedPage: (paymentServer: GitpodServer) => Promise<{}>, + params: Omit = { success: noOp }, + ) { + const paymentServer = getGitpodService().server; + this.client.openCheckout({ + ...params, + async hostedPage(): Promise { + return hostedPage(paymentServer); + }, + }); + } - createPortalSession() { - const paymentServer = getGitpodService().server; - this.client.setPortalSession(async () => { - return paymentServer.createPortalSession(); - }); - } + createPortalSession() { + const paymentServer = getGitpodService().server; + this.client.setPortalSession(async () => { + return paymentServer.createPortalSession(); + }); + } - openPortal(params: OpenPortalParams = {}) { - this.client.createChargebeePortal().open(params); - } + openPortal(params: OpenPortalParams = {}) { + this.client.createChargebeePortal().open(params); + } } -const noOp = () => { /* tslint:disable:no-empty */ }; \ No newline at end of file +const noOp = () => { + /* tslint:disable:no-empty */ +}; diff --git a/components/dashboard/src/chargebee/chargebee.d.ts b/components/dashboard/src/chargebee/chargebee.d.ts index bf1710b264a0dd..cfd44da35631cc 100644 --- a/components/dashboard/src/chargebee/chargebee.d.ts +++ b/components/dashboard/src/chargebee/chargebee.d.ts @@ -5,28 +5,25 @@ */ declare module 'chargebee' { + export interface Client { + init(options: object): Client; + openCheckout(callbacks: CheckoutCallbacks); + setPortalSession(callback: () => Promise); + createChargebeePortal(): Portal; + } - export interface Client { - init(options: object): Client; - openCheckout(callbacks: CheckoutCallbacks); - setPortalSession(callback: () => Promise); - createChargebeePortal(): Portal; - } + export interface CheckoutCallbacks { + hostedPage(): Promise; + success(hostedPageId: string); + loaded?: () => void; + error?: (error: any) => void; + step?: (step: string) => void; + close?: () => void; + } - export interface CheckoutCallbacks { - hostedPage(): Promise; - success(hostedPageId: string); - loaded?: () => void; - error?: (error: any) => void; - step?: (step: string) => void; - close?: () => void; - } - - export interface OpenCheckoutParams { + export interface OpenCheckoutParams {} + export interface Portal { + open(callbacks: object); + } } - - export interface Portal { - open(callbacks: object); - } -} \ No newline at end of file diff --git a/components/dashboard/src/components/AlertBox.tsx b/components/dashboard/src/components/AlertBox.tsx index f8bc57d870f50f..431e55399d939b 100644 --- a/components/dashboard/src/components/AlertBox.tsx +++ b/components/dashboard/src/components/AlertBox.tsx @@ -6,9 +6,11 @@ import exclamation from '../images/exclamation.svg'; -export default function AlertBox(p: { className?: string, children?: React.ReactNode }) { - return
- - {p.children} -
; +export default function AlertBox(p: { className?: string; children?: React.ReactNode }) { + return ( +
+ + {p.children} +
+ ); } diff --git a/components/dashboard/src/components/Arrow.tsx b/components/dashboard/src/components/Arrow.tsx index b158d88422fe34..ebc9c7987bc976 100644 --- a/components/dashboard/src/components/Arrow.tsx +++ b/components/dashboard/src/components/Arrow.tsx @@ -5,7 +5,19 @@ */ function Arrow(props: { up: boolean }) { - return + return ( + + ); } export default Arrow; diff --git a/components/dashboard/src/components/CheckBox.tsx b/components/dashboard/src/components/CheckBox.tsx index d16f2ea7cab92b..a54f54adbc2f71 100644 --- a/components/dashboard/src/components/CheckBox.tsx +++ b/components/dashboard/src/components/CheckBox.tsx @@ -4,36 +4,47 @@ * See License-AGPL.txt in the project root for license information. */ - function CheckBox(props: { - name?: string, - title: string | React.ReactNode, - desc: string | React.ReactNode, - checked: boolean, - disabled?: boolean, - onChange?: (e: React.ChangeEvent) => void + name?: string; + title: string | React.ReactNode; + desc: string | React.ReactNode; + checked: boolean; + disabled?: boolean; + onChange?: (e: React.ChangeEvent) => void; }) { - const inputProps: React.InputHTMLAttributes = { - checked: props.checked, - disabled: props.disabled, - onChange: props.onChange, - }; - if (props.name) { - inputProps.name = props.name; - } + const inputProps: React.InputHTMLAttributes = { + checked: props.checked, + disabled: props.disabled, + onChange: props.onChange, + }; + if (props.name) { + inputProps.name = props.name; + } - const checkboxId = `checkbox-${props.title}-${String(Math.random())}`; + const checkboxId = `checkbox-${props.title}-${String(Math.random())}`; - return
- -
- -
{props.desc}
-
+ return ( +
+ +
+ +
{props.desc}
+
+ ); } -export default CheckBox; \ No newline at end of file +export default CheckBox; diff --git a/components/dashboard/src/components/CodeText.tsx b/components/dashboard/src/components/CodeText.tsx index a02d0ae0be407c..9959a5942d4d6a 100644 --- a/components/dashboard/src/components/CodeText.tsx +++ b/components/dashboard/src/components/CodeText.tsx @@ -5,5 +5,9 @@ */ export default function CodeText(p: { children?: React.ReactNode }) { - return {p.children}; + return ( + + {p.children} + + ); } diff --git a/components/dashboard/src/components/ConfirmationModal.tsx b/components/dashboard/src/components/ConfirmationModal.tsx index 60ebf9e12157e6..7a8fd227c87ab4 100644 --- a/components/dashboard/src/components/ConfirmationModal.tsx +++ b/components/dashboard/src/components/ConfirmationModal.tsx @@ -4,83 +4,82 @@ * See License-AGPL.txt in the project root for license information. */ -import AlertBox from "./AlertBox"; -import Modal from "./Modal"; -import { useRef, useEffect } from "react"; +import AlertBox from './AlertBox'; +import Modal from './Modal'; +import { useRef, useEffect } from 'react'; export default function ConfirmationModal(props: { - title?: string; - areYouSureText?: string, - children?: Entity | React.ReactChild[] | React.ReactChild - buttonText?: string, - buttonDisabled?: boolean, - visible?: boolean, - warningText?: string, - onClose: () => void, - onConfirm: () => void, + title?: string; + areYouSureText?: string; + children?: Entity | React.ReactChild[] | React.ReactChild; + buttonText?: string; + buttonDisabled?: boolean; + visible?: boolean; + warningText?: string; + onClose: () => void; + onConfirm: () => void; }) { + const child: React.ReactChild[] = [

{props.areYouSureText}

]; - const child: React.ReactChild[] = [ -

{props.areYouSureText}

, - ] + if (props.warningText) { + child.unshift({props.warningText}); + } - if (props.warningText) { - child.unshift({props.warningText}); + const isEntity = (x: any): x is Entity => typeof x === 'object' && 'name' in x; + if (props.children) { + if (isEntity(props.children)) { + child.push( +
+

{props.children.name}

+ {props.children.description &&

{props.children.description}

} +
, + ); + } else if (Array.isArray(props.children)) { + child.push(...props.children); + } else { + child.push(props.children); } + } + const cancelButtonRef = useRef(null); - const isEntity = (x: any): x is Entity => typeof x === "object" && "name" in x; - if (props.children) { - if (isEntity(props.children)) { - child.push( -
-

{props.children.name}

- {props.children.description &&

{props.children.description}

} -
- ) - } else if (Array.isArray(props.children)) { - child.push(...props.children); - } else { - child.push(props.children); - } - } - const cancelButtonRef = useRef(null); - - const buttons = [ - , - , - ] + const buttons = [ + , + , + ]; - const buttonDisabled = useRef(props.buttonDisabled); - useEffect(() => { - buttonDisabled.current = props.buttonDisabled; - }) + const buttonDisabled = useRef(props.buttonDisabled); + useEffect(() => { + buttonDisabled.current = props.buttonDisabled; + }); - return ( - { - if (cancelButtonRef?.current?.contains(document.activeElement)) { - props.onClose(); - return false; - } - if (buttonDisabled.current) { - return false - } - props.onConfirm(); - return true; - }} - > - {child} - - ); + return ( + { + if (cancelButtonRef?.current?.contains(document.activeElement)) { + props.onClose(); + return false; + } + if (buttonDisabled.current) { + return false; + } + props.onConfirm(); + return true; + }} + > + {child} + + ); } export interface Entity { - name: string, - description?: string, + name: string; + description?: string; } diff --git a/components/dashboard/src/components/ContextMenu.tsx b/components/dashboard/src/components/ContextMenu.tsx index 5fe5f9f74cfd6e..bbbab6edb53492 100644 --- a/components/dashboard/src/components/ContextMenu.tsx +++ b/components/dashboard/src/components/ContextMenu.tsx @@ -9,108 +9,150 @@ import { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; export interface ContextMenuProps { - children?: React.ReactChild[] | React.ReactChild; - menuEntries: ContextMenuEntry[]; - classes?: string; + children?: React.ReactChild[] | React.ReactChild; + menuEntries: ContextMenuEntry[]; + classes?: string; } export interface ContextMenuEntry { - title: string; - active?: boolean; - /** - * whether a separator line should be rendered below this item - */ - separator?: boolean; - customFontStyle?: string; - customContent?: React.ReactChild; - onClick?: (event: React.MouseEvent) => void; - href?: string; - link?: string; - target?: HTMLAttributeAnchorTarget; + title: string; + active?: boolean; + /** + * whether a separator line should be rendered below this item + */ + separator?: boolean; + customFontStyle?: string; + customContent?: React.ReactChild; + onClick?: (event: React.MouseEvent) => void; + href?: string; + link?: string; + target?: HTMLAttributeAnchorTarget; } function ContextMenu(props: ContextMenuProps) { - const [expanded, setExpanded] = useState(false); - const toggleExpanded = () => { - setExpanded(!expanded); - } + const [expanded, setExpanded] = useState(false); + const toggleExpanded = () => { + setExpanded(!expanded); + }; - const handler = (evt: KeyboardEvent) => { - if (evt.key === 'Escape') { - setExpanded(false); - } + const handler = (evt: KeyboardEvent) => { + if (evt.key === 'Escape') { + setExpanded(false); } + }; - const skipClickHandlerRef = React.useRef(false); - const setSkipClickHandler = (data: boolean) => { - skipClickHandlerRef.current = data; - } - const clickHandler = (evt: MouseEvent) => { - if (skipClickHandlerRef.current) { - // skip only once - setSkipClickHandler(false); - } else { - setExpanded(false); - } + const skipClickHandlerRef = React.useRef(false); + const setSkipClickHandler = (data: boolean) => { + skipClickHandlerRef.current = data; + }; + const clickHandler = (evt: MouseEvent) => { + if (skipClickHandlerRef.current) { + // skip only once + setSkipClickHandler(false); + } else { + setExpanded(false); } + }; - useEffect(() => { - window.addEventListener('keydown', handler); - window.addEventListener('click', clickHandler); - // Remove event listeners on cleanup - return () => { - window.removeEventListener('keydown', handler); - window.removeEventListener('click', clickHandler); - }; - }, []); // Empty array ensures that effect is only run on mount and unmount - + useEffect(() => { + window.addEventListener('keydown', handler); + window.addEventListener('click', clickHandler); + // Remove event listeners on cleanup + return () => { + window.removeEventListener('keydown', handler); + window.removeEventListener('click', clickHandler); + }; + }, []); // Empty array ensures that effect is only run on mount and unmount - const font = "text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-100" + const font = 'text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-100'; - const menuId = String(Math.random()); + const menuId = String(Math.random()); - // Default 'children' is the three dots hamburger button. - const children = props.children || Actions; + // Default 'children' is the three dots hamburger button. + const children = props.children || ( + + Actions + + + + + + + ); - return ( -
-
{ - toggleExpanded(); - // Don't use `e.stopPropagation();` because that prevents that clicks on other context menus closes this one. - setSkipClickHandler(true); - }}> - {children} -
- {expanded ? -
- {props.menuEntries.length === 0 - ?

No actions available

- : props.menuEntries.map((e, index) => { - const clickable = e.href || e.onClick || e.link; - const entry =
- {e.customContent || <>
{e.title}
{e.active ?
: null}} -
- const key = `entry-${menuId}-${index}-${e.title}`; - if (e.link) { - return - {entry} - ; - } else if (e.href) { - return - {entry} - ; - } else { - return
- {entry} -
- } - })} + return ( +
+
{ + toggleExpanded(); + // Don't use `e.stopPropagation();` because that prevents that clicks on other context menus closes this one. + setSkipClickHandler(true); + }} + > + {children} +
+ {expanded ? ( +
+ {props.menuEntries.length === 0 ? ( +

No actions available

+ ) : ( + props.menuEntries.map((e, index) => { + const clickable = e.href || e.onClick || e.link; + const entry = ( +
+ {e.customContent || ( + <> +
{e.title}
+
+ {e.active ?
: null} + + )}
- : - null - } + ); + const key = `entry-${menuId}-${index}-${e.title}`; + if (e.link) { + return ( + + {entry} + + ); + } else if (e.href) { + return ( + + {entry} + + ); + } else { + return ( +
+ {entry} +
+ ); + } + }) + )}
- ); + ) : null} +
+ ); } -export default ContextMenu; \ No newline at end of file +export default ContextMenu; diff --git a/components/dashboard/src/components/DropDown.tsx b/components/dashboard/src/components/DropDown.tsx index 118bafe0fec1fb..46ef703d77835f 100644 --- a/components/dashboard/src/components/DropDown.tsx +++ b/components/dashboard/src/components/DropDown.tsx @@ -9,38 +9,43 @@ import Arrow from './Arrow'; import ContextMenu from './ContextMenu'; export interface DropDownProps { - prefix?: string; - contextMenuWidth?: string; - activeEntry?: string, - entries: DropDownEntry[]; + prefix?: string; + contextMenuWidth?: string; + activeEntry?: string; + entries: DropDownEntry[]; } export interface DropDownEntry { - title: string, - onClick: ()=>void + title: string; + onClick: () => void; } function DropDown(props: DropDownProps) { - const [current, setCurrent] = useState(props.activeEntry || props.entries[0].title); - useEffect(() => { - setCurrent(props.activeEntry || props.entries[0].title); - }, [props.activeEntry, props.entries]); - const enhancedEntries = props.entries.map(e => { - return { - ...e, - active: e.title === current, - onClick: () => { - e.onClick(); - setCurrent(e.title); - } - } - }) - const font = "text-gray-400 dark:text-gray-500 text-sm leading-1 group hover:text-gray-600 dark:hover:text-gray-400 transition ease-in-out" - return ( - - {props.prefix}{current} - - ); + const [current, setCurrent] = useState(props.activeEntry || props.entries[0].title); + useEffect(() => { + setCurrent(props.activeEntry || props.entries[0].title); + }, [props.activeEntry, props.entries]); + const enhancedEntries = props.entries.map((e) => { + return { + ...e, + active: e.title === current, + onClick: () => { + e.onClick(); + setCurrent(e.title); + }, + }; + }); + const font = + 'text-gray-400 dark:text-gray-500 text-sm leading-1 group hover:text-gray-600 dark:hover:text-gray-400 transition ease-in-out'; + return ( + + + {props.prefix} + {current} + + + + ); } -export default DropDown; \ No newline at end of file +export default DropDown; diff --git a/components/dashboard/src/components/Header.tsx b/components/dashboard/src/components/Header.tsx index a98b60baea24a8..1347b8e838000d 100644 --- a/components/dashboard/src/components/Header.tsx +++ b/components/dashboard/src/components/Header.tsx @@ -4,28 +4,30 @@ * See License-AGPL.txt in the project root for license information. */ -import { useEffect } from "react"; -import Separator from "./Separator"; +import { useEffect } from 'react'; +import Separator from './Separator'; export interface HeaderProps { - title: string | React.ReactElement; - subtitle: string | React.ReactElement; + title: string | React.ReactElement; + subtitle: string | React.ReactElement; } export default function Header(p: HeaderProps) { - useEffect(() => { - if (typeof p.title !== "string") { - return; - } - document.title = `${p.title} — Gitpod`; - }, []); - return
-
-
- {typeof p.title === "string" ? (

{p.title}

) : p.title} - {typeof p.subtitle === "string" ? (

{p.subtitle}

) : p.subtitle} -
+ useEffect(() => { + if (typeof p.title !== 'string') { + return; + } + document.title = `${p.title} — Gitpod`; + }, []); + return ( +
+
+
+ {typeof p.title === 'string' ?

{p.title}

: p.title} + {typeof p.subtitle === 'string' ?

{p.subtitle}

: p.subtitle}
- -
; +
+ +
+ ); } diff --git a/components/dashboard/src/components/InfoBox.tsx b/components/dashboard/src/components/InfoBox.tsx index 330f3e32a2475c..d29e78d3e90003 100644 --- a/components/dashboard/src/components/InfoBox.tsx +++ b/components/dashboard/src/components/InfoBox.tsx @@ -6,9 +6,15 @@ import info from '../images/info.svg'; -export default function InfoBox(p: { className?: string, children?: React.ReactNode }) { - return
- - {p.children} -
; +export default function InfoBox(p: { className?: string; children?: React.ReactNode }) { + return ( +
+ + {p.children} +
+ ); } diff --git a/components/dashboard/src/components/ItemsList.tsx b/components/dashboard/src/components/ItemsList.tsx index 8b555e70e71c9c..136e4326783876 100644 --- a/components/dashboard/src/components/ItemsList.tsx +++ b/components/dashboard/src/components/ItemsList.tsx @@ -4,54 +4,42 @@ * See License-AGPL.txt in the project root for license information. */ -import ContextMenu, { ContextMenuEntry } from "./ContextMenu" +import ContextMenu, { ContextMenuEntry } from './ContextMenu'; -export function ItemsList(props: { - children?: React.ReactNode; - className?: string; -}) { - return
- {props.children} -
; +export function ItemsList(props: { children?: React.ReactNode; className?: string }) { + return
{props.children}
; } -export function Item(props: { - children?: React.ReactNode; - className?: string; - header?: boolean; -}) { - const headerClassName = "text-sm text-gray-400 border-t border-b border-gray-200 dark:border-gray-800"; - const notHeaderClassName = "rounded-xl hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gitpod-kumquat-light"; - return
- {props.children} -
; -} - -export function ItemField(props: { - children?: React.ReactNode - className?: string -}) { +export function Item(props: { children?: React.ReactNode; className?: string; header?: boolean }) { + const headerClassName = 'text-sm text-gray-400 border-t border-b border-gray-200 dark:border-gray-800'; + const notHeaderClassName = 'rounded-xl hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gitpod-kumquat-light'; return ( -
+
{props.children}
- ) + ); +} + +export function ItemField(props: { children?: React.ReactNode; className?: string }) { + return
{props.children}
; } -export function ItemFieldIcon(props: { - children?: React.ReactNode; - className?: string; -}) { - return
- {props.children} -
; +export function ItemFieldIcon(props: { children?: React.ReactNode; className?: string }) { + return
{props.children}
; } -export function ItemFieldContextMenu(props: { - menuEntries: ContextMenuEntry[]; - className?: string; -}) { - return
- -
; +export function ItemFieldContextMenu(props: { menuEntries: ContextMenuEntry[]; className?: string }) { + return ( +
+ +
+ ); } diff --git a/components/dashboard/src/components/Modal.tsx b/components/dashboard/src/components/Modal.tsx index a53f46392cba96..e6783568f062bc 100644 --- a/components/dashboard/src/components/Modal.tsx +++ b/components/dashboard/src/components/Modal.tsx @@ -4,73 +4,83 @@ * See License-AGPL.txt in the project root for license information. */ -import { useEffect } from "react"; +import { useEffect } from 'react'; export default function Modal(props: { - title?: string; - buttons?: React.ReactChild[] | React.ReactChild, - children: React.ReactChild[] | React.ReactChild, - visible: boolean, - closeable?: boolean, - className?: string, - onClose: () => void, - onEnter?: () => boolean + title?: string; + buttons?: React.ReactChild[] | React.ReactChild; + children: React.ReactChild[] | React.ReactChild; + visible: boolean; + closeable?: boolean; + className?: string; + onClose: () => void; + onEnter?: () => boolean; }) { - - const handler = (evt: KeyboardEvent) => { - if (evt.defaultPrevented) { - return; - } - if (evt.key === 'Escape') { - props.onClose(); - } - if (evt.key === 'Enter') { - if (props.onEnter) { - if (props.onEnter()) { - props.onClose(); - } - } else { - props.onClose(); - } + const handler = (evt: KeyboardEvent) => { + if (evt.defaultPrevented) { + return; + } + if (evt.key === 'Escape') { + props.onClose(); + } + if (evt.key === 'Enter') { + if (props.onEnter) { + if (props.onEnter()) { + props.onClose(); } + } else { + props.onClose(); + } } - // Add event listeners - useEffect(() => { - window.addEventListener('keydown', handler); - // Remove event listeners on cleanup - return () => { - window.removeEventListener('keydown', handler); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.onClose, props.onEnter]); + }; + // Add event listeners + useEffect(() => { + window.addEventListener('keydown', handler); + // Remove event listeners on cleanup + return () => { + window.removeEventListener('keydown', handler); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [props.onClose, props.onEnter]); - if (!props.visible) { - return null; - } + if (!props.visible) { + return null; + } - return ( -
-
-
e.stopPropagation()}> - {props.closeable !== false && ( -
- - - - -
- )} - {props.title ? <>

{props.title}

-
- {props.children} -
-
- {props.buttons} -
: - props.children } -
+ return ( +
+
+
e.stopPropagation()} + > + {props.closeable !== false && ( +
+ + + +
+ )} + {props.title ? ( + <> +

{props.title}

+
+ {props.children} +
+
{props.buttons}
+ + ) : ( + props.children + )}
- ); -} \ No newline at end of file +
+
+ ); +} diff --git a/components/dashboard/src/components/MonacoEditor.tsx b/components/dashboard/src/components/MonacoEditor.tsx index 62f49bcddba388..0235756eb6f360 100644 --- a/components/dashboard/src/components/MonacoEditor.tsx +++ b/components/dashboard/src/components/MonacoEditor.tsx @@ -4,9 +4,9 @@ * See License-AGPL.txt in the project root for license information. */ -import { useContext, useEffect, useRef } from "react"; -import * as monaco from "monaco-editor"; -import { ThemeContext } from "../theme-context"; +import { useContext, useEffect, useRef } from 'react'; +import * as monaco from 'monaco-editor'; +import { ThemeContext } from '../theme-context'; monaco.editor.defineTheme('gitpod', { base: 'vs', @@ -69,7 +69,7 @@ export default function MonacoEditor(props: MonacoEditorProps) { props.onChange(editorRef.current!.getValue()); }); // 8px top margin: https://github.com/Microsoft/monaco-editor/issues/1333 - editorRef.current.changeViewZones(accessor => { + editorRef.current.changeViewZones((accessor) => { accessor.addZone({ afterLineNumber: 0, heightInPx: 8, @@ -84,16 +84,16 @@ export default function MonacoEditor(props: MonacoEditorProps) { if (editorRef.current && editorRef.current.getValue() !== props.value) { editorRef.current.setValue(props.value); } - }, [ props.value ]); + }, [props.value]); useEffect(() => { - monaco.editor.setTheme(props.disabled - ? (isDark ? 'gitpod-dark-disabled' : 'gitpod-disabled') - : (isDark ? 'gitpod-dark' : 'gitpod')); + monaco.editor.setTheme( + props.disabled ? (isDark ? 'gitpod-dark-disabled' : 'gitpod-disabled') : isDark ? 'gitpod-dark' : 'gitpod', + ); if (editorRef.current) { editorRef.current.updateOptions({ readOnly: props.disabled }); } - }, [ props.disabled, isDark ]); + }, [props.disabled, isDark]); return
; -} \ No newline at end of file +} diff --git a/components/dashboard/src/components/PageWithSubMenu.tsx b/components/dashboard/src/components/PageWithSubMenu.tsx index 8e709d1fdd130e..654d28d0e6facd 100644 --- a/components/dashboard/src/components/PageWithSubMenu.tsx +++ b/components/dashboard/src/components/PageWithSubMenu.tsx @@ -4,45 +4,45 @@ * See License-AGPL.txt in the project root for license information. */ -import { useLocation } from "react-router"; -import { Link } from "react-router-dom"; +import { useLocation } from 'react-router'; +import { Link } from 'react-router-dom'; import Header from '../components/Header'; export interface PageWithSubMenuProps { + title: string; + subtitle: string; + subMenu: { title: string; - subtitle: string; - subMenu: { - title: string, - link: string[] - }[]; - children: React.ReactNode; + link: string[]; + }[]; + children: React.ReactNode; } export function PageWithSubMenu(p: PageWithSubMenuProps) { - const location = useLocation(); - return
-
-
-
-
    - {p.subMenu.map(e => { - let classes = "flex block py-2 px-4 rounded-md"; - if (e.link.some(l => l === location.pathname)) { - classes += " bg-gray-800 text-gray-50"; - } else { - classes += " hover:bg-gray-100 dark:hover:bg-gray-800"; - } - return -
  • - {e.title} -
  • - ; - })} -
-
-
- {p.children} -
+ const location = useLocation(); + return ( +
+
+
+
+
    + {p.subMenu.map((e) => { + let classes = 'flex block py-2 px-4 rounded-md'; + if (e.link.some((l) => l === location.pathname)) { + classes += ' bg-gray-800 text-gray-50'; + } else { + classes += ' hover:bg-gray-100 dark:hover:bg-gray-800'; + } + return ( + +
  • {e.title}
  • + + ); + })} +
-
; +
{p.children}
+
+
+ ); } diff --git a/components/dashboard/src/components/PendingChangesDropdown.tsx b/components/dashboard/src/components/PendingChangesDropdown.tsx index e96bd7e45e7826..dd700f05ab697f 100644 --- a/components/dashboard/src/components/PendingChangesDropdown.tsx +++ b/components/dashboard/src/components/PendingChangesDropdown.tsx @@ -4,9 +4,9 @@ * See License-AGPL.txt in the project root for license information. */ -import { WorkspaceInstance } from "@gitpod/gitpod-protocol"; -import ContextMenu, { ContextMenuEntry } from "./ContextMenu"; -import CaretDown from "../icons/CaretDown.svg"; +import { WorkspaceInstance } from '@gitpod/gitpod-protocol'; +import ContextMenu, { ContextMenuEntry } from './ContextMenu'; +import CaretDown from '../icons/CaretDown.svg'; export default function PendingChangesDropdown(props: { workspaceInstance?: WorkspaceInstance }) { const repo = props.workspaceInstance?.status?.repo; @@ -18,26 +18,30 @@ export default function PendingChangesDropdown(props: { workspaceInstance?: Work if ((repo.totalUntrackedFiles || 0) > 0) { totalChanges += repo.totalUntrackedFiles || 0; menuEntries.push({ title: 'Untracked Files', customFontStyle: headingStyle }); - (repo.untrackedFiles || []).forEach(item => menuEntries.push({ title: item, customFontStyle: itemStyle })); + (repo.untrackedFiles || []).forEach((item) => menuEntries.push({ title: item, customFontStyle: itemStyle })); } if ((repo.totalUncommitedFiles || 0) > 0) { totalChanges += repo.totalUncommitedFiles || 0; menuEntries.push({ title: 'Uncommitted Files', customFontStyle: headingStyle }); - (repo.uncommitedFiles || []).forEach(item => menuEntries.push({ title: item, customFontStyle: itemStyle })); + (repo.uncommitedFiles || []).forEach((item) => menuEntries.push({ title: item, customFontStyle: itemStyle })); } if ((repo.totalUnpushedCommits || 0) > 0) { totalChanges += repo.totalUnpushedCommits || 0; menuEntries.push({ title: 'Unpushed Commits', customFontStyle: headingStyle }); - (repo.unpushedCommits || []).forEach(item => menuEntries.push({ title: item, customFontStyle: itemStyle })); + (repo.unpushedCommits || []).forEach((item) => menuEntries.push({ title: item, customFontStyle: itemStyle })); } } if (totalChanges <= 0) { return
No Changes
; } - return -

- {totalChanges} Change{totalChanges === 1 ? '' : 's'} - -

-
; -} \ No newline at end of file + return ( + +

+ + {totalChanges} Change{totalChanges === 1 ? '' : 's'} + + +

+
+ ); +} diff --git a/components/dashboard/src/components/PillLabel.tsx b/components/dashboard/src/components/PillLabel.tsx index 731d74d29d7384..435f45772f36ca 100644 --- a/components/dashboard/src/components/PillLabel.tsx +++ b/components/dashboard/src/components/PillLabel.tsx @@ -14,9 +14,11 @@ * **className**\ * Add additional css classes to style this component. */ -export default function PillLabel(props: { children?: React.ReactNode, type?: "info" | "warn", className?: string }) { - const infoStyle = "bg-blue-50 text-blue-500 dark:bg-blue-500 dark:text-blue-100"; - const warnStyle = "bg-orange-100 text-orange-700 dark:bg-orange-600 dark:text-orange-100"; - const style = `ml-2 px-3 py-1 text-sm uppercase rounded-xl ${props.type === "warn" ? warnStyle : infoStyle} ${props.className}`; - return {props.children}; +export default function PillLabel(props: { children?: React.ReactNode; type?: 'info' | 'warn'; className?: string }) { + const infoStyle = 'bg-blue-50 text-blue-500 dark:bg-blue-500 dark:text-blue-100'; + const warnStyle = 'bg-orange-100 text-orange-700 dark:bg-orange-600 dark:text-orange-100'; + const style = `ml-2 px-3 py-1 text-sm uppercase rounded-xl ${props.type === 'warn' ? warnStyle : infoStyle} ${ + props.className + }`; + return {props.children}; } diff --git a/components/dashboard/src/components/PillMenuItem.tsx b/components/dashboard/src/components/PillMenuItem.tsx index d12fcb1c5e84aa..90f5e569b2c136 100644 --- a/components/dashboard/src/components/PillMenuItem.tsx +++ b/components/dashboard/src/components/PillMenuItem.tsx @@ -4,19 +4,24 @@ * See License-AGPL.txt in the project root for license information. */ -import { Link } from "react-router-dom"; +import { Link } from 'react-router-dom'; export default function PillMenuItem(p: { - name: string, - selected: boolean, - link?: string, - onClick?: (event: React.MouseEvent) => void + name: string; + selected: boolean; + link?: string; + onClick?: (event: React.MouseEvent) => void; }) { - const classes = 'flex block font-medium dark:text-gray-200 px-2 py-1 rounded-lg transition ease-in-out ' + - (p.selected - ? 'bg-gray-200 dark:bg-gray-700' - : 'text-gray-600 hover:bg-gray-100 dark:hover:bg-gray-800'); - return ((!p.link || p.link.startsWith('https://')) - ? {p.name} - : {p.name}); -} \ No newline at end of file + const classes = + 'flex block font-medium dark:text-gray-200 px-2 py-1 rounded-lg transition ease-in-out ' + + (p.selected ? 'bg-gray-200 dark:bg-gray-700' : 'text-gray-600 hover:bg-gray-100 dark:hover:bg-gray-800'); + return !p.link || p.link.startsWith('https://') ? ( + + {p.name} + + ) : ( + + {p.name} + + ); +} diff --git a/components/dashboard/src/components/PrebuildLogs.tsx b/components/dashboard/src/components/PrebuildLogs.tsx index ebdf9048ace1f6..db745ba78a6805 100644 --- a/components/dashboard/src/components/PrebuildLogs.tsx +++ b/components/dashboard/src/components/PrebuildLogs.tsx @@ -4,10 +4,16 @@ * See License-AGPL.txt in the project root for license information. */ -import EventEmitter from "events"; -import React, { Suspense, useEffect, useState } from "react"; -import { Workspace, WorkspaceInstance, DisposableCollection, WorkspaceImageBuild, HEADLESS_LOG_STREAM_STATUS_CODE_REGEX } from "@gitpod/gitpod-protocol"; -import { getGitpodService } from "../service/service"; +import EventEmitter from 'events'; +import React, { Suspense, useEffect, useState } from 'react'; +import { + Workspace, + WorkspaceInstance, + DisposableCollection, + WorkspaceImageBuild, + HEADLESS_LOG_STREAM_STATUS_CODE_REGEX, +} from '@gitpod/gitpod-protocol'; +import { getGitpodService } from '../service/service'; const WorkspaceLogs = React.lazy(() => import('./WorkspaceLogs')); @@ -17,10 +23,10 @@ export interface PrebuildLogsProps { } export default function PrebuildLogs(props: PrebuildLogsProps) { - const [ workspace, setWorkspace ] = useState(); - const [ workspaceInstance, setWorkspaceInstance ] = useState(); - const [ error, setError ] = useState(); - const [ logsEmitter ] = useState(new EventEmitter()); + const [workspace, setWorkspace] = useState(); + const [workspaceInstance, setWorkspaceInstance] = useState(); + const [error, setError] = useState(); + const [logsEmitter] = useState(new EventEmitter()); useEffect(() => { const disposables = new DisposableCollection(); @@ -35,23 +41,34 @@ export default function PrebuildLogs(props: PrebuildLogsProps) { setWorkspace(info.workspace); setWorkspaceInstance(info.latestInstance); } - disposables.push(getGitpodService().registerClient({ - onInstanceUpdate: (instance) => { - if (props.workspaceId === instance.workspaceId) { - setWorkspaceInstance(instance); - } - }, - onWorkspaceImageBuildLogs: (info: WorkspaceImageBuild.StateInfo, content?: WorkspaceImageBuild.LogContent) => { - if (!content) { - return; - } - logsEmitter.emit('logs', content.text); - }, - })); + disposables.push( + getGitpodService().registerClient({ + onInstanceUpdate: (instance) => { + if (props.workspaceId === instance.workspaceId) { + setWorkspaceInstance(instance); + } + }, + onWorkspaceImageBuildLogs: ( + info: WorkspaceImageBuild.StateInfo, + content?: WorkspaceImageBuild.LogContent, + ) => { + if (!content) { + return; + } + logsEmitter.emit('logs', content.text); + }, + }), + ); if (info.latestInstance) { - disposables.push(watchHeadlessLogs(info.latestInstance.id, chunk => { - logsEmitter.emit('logs', chunk); - }, async () => workspaceInstance?.status.phase === 'stopped')); + disposables.push( + watchHeadlessLogs( + info.latestInstance.id, + (chunk) => { + logsEmitter.emit('logs', chunk); + }, + async () => workspaceInstance?.status.phase === 'stopped', + ), + ); } } catch (err) { console.error(err); @@ -60,8 +77,8 @@ export default function PrebuildLogs(props: PrebuildLogsProps) { })(); return function cleanUp() { disposables.dispose(); - } - }, [ props.workspaceId ]); + }; + }, [props.workspaceId]); useEffect(() => { if (props.onInstanceUpdate && workspaceInstance) { @@ -70,48 +87,48 @@ export default function PrebuildLogs(props: PrebuildLogsProps) { switch (workspaceInstance?.status.phase) { // unknown indicates an issue within the system in that it cannot determine the actual phase of // a workspace. This phase is usually accompanied by an error. - case "unknown": + case 'unknown': break; // Preparing means that we haven't actually started the workspace instance just yet, but rather // are still preparing for launch. This means we're building the Docker image for the workspace. - case "preparing": + case 'preparing': getGitpodService().server.watchWorkspaceImageBuildLogs(workspace!.id); break; // Pending means the workspace does not yet consume resources in the cluster, but rather is looking for // some space within the cluster. If for example the cluster needs to scale up to accomodate the // workspace, the workspace will be in Pending state until that happened. - case "pending": + case 'pending': break; // Creating means the workspace is currently being created. That includes downloading the images required // to run the workspace over the network. The time spent in this phase varies widely and depends on the current // network speed, image size and cache states. - case "creating": + case 'creating': break; // Initializing is the phase in which the workspace is executing the appropriate workspace initializer (e.g. Git // clone or backup download). After this phase one can expect the workspace to either be Running or Failed. - case "initializing": + case 'initializing': break; // Running means the workspace is able to actively perform work, either by serving a user through Theia, // or as a headless workspace. - case "running": + case 'running': break; // Interrupted is an exceptional state where the container should be running but is temporarily unavailable. // When in this state, we expect it to become running or stopping anytime soon. - case "interrupted": + case 'interrupted': break; // Stopping means that the workspace is currently shutting down. It could go to stopped every moment. - case "stopping": + case 'stopping': break; // Stopped means the workspace ended regularly because it was shut down. - case "stopped": + case 'stopped': getGitpodService().server.watchWorkspaceImageBuildLogs(workspace!.id); break; } @@ -121,14 +138,20 @@ export default function PrebuildLogs(props: PrebuildLogsProps) { if (workspaceInstance?.status.conditions.failed) { setError(new Error(workspaceInstance.status.conditions.failed)); } - }, [ props.workspaceId, workspaceInstance?.status.phase ]); + }, [props.workspaceId, workspaceInstance?.status.phase]); - return }> - - ; + return ( + }> + + + ); } -export function watchHeadlessLogs(instanceId: string, onLog: (chunk: string) => void, checkIsDone: () => Promise): DisposableCollection { +export function watchHeadlessLogs( + instanceId: string, + onLog: (chunk: string) => void, + checkIsDone: () => Promise, +): DisposableCollection { const disposables = new DisposableCollection(); const startWatchingLogs = async () => { @@ -143,7 +166,7 @@ export function watchHeadlessLogs(instanceId: string, onLog: (chunk: string) => const maxBackoffSeconds = 5; delayInSeconds = Math.min(delayInSeconds * backoffFactor, maxBackoffSeconds); - console.debug("re-trying headless-logs because: " + reason, err); + console.debug('re-trying headless-logs because: ' + reason, err); await new Promise((resolve) => { setTimeout(resolve, delayInSeconds * 1000); }); @@ -157,24 +180,24 @@ export function watchHeadlessLogs(instanceId: string, onLog: (chunk: string) => // TODO(gpl) Only listening on first stream for now const streamIds = Object.keys(logSources.streams); if (streamIds.length < 1) { - await retryBackoff("no streams"); + await retryBackoff('no streams'); return; } const streamUrl = logSources.streams[streamIds[0]]; - console.log("fetching from streamUrl: " + streamUrl); + console.log('fetching from streamUrl: ' + streamUrl); response = await fetch(streamUrl, { method: 'GET', cache: 'no-cache', credentials: 'include', keepalive: true, headers: { - 'TE': 'trailers', // necessary to receive stream status code + TE: 'trailers', // necessary to receive stream status code }, }); reader = response.body?.getReader(); if (!reader) { - await retryBackoff("no reader"); + await retryBackoff('no reader'); return; } disposables.push({ dispose: () => reader?.cancel() }); @@ -189,7 +212,7 @@ export function watchHeadlessLogs(instanceId: string, onLog: (chunk: string) => const matches = msg.match(HEADLESS_LOG_STREAM_STATUS_CODE_REGEX); if (matches) { if (matches.length < 2) { - console.debug("error parsing log stream status code. msg: " + msg); + console.debug('error parsing log stream status code. msg: ' + msg); } else { const code = parseStatusCode(matches[1]); if (code !== 200) { @@ -202,19 +225,19 @@ export function watchHeadlessLogs(instanceId: string, onLog: (chunk: string) => chunk = await reader.read(); } - reader.cancel() + reader.cancel(); if (await checkIsDone()) { return; } - } catch(err) { + } catch (err) { reader?.cancel().catch(console.debug); if (err.code === 400) { // sth is really off, and we _should not_ retry - console.error("stopped watching headless logs", err); + console.error('stopped watching headless logs', err); return; } - await retryBackoff("error while listening to stream", err); + await retryBackoff('error while listening to stream', err); } }; startWatchingLogs().catch(console.error); @@ -224,7 +247,7 @@ export function watchHeadlessLogs(instanceId: string, onLog: (chunk: string) => class StreamError extends Error { constructor(readonly code?: number) { - super(`stream status code: ${code}`) + super(`stream status code: ${code}`); } } @@ -234,7 +257,7 @@ function parseStatusCode(code: string | undefined): number | undefined { return undefined; } return Number.parseInt(code); - } catch(err) { + } catch (err) { return undefined; } -} \ No newline at end of file +} diff --git a/components/dashboard/src/components/SelectableCard.tsx b/components/dashboard/src/components/SelectableCard.tsx index d6eba08cb12cc2..d75d80fdefccb8 100644 --- a/components/dashboard/src/components/SelectableCard.tsx +++ b/components/dashboard/src/components/SelectableCard.tsx @@ -5,21 +5,41 @@ */ export interface SelectableCardProps { - title: string; - selected: boolean; - className?: string; - onClick: () => void; - children?: React.ReactNode; + title: string; + selected: boolean; + className?: string; + onClick: () => void; + children?: React.ReactNode; } function SelectableCard(props: SelectableCardProps) { - return
-
-

{props.title}

- -
- {props.children} -
; + return ( +
+
+

+ {props.title} +

+ +
+ {props.children} +
+ ); } export default SelectableCard; diff --git a/components/dashboard/src/components/Separator.tsx b/components/dashboard/src/components/Separator.tsx index 9dea3991464f89..32c35bc74472f3 100644 --- a/components/dashboard/src/components/Separator.tsx +++ b/components/dashboard/src/components/Separator.tsx @@ -5,5 +5,5 @@ */ export default function Separator() { - return
; -} \ No newline at end of file + return
; +} diff --git a/components/dashboard/src/components/TabMenuItem.tsx b/components/dashboard/src/components/TabMenuItem.tsx index 7cccdbb4495334..71c516b24996ce 100644 --- a/components/dashboard/src/components/TabMenuItem.tsx +++ b/components/dashboard/src/components/TabMenuItem.tsx @@ -4,19 +4,26 @@ * See License-AGPL.txt in the project root for license information. */ -import { Link } from "react-router-dom"; +import { Link } from 'react-router-dom'; export default function TabMenuItem(p: { - name: string, - selected: boolean, - link?: string, - onClick?: (event: React.MouseEvent) => void + name: string; + selected: boolean; + link?: string; + onClick?: (event: React.MouseEvent) => void; }) { - const classes = 'cursor-pointer py-2 px-4 border-b-4 border-transparent transition ease-in-out ' + - (p.selected - ? 'text-gray-600 dark:text-gray-400 border-gray-700 dark:border-gray-400' - : 'text-gray-400 dark:text-gray-600 hover:border-gray-400 dark:hover:border-gray-600'); - return ((!p.link || p.link.startsWith('https://')) - ? {p.name} - : {p.name}); -} \ No newline at end of file + const classes = + 'cursor-pointer py-2 px-4 border-b-4 border-transparent transition ease-in-out ' + + (p.selected + ? 'text-gray-600 dark:text-gray-400 border-gray-700 dark:border-gray-400' + : 'text-gray-400 dark:text-gray-600 hover:border-gray-400 dark:hover:border-gray-600'); + return !p.link || p.link.startsWith('https://') ? ( + + {p.name} + + ) : ( + + {p.name} + + ); +} diff --git a/components/dashboard/src/components/Tooltip.tsx b/components/dashboard/src/components/Tooltip.tsx index eb01d359a5a360..a51cef1b23298a 100644 --- a/components/dashboard/src/components/Tooltip.tsx +++ b/components/dashboard/src/components/Tooltip.tsx @@ -7,28 +7,30 @@ import { useState } from 'react'; export interface TooltipProps { - children: React.ReactChild[] | React.ReactChild; - content: string; - allowWrap?: boolean; + children: React.ReactChild[] | React.ReactChild; + content: string; + allowWrap?: boolean; } function Tooltip(props: TooltipProps) { - const [expanded, setExpanded] = useState(false); + const [expanded, setExpanded] = useState(false); - return ( -
setExpanded(false)} onMouseEnter={() => setExpanded(true)} className="relative"> -
- {props.children} -
- {expanded ? -
- {props.content} -
- : - null - } + return ( +
setExpanded(false)} onMouseEnter={() => setExpanded(true)} className="relative"> +
{props.children}
+ {expanded ? ( +
+ {props.content}
- ); + ) : null} +
+ ); } -export default Tooltip; \ No newline at end of file +export default Tooltip; diff --git a/components/dashboard/src/components/WorkspaceLogs.tsx b/components/dashboard/src/components/WorkspaceLogs.tsx index ae6be25bb1957c..ce2a45d265671b 100644 --- a/components/dashboard/src/components/WorkspaceLogs.tsx +++ b/components/dashboard/src/components/WorkspaceLogs.tsx @@ -7,7 +7,7 @@ import EventEmitter from 'events'; import { useContext, useEffect, useRef } from 'react'; import { Terminal, ITerminalOptions, ITheme } from 'xterm'; -import { FitAddon } from 'xterm-addon-fit' +import { FitAddon } from 'xterm-addon-fit'; import 'xterm/css/xterm.css'; import { ThemeContext } from '../theme-context'; @@ -18,7 +18,7 @@ const lightTheme: ITheme = { background: '#F5F5F4', // Tailwind's warmGray 100 https://tailwindcss.com/docs/customizing-colors foreground: '#78716C', // Tailwind's warmGray 500 https://tailwindcss.com/docs/customizing-colors cursor: '#78716C', // Tailwind's warmGray 500 https://tailwindcss.com/docs/customizing-colors -} +}; export interface WorkspaceLogsProps { logsEmitter: EventEmitter; @@ -48,7 +48,7 @@ export default function WorkspaceLogs(props: WorkspaceLogsProps) { terminal.loadAddon(fitAddon); terminal.open(xTermParentRef.current); terminal.write('Connecting to workspace logs...\r\n'); - props.logsEmitter.on('logs', logs => { + props.logsEmitter.on('logs', (logs) => { if (terminal && logs) { terminal.write(logs); } @@ -56,7 +56,7 @@ export default function WorkspaceLogs(props: WorkspaceLogsProps) { fitAddon.fit(); return function cleanUp() { terminal.dispose(); - } + }; }, []); useEffect(() => { @@ -70,23 +70,29 @@ export default function WorkspaceLogs(props: WorkspaceLogsProps) { return function cleanUp() { clearTimeout(timeout!); window.removeEventListener('resize', onWindowResize); - } + }; }, []); useEffect(() => { if (terminalRef.current && props.errorMessage) { terminalRef.current.write(`\r\n\u001b[38;5;196m${props.errorMessage}\u001b[0m\r\n`); } - }, [ terminalRef.current, props.errorMessage ]); + }, [terminalRef.current, props.errorMessage]); useEffect(() => { if (!terminalRef.current) { return; } terminalRef.current.setOption('theme', isDark ? darkTheme : lightTheme); - }, [ terminalRef.current, isDark ]); + }, [terminalRef.current, isDark]); - return
-
-
; + return ( +
+
+
+ ); } diff --git a/components/dashboard/src/experiments.ts b/components/dashboard/src/experiments.ts index 1270a0d861a72a..8247a60026a3d1 100644 --- a/components/dashboard/src/experiments.ts +++ b/components/dashboard/src/experiments.ts @@ -4,7 +4,7 @@ * See License-AGPL.txt in the project root for license information. */ -const UI_EXPERIMENTS_KEY = "gitpod-ui-experiments"; +const UI_EXPERIMENTS_KEY = 'gitpod-ui-experiments'; /** * This enables UI-experiments: Dashboard-local changes that we'd like to try out and get some feedback on/validate @@ -24,73 +24,73 @@ const UI_EXPERIMENTS_KEY = "gitpod-ui-experiments"; * - multiple experiments per user/time */ const Experiments = { - /** - * Experiment "example" will be activate on login for 10% of all clients. - */ - "example": 0.1, + /** + * Experiment "example" will be activate on login for 10% of all clients. + */ + example: 0.1, }; type Experiments = Partial<{ [e in Experiment]: boolean }>; -export type Experiment = keyof (typeof Experiments); +export type Experiment = keyof typeof Experiments; export namespace Experiment { - /** - * Randomly decides what the set of Experiments is the user participates in - * @param keepCurrent - * @returns Experiments - */ - export function seed(keepCurrent: boolean): Experiments { - const result = keepCurrent ? get() || {} : {}; + /** + * Randomly decides what the set of Experiments is the user participates in + * @param keepCurrent + * @returns Experiments + */ + export function seed(keepCurrent: boolean): Experiments { + const result = keepCurrent ? get() || {} : {}; - for (const experiment of Object.keys(Experiments) as Experiment[]) { - if (!(experiment in result)) { - result[experiment] = Math.random() < Experiments[experiment]; - } - } - - return result; + for (const experiment of Object.keys(Experiments) as Experiment[]) { + if (!(experiment in result)) { + result[experiment] = Math.random() < Experiments[experiment]; + } } - export function set(set: Experiments): void { - try { - window.localStorage.setItem(UI_EXPERIMENTS_KEY, JSON.stringify(set)); - } catch (err) { - console.warn(`error setting ${UI_EXPERIMENTS_KEY}`, err); - } + return result; + } + + export function set(set: Experiments): void { + try { + window.localStorage.setItem(UI_EXPERIMENTS_KEY, JSON.stringify(set)); + } catch (err) { + console.warn(`error setting ${UI_EXPERIMENTS_KEY}`, err); } + } - export function has(experiment: Experiment): boolean { - try { - const set = get(); - if (!set) { - return false; - } - return set[experiment] === true; - } catch (err) { - console.warn(`error checking experiment '${experiment}'`, err); - return false; - } + export function has(experiment: Experiment): boolean { + try { + const set = get(); + if (!set) { + return false; + } + return set[experiment] === true; + } catch (err) { + console.warn(`error checking experiment '${experiment}'`, err); + return false; } + } - /** Retrieves all currently valid Experiments from localStorage */ - export function get(): Experiments | undefined { - try { - const objStr = window.localStorage.getItem(UI_EXPERIMENTS_KEY); - if (objStr === null) { - return undefined; - } + /** Retrieves all currently valid Experiments from localStorage */ + export function get(): Experiments | undefined { + try { + const objStr = window.localStorage.getItem(UI_EXPERIMENTS_KEY); + if (objStr === null) { + return undefined; + } - const obj = JSON.parse(objStr) as Experiments; - // trim to contain only known keys so we're type-safe - for (const e of Object.keys(obj)) { - if (!(e in Experiments)) { - delete (obj as any)[e]; - } - } - return obj; - } catch (err) { - // we definitely don't want to break anybody because of weird errors - console.warn(`error getting ${UI_EXPERIMENTS_KEY}`, err); - return undefined; + const obj = JSON.parse(objStr) as Experiments; + // trim to contain only known keys so we're type-safe + for (const e of Object.keys(obj)) { + if (!(e in Experiments)) { + delete (obj as any)[e]; } + } + return obj; + } catch (err) { + // we definitely don't want to break anybody because of weird errors + console.warn(`error getting ${UI_EXPERIMENTS_KEY}`, err); + return undefined; } -} \ No newline at end of file + } +} diff --git a/components/dashboard/src/index.css b/components/dashboard/src/index.css index 7e5035bb1b0689..3dea14e68f95b1 100644 --- a/components/dashboard/src/index.css +++ b/components/dashboard/src/index.css @@ -9,94 +9,102 @@ @tailwind utilities; @layer base { - html, body { - @apply h-full; - } - body { - @apply bg-white dark:bg-gitpod-black text-black dark:text-white; - } - h1 { - @apply text-gray-900 dark:text-gray-100 font-bold; - line-height: 64px; - font-size: 48px; - } - h2 { - @apply text-base text-gray-500 dark:text-gray-400; - } - h3 { - @apply text-2xl text-gray-800 dark:text-gray-100 leading-9 font-semibold; - } - h4 { - @apply pb-2 text-sm font-semibold text-gray-600 dark:text-gray-400; - } - p { - @apply text-sm text-gray-400 dark:text-gray-600; - } + html, + body { + @apply h-full; + } + body { + @apply bg-white dark:bg-gitpod-black text-black dark:text-white; + } + h1 { + @apply text-gray-900 dark:text-gray-100 font-bold; + line-height: 64px; + font-size: 48px; + } + h2 { + @apply text-base text-gray-500 dark:text-gray-400; + } + h3 { + @apply text-2xl text-gray-800 dark:text-gray-100 leading-9 font-semibold; + } + h4 { + @apply pb-2 text-sm font-semibold text-gray-600 dark:text-gray-400; + } + p { + @apply text-sm text-gray-400 dark:text-gray-600; + } - .app-container { - @apply lg:px-28 px-10; - } - .btn-login { - @apply rounded-md border-none bg-gray-100 hover:bg-gray-200 text-gray-500 dark:text-gray-200 dark:bg-gray-800 dark:hover:bg-gray-600; - } - .dark .dark\:filter-invert { - @apply filter-invert; - } + .app-container { + @apply lg:px-28 px-10; + } + .btn-login { + @apply rounded-md border-none bg-gray-100 hover:bg-gray-200 text-gray-500 dark:text-gray-200 dark:bg-gray-800 dark:hover:bg-gray-600; + } + .dark .dark\:filter-invert { + @apply filter-invert; + } } @layer components { - button { - @apply cursor-pointer px-4 py-2 my-auto bg-green-600 dark:bg-green-700 hover:bg-green-700 dark:hover:bg-green-600 text-gray-100 dark:text-green-100 text-sm font-medium rounded-md focus:outline-none focus:ring transition ease-in-out; - } - button.secondary { - @apply bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-500 dark:text-gray-100 hover:text-gray-600; - } - button.danger { - @apply bg-red-600 hover:bg-red-700 text-gray-100 dark:text-red-100; - } - button.danger.secondary { - @apply bg-red-50 dark:bg-red-300 hover:bg-red-100 dark:hover:bg-red-200 text-red-600 hover:text-red-700; - } - button:disabled { - @apply cursor-default opacity-50 pointer-events-none; - } + button { + @apply cursor-pointer px-4 py-2 my-auto bg-green-600 dark:bg-green-700 hover:bg-green-700 dark:hover:bg-green-600 text-gray-100 dark:text-green-100 text-sm font-medium rounded-md focus:outline-none focus:ring transition ease-in-out; + } + button.secondary { + @apply bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-500 dark:text-gray-100 hover:text-gray-600; + } + button.danger { + @apply bg-red-600 hover:bg-red-700 text-gray-100 dark:text-red-100; + } + button.danger.secondary { + @apply bg-red-50 dark:bg-red-300 hover:bg-red-100 dark:hover:bg-red-200 text-red-600 hover:text-red-700; + } + button:disabled { + @apply cursor-default opacity-50 pointer-events-none; + } - a.gp-link { - @apply text-blue-500 hover:text-blue-600 dark:text-blue-400 dark:hover:text-blue-500; - } + a.gp-link { + @apply text-blue-500 hover:text-blue-600 dark:text-blue-400 dark:hover:text-blue-500; + } - input[type=text], input[type=search], input[type=password], select { - @apply block w-56 text-gray-600 dark:text-gray-400 bg-white dark:bg-gray-800 rounded-md border border-gray-300 dark:border-gray-500 focus:border-gray-400 dark:focus:border-gray-400 focus:ring-0; - } - input[type=text]::placeholder, input[type=search]::placeholder, input[type=password]::placeholder { - @apply text-gray-400 dark:text-gray-500; - } - input[type=text].error, input[type=password].error, select.error { - @apply border-gitpod-red dark:border-gitpod-red focus:border-gitpod-red dark:focus:border-gitpod-red; - } - input[disabled] { - @apply bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 text-gray-400 dark:text-gray-500; - } - input[type=radio] { - @apply border border-gray-300 focus:border-gray-400 focus:bg-white focus:ring-0; - } - input[type=search] { - @apply border-0 dark:bg-transparent; - } - input[type=checkbox] { - @apply disabled:opacity-50 - } + input[type='text'], + input[type='search'], + input[type='password'], + select { + @apply block w-56 text-gray-600 dark:text-gray-400 bg-white dark:bg-gray-800 rounded-md border border-gray-300 dark:border-gray-500 focus:border-gray-400 dark:focus:border-gray-400 focus:ring-0; + } + input[type='text']::placeholder, + input[type='search']::placeholder, + input[type='password']::placeholder { + @apply text-gray-400 dark:text-gray-500; + } + input[type='text'].error, + input[type='password'].error, + select.error { + @apply border-gitpod-red dark:border-gitpod-red focus:border-gitpod-red dark:focus:border-gitpod-red; + } + input[disabled] { + @apply bg-gray-100 dark:bg-gray-700 border border-gray-200 dark:border-gray-600 text-gray-400 dark:text-gray-500; + } + input[type='radio'] { + @apply border border-gray-300 focus:border-gray-400 focus:bg-white focus:ring-0; + } + input[type='search'] { + @apply border-0 dark:bg-transparent; + } + input[type='checkbox'] { + @apply disabled:opacity-50; + } - progress { - @apply h-2 rounded; - } - progress::-webkit-progress-bar { - @apply rounded-md bg-gray-200; - } - progress::-webkit-progress-value { - @apply rounded-md bg-green-500; - } - progress::-moz-progress-bar { - @apply rounded-md bg-green-500; - } -} \ No newline at end of file + progress { + @apply h-2 rounded; + } + progress::-webkit-progress-bar { + @apply rounded-md bg-gray-200; + } + progress::-webkit-progress-value { + @apply rounded-md bg-green-500; + } + progress::-moz-progress-bar { + @apply rounded-md bg-green-500; + } +} diff --git a/components/dashboard/src/index.tsx b/components/dashboard/src/index.tsx index 8fb34ef8b70765..e15272180ba37a 100644 --- a/components/dashboard/src/index.tsx +++ b/components/dashboard/src/index.tsx @@ -13,21 +13,21 @@ import { ProjectContextProvider } from './projects/project-context'; import { ThemeContextProvider } from './theme-context'; import { BrowserRouter } from 'react-router-dom'; -import "./index.css" +import './index.css'; ReactDOM.render( - - - - - - - - - - - - - , - document.getElementById('root') -); \ No newline at end of file + + + + + + + + + + + + + , + document.getElementById('root'), +); diff --git a/components/dashboard/src/projects/ConfigureProject.tsx b/components/dashboard/src/projects/ConfigureProject.tsx index 729455ca7b2e7f..878ec43a8bdd8a 100644 --- a/components/dashboard/src/projects/ConfigureProject.tsx +++ b/components/dashboard/src/projects/ConfigureProject.tsx @@ -4,31 +4,31 @@ * See License-AGPL.txt in the project root for license information. */ -import React, { Suspense, useContext, useEffect, useState } from "react"; -import { Project, StartPrebuildResult, WorkspaceInstance } from "@gitpod/gitpod-protocol"; -import PrebuildLogs from "../components/PrebuildLogs"; -import TabMenuItem from "../components/TabMenuItem"; -import { getGitpodService } from "../service/service"; -import Spinner from "../icons/Spinner.svg"; -import NoAccess from "../icons/NoAccess.svg"; -import PrebuildLogsEmpty from "../images/prebuild-logs-empty.svg"; -import PrebuildLogsEmptyDark from "../images/prebuild-logs-empty-dark.svg"; -import { ThemeContext } from "../theme-context"; -import { PrebuildInstanceStatus } from "./Prebuilds"; -import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error"; -import { openAuthorizeWindow } from "../provider-utils"; -import { ProjectSettingsPage } from "./ProjectSettings"; -import { ProjectContext } from "./project-context"; +import React, { Suspense, useContext, useEffect, useState } from 'react'; +import { Project, StartPrebuildResult, WorkspaceInstance } from '@gitpod/gitpod-protocol'; +import PrebuildLogs from '../components/PrebuildLogs'; +import TabMenuItem from '../components/TabMenuItem'; +import { getGitpodService } from '../service/service'; +import Spinner from '../icons/Spinner.svg'; +import NoAccess from '../icons/NoAccess.svg'; +import PrebuildLogsEmpty from '../images/prebuild-logs-empty.svg'; +import PrebuildLogsEmptyDark from '../images/prebuild-logs-empty-dark.svg'; +import { ThemeContext } from '../theme-context'; +import { PrebuildInstanceStatus } from './Prebuilds'; +import { ErrorCodes } from '@gitpod/gitpod-protocol/lib/messaging/error'; +import { openAuthorizeWindow } from '../provider-utils'; +import { ProjectSettingsPage } from './ProjectSettings'; +import { ProjectContext } from './project-context'; const MonacoEditor = React.lazy(() => import('../components/MonacoEditor')); const TASKS = { - Other: `tasks: + Other: `tasks: - init: | echo 'TODO: build project' command: | - echo 'TODO: start app'` -} + echo 'TODO: start app'`, +}; // const IMAGES = { // Default: 'gitpod/workspace-full', @@ -40,234 +40,362 @@ const TASKS = { // } export default function () { - const { project } = useContext(ProjectContext); - const [gitpodYml, setGitpodYml] = useState(''); - const [dockerfile, setDockerfile] = useState(''); - const [editorMessage, setEditorMessage] = useState(null); - const [selectedEditor, setSelectedEditor] = useState<'.gitpod.yml' | '.gitpod.Dockerfile'>('.gitpod.yml'); - const [isEditorDisabled, setIsEditorDisabled] = useState(true); - const [isDetecting, setIsDetecting] = useState(true); - const [prebuildWasTriggered, setPrebuildWasTriggered] = useState(false); - const [prebuildWasCancelled, setPrebuildWasCancelled] = useState(false); - const [startPrebuildResult, setStartPrebuildResult] = useState(); - const [prebuildInstance, setPrebuildInstance] = useState(); - const { isDark } = useContext(ThemeContext); - - const [showAuthBanner, setShowAuthBanner] = useState<{ host: string, scope?: string } | undefined>(undefined); - const [buttonNewWorkspaceEnabled, setButtonNewWorkspaceEnabled] = useState(true); + const { project } = useContext(ProjectContext); + const [gitpodYml, setGitpodYml] = useState(''); + const [dockerfile, setDockerfile] = useState(''); + const [editorMessage, setEditorMessage] = useState(null); + const [selectedEditor, setSelectedEditor] = useState<'.gitpod.yml' | '.gitpod.Dockerfile'>('.gitpod.yml'); + const [isEditorDisabled, setIsEditorDisabled] = useState(true); + const [isDetecting, setIsDetecting] = useState(true); + const [prebuildWasTriggered, setPrebuildWasTriggered] = useState(false); + const [prebuildWasCancelled, setPrebuildWasCancelled] = useState(false); + const [startPrebuildResult, setStartPrebuildResult] = useState(); + const [prebuildInstance, setPrebuildInstance] = useState(); + const { isDark } = useContext(ThemeContext); - useEffect(() => { - // Disable editing while loading, or when the config comes from Git. - setIsDetecting(true); - setIsEditorDisabled(true); - setEditorMessage(null); - (async () => { - if (!project) { - setIsDetecting(false); - setEditorMessage(); - return; - } - try { - await detectProjectConfiguration(project); - } catch (error) { - if (error && error.message && error.message.includes("NotFound")) { - const host = new URL(project.cloneUrl).hostname; - const scope: string | undefined = host === "github.com" ? "repo" : undefined; - setShowAuthBanner({ host: new URL(project.cloneUrl).hostname, scope }); - } else if (error && error.code === ErrorCodes.NOT_AUTHENTICATED) { - setShowAuthBanner({ host: new URL(project.cloneUrl).hostname }); - } else { - console.error('Getting project configuration failed', error); - setIsDetecting(false); - setIsEditorDisabled(true); - setEditorMessage(); - setGitpodYml(TASKS.Other); - } - } - })(); - }, [project]); + const [showAuthBanner, setShowAuthBanner] = useState<{ host: string; scope?: string } | undefined>(undefined); + const [buttonNewWorkspaceEnabled, setButtonNewWorkspaceEnabled] = useState(true); - const detectProjectConfiguration = async (project: Project) => { - const guessedConfigStringPromise = getGitpodService().server.guessProjectConfiguration(project.id); - const repoConfigString = await getGitpodService().server.fetchProjectRepositoryConfiguration(project.id); - if (repoConfigString) { - setIsDetecting(false); - setEditorMessage(); - setGitpodYml(repoConfigString); - return; - } - if (project.config && project.config['.gitpod.yml']) { - setIsDetecting(false); - setIsEditorDisabled(false); - setGitpodYml(project.config['.gitpod.yml']); - return; - } - const guessedConfigString = await guessedConfigStringPromise; + useEffect(() => { + // Disable editing while loading, or when the config comes from Git. + setIsDetecting(true); + setIsEditorDisabled(true); + setEditorMessage(null); + (async () => { + if (!project) { setIsDetecting(false); - setIsEditorDisabled(false); - if (guessedConfigString) { - setEditorMessage(); - setGitpodYml(guessedConfigString); - return; + setEditorMessage( + , + ); + return; + } + try { + await detectProjectConfiguration(project); + } catch (error) { + if (error && error.message && error.message.includes('NotFound')) { + const host = new URL(project.cloneUrl).hostname; + const scope: string | undefined = host === 'github.com' ? 'repo' : undefined; + setShowAuthBanner({ host: new URL(project.cloneUrl).hostname, scope }); + } else if (error && error.code === ErrorCodes.NOT_AUTHENTICATED) { + setShowAuthBanner({ host: new URL(project.cloneUrl).hostname }); + } else { + console.error('Getting project configuration failed', error); + setIsDetecting(false); + setIsEditorDisabled(true); + setEditorMessage( + , + ); + setGitpodYml(TASKS.Other); } - setEditorMessage(); - setGitpodYml(TASKS.Other); - } + } + })(); + }, [project]); - const tryAuthorize = async (params: {host: string, scope?: string, onSuccess: () => void}) => { - try { - await openAuthorizeWindow({ - host: params.host, - onSuccess: params.onSuccess, - scopes: params.scope ? [params.scope] : undefined, - onError: (error) => { - console.log(error); - } - }); - } catch (error) { - console.log(error); - } - }; + const detectProjectConfiguration = async (project: Project) => { + const guessedConfigStringPromise = getGitpodService().server.guessProjectConfiguration(project.id); + const repoConfigString = await getGitpodService().server.fetchProjectRepositoryConfiguration(project.id); + if (repoConfigString) { + setIsDetecting(false); + setEditorMessage( + , + ); + setGitpodYml(repoConfigString); + return; + } + if (project.config && project.config['.gitpod.yml']) { + setIsDetecting(false); + setIsEditorDisabled(false); + setGitpodYml(project.config['.gitpod.yml']); + return; + } + const guessedConfigString = await guessedConfigStringPromise; + setIsDetecting(false); + setIsEditorDisabled(false); + if (guessedConfigString) { + setEditorMessage( + , + ); + setGitpodYml(guessedConfigString); + return; + } + setEditorMessage( + , + ); + setGitpodYml(TASKS.Other); + }; - const onConfirmShowAuthModal = async (host: string, scope?: string) => { - setShowAuthBanner(undefined); - await tryAuthorize({host, scope, onSuccess: async () => { - // update remote session - await getGitpodService().reconnect(); + const tryAuthorize = async (params: { host: string; scope?: string; onSuccess: () => void }) => { + try { + await openAuthorizeWindow({ + host: params.host, + onSuccess: params.onSuccess, + scopes: params.scope ? [params.scope] : undefined, + onError: (error) => { + console.log(error); + }, + }); + } catch (error) { + console.log(error); + } + }; - // retry fetching branches - if (project) { - detectProjectConfiguration(project); - } - }}); - }; + const onConfirmShowAuthModal = async (host: string, scope?: string) => { + setShowAuthBanner(undefined); + await tryAuthorize({ + host, + scope, + onSuccess: async () => { + // update remote session + await getGitpodService().reconnect(); - const buildProject = async () => { - if (!project) { - return; - } - setEditorMessage(null); - if (!!startPrebuildResult) { - setStartPrebuildResult(undefined); - } - if (!!prebuildInstance) { - setPrebuildInstance(undefined); - } - try { - setPrebuildWasTriggered(true); - if (!isEditorDisabled) { - await getGitpodService().server.setProjectConfiguration(project.id, gitpodYml); - } - const result = await getGitpodService().server.triggerPrebuild(project.id, null); - setStartPrebuildResult(result); - } catch (error) { - setPrebuildWasTriggered(false); - setEditorMessage(); + // retry fetching branches + if (project) { + detectProjectConfiguration(project); } - } + }, + }); + }; - const cancelPrebuild = async () => { - if (!project || !startPrebuildResult) { - return; - } - setPrebuildWasCancelled(true); - try { - await getGitpodService().server.cancelPrebuild(project.id, startPrebuildResult.prebuildId); - } catch (error) { - setEditorMessage(); - } finally { - setPrebuildWasCancelled(false); - } + const buildProject = async () => { + if (!project) { + return; + } + setEditorMessage(null); + if (!!startPrebuildResult) { + setStartPrebuildResult(undefined); + } + if (!!prebuildInstance) { + setPrebuildInstance(undefined); } + try { + setPrebuildWasTriggered(true); + if (!isEditorDisabled) { + await getGitpodService().server.setProjectConfiguration(project.id, gitpodYml); + } + const result = await getGitpodService().server.triggerPrebuild(project.id, null); + setStartPrebuildResult(result); + } catch (error) { + setPrebuildWasTriggered(false); + setEditorMessage( + , + ); + } + }; - const onInstanceUpdate = (instance: WorkspaceInstance) => { - setPrebuildInstance(instance); + const cancelPrebuild = async () => { + if (!project || !startPrebuildResult) { + return; + } + setPrebuildWasCancelled(true); + try { + await getGitpodService().server.cancelPrebuild(project.id, startPrebuildResult.prebuildId); + } catch (error) { + setEditorMessage( + , + ); + } finally { + setPrebuildWasCancelled(false); } + }; - useEffect(() => { document.title = 'Configure Project — Gitpod' }, []); + const onInstanceUpdate = (instance: WorkspaceInstance) => { + setPrebuildInstance(instance); + }; - const onNewWorkspace = async () => { - setButtonNewWorkspaceEnabled(false); - const redirectToNewWorkspace = () => { - // instead of `history.push` we want forcibly to redirect here in order to avoid a following redirect from `/` -> `/projects` (cf. App.tsx) - const url = new URL(window.location.toString()); - url.pathname = "/"; - url.hash = project?.cloneUrl!; - window.location.href = url.toString(); - } + useEffect(() => { + document.title = 'Configure Project — Gitpod'; + }, []); - if (prebuildInstance?.status.phase === "stopped" && !prebuildInstance?.status.conditions.failed && !prebuildInstance?.status.conditions.headlessTaskFailed) { - redirectToNewWorkspace(); - return; - } - if (!prebuildWasTriggered) { - await buildProject(); - } - redirectToNewWorkspace(); + const onNewWorkspace = async () => { + setButtonNewWorkspaceEnabled(false); + const redirectToNewWorkspace = () => { + // instead of `history.push` we want forcibly to redirect here in order to avoid a following redirect from `/` -> `/projects` (cf. App.tsx) + const url = new URL(window.location.toString()); + url.pathname = '/'; + url.hash = project?.cloneUrl!; + window.location.href = url.toString(); + }; + + if ( + prebuildInstance?.status.phase === 'stopped' && + !prebuildInstance?.status.conditions.failed && + !prebuildInstance?.status.conditions.headlessTaskFailed + ) { + redirectToNewWorkspace(); + return; + } + if (!prebuildWasTriggered) { + await buildProject(); } + redirectToNewWorkspace(); + }; - return -
-
-
- setSelectedEditor('.gitpod.yml')} /> - {!!dockerfile && setSelectedEditor('.gitpod.Dockerfile')} />} + return ( + +
+
+
+ setSelectedEditor('.gitpod.yml')} + /> + {!!dockerfile && ( + setSelectedEditor('.gitpod.Dockerfile')} + /> + )} +
+ {editorMessage} + }> + {selectedEditor === '.gitpod.yml' && ( + + )} + {selectedEditor === '.gitpod.Dockerfile' && ( + + )} + + {isDetecting && ( +
+ {showAuthBanner ? ( +
+
+ +
No Access
+
+ Authorize {showAuthBanner.host}{' '} + {showAuthBanner.scope ? ( + <> + and grant {showAuthBanner.scope} permission + + ) : ( + '' + )}{' '} +
to access project configuration. +
+ +
- {editorMessage} - }> - {selectedEditor === '.gitpod.yml' && - } - {selectedEditor === '.gitpod.Dockerfile' && - } - - {isDetecting &&
- {showAuthBanner ? ( -
-
- -
- No Access -
-
- Authorize {showAuthBanner.host} {showAuthBanner.scope ? (<>and grant {showAuthBanner.scope} permission) : ""}
to access project configuration. -
- -
-
- ) : (<> - - Detecting project configuration ... - - )} -
} + ) : ( + <> + + Detecting project configuration ... + + )}
-
-
{startPrebuildResult - ? - : (!prebuildWasTriggered &&
- -

No Recent Prebuild

-

Edit the project configuration on the left to get started. Learn more

-
) - }
-
- {prebuildWasTriggered && } -
- {(prebuildWasTriggered && prebuildInstance?.status.phase !== "stopped") - ? - : } - + )} +
+
+
+ {startPrebuildResult ? ( + + ) : ( + !prebuildWasTriggered && ( +
+ +

No Recent Prebuild

+

+ Edit the project configuration on the left to get started.{' '} + + Learn more + +

-
+ ) + )} +
+
+ {prebuildWasTriggered && } +
+ {prebuildWasTriggered && prebuildInstance?.status.phase !== 'stopped' ? ( + + ) : ( + + )} + +
- ; +
+ + ); } -function EditorMessage(props: { heading: string, message: string, type: 'success' | 'warning' }) { - return
- {props.heading} - {props.message} -
; -} \ No newline at end of file +function EditorMessage(props: { heading: string; message: string; type: 'success' | 'warning' }) { + return ( +
+ + {props.heading} + + {props.message} +
+ ); +} diff --git a/components/dashboard/src/projects/InstallGitHubApp.tsx b/components/dashboard/src/projects/InstallGitHubApp.tsx index 315eb965e9073b..20e32ea35058a2 100644 --- a/components/dashboard/src/projects/InstallGitHubApp.tsx +++ b/components/dashboard/src/projects/InstallGitHubApp.tsx @@ -4,84 +4,114 @@ * See License-AGPL.txt in the project root for license information. */ -import { useLocation } from "react-router"; -import InfoBox from "../components/InfoBox"; -import Modal from "../components/Modal"; -import { Deferred } from "@gitpod/gitpod-protocol/lib/util/deferred"; -import { getGitpodService, gitpodHostUrl } from "../service/service"; -import { useState } from "react"; -import { openAuthorizeWindow } from "../provider-utils"; +import { useLocation } from 'react-router'; +import InfoBox from '../components/InfoBox'; +import Modal from '../components/Modal'; +import { Deferred } from '@gitpod/gitpod-protocol/lib/util/deferred'; +import { getGitpodService, gitpodHostUrl } from '../service/service'; +import { useState } from 'react'; +import { openAuthorizeWindow } from '../provider-utils'; async function registerApp(installationId: string, setModal: (modal: 'done' | string | undefined) => void) { - try { - await getGitpodService().server.registerGithubApp(installationId); + try { + await getGitpodService().server.registerGithubApp(installationId); - const result = new Deferred(1000 * 60 * 10 /* 10 min */); + const result = new Deferred(1000 * 60 * 10 /* 10 min */); - openAuthorizeWindow({ - host: "github.com", - scopes: ["repo"], - onSuccess: () => { - setModal('done'); - result.resolve(); - }, - onError: (payload) => { - let errorMessage: string; - if (typeof payload === "string") { - errorMessage = payload; - } else { - errorMessage = payload.description ? payload.description : `Error: ${payload.error}`; - } - setModal(errorMessage); - } - }) + openAuthorizeWindow({ + host: 'github.com', + scopes: ['repo'], + onSuccess: () => { + setModal('done'); + result.resolve(); + }, + onError: (payload) => { + let errorMessage: string; + if (typeof payload === 'string') { + errorMessage = payload; + } else { + errorMessage = payload.description ? payload.description : `Error: ${payload.error}`; + } + setModal(errorMessage); + }, + }); - return result.promise; - } catch (e) { - setModal(e.message); - } + return result.promise; + } catch (e) { + setModal(e.message); + } } export default function InstallGitHubApp() { - const location = useLocation(); - const [modal, setModal] = useState<'done' | string | undefined>(); - const params = new URLSearchParams(location.search); - const installationId = params.get("installation_id") || undefined; - if (!installationId) { - return
-
-
-

No Installation ID Found

-
Did you come here from the GitHub app's page?
-
-
+ const location = useLocation(); + const [modal, setModal] = useState<'done' | string | undefined>(); + const params = new URLSearchParams(location.search); + const installationId = params.get('installation_id') || undefined; + if (!installationId) { + return ( +
+
+
+

No Installation ID Found

+
Did you come here from the GitHub app's page?
+
- } +
+ ); + } - const goToApp = () => window.location.href = gitpodHostUrl.toString(); + const goToApp = () => (window.location.href = gitpodHostUrl.toString()); - return <> -
-
-
-

Install GitHub App

-
You are about to install the GitHub app for Gitpod.
- This action will also allow Gitpod to access private repositories. You can edit Git provider permissions later in user settings. -
- - -
-
+ return ( + <> +
+
+
+

Install GitHub App

+
You are about to install the GitHub app for Gitpod.
+ + This action will also allow Gitpod to access private repositories. You can edit Git provider permissions + later in user settings. + +
+ +
+
+
+
+ Go to Dashboard} + > +
+ The GitHub app was installed successfully. Have a look at the{' '} + + documentation + {' '} + to find out how to configure it.
- Go to Dashboard}> -
The GitHub app was installed successfully. Have a look at the documentation to find out how to configure it.
-
- Cancel, - - ]}> -
Could not install the GitHub app.
- {modal} -
; -} \ No newline at end of file +
+ + Cancel + , + , + ]} + > +
Could not install the GitHub app.
+ {modal} +
+ + ); +} diff --git a/components/dashboard/src/projects/NewProject.tsx b/components/dashboard/src/projects/NewProject.tsx index 029318414d3e40..7777d317e8a35b 100644 --- a/components/dashboard/src/projects/NewProject.tsx +++ b/components/dashboard/src/projects/NewProject.tsx @@ -4,650 +4,783 @@ * See License-AGPL.txt in the project root for license information. */ -import { useContext, useEffect, useState } from "react"; -import { getGitpodService, gitpodHostUrl } from "../service/service"; -import { iconForAuthProvider, openAuthorizeWindow, simplifyProviderName } from "../provider-utils"; -import { AuthProviderInfo, Project, ProviderRepository, Team, TeamMemberInfo, User } from "@gitpod/gitpod-protocol"; -import { TeamsContext } from "../teams/teams-context"; -import { useLocation } from "react-router"; -import ContextMenu, { ContextMenuEntry } from "../components/ContextMenu"; -import CaretDown from "../icons/CaretDown.svg"; -import Plus from "../icons/Plus.svg"; -import Switch from "../icons/Switch.svg"; -import search from "../icons/search.svg"; -import moment from "moment"; -import { UserContext } from "../user-context"; -import { trackEvent } from "../Analytics"; -import exclamation from "../images/exclamation.svg"; +import { useContext, useEffect, useState } from 'react'; +import { getGitpodService, gitpodHostUrl } from '../service/service'; +import { iconForAuthProvider, openAuthorizeWindow, simplifyProviderName } from '../provider-utils'; +import { AuthProviderInfo, Project, ProviderRepository, Team, TeamMemberInfo, User } from '@gitpod/gitpod-protocol'; +import { TeamsContext } from '../teams/teams-context'; +import { useLocation } from 'react-router'; +import ContextMenu, { ContextMenuEntry } from '../components/ContextMenu'; +import CaretDown from '../icons/CaretDown.svg'; +import Plus from '../icons/Plus.svg'; +import Switch from '../icons/Switch.svg'; +import search from '../icons/search.svg'; +import moment from 'moment'; +import { UserContext } from '../user-context'; +import { trackEvent } from '../Analytics'; +import exclamation from '../images/exclamation.svg'; export default function NewProject() { - const location = useLocation(); - const { teams } = useContext(TeamsContext); - const { user, setUser } = useContext(UserContext); - - const [selectedProviderHost, setSelectedProviderHost] = useState(); - const [reposInAccounts, setReposInAccounts] = useState([]); - const [repoSearchFilter, setRepoSearchFilter] = useState(""); - const [selectedAccount, setSelectedAccount] = useState(undefined); - const [showGitProviders, setShowGitProviders] = useState(false); - const [selectedRepo, setSelectedRepo] = useState(undefined); - const [selectedTeamOrUser, setSelectedTeamOrUser] = useState(undefined); - - const [showNewTeam, setShowNewTeam] = useState(false); - const [loaded, setLoaded] = useState(false); - - const [project, setProject] = useState(); - const [guessedConfigString, setGuessedConfigString] = useState(); - const [sourceOfConfig, setSourceOfConfig] = useState<"repo" | "db" | undefined>(); - - const [authProviders, setAuthProviders] = useState([]); - - useEffect(() => { - if (user && selectedProviderHost === undefined) { - if (user.identities.find(i => i.authProviderId === "Public-GitLab")) { - setSelectedProviderHost("gitlab.com"); - } else if (user.identities.find(i => i.authProviderId === "Public-GitHub")) { - setSelectedProviderHost("github.com"); - } else if (user.identities.find(i => i.authProviderId === "Public-Bitbucket")) { - setSelectedProviderHost("bitbucket.org"); - } - (async () => { - setAuthProviders(await getGitpodService().server.getAuthProviders()); - })(); - } - }, [user]); - - useEffect(() => { - const params = new URLSearchParams(location.search); - const teamParam = params.get("team"); - if (teamParam) { - window.history.replaceState({}, '', window.location.pathname); - const team = teams?.find(t => t.slug === teamParam); - setSelectedTeamOrUser(team); - } - if (params.get("user")) { - window.history.replaceState({}, '', window.location.pathname); - setSelectedTeamOrUser(user); - } - }, []); + const location = useLocation(); + const { teams } = useContext(TeamsContext); + const { user, setUser } = useContext(UserContext); + + const [selectedProviderHost, setSelectedProviderHost] = useState(); + const [reposInAccounts, setReposInAccounts] = useState([]); + const [repoSearchFilter, setRepoSearchFilter] = useState(''); + const [selectedAccount, setSelectedAccount] = useState(undefined); + const [showGitProviders, setShowGitProviders] = useState(false); + const [selectedRepo, setSelectedRepo] = useState(undefined); + const [selectedTeamOrUser, setSelectedTeamOrUser] = useState(undefined); + + const [showNewTeam, setShowNewTeam] = useState(false); + const [loaded, setLoaded] = useState(false); + + const [project, setProject] = useState(); + const [guessedConfigString, setGuessedConfigString] = useState(); + const [sourceOfConfig, setSourceOfConfig] = useState<'repo' | 'db' | undefined>(); + + const [authProviders, setAuthProviders] = useState([]); + + useEffect(() => { + if (user && selectedProviderHost === undefined) { + if (user.identities.find((i) => i.authProviderId === 'Public-GitLab')) { + setSelectedProviderHost('gitlab.com'); + } else if (user.identities.find((i) => i.authProviderId === 'Public-GitHub')) { + setSelectedProviderHost('github.com'); + } else if (user.identities.find((i) => i.authProviderId === 'Public-Bitbucket')) { + setSelectedProviderHost('bitbucket.org'); + } + (async () => { + setAuthProviders(await getGitpodService().server.getAuthProviders()); + })(); + } + }, [user]); + + useEffect(() => { + const params = new URLSearchParams(location.search); + const teamParam = params.get('team'); + if (teamParam) { + window.history.replaceState({}, '', window.location.pathname); + const team = teams?.find((t) => t.slug === teamParam); + setSelectedTeamOrUser(team); + } + if (params.get('user')) { + window.history.replaceState({}, '', window.location.pathname); + setSelectedTeamOrUser(user); + } + }, []); - const [ teamMembers, setTeamMembers ] = useState>({}); - useEffect(() => { - if (!teams) { - return; - } - (async () => { - const members: Record = {}; - await Promise.all(teams.map(async (team) => { - try { - members[team.id] = await getGitpodService().server.getTeamMembers(team.id); - } catch (error) { - console.error('Could not get members of team', team, error); - } - })); - setTeamMembers(members); - })(); - }, [teams]); - - useEffect(() => { - if (selectedRepo) { - (async () => { - - try { - const guessedConfigStringPromise = getGitpodService().server.guessRepositoryConfiguration(selectedRepo.cloneUrl); - const repoConfigString = await getGitpodService().server.fetchRepositoryConfiguration(selectedRepo.cloneUrl); - if (repoConfigString) { - setSourceOfConfig("repo"); - } else { - setGuessedConfigString(await guessedConfigStringPromise || `tasks: + const [teamMembers, setTeamMembers] = useState>({}); + useEffect(() => { + if (!teams) { + return; + } + (async () => { + const members: Record = {}; + await Promise.all( + teams.map(async (team) => { + try { + members[team.id] = await getGitpodService().server.getTeamMembers(team.id); + } catch (error) { + console.error('Could not get members of team', team, error); + } + }), + ); + setTeamMembers(members); + })(); + }, [teams]); + + useEffect(() => { + if (selectedRepo) { + (async () => { + try { + const guessedConfigStringPromise = getGitpodService().server.guessRepositoryConfiguration( + selectedRepo.cloneUrl, + ); + const repoConfigString = await getGitpodService().server.fetchRepositoryConfiguration(selectedRepo.cloneUrl); + if (repoConfigString) { + setSourceOfConfig('repo'); + } else { + setGuessedConfigString( + (await guessedConfigStringPromise) || + `tasks: - init: | echo 'TODO: build project' command: | - echo 'TODO: start app'`); - setSourceOfConfig("db"); - } - } catch (error) { - console.error('Getting project configuration failed', error); - setSourceOfConfig(undefined); - } - - })(); - } - }, [selectedRepo]); - - useEffect(() => { - if (selectedTeamOrUser && selectedRepo) { - createProject(selectedTeamOrUser, selectedRepo); - } - }, [selectedTeamOrUser, selectedRepo]); - - useEffect(() => { - if (reposInAccounts.length === 0) { - setSelectedAccount(undefined); - } else { - const first = reposInAccounts[0]; - if (!!first.installationUpdatedAt) { - const mostRecent = reposInAccounts.reduce((prev, current) => (prev.installationUpdatedAt || 0) > (current.installationUpdatedAt || 0) ? prev : current); - setSelectedAccount(mostRecent.account); - } else { - setSelectedAccount(first.account); - } - } - - }, [reposInAccounts]); - - useEffect(() => { - setRepoSearchFilter(""); - }, [selectedAccount]); - - useEffect(() => { - if (!selectedProviderHost) { - return; - } - (async () => { - await updateReposInAccounts(); - })(); - }, [selectedProviderHost]); - - useEffect(() => { - if (project && sourceOfConfig) { - (async () => { - if (guessedConfigString && sourceOfConfig === "db") { - await getGitpodService().server.setProjectConfiguration(project.id, guessedConfigString); - } - await getGitpodService().server.triggerPrebuild(project.id, null); - })(); - } - }, [project, sourceOfConfig]); - - const isGitHub = () => selectedProviderHost === "github.com"; - - const updateReposInAccounts = async (installationId?: string) => { - setLoaded(false); - setReposInAccounts([]); - if (!selectedProviderHost) { - return []; - } - try { - const repos = await getGitpodService().server.getProviderRepositoriesForUser({ provider: selectedProviderHost, hints: { installationId } }); - setReposInAccounts(repos); - setLoaded(true); - return repos; + echo 'TODO: start app'`, + ); + setSourceOfConfig('db'); + } } catch (error) { - console.log(error); + console.error('Getting project configuration failed', error); + setSourceOfConfig(undefined); } - return []; + })(); } + }, [selectedRepo]); - const reconfigure = () => { - openReconfigureWindow({ - account: selectedAccount, - onSuccess: (p: { installationId: string, setupAction?: string }) => { - updateReposInAccounts(p.installationId); - trackEvent("organisation_authorised", { - installation_id: p.installationId, - setup_action: p.setupAction - }); - } - }); + useEffect(() => { + if (selectedTeamOrUser && selectedRepo) { + createProject(selectedTeamOrUser, selectedRepo); } + }, [selectedTeamOrUser, selectedRepo]); - const createProject = async (teamOrUser: Team | User, repo: ProviderRepository) => { - if (!selectedProviderHost) { - return; - } - const repoSlug = repo.path || repo.name; - - try { - const project = await getGitpodService().server.createProject({ - name: repo.name, - slug: repoSlug, - cloneUrl: repo.cloneUrl, - account: repo.account, - provider: selectedProviderHost, - ...(User.is(teamOrUser) ? { userId: teamOrUser.id } : { teamId: teamOrUser.id }), - appInstallationId: String(repo.installationId), - }); - - setProject(project); - } catch (error) { - const message = (error && error?.message) || "Failed to create new project." - window.alert(message); - } - } - - const toSimpleName = (fullName: string) => { - const splitted = fullName.split("/"); - if (splitted.length < 2) { - return fullName; - } - return splitted.shift() && splitted.join("/"); + useEffect(() => { + if (reposInAccounts.length === 0) { + setSelectedAccount(undefined); + } else { + const first = reposInAccounts[0]; + if (!!first.installationUpdatedAt) { + const mostRecent = reposInAccounts.reduce((prev, current) => + (prev.installationUpdatedAt || 0) > (current.installationUpdatedAt || 0) ? prev : current, + ); + setSelectedAccount(mostRecent.account); + } else { + setSelectedAccount(first.account); + } } + }, [reposInAccounts]); - const accounts = new Map(); - reposInAccounts.forEach(r => { if (!accounts.has(r.account)) accounts.set(r.account, { avatarUrl: r.accountAvatarUrl }) }); - - const getDropDownEntries = (accounts: Map) => { - const renderItemContent = (label: string, icon: string, addClasses?: string) => (
- - {label} -
) - const result: ContextMenuEntry[] = []; - - if (!selectedAccount && user && user.name && user.avatarUrl) { - result.push({ - title: "user", - customContent: renderItemContent(user?.name, user?.avatarUrl), - separator: true, - }) - } - for (const [account, props] of accounts.entries()) { - result.push({ - title: account, - customContent: renderItemContent(account, props.avatarUrl, "font-semibold"), - separator: true, - onClick: () => setSelectedAccount(account), - }) - } - if (isGitHub()) { - result.push({ - title: "Add another GitHub account", - customContent: renderItemContent("Add GitHub Orgs or Account", Plus), - separator: true, - onClick: () => reconfigure(), - }) - } - result.push({ - title: "Select another Git Provider to continue with", - customContent: renderItemContent("Select Git Provider", Switch), - onClick: () => setShowGitProviders(true), - }) + useEffect(() => { + setRepoSearchFilter(''); + }, [selectedAccount]); - return result; + useEffect(() => { + if (!selectedProviderHost) { + return; } - - const renderSelectRepository = () => { - - const noReposAvailable = reposInAccounts.length === 0; - const filteredRepos = Array.from(reposInAccounts).filter(r => r.account === selectedAccount && `${r.name}`.toLowerCase().includes(repoSearchFilter.toLowerCase())); - const icon = selectedAccount && accounts.get(selectedAccount)?.avatarUrl; - - const showSearchInput = !!repoSearchFilter || filteredRepos.length > 0; - - const userLink = (r: ProviderRepository) => { - return `https://${new URL(r.cloneUrl).host}/${r.inUse?.userName}` + (async () => { + await updateReposInAccounts(); + })(); + }, [selectedProviderHost]); + + useEffect(() => { + if (project && sourceOfConfig) { + (async () => { + if (guessedConfigString && sourceOfConfig === 'db') { + await getGitpodService().server.setProjectConfiguration(project.id, guessedConfigString); } + await getGitpodService().server.triggerPrebuild(project.id, null); + })(); + } + }, [project, sourceOfConfig]); - const projectText = () => { - return

Projects allow you to manage prebuilds and workspaces for your repository. Learn more

- } - - const renderRepos = () => (<> - {projectText()} -

{loaded && noReposAvailable ? 'Select account on ' : 'Select a Git repository on '}{selectedProviderHost} ( setShowGitProviders(true)}>change)

-
-
- -
- {!selectedAccount && user && user.name && user.avatarUrl && ( - <> - - - - )} - {selectedAccount && ( - <> - - - - )} - -
-
- {showSearchInput && ( -
- - setRepoSearchFilter(e.target.value)}> -
- )} -
-
- {filteredRepos.length > 0 && ( -
- {filteredRepos.map((r, index) => ( -
- -
-
{toSimpleName(r.name)}
-

Updated {moment(r.updatedAt).fromNow()}

-
-
-
- {!r.inUse ? ( - - ) : ( -

- @{r.inUse.userName} already
added this repo -

- )} -
-
-
- ))} -
- )} - {!noReposAvailable && filteredRepos.length === 0 && ( -

No Results

- )} - {loaded && noReposAvailable && isGitHub() && (
-
- - Additional authorization is required for our GitHub App to watch your repositories and trigger prebuilds. - -
- -
-
)} -
- -
- {reposInAccounts.length > 0 && isGitHub() && ( - - )} -

- Teams & Projects are currently in Beta. Send feedback -

- - ); + const isGitHub = () => selectedProviderHost === 'github.com'; - const renderLoadingState = () => ( -
- {projectText()} -
-
-
-

- Loading ... -

-
-
-
-
) - - const onGitProviderSeleted = async (host: string, updateUser?: boolean) => { - if (updateUser) { - setUser(await getGitpodService().server.getLoggedInUser()); - } - setShowGitProviders(false); - setSelectedProviderHost(host); - } + const updateReposInAccounts = async (installationId?: string) => { + setLoaded(false); + setReposInAccounts([]); + if (!selectedProviderHost) { + return []; + } + try { + const repos = await getGitpodService().server.getProviderRepositoriesForUser({ + provider: selectedProviderHost, + hints: { installationId }, + }); + setReposInAccounts(repos); + setLoaded(true); + return repos; + } catch (error) { + console.log(error); + } + return []; + }; + + const reconfigure = () => { + openReconfigureWindow({ + account: selectedAccount, + onSuccess: (p: { installationId: string; setupAction?: string }) => { + updateReposInAccounts(p.installationId); + trackEvent('organisation_authorised', { + installation_id: p.installationId, + setup_action: p.setupAction, + }); + }, + }); + }; - if (!loaded) { - return renderLoadingState(); - } + const createProject = async (teamOrUser: Team | User, repo: ProviderRepository) => { + if (!selectedProviderHost) { + return; + } + const repoSlug = repo.path || repo.name; + + try { + const project = await getGitpodService().server.createProject({ + name: repo.name, + slug: repoSlug, + cloneUrl: repo.cloneUrl, + account: repo.account, + provider: selectedProviderHost, + ...(User.is(teamOrUser) ? { userId: teamOrUser.id } : { teamId: teamOrUser.id }), + appInstallationId: String(repo.installationId), + }); + + setProject(project); + } catch (error) { + const message = (error && error?.message) || 'Failed to create new project.'; + window.alert(message); + } + }; - if (showGitProviders) { - return (); - } + const toSimpleName = (fullName: string) => { + const splitted = fullName.split('/'); + if (splitted.length < 2) { + return fullName; + } + return splitted.shift() && splitted.join('/'); + }; + + const accounts = new Map(); + reposInAccounts.forEach((r) => { + if (!accounts.has(r.account)) accounts.set(r.account, { avatarUrl: r.accountAvatarUrl }); + }); + + const getDropDownEntries = (accounts: Map) => { + const renderItemContent = (label: string, icon: string, addClasses?: string) => ( +
+ + {label} +
+ ); + const result: ContextMenuEntry[] = []; + + if (!selectedAccount && user && user.name && user.avatarUrl) { + result.push({ + title: 'user', + customContent: renderItemContent(user?.name, user?.avatarUrl), + separator: true, + }); + } + for (const [account, props] of accounts.entries()) { + result.push({ + title: account, + customContent: renderItemContent(account, props.avatarUrl, 'font-semibold'), + separator: true, + onClick: () => setSelectedAccount(account), + }); + } + if (isGitHub()) { + result.push({ + title: 'Add another GitHub account', + customContent: renderItemContent('Add GitHub Orgs or Account', Plus), + separator: true, + onClick: () => reconfigure(), + }); + } + result.push({ + title: 'Select another Git Provider to continue with', + customContent: renderItemContent('Select Git Provider', Switch), + onClick: () => setShowGitProviders(true), + }); + + return result; + }; + + const renderSelectRepository = () => { + const noReposAvailable = reposInAccounts.length === 0; + const filteredRepos = Array.from(reposInAccounts).filter( + (r) => r.account === selectedAccount && `${r.name}`.toLowerCase().includes(repoSearchFilter.toLowerCase()), + ); + const icon = selectedAccount && accounts.get(selectedAccount)?.avatarUrl; + + const showSearchInput = !!repoSearchFilter || filteredRepos.length > 0; + + const userLink = (r: ProviderRepository) => { + return `https://${new URL(r.cloneUrl).host}/${r.inUse?.userName}`; + }; - return renderRepos(); + const projectText = () => { + return ( +

+ Projects allow you to manage prebuilds and workspaces for your repository.{' '} + + Learn more + +

+ ); }; - const renderSelectTeam = () => { - const userFullName = user?.fullName || user?.name || '...'; - const teamsToRender = teams || []; - return (<> -

Select team or personal account

-
-